source: trunk/dports/devel/openssl/Portfile @ 22510

Last change on this file since 22510 was 22510, checked in by pipping@…, 11 years ago

variant universal: * fix testsuite

  • beautify/shorten code (use loops wherever possible)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.9 KB
Line 
1# $Id: Portfile 22510 2007-03-03 14:59:44Z pipping@macports.org $
2
3PortSystem 1.0
4name                    openssl
5version                 0.9.8e
6platforms               darwin freebsd
7categories              devel security
8maintainers             mww@macports.org
9homepage                http://www.openssl.org/
10description             OpenSSL SSL/TLS cryptography library
11
12long_description \
13        The OpenSSL Project is a collaborative effort to develop a robust, \
14        commercial-grade, full-featured, and Open Source toolkit implementing \
15        the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security \
16        (TLS v1) protocols as well as a full-strength general purpose \
17        cryptography library.
18
19master_sites    http://www.openssl.org/source/
20checksums               md5 3a7ff24f6ea5cd711984722ad654b927 \
21                                sha1 b429872d2a287714ab37e42296e6a5fbe23d32ff \
22                                rmd160 c1a498606dc0fc7219376b950fab6b53687466db
23
24depends_lib             port:zlib
25
26variant darwin {
27        patchfiles      patch-Makefile.org patch-crypto-Makefile
28}
29
30configure.cmd   ./config
31configure.args  -L${prefix}/lib --openssldir=${prefix}/etc/openssl zlib no-asm no-krb5 shared
32
33platform darwin 6 {
34        depends_lib-append      port:dlcompat
35}
36
37platform darwin 8 {
38        build.args      CC=/usr/bin/gcc-4.0
39}
40
41destroot.destdir        INSTALL_PREFIX=${destroot}
42destroot.args           MANDIR=${prefix}/share/man
43
44test.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        set tList {}
77        foreach f [glob test/*test] {
78            lappend tList ${f}
79        }
80        lappend tList test/sha256t
81        lappend tList test/sha512t
82
83        # define a backup procedure to a temporary location
84        proc backup {bakPath} {
85            xinstall -d ${bakPath}   
86            foreach a {l e b t} b {. engines apps test} {
87                upvar 1 [set a]List [set a]List
88                xinstall -d ${bakPath}/$b
89                foreach n [set [set a]List] {
90                    xinstall ${n} ${bakPath}/${b}
91                }
92            }
93        }
94        # backup the output of the first run (ppc)
95        set ppcPath ${workpath}/ppc
96        backup ${ppcPath}
97
98        # cleanup the worksrcdir
99        system "make clean"
100        foreach f [glob lib*.0.9.8.dylib] {
101            delete ${f}
102        }
103
104        # prepare building for i386
105        reinplace "s|darwin-ppc-cc|darwin-i386-cc|g" ${worksrcpath}/Makefile
106        reinplace "s|DB_ENDIAN|DL_ENDIAN|g" ${worksrcpath}/Makefile
107        reinplace "s|-arch ppc|-arch i386|g" ${worksrcpath}/Makefile
108        reinplace "s|-arch ppc|-arch i386|g" Makefile.shared
109
110        # build for i386
111        system [command build]
112
113        # backup the output of the first run (ppc)
114        set i386Path ${workpath}/i386
115        backup ${i386Path}
116
117        # run lipo on the output of both runs
118        foreach n {l e b t} {
119            foreach m [set [set n]List] {
120                delete ${m}
121                system "lipo \
122                -arch i386 ${i386Path}/${m} \
123                -arch  ppc  ${ppcPath}/${m} \
124                -create -output ${m}"
125            }
126        }
127
128        # make sure installing won't rebuild
129        reinplace "s|install: all |install: |g" Makefile
130    }
131
132    # make sure we don't build a third time
133    post-build {}
134}
135
136platform darwin_i386 {}
Note: See TracBrowser for help on using the repository browser.