[lxml-dev] lxml Mac installation idea

Guntsche Michael mike at it-loops.com
Thu Nov 13 00:05:31 CET 2008


On Nov 12, 2008, at 20:11, Stefan Behnel wrote:

> Ok, I've updated the trunk build script to reflect some of this.
>
> http://codespeak.net/svn/lxml/trunk/buildlibxml.py
>
> Please check if it works better. Patches are very welcome.
>

I spent far more time than I wanted on this one, but please check this..
Maybe there is a better way to add the environment variables, but I  
did not wnat to change call_subprocess that much.

Kind regards,
Michael

Index: buildlibxml.py
===================================================================
--- buildlibxml.py	(revision 59893)
+++ buildlibxml.py	(working copy)
@@ -165,7 +165,17 @@
      prefix = os.path.join(os.path.abspath(build_dir), 'libxml2')
      safe_mkdir(prefix)

-    configure_cmd = ['./configure', '--without-python',
+
+    # We just take the CFLAGS and LDFLAG from the python build  
environment
+    # so it does not matter if it was compiled Universal or not.
+    os.environ['CFLAGS'] = sysconfig.get_config_var('CFLAGS')
+    os.environ['LDFLAGS'] = sysconfig.get_config_var('LDFLAGS')
+    os.environ['MACOS_DEPLOYMENT_TARGET'] = "10.3"
+
+    # We are loosing the link to iconv add it again
+    static_binaries.append('-liconv')
+
+    configure_cmd = ['./configure', '--without-python' ,
                       '--disable-dependency-tracking',
                       '--disable-shared', '--prefix=%s' % prefix]
      call_subprocess(configure_cmd, cwd=libxml2_dir)
@@ -174,7 +184,7 @@
      call_subprocess(
          ['make', 'install'], cwd=libxml2_dir)

-    libxslt_configure_cmd = configure_cmd + ['--with-libxml-prefix= 
%s' % prefix]
+    libxslt_configure_cmd = configure_cmd + ['--with-libxml-prefix= 
%s' % prefix, '--without-crypto']
      call_subprocess(libxslt_configure_cmd, cwd=libxslt_dir)
      call_subprocess(
          ['make'], cwd=libxslt_dir)
@@ -191,11 +201,6 @@
              os.path.join(prefix, 'include', 'libexslt')])
      static_library_dirs.append(lib_dir)

-    unisdk_dir = sysconfig.get_config_var('UNIVERSALSDK')
-    if unisdk_dir:
-        static_cflags.extend(['-isysroot', unisdk_dir,
-                              '-arch', '-i386', '-arch', 'ppc'])
-
      for filename in os.listdir(lib_dir):
          if [l for l in ['libxml2', 'libxslt', 'libexslt'] if l in  
filename]:
              if [ext for ext in ['.a'] if filename.endswith(ext)]:



More information about the lxml-dev mailing list