source: trunk/dports/net/nss/Portfile @ 147861

Last change on this file since 147861 was 147861, checked in by mcalhoun@…, 4 years ago

nss: update version 3.14.3->3.23; remove nss- prefix from binaries; allow universal build

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.0 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 147861 2016-04-19 00:51:32Z mcalhoun@macports.org $
3
4PortSystem          1.0
5PortGroup           muniversal 1.0
6
7name                nss
8version             3.23
9set NSS_VMAJOR      [lindex [split ${version} .] 0]
10set NSS_VMINOR      [lindex [split ${version} .] 1]
11set NSS_VPATCH      [lindex [split ${version} .] 2]
12if {${NSS_VPATCH} eq ""} {
13    # NSS_VPATCH should always be a number
14    set NSS_VPATCH 0
15}
16categories          net
17maintainers         nomaintainer
18license             {MPL-2 GPL-2+ LGPL-2.1+}
19description         Network Security Service libraries.
20
21long_description    ${description}
22use_configure       no
23homepage            http://www.mozilla.org/projects/security/pki/nss/
24platforms           darwin
25
26set my_release      NSS_[strsed ${version} {g/\./_/}]_RTM
27
28use_bzip2           no
29master_sites        ftp://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${my_release}/src/ \
30                    http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${my_release}/src/
31
32checksums           rmd160  2cb9a448ec60a00edd7cf5a08321dd6583d03cb9 \
33                    sha256  94b383e31c9671e9dfcca81084a8a813817e8f05a57f54533509b318d26e11cf
34
35depends_lib     port:nspr \
36                port:zlib \
37                port:sqlite3
38
39destroot.dir ${destroot.dir}/dist
40build.dir    ${build.dir}/nss
41
42# muniversal destroot requires a Makefile
43post-extract {
44    xinstall -d -m 0755 ${destroot.dir}
45
46    copy ${filespath}/Makefile-MacPorts-Install.in ${destroot.dir}/Makefile-MacPorts-Install
47    reinplace "s|__MACPORTS_PREFIX__|${prefix}|g" ${destroot.dir}/Makefile-MacPorts-Install
48}
49
50destroot.args-append \
51    -f Makefile-MacPorts-Install
52
53post-patch {
54    # libraries are not relative to any main executable, so no need for @executable_path
55    reinplace "s|@executable_path|${prefix}/lib/nss|g" \
56        ${build.dir}/coreconf/Darwin.mk \
57        ${build.dir}/lib/freebl/config.mk
58}
59
60post-destroot {
61    # applications seem to expect an nss-config executable and nss.pc file, but nss does not provide them
62    # see https://bugzilla.mozilla.org/show_bug.cgi?id=530672
63
64    xinstall  -m 0755 ${filespath}/nss-config.in       ${destroot}${prefix}/bin/nss-config
65    reinplace "s,@libdir@,${prefix}/lib/nss,g"         ${destroot}${prefix}/bin/nss-config
66    reinplace "s,@prefix@,${prefix},g"                 ${destroot}${prefix}/bin/nss-config
67    reinplace "s,@exec_prefix@,${prefix},g"            ${destroot}${prefix}/bin/nss-config
68    reinplace "s,@includedir@,${prefix}/include/nss,g" ${destroot}${prefix}/bin/nss-config
69    reinplace "s,@MOD_MAJOR_VERSION@,${NSS_VMAJOR},g"  ${destroot}${prefix}/bin/nss-config
70    reinplace "s,@MOD_MINOR_VERSION@,${NSS_VMINOR},g"  ${destroot}${prefix}/bin/nss-config
71    reinplace "s,@MOD_PATCH_VERSION@,${NSS_VPATCH},g"  ${destroot}${prefix}/bin/nss-config
72
73    set nspr_version [exec ${prefix}/bin/nspr-config --version]
74    set nss_version  [exec ${destroot}${prefix}/bin/nss-config --version]
75
76    xinstall  -m 0644 ${filespath}/nss.pc.in          ${destroot}${prefix}/lib/pkgconfig/nss.pc
77    reinplace "s,@libdir@,${prefix}/lib/nss,g"        ${destroot}${prefix}/lib/pkgconfig/nss.pc
78    reinplace "s,@prefix@,${prefix},g"                ${destroot}${prefix}/lib/pkgconfig/nss.pc
79    reinplace "s,@exec_prefix@,${prefix},g"           ${destroot}${prefix}/lib/pkgconfig/nss.pc
80    reinplace "s,@includedir@,${prefix}/include/nss," ${destroot}${prefix}/lib/pkgconfig/nss.pc
81    reinplace "s,@NSPR_VERSION@,${nspr_version},g"    ${destroot}${prefix}/lib/pkgconfig/nss.pc
82    reinplace "s,@NSS_VERSION@,${nss_version},g"      ${destroot}${prefix}/lib/pkgconfig/nss.pc
83
84    # install man files
85    xinstall -m 0644 \
86        {*}[glob ${build.dir}/doc/nroff/*.1] \
87        ${destroot}${prefix}/share/man/man1/
88}
89
90use_parallel_build  no
91
92# mimic nss/coreconf/Darwin.mk
93
94if {![variant_isset universal]} {
95    if {${build_arch} eq "x86_64" || ${build_arch} eq "ppc64"} {
96        build.args-append USE_64=1
97    }
98
99    build.args-append \
100        CC=\"${configure.cc} -arch ${build_arch}\" \
101        CCC=\"${configure.cxx} -arch ${build_arch}\"
102} else {
103    lappend merger_build_args(x86_64) USE_64=1
104    lappend merger_build_args(ppc64)  USE_64=1
105
106    foreach arch ${universal_archs} {
107        lappend merger_build_args(${arch}) \
108            CC='${configure.cc} -arch ${arch}' \
109            CCC='${configure.cxx} -arch ${arch}'
110    }
111}
112
113build.args-append \
114    NSPR_INCLUDE_DIR=${prefix}/include/nspr \
115    NSPR_LIB_DIR=${prefix}/lib/nspr \
116    NSS_USE_SYSTEM_SQLITE=1 \
117    USE_SYSTEM_ZLIB=1 \
118    BUILD_OPT=1 \
119    OPTIMIZER="${configure.optflags}" \
120    OBJDIR_NAME="Output.OBJD"
121
122if {${configure.sdkroot} ne ""} {
123    build.args-append \
124        MACOS_SDK_DIR=${configure.sdkroot}
125}
126
127if {[variant_isset universal]} {
128    # chk files can not be merged
129
130    merger-post-destroot {
131        foreach arch ${universal_archs_to_use} {
132            foreach chk [glob -nocomplain -directory ${destroot}-${arch}${prefix}/lib/nss *.chk] {
133                # delete chk file and replace it with an empty file, which can be merged
134                # keep the empty file so that later, we can know which chk files need to be regenerated from universal library
135                file delete ${chk}
136                system "touch ${chk}"
137            }
138        }
139    }
140
141    post-destroot {
142        foreach chk [glob -nocomplain -directory ${destroot}${prefix}/lib/nss *.chk] {
143            # replace empty chk file with an actual one generated from universal library
144            file delete ${chk}
145            set base [file rootname ${chk}]
146            system "env DYLD_LIBRARY_PATH=${destroot}${prefix}/lib/nss ${destroot}${prefix}/bin/shlibsign -i ${base}.dylib -o ${chk}"
147        }
148    }
149}
150
151livecheck.type    regex
152livecheck.url     http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/
153if {${NSS_VPATCH} eq 0} {
154    livecheck.version "${NSS_VMAJOR}_${NSS_VMINOR}"
155} else {
156    livecheck.version "${NSS_VMAJOR}_${NSS_VMINOR}_${NSS_VPATCH}"
157}
158livecheck.regex   {(\d+_\d+(?:_\d+)*)}
Note: See TracBrowser for help on using the repository browser.