Revision
79850
Author
ryandesign@macports.org
Date
2011-06-27 20:58:49 -0700 (Mon, 27 Jun 2011)

Log Message

freeimage: actually use the right archs; see #29950

Modified Paths

Diff

Modified: trunk/dports/graphics/freeimage/Portfile (79849 => 79850)


--- trunk/dports/graphics/freeimage/Portfile	2011-06-28 03:38:48 UTC (rev 79849)
+++ trunk/dports/graphics/freeimage/Portfile	2011-06-28 03:58:49 UTC (rev 79850)
@@ -5,6 +5,7 @@
 
 name                freeimage
 version             3.15.0
+revision            1
 license             FreeImage-1.0 GPL-2
 categories          graphics
 platforms           macosx
@@ -27,6 +28,8 @@
                     sha1    ec2faa01d1b312aab68d77afe62861759c790100 \
                     rmd160  5d309d0d8335129d00d6b5455613c89a419ebcac
 
+set VERLIBNAME libfreeimage.[lindex [split ${version} .] 0].dylib
+
 post-patch {
     # Libraries extension is ".dylib" on Darwin, not ".so"
     reinplace {s/\.so/.dylib/} ${worksrcpath}/Makefile.gnu
@@ -47,27 +50,20 @@
     reinplace "s|ldconfig||g" ${worksrcpath}/Makefile.gnu
 }
 
-if { [variant_isset universal] } {
-    post-patch {
-        reinplace "s|CFLAGS ?= |CFLAGS ?= ${configure.universal_cflags} |g" ${worksrcpath}/Makefile.gnu
-        reinplace "s|CXXFLAGS ?= |CXXFLAGS ?= ${configure.universal_cxxflags} |g" ${worksrcpath}/Makefile.gnu
-    }
+use_configure       no
+
+variant universal {}
+if {[variant_isset universal]} {
+    set archflags ${configure.universal_cflags}
 } else {
-    post-patch {
-        reinplace "s|CFLAGS ?= |CFLAGS ?= -arch ${build_arch} |g" ${worksrcpath}/Makefile.gnu
-        reinplace "s|CXXFLAGS ?= |CXXFLAGS ?= -arch ${build_arch} |g" ${worksrcpath}/Makefile.gnu
-    }
+    set archflags ${configure.cc_archflags}
 }
 
-use_configure       no
-
-set VERLIBNAME libfreeimage.[lindex [split ${version} .] 0].dylib
-
 build.args          -f Makefile.gnu \
                     PREFIX=${prefix} \
                     VERLIBNAME=${VERLIBNAME} \
-                    CC="${configure.cc}" \
-                    CXX="${configure.cxx}" \
+                    CC="${configure.cc} ${configure.cflags} ${archflags}" \
+                    CXX="${configure.cxx} ${configure.cxxflags} ${archflags}" \
                     LDFLAGS="${configure.ldflags}"
 
 destroot.args       -f Makefile.gnu \
@@ -91,7 +87,7 @@
 
 pre-test {
     # Use correct compiler and flags when compiling test
-    reinplace s:g++:${configure.cxx}: ${test.dir}/Makefile
+    reinplace "s:g++:${configure.cxx} ${configure.cxxflags} ${archflags}:" ${test.dir}/Makefile
 
     # Build the test
     system "make -C ${test.dir}"