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