Skip to content

Instantly share code, notes, and snippets.

@larryv
Created February 10, 2014 01:31
Show Gist options
  • Save larryv/8908813 to your computer and use it in GitHub Desktop.
Save larryv/8908813 to your computer and use it in GitHub Desktop.
Enabling a universal MacPorts build of SciPy.
Index: Portfile
===================================================================
--- Portfile (revision 116903)
+++ Portfile (working copy)
@@ -3,6 +3,7 @@
PortSystem 1.0
PortGroup python 1.0
+PortGroup muniversal 1.0
name py-scipy
version 0.13.3
@@ -22,9 +23,18 @@
python.versions 26 27 32 33
python.add_archflags no
-universal_variant no
if {${name} ne ${subport}} {
+ # Preliminary muniversal fluff.
+ if {${os.arch} eq "i386"} {
+ universal_archs_supported x86_64 i386
+ } else {
+ universal_archs_supported ppc64 ppc
+ }
+ foreach arch ${universal_archs_supported} {
+ set merger_build_env(${arch}) {}
+ set merger_destroot_env(${arch}) {}
+ }
depends_lib-append port:py${python.version}-numpy \
port:py${python.version}-nose \
@@ -37,9 +47,16 @@
destroot.env-append CCFLAGS="-I${prefix}/include -L${prefix}/lib"
if {[string match "*clang*" ${configure.compiler}]} {
- build.env-append FFLAGS="-ff2c"
- destroot.env-append FFLAGS="-ff2c"
+ configure.fflags-append -ff2c
}
+ build.env-append FFLAGS="${configure.fflags}"
+ destroot.env-append FFLAGS="${configure.fflags}"
+ foreach arch ${universal_archs_supported} {
+ append merger_build_env(${arch}) \
+ "FFLAGS='${configure.fflags} [muniversal_get_arch_flag ${arch} fortran]'"
+ append merger_destroot_env(${arch}) \
+ "FFLAGS='${configure.fflags} [muniversal_get_arch_flag ${arch} fortran]'"
+ }
patchfiles umfpack_extra_libs.patch
@@ -108,11 +125,36 @@
build.cmd-append ${fc_options} ${config_options}
destroot.cmd-append ${fc_options} ${config_options}
- build.env-append CC="${configure.cc}" \
- CXX="${configure.cxx}"
+ if {[variant_isset universal]} {
+ destroot.args --no-compile
+ }
+
destroot.env-append CC="${configure.cc}" \
CXX="${configure.cxx}"
+ pre-build {
+ set cflags [exec -- ${python.prefix}/bin/python-config --cflags]
+ set ldflags "[exec -- ${python.prefix}/bin/python-config --ldflags] -bundle"
+
+ build.env-append CFLAGS="${cflags}" \
+ CXXFLAGS="${cflags}" \
+ LDFLAGS="${ldflags}"
+ destroot.env-append CFLAGS="${cflags}" \
+ CXXFLAGS="${cflags}" \
+ LDFLAGS="${ldflags}"
+
+ foreach arch ${universal_archs_supported} {
+ append merger_build_env(${arch}) \
+ " CFLAGS='${cflags} [muniversal_get_arch_flag ${arch}]'" \
+ " CXXFLAGS='${cflags} [muniversal_get_arch_flag ${arch}]'" \
+ " LDFLAGS='${ldflags} -Wl,-arch -Wl,${arch}'"
+ append merger_destroot_env(${arch}) \
+ " CFLAGS='${cflags} [muniversal_get_arch_flag ${arch}]'" \
+ " CXXFLAGS='${cflags} [muniversal_get_arch_flag ${arch}]'" \
+ " LDFLAGS='${ldflags} -Wl,-arch -Wl,${arch}'"
+ }
+ }
+
livecheck.type none
} else {
livecheck.type regex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment