blob: 84f1916f308a47628281b243d02156a89b05329c [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001SUMMARY = "Mozilla's SSL and TLS implementation"
2DESCRIPTION = "Network Security Services (NSS) is a set of libraries \
3designed to support cross-platform development of \
4security-enabled client and server applications. \
5Applications built with NSS can support SSL v2 and v3, \
6TLS, PKCS 5, PKCS 7, PKCS 11, PKCS 12, S/MIME, X.509 \
7v3 certificates, and other security standards."
8HOMEPAGE = "http://www.mozilla.org/projects/security/pki/nss/"
9SECTION = "libs"
10
11LICENSE = "MPL-2.0 | (MPL-2.0 & GPL-2.0+) | (MPL-2.0 & LGPL-2.1+)"
12
13LIC_FILES_CHKSUM = "file://nss/COPYING;md5=3b1e88e1b9c0b5a4b2881d46cce06a18 \
14 file://nss/lib/freebl/mpi/doc/LICENSE;md5=491f158d09d948466afce85d6f1fe18f \
15 file://nss/lib/freebl/mpi/doc/LICENSE-MPL;md5=5d425c8f3157dbf212db2ec53d9e5132"
16
17VERSION_DIR = "${@d.getVar('BP').upper().replace('-', '_').replace('.', '_') + '_RTM'}"
18
19SRC_URI = "http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${VERSION_DIR}/src/${BP}.tar.gz \
20 file://nss.pc.in \
21 file://signlibs.sh \
22 file://0001-nss-fix-support-cross-compiling.patch \
23 file://nss-no-rpath-for-cross-compiling.patch \
24 file://nss-fix-incorrect-shebang-of-perl.patch \
25 file://nss-fix-nsinstall-build.patch \
26 file://disable-Wvarargs-with-clang.patch \
27 file://pqg.c-ULL_addend.patch \
28 file://Fix-compilation-for-X32.patch \
29 file://nss-build-hacl-poly1305-aarch64.patch \
30 file://0001-Bug-1437734-Use-snprintf-in-sign.c-r-ttaubert.patch \
31 "
32
33SRC_URI[md5sum] = "9467ec9e65c5aeb3254a50250490f5f7"
34SRC_URI[sha256sum] = "f4127de09bede39f5fd0f789d33c3504c5d261e69ea03022d46b319b3e32f6fa"
35
36UPSTREAM_CHECK_URI = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_Releases"
37UPSTREAM_CHECK_REGEX = "NSS_(?P<pver>.+)_release_notes"
38
39inherit siteinfo
40
41DEPENDS = "sqlite3 nspr zlib nss-native"
42DEPENDS_class-native = "sqlite3-native nspr-native zlib-native"
43RDEPENDS_${PN}-smime = "perl"
44
45TD = "${S}/tentative-dist"
46TDS = "${S}/tentative-dist-staging"
47
48TARGET_CC_ARCH += "${LDFLAGS}"
49
50do_configure_prepend_libc-musl () {
51 sed -i -e '/-DHAVE_SYS_CDEFS_H/d' ${S}/nss/lib/dbm/config/config.mk
52}
53
54do_compile_prepend_class-native() {
55 export NSPR_INCLUDE_DIR=${STAGING_INCDIR_NATIVE}
56 export NSPR_LIB_DIR=${STAGING_LIBDIR_NATIVE}
57 export NSS_ENABLE_WERROR=0
58}
59
60do_compile_prepend_class-nativesdk() {
61 export LDFLAGS=""
62}
63
64do_compile_prepend_class-native() {
65 # Need to set RPATH so that chrpath will do its job correctly
66 RPATH="-Wl,-rpath-link,${STAGING_LIBDIR_NATIVE} -Wl,-rpath-link,${STAGING_BASE_LIBDIR_NATIVE} -Wl,-rpath,${STAGING_LIBDIR_NATIVE} -Wl,-rpath,${STAGING_BASE_LIBDIR_NATIVE}"
67}
68
69do_compile() {
70 export CROSS_COMPILE=1
71 export NATIVE_CC="${BUILD_CC}"
72 export NATIVE_FLAGS="${BUILD_CFLAGS}"
73 export BUILD_OPT=1
74
75 export FREEBL_NO_DEPEND=1
76 export FREEBL_LOWHASH=1
77
78 export LIBDIR=${libdir}
79 export MOZILLA_CLIENT=1
80 export NS_USE_GCC=1
81 export NSS_USE_SYSTEM_SQLITE=1
82 export NSS_ENABLE_ECC=1
83
84 export OS_RELEASE=3.4
85 export OS_TARGET=Linux
86 export OS_ARCH=Linux
87
88 if [ "${TARGET_ARCH}" = "powerpc" ]; then
89 OS_TEST=ppc
90 elif [ "${TARGET_ARCH}" = "powerpc64" ]; then
91 OS_TEST=ppc64
92 elif [ "${TARGET_ARCH}" = "mips" -o "${TARGET_ARCH}" = "mipsel" -o "${TARGET_ARCH}" = "mips64" -o "${TARGET_ARCH}" = "mips64el" ]; then
93 OS_TEST=mips
94 else
95 OS_TEST="${TARGET_ARCH}"
96 fi
97
98 if [ "${SITEINFO_BITS}" = "64" ]; then
99 export USE_64=1
100 elif [ "${TARGET_ARCH}" = "x86_64" -a "${SITEINFO_BITS}" = "32" ]; then
101 export USE_X32=1
102 fi
103
104 export NSS_DISABLE_GTESTS=1
105
106 # We can modify CC in the environment, but if we set it via an
107 # argument to make, nsinstall, a host program, will also build with it!
108 #
109 # nss pretty much does its own thing with CFLAGS, so we put them into CC.
110 # Optimization will get clobbered, but most of the stuff will survive.
111 # The motivation for this is to point to the correct place for debug
112 # source files and CFLAGS does that. Nothing uses CCC.
113 #
114 export CC="${CC} ${CFLAGS}"
115 make -C ./nss CCC="${CXX} -g" \
116 OS_TEST=${OS_TEST} \
117 RPATH="${RPATH}"
118}
119do_compile[vardepsexclude] += "SITEINFO_BITS"
120
121
122do_install_prepend_class-nativesdk() {
123 export LDFLAGS=""
124}
125
126do_install() {
127 export CROSS_COMPILE=1
128 export NATIVE_CC="${BUILD_CC}"
129 export BUILD_OPT=1
130
131 export FREEBL_NO_DEPEND=1
132
133 export LIBDIR=${libdir}
134 export MOZILLA_CLIENT=1
135 export NS_USE_GCC=1
136 export NSS_USE_SYSTEM_SQLITE=1
137 export NSS_ENABLE_ECC=1
138
139 export OS_RELEASE=3.4
140 export OS_TARGET=Linux
141 export OS_ARCH=Linux
142
143 if [ "${TARGET_ARCH}" = "powerpc" ]; then
144 OS_TEST=ppc
145 elif [ "${TARGET_ARCH}" = "powerpc64" ]; then
146 OS_TEST=ppc64
147 elif [ "${TARGET_ARCH}" = "mips" -o "${TARGET_ARCH}" = "mipsel" -o "${TARGET_ARCH}" = "mips64" -o "${TARGET_ARCH}" = "mips64el" ]; then
148 OS_TEST=mips
149 else
150 OS_TEST="${TARGET_ARCH}"
151 fi
152 if [ "${SITEINFO_BITS}" = "64" ]; then
153 export USE_64=1
154 elif [ "${TARGET_ARCH}" = "x86_64" -a "${SITEINFO_BITS}" = "32" ]; then
155 export USE_X32=1
156 fi
157
158 export NSS_DISABLE_GTESTS=1
159
160 make -C ./nss \
161 CCC="${CXX}" \
162 OS_TEST=${OS_TEST} \
163 SOURCE_LIB_DIR="${TD}/${libdir}" \
164 SOURCE_BIN_DIR="${TD}/${bindir}" \
165 install
166
167 install -d ${D}/${libdir}/
168 for file in ${S}/dist/*.OBJ/lib/*.so; do
169 echo "Installing `basename $file`..."
170 cp $file ${D}/${libdir}/
171 done
172
173 for shared_lib in ${TD}/${libdir}/*.so.*; do
174 if [ -f $shared_lib ]; then
175 cp $shared_lib ${D}/${libdir}
176 ln -sf $(basename $shared_lib) ${D}/${libdir}/$(basename $shared_lib .1oe)
177 fi
178 done
179 for shared_lib in ${TD}/${libdir}/*.so; do
180 if [ -f $shared_lib -a ! -e ${D}/${libdir}/$shared_lib ]; then
181 cp $shared_lib ${D}/${libdir}
182 fi
183 done
184
185 install -d ${D}/${includedir}/nss3
186 install -m 644 -t ${D}/${includedir}/nss3 dist/public/nss/*
187
188 install -d ${D}/${bindir}
189 for binary in ${TD}/${bindir}/*; do
190 install -m 755 -t ${D}/${bindir} $binary
191 done
192}
193do_install[vardepsexclude] += "SITEINFO_BITS"
194
195do_install_append() {
196 # Create empty .chk files for the NSS libraries at build time. They could
197 # be regenerated at target's boot time.
198 for file in libsoftokn3.chk libfreebl3.chk libnssdbm3.chk; do
199 touch ${D}/${libdir}/$file
200 chmod 755 ${D}/${libdir}/$file
201 done
202 install -D -m 755 ${WORKDIR}/signlibs.sh ${D}/${bindir}/signlibs.sh
203
204 install -d ${D}${libdir}/pkgconfig/
205 sed 's/%NSS_VERSION%/${PV}/' ${WORKDIR}/nss.pc.in | sed 's/%NSPR_VERSION%/4.9.2/' > ${D}${libdir}/pkgconfig/nss.pc
206 sed -i s:OEPREFIX:${prefix}:g ${D}${libdir}/pkgconfig/nss.pc
207 sed -i s:OEEXECPREFIX:${exec_prefix}:g ${D}${libdir}/pkgconfig/nss.pc
208 sed -i s:OELIBDIR:${libdir}:g ${D}${libdir}/pkgconfig/nss.pc
209 sed -i s:OEINCDIR:${includedir}/nss3:g ${D}${libdir}/pkgconfig/nss.pc
210}
211
212do_install_append_class-target() {
213 # Create a blank certificate
214 mkdir -p ${D}${sysconfdir}/pki/nssdb/
215 touch ./empty_password
216 certutil -N -d ${D}${sysconfdir}/pki/nssdb/ -f ./empty_password
217 chmod 644 ${D}${sysconfdir}/pki/nssdb/*.db
218 rm ./empty_password
219}
220
221PACKAGE_WRITE_DEPS += "nss-native"
222pkg_postinst_${PN} () {
223 if [ -n "$D" ]; then
224 for I in $D${libdir}/lib*.chk; do
225 DN=`dirname $I`
226 BN=`basename $I .chk`
227 FN=$DN/$BN.so
228 shlibsign -i $FN
229 if [ $? -ne 0 ]; then
230 exit 1
231 fi
232 done
233 else
234 signlibs.sh
235 fi
236}
237
238PACKAGES =+ "${PN}-smime"
239FILES_${PN}-smime = "\
240 ${bindir}/smime \
241"
242FILES_${PN} = "\
243 ${sysconfdir} \
244 ${bindir} \
245 ${libdir}/lib*.chk \
246 ${libdir}/lib*.so \
247 "
248FILES_${PN}-dev = "\
249 ${libdir}/nss \
250 ${libdir}/pkgconfig/* \
251 ${includedir}/* \
252 "
253
254BBCLASSEXTEND = "native nativesdk"
255