Ignore:
Timestamp:
Mar 3, 2007, 11:56:34 AM (12 years ago)
Author:
pipping@…
Message:
  • add universal variant
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/devel/openssl/Portfile

    r22327 r22506  
    4343
    4444test.run                yes
     45
     46variant universal {
     47
     48    post-configure {
     49        cd ${worksrcpath}
     50        # prepare building for ppc
     51        if [variant_isset darwin_i386] {
     52            reinplace "s|PLATFORM=darwin-i386-cc|PLATFORM=darwin-ppc-cc|g" Makefile
     53            reinplace "s|DL_ENDIAN|DB_ENDIAN|g" Makefile
     54        }
     55        reinplace "s|-O3 -DB_ENDIAN$|-O3 -DB_ENDIAN -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk|" Makefile
     56        reinplace "s|^LDFLAGS=.*|LDFLAGS=-arch ppc|g" Makefile.shared
     57    }
     58
     59    build {
     60        cd ${worksrcpath}
     61        # build for ppc
     62        system [command build]
     63
     64        # determine which files will need to be lipo'ed together
     65        set lList {}
     66        foreach s {0.9.8.dylib a} {
     67            foreach n {crypto ssl} {
     68                lappend lList lib${n}.${s}
     69            }
     70        }
     71        set eList {}
     72        foreach f [glob engines/*.so] {
     73            lappend eList ${f}
     74        }
     75        set bList apps/openssl
     76
     77        # save the output of the first go in a temporary location
     78        set ppcPath ${workpath}/ppc
     79        xinstall -d ${ppcPath}
     80        foreach l $lList {
     81            xinstall ${l} ${ppcPath}
     82        }
     83        xinstall -d ${ppcPath}/engines
     84        foreach e $eList {
     85            xinstall ${e} ${ppcPath}/engines
     86        }
     87        xinstall -d ${ppcPath}/apps
     88        foreach b $bList {
     89            xinstall ${b} ${ppcPath}/apps
     90        }
     91
     92        # cleanup the worksrcdir
     93        system "make clean"
     94        foreach f [glob lib*.0.9.8.dylib] {
     95            delete ${f}
     96        }
     97
     98        # prepare building for i386
     99        reinplace "s|darwin-ppc-cc|darwin-i386-cc|g" ${worksrcpath}/Makefile
     100        reinplace "s|DB_ENDIAN|DL_ENDIAN|g" ${worksrcpath}/Makefile
     101        reinplace "s|-arch ppc|-arch i386|g" ${worksrcpath}/Makefile
     102        reinplace "s|-arch ppc|-arch i386|g" Makefile.shared
     103
     104        # build for i386
     105        system [command build]
     106
     107        # save the output of the second go in another temporary location
     108        set i386Path ${workpath}/i386
     109        xinstall -d ${i386Path}
     110        foreach l $lList {
     111           xinstall ${l} ${i386Path}
     112        }
     113        xinstall -d ${i386Path}/engines
     114        foreach e $eList {
     115            xinstall ${e} ${i386Path}/engines
     116        }
     117        xinstall -d ${i386Path}/apps
     118        foreach b $bList {
     119            xinstall ${b} ${i386Path}/apps
     120        }
     121
     122        # run lipo on the output of both runs
     123        foreach l $lList {
     124            delete ${l}
     125            system "lipo \
     126            -arch i386 ${i386Path}/${l} \
     127            -arch  ppc  ${ppcPath}/${l} \
     128            -create -output ${l}"
     129        }
     130        foreach e $eList {
     131            delete ${e}
     132            system "lipo \
     133            -arch i386 ${i386Path}/${e} \
     134            -arch  ppc  ${ppcPath}/${e} \
     135            -create -output ${e}"
     136        }
     137        foreach b $bList {
     138            delete ${b}
     139            system "lipo \
     140            -arch i386 ${i386Path}/${b} \
     141            -arch  ppc  ${ppcPath}/${b} \
     142            -create -output ${b}"
     143        }
     144
     145        # make sure installing won't rebuild
     146        reinplace "s|install: all |install: |g" Makefile
     147    }
     148
     149    # make sure we don't build a third time
     150    post-build {}
     151}
     152
     153platform darwin_i386 {}
Note: See TracChangeset for help on using the changeset viewer.