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