source: trunk/dports/net/nss/Portfile

Last change on this file was 153771, checked in by devans@…, 10 months ago

nss: build fix for 10.7, don't use -Werror.

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