| 1 | # $Id: Portfile 39871 2008-09-09 21:55:08Z dluke@macports.org $ |
|---|
| 2 | |
|---|
| 3 | PortSystem 1.0 |
|---|
| 4 | |
|---|
| 5 | name apr |
|---|
| 6 | version 1.3.3 |
|---|
| 7 | categories devel |
|---|
| 8 | maintainers dluke@geeklair.net |
|---|
| 9 | platforms darwin |
|---|
| 10 | description The apache group's portability library |
|---|
| 11 | |
|---|
| 12 | long_description The Apache Portable Runtime is a library of C data \ |
|---|
| 13 | structures and routines, forming a system portability \ |
|---|
| 14 | layer that covers as many operating systems as \ |
|---|
| 15 | possible, including Unices, Win32, BeOS, and OS/2. |
|---|
| 16 | |
|---|
| 17 | homepage http://apr.apache.org/ |
|---|
| 18 | master_sites apache:apr |
|---|
| 19 | |
|---|
| 20 | use_bzip2 yes |
|---|
| 21 | checksums md5 2090c21dee4f0eb1512604127dcd158f \ |
|---|
| 22 | sha1 25ff863e52e1701a5afdbdfa9873c8e718040fc6 \ |
|---|
| 23 | rmd160 8dcd2c7c8481fb8926fe67e1172185dec7ebd10e |
|---|
| 24 | |
|---|
| 25 | #universal_variant no |
|---|
| 26 | use_parallel_build yes |
|---|
| 27 | configure.env ac_cv_prog_AWK=awk |
|---|
| 28 | configure.args --with-installbuilddir=${prefix}/share/apr-1/build |
|---|
| 29 | |
|---|
| 30 | test.run yes |
|---|
| 31 | test.target check |
|---|
| 32 | test.env DYLD_LIBRARY_PATH=${worksrcpath}/.libs |
|---|
| 33 | pre-test { |
|---|
| 34 | use_parallel_build no |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | livecheck.check regex |
|---|
| 38 | livecheck.url http://apache.org/dist/apr/ |
|---|
| 39 | livecheck.regex {<a href="#apr">APR (\d+(?:\.\d+)*) is the latest available version</a>} |
|---|
| 40 | |
|---|
| 41 | ## copied from openssl |
|---|
| 42 | |
|---|
| 43 | if { ![info exists universal_archs] } { |
|---|
| 44 | set universal_archs {i386 ppc} |
|---|
| 45 | #set universal_archs {i386 x86_64 ppc ppc64} |
|---|
| 46 | } |
|---|
| 47 | set first_arch [lindex ${universal_archs} 0] |
|---|
| 48 | |
|---|
| 49 | variant universal { |
|---|
| 50 | pre-configure { |
|---|
| 51 | foreach arch ${universal_archs} { |
|---|
| 52 | if {[string equal ${arch} ${first_arch}]} { |
|---|
| 53 | move ${worksrcpath} ${workpath}/${first_arch} |
|---|
| 54 | } else { |
|---|
| 55 | copy ${workpath}/${first_arch} ${workpath}/${arch} |
|---|
| 56 | } |
|---|
| 57 | } |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | configure { |
|---|
| 61 | foreach arch ${universal_archs} { |
|---|
| 62 | set my_cflags "-isysroot ${universal_sysroot} -arch ${arch}" |
|---|
| 63 | set my_cxxflags "-isysroot ${universal_sysroot} -arch ${arch}" |
|---|
| 64 | set my_ldflags "-arch ${arch}" |
|---|
| 65 | configure.cflags-append "${my_cflags}" |
|---|
| 66 | configure.cxxflags-append "${my_cxxflags}" |
|---|
| 67 | configure.ldflags-append "${my_ldflags}" |
|---|
| 68 | configure.dir "${workpath}/${arch}" |
|---|
| 69 | configure_main |
|---|
| 70 | configure.cflags-delete "${my_cflags}" |
|---|
| 71 | configure.cxxflags-delete "${my_cxxflags}" |
|---|
| 72 | configure.ldflags-delete "${my_ldflags}" |
|---|
| 73 | } |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | build { |
|---|
| 77 | foreach arch ${universal_archs} { |
|---|
| 78 | #system "cd ${workpath}/${arch} && make all" |
|---|
| 79 | build.dir "${workpath}/${arch}" |
|---|
| 80 | build_main |
|---|
| 81 | } |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | destroot { |
|---|
| 85 | set my_cflags "${configure.cflags} -isysroot ${universal_sysroot}" |
|---|
| 86 | set my_ldflags "${configure.ldflags}" |
|---|
| 87 | foreach arch ${universal_archs} { |
|---|
| 88 | set my_cflags "${my_cflags} -arch ${arch}" |
|---|
| 89 | set my_ldflags "${my_ldflags} -arch ${arch}" |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | foreach arch ${universal_archs} { |
|---|
| 93 | set my_predest "${workpath}/pre-dest" |
|---|
| 94 | destroot.dir "${workpath}/${arch}" |
|---|
| 95 | destroot.destdir "DESTDIR=${my_predest}/${arch}" |
|---|
| 96 | destroot_main |
|---|
| 97 | |
|---|
| 98 | # Remove arch from apr-1-config script |
|---|
| 99 | reinplace "s|/${arch}||" "${my_predest}/${arch}/opt/local/bin/apr-1-config" |
|---|
| 100 | |
|---|
| 101 | # Combine archs into CLFAGS and LDFLAGS |
|---|
| 102 | reinplace "s|^CFLAGS=.*\$|CFLAGS=${my_cflags}|" "${my_predest}/${arch}/opt/local/share/apr-1/build/apr_rules.mk" |
|---|
| 103 | reinplace "s|^LDFLAGS=.*\$|LDFLAGS=${my_ldflags}|" "${my_predest}/${arch}/opt/local/share/apr-1/build/apr_rules.mk" |
|---|
| 104 | |
|---|
| 105 | # Cobine archs into libtool |
|---|
| 106 | reinplace "s|^LTCFLAGS=.*\$|LTCFLAGS=${my_cflags}|" "${my_predest}/${arch}/opt/local/share/apr-1/build/libtool" |
|---|
| 107 | # Really hacky! Something better here please? |
|---|
| 108 | reinplace "s|^sys_lib_search_path_spec=\".*\"\$|sys_lib_search_path_spec=\"/usr/lib/i686-apple-darwin9/4.0.1 /usr/lib /usr/lib/gcc/i686-apple-darwin9/4.0.1 /usr/lib/gcc/i686-apple-darwin9/4.0.1/x86_64 /usr/local/lib\"|" "${my_predest}/${arch}/opt/local/share/apr-1/build/libtool" |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | ## Merge each apr.h into one file |
|---|
| 112 | xinstall -d "${workpath}/destroot/opt/local/include/apr-1" |
|---|
| 113 | |
|---|
| 114 | set my_apr_h_dst "${workpath}/destroot/opt/local/include/apr-1/apr.h" |
|---|
| 115 | foreach arch ${universal_archs} { |
|---|
| 116 | set my_predest "${workpath}/pre-dest" |
|---|
| 117 | set my_apr_h_src "${my_predest}/${arch}/opt/local/include/apr-1/apr.h" |
|---|
| 118 | system "(echo '#if defined(__${arch}__)' && cat ${my_apr_h_src} && echo '#endif /* defined(__${arch}__) */') >> ${my_apr_h_dst}" |
|---|
| 119 | delete ${my_apr_h_src} |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | merge "${workpath}/pre-dest" |
|---|
| 123 | } |
|---|
| 124 | } |
|---|