Just say no to +universal
Landon Fuller
landonf at macports.org
Sat Mar 3 13:09:51 PST 2007
On Mar 3, 2007, at 12:49 PM, James Berry wrote:
> I'm quite distressed by the concept of too much work (and too much
> ugly code) going into building +universal variants of ports.
>
> I'd like to see people refrain from completely bastardizing
> portfiles in order to support universal builds. Let's be
> reasonable: the case for universal builds is fringe. We don't have
> easy ways to transport binary ports between systems, and it's not
> in general a safe thing to do.
>
> I'd much rather see:
>
> - Smaller, cleaner, more maintainable portfiles and no universal.
>
> - Work on binary packages and a build/distribution system that
> could deliver the pre-built port for a given architecture.
>
> Let's not see more ugliness like the universal variant in the
> OpenSSL port, please!
>
> (Feel free to chime in on this issue, all who care...)
I agree. It's not that universal builds are a bad idea; it's that
supporting universal software requires serious bastardization of
Portfiles in most cases. Assuming we implement some sort of binary
distribution, I'd personally much rather use the approach that fkr
and shantonu used for supporting Darwin x86 and PowerPC -- build the
software on each system, natively, and then join the resultant RPMs
into a single fat RPM.
The example jberry notes is OpenSSL's universal-ized portfile. I
don't mean to pick on Pipping -- I've personally implemented a very
similar approach for building OpenVPN universally. It's pretty much
the only way to do it without drastically changing the software's
build system and source, but it's blindingly painful. It's not unique
to OpenSSL, or OpenVPN -- most software is going to have the same
issues:
+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
+ set tList {}
+ foreach f [glob test/*test] {
+ lappend tList ${f}
+ }
+ lappend tList test/sha256t
+ lappend tList test/sha512t
+
+ # define a backup procedure to a temporary location
+ proc backup {bakPath} {
+ xinstall -d ${bakPath}
+ foreach a {l e b t} b {. engines apps test} {
+ upvar 1 [set a]List [set a]List
+ xinstall -d ${bakPath}/$b
+ foreach n [set [set a]List] {
+ xinstall ${n} ${bakPath}/${b}
+ }
+ }
+ }
+ # backup the output of the first run (ppc)
+ set ppcPath ${workpath}/ppc
+ backup ${ppcPath}
+
+ # 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]
+
+ # backup the output of the first run (ppc)
+ set i386Path ${workpath}/i386
+ backup ${i386Path}
+
+ # run lipo on the output of both runs
+ foreach n {l e b t} {
+ foreach m [set [set n]List] {
+ delete ${m}
+ system "lipo \
+ -arch i386 ${i386Path}/${m} \
+ -arch ppc ${ppcPath}/${m} \
+ -create -output ${m}"
+ }
+ }
+
+ # make sure installing won't rebuild
+ reinplace "s|install: all |install: |g" Makefile
+ }
+
+ # make sure we don't build a third time
+ post-build {}
+}
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.macosforge.org/pipermail/macports-dev/attachments/20070303/e9f6a874/PGP.bin
More information about the macports-dev
mailing list