[22506] trunk/dports/devel/openssl/Portfile

source_changes at macosforge.org source_changes at macosforge.org
Sat Mar 3 03:56:35 PST 2007


Revision: 22506
          http://trac.macosforge.org/projects/macports/changeset/22506
Author:   pipping at macports.org
Date:     2007-03-03 03:56:34 -0800 (Sat, 03 Mar 2007)

Log Message:
-----------
 * add universal variant

Modified Paths:
--------------
    trunk/dports/devel/openssl/Portfile

Modified: trunk/dports/devel/openssl/Portfile
===================================================================
--- trunk/dports/devel/openssl/Portfile	2007-03-03 08:38:37 UTC (rev 22505)
+++ trunk/dports/devel/openssl/Portfile	2007-03-03 11:56:34 UTC (rev 22506)
@@ -42,3 +42,112 @@
 destroot.args		MANDIR=${prefix}/share/man
 
 test.run		yes
+
+variant universal {
+
+    post-configure {
+        cd ${worksrcpath}
+        # prepare building for ppc
+        if [variant_isset darwin_i386] {
+            reinplace "s|PLATFORM=darwin-i386-cc|PLATFORM=darwin-ppc-cc|g" Makefile
+            reinplace "s|DL_ENDIAN|DB_ENDIAN|g" Makefile
+        }
+        reinplace "s|-O3 -DB_ENDIAN$|-O3 -DB_ENDIAN -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk|" Makefile
+        reinplace "s|^LDFLAGS=.*|LDFLAGS=-arch ppc|g" Makefile.shared
+    }
+
+    build {
+        cd ${worksrcpath}
+        # build for ppc
+        system [command build]
+
+        # determine which files will need to be lipo'ed together
+        set lList {}
+        foreach s {0.9.8.dylib a} {
+            foreach n {crypto ssl} {
+                lappend lList lib${n}.${s}
+            }
+        }
+        set eList {}
+        foreach f [glob engines/*.so] {
+            lappend eList ${f}
+        }
+        set bList apps/openssl
+
+        # save the output of the first go in a temporary location
+        set ppcPath ${workpath}/ppc
+        xinstall -d ${ppcPath}
+        foreach l $lList {
+            xinstall ${l} ${ppcPath}
+        }
+        xinstall -d ${ppcPath}/engines
+        foreach e $eList {
+            xinstall ${e} ${ppcPath}/engines
+        }
+        xinstall -d ${ppcPath}/apps
+        foreach b $bList {
+            xinstall ${b} ${ppcPath}/apps
+        }
+
+        # cleanup the worksrcdir
+        system "make clean"
+        foreach f [glob lib*.0.9.8.dylib] {
+            delete ${f}
+        }
+
+        # prepare building for i386
+        reinplace "s|darwin-ppc-cc|darwin-i386-cc|g" ${worksrcpath}/Makefile
+        reinplace "s|DB_ENDIAN|DL_ENDIAN|g" ${worksrcpath}/Makefile
+        reinplace "s|-arch ppc|-arch i386|g" ${worksrcpath}/Makefile
+        reinplace "s|-arch ppc|-arch i386|g" Makefile.shared
+
+        # build for i386
+        system [command build]
+
+        # save the output of the second go in another temporary location
+        set i386Path ${workpath}/i386
+        xinstall -d ${i386Path}
+        foreach l $lList {
+           xinstall ${l} ${i386Path}
+        }
+        xinstall -d ${i386Path}/engines
+        foreach e $eList {
+            xinstall ${e} ${i386Path}/engines
+        }
+        xinstall -d ${i386Path}/apps
+        foreach b $bList {
+            xinstall ${b} ${i386Path}/apps
+        }
+
+        # run lipo on the output of both runs
+        foreach l $lList {
+            delete ${l}
+            system "lipo \
+            -arch i386 ${i386Path}/${l} \
+            -arch  ppc  ${ppcPath}/${l} \
+            -create -output ${l}"
+        }
+        foreach e $eList {
+            delete ${e}
+            system "lipo \
+            -arch i386 ${i386Path}/${e} \
+            -arch  ppc  ${ppcPath}/${e} \
+            -create -output ${e}"
+        }
+        foreach b $bList {
+            delete ${b}
+            system "lipo \
+            -arch i386 ${i386Path}/${b} \
+            -arch  ppc  ${ppcPath}/${b} \
+            -create -output ${b}"
+        }
+
+        # make sure installing won't rebuild
+        reinplace "s|install: all |install: |g" Makefile
+    }
+
+    # make sure we don't build a third time
+    post-build {}
+}
+
+platform darwin_i386 {}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070303/d4ec90f3/attachment.html


More information about the macports-changes mailing list