diff options
Diffstat (limited to 'packaging/macosx/ports/python')
10 files changed, 637 insertions, 0 deletions
diff --git a/packaging/macosx/ports/python/py25-Pillow/Portfile b/packaging/macosx/ports/python/py25-Pillow/Portfile new file mode 100644 index 000000000..85363b206 --- /dev/null +++ b/packaging/macosx/ports/python/py25-Pillow/Portfile @@ -0,0 +1,77 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 +# $Id: Portfile 104088 2013-03-15 14:39:56Z stromnov@macports.org $ + +PortSystem 1.0 +PortGroup python 1.0 + +name py25-Pillow +set real_name py-Pillow +version 1.7.8 +revision 100 +categories-append devel +platforms darwin +license BSD + +python.versions 25 +python.version 25 + +maintainers stromnov openmaintainer + +description Python Imaging Library (fork) + +long_description ${description} + +homepage http://github.com/python-imaging/Pillow +master_sites http://pypi.python.org/packages/source/P/Pillow/ + +distname Pillow-${version} +use_zip yes + +checksums rmd160 e52cec02d943951a80d30b32b1764cb3ae87b283 \ + sha256 907f5342b1df1d277dcc10df2aeabc61099e5a07e0676b9fcd1bb7379890c0ee + +if {$subport == $name} { + conflicts py${python.version}-pil + + depends_build port:py${python.version}-setuptools + depends_lib-append \ + port:zlib \ + port:jpeg \ + port:tiff \ + port:lcms \ + port:webp \ + port:freetype + + patchfiles patch-setup.py-v1.7.8.diff \ + patch-_imagingft.c.diff + + post-patch { + reinplace "s|@prefix@|${prefix}|g" ${worksrcpath}/setup.py + } + + livecheck.type none +} else { + livecheck.type regex + livecheck.url ${master_sites} + livecheck.regex "Pillow-(\\d+(?:\\.\\d+)*)${extract.suffix}" +} + +variant quartz conflicts x11 tkinter { + # tkinter doesn't build +} + +variant x11 conflicts quartz { + # tkinter does build +} + +variant tkinter description {with tkinter support} { + if {$subport == $name} { + depends_lib-append port:py${python.version}-tkinter + } +} + +#if { ![variant_isset quartz] } { +# default_variants-append +tkinter +#} + +default_variants -tkinter diff --git a/packaging/macosx/ports/python/py25-Pillow/files/patch-_imagingft.c.diff b/packaging/macosx/ports/python/py25-Pillow/files/patch-_imagingft.c.diff new file mode 100644 index 000000000..99f72a8c9 --- /dev/null +++ b/packaging/macosx/ports/python/py25-Pillow/files/patch-_imagingft.c.diff @@ -0,0 +1,14 @@ +--- _imagingft.c.orig 2013-11-27 16:07:53.000000000 +0400 ++++ _imagingft.c 2013-11-27 16:12:01.000000000 +0400 +@@ -70,7 +70,11 @@ + const char* message; + } ft_errors[] = + ++#if defined(USE_FREETYPE_2_1) ++#include FT_ERRORS_H ++#else + #include <freetype/fterrors.h> ++#endif + + /* -------------------------------------------------------------------- */ + /* font objects */ diff --git a/packaging/macosx/ports/python/py25-Pillow/files/patch-setup.py-v1.7.8.diff b/packaging/macosx/ports/python/py25-Pillow/files/patch-setup.py-v1.7.8.diff new file mode 100644 index 000000000..2f4b797f6 --- /dev/null +++ b/packaging/macosx/ports/python/py25-Pillow/files/patch-setup.py-v1.7.8.diff @@ -0,0 +1,83 @@ +--- setup.py.orig 2014-09-02 02:51:22.000000000 +0200 ++++ setup.py 2014-09-02 02:53:51.000000000 +0200 +@@ -100,18 +100,9 @@ + "/usr/lib", "python%s" % sys.version[:3], "config")) + + elif sys.platform == "darwin": +- # attempt to make sure we pick freetype2 over other versions +- _add_directory(include_dirs, "/sw/include/freetype2") +- _add_directory(include_dirs, "/sw/lib/freetype2/include") +- # fink installation directories +- _add_directory(library_dirs, "/sw/lib") +- _add_directory(include_dirs, "/sw/include") + # darwin ports installation directories +- _add_directory(library_dirs, "/opt/local/lib") +- _add_directory(include_dirs, "/opt/local/include") +- # freetype2 ships with X11 +- _add_directory(library_dirs, "/usr/X11/lib") +- _add_directory(include_dirs, "/usr/X11/include") ++ _add_directory(library_dirs, "@prefix@/lib") ++ _add_directory(include_dirs, "@prefix@/include") + + elif sys.platform.startswith("linux"): + if platform.processor() == "x86_64": +@@ -126,9 +117,6 @@ + # work ;-) + self.add_multiarch_paths() + +- _add_directory(library_dirs, "/usr/local/lib") +- # FIXME: check /opt/stuff directories here? +- + prefix = sysconfig.get_config_var("prefix") + if prefix: + _add_directory(library_dirs, os.path.join(prefix, "lib")) +@@ -180,19 +168,6 @@ + # + # add standard directories + +- # look for tcl specific subdirectory (e.g debian) +- if _tkinter: +- tcl_dir = "/usr/include/tcl" + TCL_VERSION +- if os.path.isfile(os.path.join(tcl_dir, "tk.h")): +- _add_directory(include_dirs, tcl_dir) +- +- # standard locations +- _add_directory(library_dirs, "/usr/local/lib") +- _add_directory(include_dirs, "/usr/local/include") +- +- _add_directory(library_dirs, "/usr/lib") +- _add_directory(include_dirs, "/usr/include") +- + # + # insert new dirs *before* default libs, to avoid conflicts + # between Python PYD stub libs and real libraries +@@ -307,28 +282,7 @@ + exts.append(Extension( + "_imagingcms", ["_imagingcms.c"], libraries=["lcms"] + extra)) + +- if sys.platform == "darwin": +- # locate Tcl/Tk frameworks +- frameworks = [] +- framework_roots = [ +- "/Library/Frameworks", +- "/System/Library/Frameworks"] +- for root in framework_roots: +- if (os.path.exists(os.path.join(root, "Tcl.framework")) and +- os.path.exists(os.path.join(root, "Tk.framework"))): +- print("--- using frameworks at %s" % root) +- frameworks = ["-framework", "Tcl", "-framework", "Tk"] +- dir = os.path.join(root, "Tcl.framework", "Headers") +- _add_directory(self.compiler.include_dirs, dir, 0) +- dir = os.path.join(root, "Tk.framework", "Headers") +- _add_directory(self.compiler.include_dirs, dir, 1) +- break +- if frameworks: +- exts.append(Extension( +- "_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"], +- extra_compile_args=frameworks, extra_link_args=frameworks)) +- feature.tcl = feature.tk = 1 # mark as present +- elif feature.tcl and feature.tk: ++ if feature.tcl and feature.tk: + exts.append(Extension( + "_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"], + libraries=[feature.tcl, feature.tk])) diff --git a/packaging/macosx/ports/python/py25-numpy/Portfile b/packaging/macosx/ports/python/py25-numpy/Portfile new file mode 100644 index 000000000..169c1d2ec --- /dev/null +++ b/packaging/macosx/ports/python/py25-numpy/Portfile @@ -0,0 +1,206 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4 +# $Id: Portfile 113172 2013-11-11 10:24:44Z jeremyhu@macports.org $ + +PortSystem 1.0 +PortGroup python 1.0 +PortGroup github 1.0 + +github.setup numpy numpy 1.7.1 v +name py25-numpy +revision 1 +dist_subdir ${name}/${version}_1 + +categories-append math +license BSD +platforms darwin +maintainers dh michaelld openmaintainer +description The core utilities for the scientific library scipy for Python +long_description ${description} + +checksums rmd160 16df4216f40b22077e1f14cc41b8c8ae486b45af \ + sha256 14964724915e5fa1ed34d2cdb93eed5a86bc16edd4a1203cf521ad8bbbcb5215 + +python.versions 25 + +if {$subport == $name} { + patchfiles patch-f2py_setup.py.diff \ + patch-numpy_distutils_fcompiler___init__.py.diff \ + patch-fcompiler_g95.diff + + depends_lib-append port:fftw-3 \ + port:py${python.version}-nose + + # http://trac.macports.org/ticket/34562 + destroot.env-append \ + CC="${configure.cc}" \ + CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \ + CXX="${configure.cxx}" \ + CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]" \ + OBJC="${configure.objc}" \ + OBJCFLAGS="${configure.objcflags} [get_canonical_archflags objc]" \ + LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]" + + build.env-append ARCHFLAGS="[get_canonical_archflags ld]" + destroot.env-append ARCHFLAGS="[get_canonical_archflags ld]" + + variant atlas description {Use the MacPorts' ATLAS libraries \ + instead of Apple's Accelerate framework} { + build.env-append ATLAS=${prefix}/lib \ + LAPACK=${prefix}/lib \ + BLAS=${prefix}/lib + destroot.env-append ATLAS=${prefix}/lib \ + LAPACK=${prefix}/lib \ + BLAS=${prefix}/lib + depends_lib-append port:atlas + + if {[variant_isset universal]} { + python.set_compiler no + } + } + + # when using ATLAS (whether by default or specified by the user via + # the +atlas variant) ... + set gcc_version "" + if {[variant_isset atlas]} { + + # see if the user has set -gcc4X to disable using MacPorts' + # compiler; if not, either use what the user set (as +gcc4X) or + # default to gcc47. + + variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 gcc48 \ + description {Use the gcc43 compiler (enables fortran linking)} { + configure.compiler macports-gcc-4.3 + } + + variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 gcc48 \ + description {Use the gcc44 compiler (enables fortran linking)} { + configure.compiler macports-gcc-4.4 + } + + variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 gcc48 \ + description {Use the gcc45 compiler (enables fortran linking)} { + configure.compiler macports-gcc-4.5 + } + + variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 gcc48 \ + description {Use the gcc46 compiler (enables fortran linking)} { + configure.compiler macports-gcc-4.6 + } + + variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 gcc48 \ + description {Use the gcc47 compiler (enables fortran linking)} { + configure.compiler macports-gcc-4.7 + } + + variant gcc48 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 \ + description {Use the gcc48 compiler (enables fortran linking)} { + configure.compiler macports-gcc-4.8 + } + + if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc48]} { + default_variants +gcc47 + } + + if {[variant_isset gcc43]} { + set gcc_version "4.3" + } elseif {[variant_isset gcc44]} { + set gcc_version "4.4" + } elseif {[variant_isset gcc45]} { + set gcc_version "4.5" + } elseif {[variant_isset gcc46]} { + set gcc_version "4.6" + } elseif {[variant_isset gcc47]} { + set gcc_version "4.7" + } elseif {[variant_isset gcc48]} { + set gcc_version "4.8" + } + + # when using non-Apple GCC for universal install, it can + # create binaries only for the native OS architecture, at + # either 32 or 64 bits. Restrict the supported archs + # accordingly. + if {${os.arch} == "i386"} { + supported_archs i386 x86_64 + } elseif {${os.arch} == "powerpc"} { + supported_archs ppc ppc64 + } + + # include all the correct GCC4X port + depends_lib-append port:gcc[join [split ${gcc_version} "."] ""] + + # force LDFLAGS for correct linking of the linalg module + # for non-Apple GCC compilers + patchfiles-append patch-numpy_linalg_setup.py.diff + + if {${gcc_version} == ""} { + # user specified -gcc4X but +atlas (either as default or + # explicitly); do not allow since it might lead to + # undetermined runtime execution. + return -code error \ +"\n\nWhen using the +atlas variant (either as the default or setting +explicitly), one of the +gcc4X variants must be selected.\n" + } + + } else { + variant universal { + patchfiles-append patch-setup.py.diff + } + } + + post-patch { + reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \ + ${worksrcpath}/numpy/f2py/setup.py + + if {[variant_isset universal] && [variant_isset atlas]} { + # Prepare wrappers + file copy -force ${filespath}/wrapper-template \ + ${worksrcpath}/c-wrapper + file copy -force ${filespath}/wrapper-template \ + ${worksrcpath}/f-wrapper + file copy -force ${filespath}/wrapper-template \ + ${worksrcpath}/cxx-wrapper + + reinplace "s|@@@|${configure.cc}|" ${worksrcpath}/c-wrapper + reinplace "s|---|\\\\.c|" ${worksrcpath}/c-wrapper + reinplace "s|&&&|${prefix}|" ${worksrcpath}/c-wrapper + + reinplace "s|@@@|${configure.cxx}|" ${worksrcpath}/cxx-wrapper + reinplace "s#---#(\\\\.C|\\\\.cpp|\\\\.cc)#" \ + ${worksrcpath}/cxx-wrapper + reinplace "s|&&&|${prefix}|" ${worksrcpath}/cxx-wrapper + + reinplace "s|@@@|${configure.f90}|" ${worksrcpath}/f-wrapper + reinplace "s|---|\\\\.f|" ${worksrcpath}/f-wrapper + reinplace "s|&&&|${prefix}|" ${worksrcpath}/f-wrapper + + build.env-append CC="${worksrcpath}/c-wrapper" \ + CXX="${worksrcpath}/cxx-wrapper" \ + F77="${worksrcpath}/f-wrapper" \ + F90="${worksrcpath}/f-wrapper" + + destroot.env-append CC="${worksrcpath}/c-wrapper" \ + CXX="${worksrcpath}/cxx-wrapper" \ + F77="${worksrcpath}/f-wrapper" \ + F90="${worksrcpath}/f-wrapper" + } + + if {[variant_isset atlas]} { + # We must link against libSatlas or libTatlas, not libAtlas + if {[file exists ${prefix}/lib/libtatlas.dylib]} { + reinplace -E \ + "s|_lib_atlas = \\\['atlas'\\\]|_lib_atlas = \\\['tatlas'\\\]|" \ + ${worksrcpath}/numpy/distutils/system_info.py + } elseif {[file exists ${prefix}/lib/libsatlas.dylib]} { + reinplace -E \ + "s|_lib_atlas = \\\['atlas'\\\]|_lib_atlas = \\\['satlas'\\\]|" \ + ${worksrcpath}/numpy/distutils/system_info.py + } else { + return -code error "Unable to find Atlas dylibs. Bailing out." + } + } + } + + livecheck.type none +} else { + livecheck.regex archive/[join ${github.tag_prefix} ""](\[\\d+(?:\\.\\d+)*"\]+)${extract.suffix}" +} diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-f2py_setup.py.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-f2py_setup.py.diff new file mode 100644 index 000000000..5b8f2a28f --- /dev/null +++ b/packaging/macosx/ports/python/py25-numpy/files/patch-f2py_setup.py.diff @@ -0,0 +1,29 @@ +--- numpy/f2py/setup.py.orig 2013-02-10 00:51:36.000000000 +0400 ++++ numpy/f2py/setup.py 2013-03-19 15:27:15.000000000 +0400 +@@ -41,7 +41,7 @@ + config.make_svn_version_py() + + def generate_f2py_py(build_dir): +- f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:] ++ f2py_exe = 'f2py' + if f2py_exe[-4:]=='.exe': + f2py_exe = f2py_exe[:-4] + '.py' + if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py': +@@ -51,7 +51,7 @@ + log.info('Creating %s', target) + f = open(target,'w') + f.write('''\ +-#!/usr/bin/env %s ++#!@@MPORTS_PYTHON@@ + # See http://cens.ioc.ee/projects/f2py2e/ + import os, sys + for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]: +@@ -75,7 +75,7 @@ + sys.stderr.write("Unknown mode: " + repr(mode) + "\\n") + sys.exit(1) + main() +-'''%(os.path.basename(sys.executable))) ++''') + f.close() + return target + diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-fcompiler_g95.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-fcompiler_g95.diff new file mode 100644 index 000000000..2640a530b --- /dev/null +++ b/packaging/macosx/ports/python/py25-numpy/files/patch-fcompiler_g95.diff @@ -0,0 +1,11 @@ +--- numpy/distutils/fcompiler/__init__.py.orig 2013-03-19 13:35:03.000000000 +0400 ++++ numpy/distutils/fcompiler/__init__.py 2013-03-19 13:35:27.000000000 +0400 +@@ -708,7 +708,7 @@ + ('cygwin.*', ('gnu','intelv','absoft','compaqv','intelev','gnu95','g95')), + ('linux.*', ('gnu95','intel','lahey','pg','absoft','nag','vast','compaq', + 'intele','intelem','gnu','g95','pathf95')), +- ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')), ++ ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'pg')), + ('sunos.*', ('sun','gnu','gnu95','g95')), + ('irix.*', ('mips','gnu','gnu95',)), + ('aix.*', ('ibm','gnu','gnu95',)), diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_distutils_fcompiler___init__.py.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_distutils_fcompiler___init__.py.diff new file mode 100644 index 000000000..4f73dcfc9 --- /dev/null +++ b/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_distutils_fcompiler___init__.py.diff @@ -0,0 +1,30 @@ +--- numpy/distutils/fcompiler/__init__.py.orig 2013-10-31 13:24:12.000000000 +0400 ++++ numpy/distutils/fcompiler/__init__.py 2013-10-31 13:45:03.000000000 +0400 +@@ -815,7 +815,7 @@ + return compiler_type + + # Flag to avoid rechecking for Fortran compiler every time +-failed_fcompiler = False ++failed_fcompilers = [] + + def new_fcompiler(plat=None, + compiler=None, +@@ -828,7 +828,8 @@ + platform/compiler combination. + """ + global failed_fcompiler +- if failed_fcompiler: ++ fcompiler_key = (plat, compiler) ++ if fcompiler_key in failed_fcompilers: + return None + + load_all_fcompiler_classes() +@@ -848,7 +849,7 @@ + msg = msg + " Supported compilers are: %s)" \ + % (','.join(fcompiler_class.keys())) + log.warn(msg) +- failed_fcompiler = True ++ failed_fcompilers.append(fcompiler_key) + return None + + compiler = klass(verbose=verbose, dry_run=dry_run, force=force) diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff new file mode 100644 index 000000000..0b06883a4 --- /dev/null +++ b/packaging/macosx/ports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff @@ -0,0 +1,10 @@ +--- numpy/linalg/setup.py.orig 2010-09-14 11:44:21.000000000 -0400 ++++ numpy/linalg/setup.py 2010-09-14 11:45:01.000000000 -0400 +@@ -27,6 +27,7 @@ + 'zlapack_lite.c', 'dlapack_lite.c', + 'blas_lite.c', 'dlamch.c', + 'f2c_lite.c','f2c.h'], ++ extra_link_args=['-undefined dynamic_lookup -bundle'], + extra_info = lapack_info + ) + diff --git a/packaging/macosx/ports/python/py25-numpy/files/patch-setup.py.diff b/packaging/macosx/ports/python/py25-numpy/files/patch-setup.py.diff new file mode 100644 index 000000000..04e3cdd7a --- /dev/null +++ b/packaging/macosx/ports/python/py25-numpy/files/patch-setup.py.diff @@ -0,0 +1,34 @@ +--- numpy/core/setup.py.orig 2009-04-05 04:09:20.000000000 -0400 ++++ numpy/core/setup.py 2009-04-08 19:53:45.000000000 -0400 +@@ -309,7 +309,14 @@ + if isinstance(d,str): + target_f.write('#define %s\n' % (d)) + else: +- target_f.write('#define %s %s\n' % (d[0],d[1])) ++ if d[0]!='SIZEOF_LONG' and d[0]!='SIZEOF_PY_INTPTR_T': ++ target_f.write('#define %s %s\n' % (d[0],d[1])) ++ else: ++ target_f.write('#ifdef __LP64__\n') ++ target_f.write('#define %s %s\n' % (d[0],8)) ++ target_f.write('#else\n') ++ target_f.write('#define %s %s\n' % (d[0],4)) ++ target_f.write('#endif\n') + + # define inline to our keyword, or nothing + target_f.write('#ifndef __cplusplus\n') +@@ -393,7 +393,14 @@ + if isinstance(d,str): + target_f.write('#define %s\n' % (d)) + else: +- target_f.write('#define %s %s\n' % (d[0],d[1])) ++ if d[0]!='NPY_SIZEOF_LONG' and d[0]!='NPY_SIZEOF_PY_INTPTR_T': ++ target_f.write('#define %s %s\n' % (d[0],d[1])) ++ else: ++ target_f.write('#ifdef __LP64__\n') ++ target_f.write('#define %s %s\n' % (d[0],8)) ++ target_f.write('#else\n') ++ target_f.write('#define %s %s\n' % (d[0],4)) ++ target_f.write('#endif\n') + + # define NPY_INLINE to recognized keyword + target_f.write('#define NPY_INLINE %s\n' % inline) diff --git a/packaging/macosx/ports/python/py25-numpy/files/wrapper-template b/packaging/macosx/ports/python/py25-numpy/files/wrapper-template new file mode 100755 index 000000000..48936d107 --- /dev/null +++ b/packaging/macosx/ports/python/py25-numpy/files/wrapper-template @@ -0,0 +1,143 @@ +#!/bin/sh +COMPILER='@@@' +SUFFIX='---' +PREFIX='&&&' +OUTPUT_O='NO' +OUTPUT='' +NAMED_OUTPUT='' +LASTFILE='' +INTEL='NO' +SIZE32='NO' +SIZE64='NO' +NEWARGS='' + +SKIP='NO' + +for arg in $@ +do + if [ $SKIP = 'ARCH' ]; then + # intercept -arch option and set SIZEXX + SKIP='NO' + if [ $arg = 'x86_64' ] || [ $arg = 'ppc64' ]; then + SIZE64='YES' + else + SIZE32='YES' + fi + + # which architecture are we compiling for? + if [ $arg = 'x86_64' ] || [ $arg = 'i386' ]; then + INTEL='YES' + fi + + elif [ $arg = '-arch' ]; then + SKIP='ARCH' + + elif [ $arg = '--version' ]; then + ${COMPILER} --version + exit 0 + + else + NEWARGS+="$arg " + + # if the -c option is given, the output is .o + if [ $arg = '-c' ]; then + OUTPUT_O='YES' + fi + + # if the output file is given by a -o option, record it + if [ $SKIP = 'O' ]; then + SKIP='NO' + NAMED_OUTPUT=$arg + fi + + if [ $arg = '-o' ]; then + SKIP='O' + fi + + # Note each file ending by ${SUFFIX} and remember the last one + # Transform them in .o + if `echo $arg | grep -q "${SUFFIX}$"`; then + LASTFILE=$arg + OUTPUT+=`echo $arg | sed "s/${SUFFIX}/\.o/"` + OUTPUT+=' ' + fi + fi +done + +# What is the output? + +if [ ${NAMED_OUTPUT}"X" != "X" ]; then + OUTPUT=$NAMED_OUTPUT + +elif [ $OUTPUT_O = 'NO' ]; then + # It is an executable whose is name is the LASTFILE without suffix + OUTPUT=`echo ${LASTFILE} | sed "s/${SUFFIX}//"` +fi + +# Othewise, the output is just the ${OUTPUT} variable as computed before + +# For some reason, -dynamiclib and -lpython2.6 are missing when linking +# .so files. Add them, except if -bundle is set (incompatible switches) +if [ `echo $OUTPUT | sed -E 's|.*\.||'` = "so" ] && \ + ! `echo $NEWARGS | grep -q bundle`; then + NEWARGS="${NEWARGS} ${PREFIX}/lib/libpython2.6.dylib -dynamiclib" +fi + +# Now, compile + +if [ $SIZE32 = 'NO' ] && [ $SIZE64 = 'NO' ]; then + # No size indication given, just proceed with default + if `${COMPILER} $NEWARGS`; then + exit 0 + else + exit 1 + fi + +elif [ $SIZE32 = 'YES' ] && [ $SIZE64 = 'NO' ]; then + # 32-bit + if `${COMPILER} -m32 $NEWARGS`; then + exit 0 + else + exit 1 + fi + +elif [ $SIZE32 = 'NO' ] && [ $SIZE64 = 'YES' ]; then + # 64-bit + if `${COMPILER} -m64 $NEWARGS`; then + exit 0 + else + exit 1 + fi + +else + # Universal case + if `${COMPILER} -m32 $NEWARGS`; then + for filename in ${OUTPUT} + do + mv ${filename} ${filename}.32 + done + + if `${COMPILER} -m64 $NEWARGS`; then + for filename in ${OUTPUT} + do + mv ${filename} ${filename}.64 + if [ $INTEL = 'YES' ]; then + lipo -create -arch x86_64 ${filename}.64 \ + -arch i386 ${filename}.32 \ + -output ${filename} + else + lipo -create -arch ppc64 ${filename}.64 \ + -arch ppc ${filename}.32 \ + -output ${filename} + fi + + rm -f ${filename}.32 ${filename}.64 + done + else + exit 1 + fi + else + exit 1 + fi +fi +exit 0 |
