[39490] trunk/dports/audio/lame/Portfile

ram at macports.org ram at macports.org
Thu Aug 21 17:21:00 PDT 2008


Revision: 39490
          http://trac.macosforge.org/projects/macports/changeset/39490
Author:   ram at macports.org
Date:     2008-08-21 17:21:00 -0700 (Thu, 21 Aug 2008)
Log Message:
-----------
audio/lame: fix universal variant, closes #15995 (patch from hvdwolf at gmail.com)

Modified Paths:
--------------
    trunk/dports/audio/lame/Portfile

Modified: trunk/dports/audio/lame/Portfile
===================================================================
--- trunk/dports/audio/lame/Portfile	2008-08-22 00:00:50 UTC (rev 39489)
+++ trunk/dports/audio/lame/Portfile	2008-08-22 00:21:00 UTC (rev 39490)
@@ -28,9 +28,67 @@
 
 configure.args    --mandir=${prefix}/share/man
 
-# disable universal variant until a solution to #15995 is found
-universal_variant no
+set my_universal_archs {i386 ppc}
+set first_arch [lindex ${my_universal_archs} 0]
 
+set my_worksrcpaths ${worksrcpath}
+
+variant universal {
+  set my_worksrcpaths {}
+  foreach arch ${my_universal_archs} {
+    lappend my_worksrcpaths ${workpath}/${arch}
+  }
+
+  post-patch {
+    foreach arch ${my_universal_archs} {
+      if {[string equal ${arch} ${first_arch}]} {
+        move ${worksrcpath} ${workpath}/${first_arch}
+      } else {
+        copy ${workpath}/${first_arch} ${workpath}/${arch}
+      }
+    }
+  }
+
+  configure {
+    foreach arch ${my_universal_archs} {
+      set my_arch_flag "-arch ${arch}"
+      set my_cflags "${configure.cflags} -isysroot ${sysroot} ${my_arch_flag} -I${prefix}/include -L${prefix}/lib"
+      set my_ldflags "${configure.ldflags} ${my_arch_flag}"
+      set pcp "{prefix}/lib/pkgconfig"
+	    set my_configure_args "CC=\"gcc -arch ${arch}\""
+      system "cd ${workpath}/${arch} && CFLAGS=\"${my_cflags}\" CXXFLAGS=\"${my_cflags}\" LDFLAGS=\"${my_ldflags}\" PKG_CONFIG_PATH=\"${pcp}\" ${configure.cmd} ${configure.pre_args} ${configure.args} ${my_configure_args}"
+    }
+  }
+
+  build {
+    foreach arch ${my_universal_archs} {
+      system "cd ${workpath}/${arch} && ${build.cmd} ${build.pre_args}"
+    }
+  }
+
+  destroot {
+    system "cd ${workpath}/${first_arch} && ${destroot.cmd} ${destroot.pre_args} ${destroot.post_args}"
+    foreach lib [list [file readlink ${workpath}/${first_arch}/libmp3lame/.libs/libmp3lame.dylib] libmp3lame.a] {
+      set output_lib ${destroot}${prefix}/lib/${lib}
+      set lipo_args {}
+      foreach arch ${my_universal_archs} {
+        lappend lipo_args -arch ${arch} ${workpath}/${arch}/libmp3lame/.libs/${lib}
+      }
+      lappend lipo_args -create -output ${output_lib}
+      delete ${output_lib}
+      system "lipo ${lipo_args}"
+    }
+    set output_bin ${destroot}${prefix}/bin/lame
+    set lipo_args {}
+    foreach arch ${my_universal_archs} {
+      lappend lipo_args -arch ${arch} ${workpath}/${arch}/frontend/lame
+    }
+    lappend lipo_args -create -output ${output_bin}
+    delete ${output_bin}
+    system "lipo ${lipo_args}"
+  }
+}
+
 livecheck.check   regex
 livecheck.url     ${homepage}download.php
 livecheck.regex   {The current release version of LAME is ([0-9]+\.[0-9]+)}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080821/d108f927/attachment.html 


More information about the macports-changes mailing list