Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/nss/
Date: Fri, 28 May 2021 19:36:16
Message-Id: 1622230568.7b03da02da69388bbeb972a9641194f23ee59237.whissi@gentoo
1 commit: 7b03da02da69388bbeb972a9641194f23ee59237
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 28 19:33:25 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Fri May 28 19:36:08 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b03da02
7
8 dev-libs/nss: bump to v3.66
9
10 Package-Manager: Portage-3.0.19, Repoman-3.0.3
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-libs/nss/Manifest | 1 +
14 dev-libs/nss/nss-3.66.ebuild | 357 +++++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 358 insertions(+)
16
17 diff --git a/dev-libs/nss/Manifest b/dev-libs/nss/Manifest
18 index d56dec8421e..a51cccc229f 100644
19 --- a/dev-libs/nss/Manifest
20 +++ b/dev-libs/nss/Manifest
21 @@ -1,3 +1,4 @@
22 DIST nss-3.63.1.tar.gz 82166899 BLAKE2B a3c1939d16dcb083fae819659c0a61ff1d4dab70c8a7fc4b176a391bf7cd22eae1c93c85533b6af15e1c1cd9fb6b007380741e0b1670f3891f298ffa1b309284 SHA512 62d1bc161fc8eea6be191dc23ec42042a2626e119b7329f6449cf78729775776fd8e9faebd0457c2413684c15be6e10722ee4a7087c7c3e103fe993f3acec730
23 DIST nss-3.65.tar.gz 82386222 BLAKE2B 4e1876a12d042b67c6654a8396611ca33d5257b07c75b55201de229f0a6860577886f38d640837d6512b30a074d05b917bae4e34263d9c0f6f4606c80b369a04 SHA512 6f980f44056c69c74754124ce16d4880fb47440146d55906584f70d1be8e74885570308914d4482b3ee676a1f5b1e529616eae8ccd6906d678394dd929dd0825
24 +DIST nss-3.66.tar.gz 82401896 BLAKE2B ae369899af681e1c6ea8046098c83da08c2112b16d85a0eaee46e9d4f97dfb3f7c3e97eb681ec947b5648446c6db51e8f1396ec9bb6c731c9678ecf925e7f743 SHA512 327129cb065a8c19246e081e3cbc4798c81dc52eab6ee366eade151e9d308990592075c52a7c672165725fd855a0c539d56a803c26ef066561c584d693e0e467
25 DIST nss-cacert-class1-class3-r2.patch 21925 BLAKE2B 7627ff9a09f084c19d72d0490676865e3cab3ca7c920ae1ce4bea2db664f37fd0aa84fcda919809a516891ab2a62e2e7a43a9d6ada4c231adfe4c216525fac7d SHA512 1ce6ff9ab310aaca9005eafb461338b291df8523cc7044e096cd75774ce746c26eed19ec6bb2643c6c67f94650f2f309463492d80a90568f38ce2557f8ada2f4
26
27 diff --git a/dev-libs/nss/nss-3.66.ebuild b/dev-libs/nss/nss-3.66.ebuild
28 new file mode 100644
29 index 00000000000..200e2c3b7bf
30 --- /dev/null
31 +++ b/dev-libs/nss/nss-3.66.ebuild
32 @@ -0,0 +1,357 @@
33 +# Copyright 1999-2021 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +inherit flag-o-matic multilib toolchain-funcs multilib-minimal
39 +
40 +NSPR_VER="4.29"
41 +RTM_NAME="NSS_${PV//./_}_RTM"
42 +
43 +DESCRIPTION="Mozilla's Network Security Services library that implements PKI support"
44 +HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS"
45 +SRC_URI="https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz
46 + cacert? ( https://dev.gentoo.org/~whissi/dist/ca-certificates/nss-cacert-class1-class3-r2.patch )"
47 +
48 +LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )"
49 +SLOT="0"
50 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-solaris ~x86-solaris"
51 +IUSE="cacert utils"
52 +# pkg-config called by nss-config -> virtual/pkgconfig in RDEPEND
53 +RDEPEND="
54 + >=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}]
55 + >=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}]
56 + >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
57 + virtual/pkgconfig
58 +"
59 +DEPEND="${RDEPEND}"
60 +
61 +RESTRICT="test"
62 +
63 +S="${WORKDIR}/${P}/${PN}"
64 +
65 +MULTILIB_CHOST_TOOLS=(
66 + /usr/bin/nss-config
67 +)
68 +
69 +PATCHES=(
70 + # Custom changes for gentoo
71 + "${FILESDIR}/${PN}-3.53-gentoo-fixups.patch"
72 + "${FILESDIR}/${PN}-3.21-gentoo-fixup-warnings.patch"
73 + "${FILESDIR}/${PN}-3.23-hppa-byte_order.patch"
74 +)
75 +
76 +src_prepare() {
77 + default
78 +
79 + if use cacert ; then
80 + eapply -p2 "${DISTDIR}"/nss-cacert-class1-class3-r2.patch
81 + fi
82 +
83 + pushd coreconf >/dev/null || die
84 + # hack nspr paths
85 + echo 'INCLUDES += -I$(DIST)/include/dbm' \
86 + >> headers.mk || die "failed to append include"
87 +
88 + # modify install path
89 + sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \
90 + -i source.mk || die
91 +
92 + # Respect LDFLAGS
93 + sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk
94 + popd >/dev/null || die
95 +
96 + # Fix pkgconfig file for Prefix
97 + sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \
98 + config/Makefile || die
99 +
100 + # use host shlibsign if need be #436216
101 + if tc-is-cross-compiler ; then
102 + sed -i \
103 + -e 's:"${2}"/shlibsign:shlibsign:' \
104 + cmd/shlibsign/sign.sh || die
105 + fi
106 +
107 + # dirty hack
108 + sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \
109 + lib/ssl/config.mk || die
110 + sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \
111 + cmd/platlibs.mk || die
112 +
113 + multilib_copy_sources
114 +
115 + strip-flags
116 +}
117 +
118 +multilib_src_configure() {
119 + # Ensure we stay multilib aware
120 + sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die
121 +}
122 +
123 +nssarch() {
124 + # Most of the arches are the same as $ARCH
125 + local t=${1:-${CHOST}}
126 + case ${t} in
127 + *86*-pc-solaris2*) echo "i86pc" ;;
128 + aarch64*) echo "aarch64" ;;
129 + hppa*) echo "parisc" ;;
130 + i?86*) echo "i686" ;;
131 + x86_64*) echo "x86_64" ;;
132 + *) tc-arch ${t} ;;
133 + esac
134 +}
135 +
136 +nssbits() {
137 + local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS"
138 + if [[ ${1} == BUILD_ ]]; then
139 + cc=$(tc-getBUILD_CC)
140 + else
141 + cc=$(tc-getCC)
142 + fi
143 + echo > "${T}"/test.c || die
144 + ${cc} ${!cppflags} ${!cflags} -c "${T}"/test.c -o "${T}/${1}test.o" || die
145 + case $(file "${T}/${1}test.o") in
146 + *32-bit*x86-64*) echo USE_X32=1;;
147 + *64-bit*|*ppc64*|*x86_64*) echo USE_64=1;;
148 + *32-bit*|*ppc*|*i386*) ;;
149 + *) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";;
150 + esac
151 +}
152 +
153 +multilib_src_compile() {
154 + # use ABI to determine bit'ness, or fallback if unset
155 + local buildbits mybits
156 + case "${ABI}" in
157 + n32) mybits="USE_N32=1";;
158 + x32) mybits="USE_X32=1";;
159 + s390x|*64) mybits="USE_64=1";;
160 + ${DEFAULT_ABI})
161 + einfo "Running compilation test to determine bit'ness"
162 + mybits=$(nssbits)
163 + ;;
164 + esac
165 + # bitness of host may differ from target
166 + if tc-is-cross-compiler; then
167 + buildbits=$(nssbits BUILD_)
168 + fi
169 +
170 + local makeargs=(
171 + CC="$(tc-getCC)"
172 + CCC="$(tc-getCXX)"
173 + AR="$(tc-getAR) rc \$@"
174 + RANLIB="$(tc-getRANLIB)"
175 + OPTIMIZER=
176 + ${mybits}
177 + )
178 +
179 + # Take care of nspr settings #436216
180 + local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)"
181 + unset NSPR_INCLUDE_DIR
182 +
183 + export NSS_ALLOW_SSLKEYLOGFILE=1
184 + export NSS_ENABLE_WERROR=0 #567158
185 + export BUILD_OPT=1
186 + export NSS_USE_SYSTEM_SQLITE=1
187 + export NSDISTMODE=copy
188 + export FREEBL_NO_DEPEND=1
189 + export FREEBL_LOWHASH=1
190 + export NSS_SEED_ONLY_DEV_URANDOM=1
191 + export USE_SYSTEM_ZLIB=1
192 + export ZLIB_LIBS=-lz
193 + export ASFLAGS=""
194 + # Fix build failure on arm64
195 + export NS_USE_GCC=1
196 + # Detect compiler type and set proper environment value
197 + if tc-is-gcc; then
198 + export CC_IS_GCC=1
199 + elif tc-is-clang; then
200 + export CC_IS_CLANG=1
201 + fi
202 +
203 + local d
204 +
205 + # Build the host tools first.
206 + LDFLAGS="${BUILD_LDFLAGS}" \
207 + XCFLAGS="${BUILD_CFLAGS}" \
208 + NSPR_LIB_DIR="${T}/fakedir" \
209 + emake -j1 -C coreconf \
210 + CC="$(tc-getBUILD_CC)" \
211 + ${buildbits-${mybits}}
212 + makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" )
213 +
214 + # Then build the target tools.
215 + for d in . lib/dbm ; do
216 + CPPFLAGS="${myCPPFLAGS}" \
217 + XCFLAGS="${CFLAGS} ${CPPFLAGS}" \
218 + NSPR_LIB_DIR="${T}/fakedir" \
219 + emake -j1 "${makeargs[@]}" -C ${d} OS_TEST="$(nssarch)"
220 + done
221 +}
222 +
223 +# Altering these 3 libraries breaks the CHK verification.
224 +# All of the following cause it to break:
225 +# - stripping
226 +# - prelink
227 +# - ELF signing
228 +# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html
229 +# Either we have to NOT strip them, or we have to forcibly resign after
230 +# stripping.
231 +#local_libdir="$(get_libdir)"
232 +#export STRIP_MASK="
233 +# */${local_libdir}/libfreebl3.so*
234 +# */${local_libdir}/libnssdbm3.so*
235 +# */${local_libdir}/libsoftokn3.so*"
236 +
237 +export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3"
238 +
239 +generate_chk() {
240 + local shlibsign="$1"
241 + local libdir="$2"
242 + einfo "Resigning core NSS libraries for FIPS validation"
243 + shift 2
244 + local i
245 + for i in ${NSS_CHK_SIGN_LIBS} ; do
246 + local libname=lib${i}.so
247 + local chkname=lib${i}.chk
248 + "${shlibsign}" \
249 + -i "${libdir}"/${libname} \
250 + -o "${libdir}"/${chkname}.tmp \
251 + && mv -f \
252 + "${libdir}"/${chkname}.tmp \
253 + "${libdir}"/${chkname} \
254 + || die "Failed to sign ${libname}"
255 + done
256 +}
257 +
258 +cleanup_chk() {
259 + local libdir="$1"
260 + shift 1
261 + local i
262 + for i in ${NSS_CHK_SIGN_LIBS} ; do
263 + local libfname="${libdir}/lib${i}.so"
264 + # If the major version has changed, then we have old chk files.
265 + [ ! -f "${libfname}" -a -f "${libfname}.chk" ] \
266 + && rm -f "${libfname}.chk"
267 + done
268 +}
269 +
270 +multilib_src_install() {
271 + pushd dist >/dev/null || die
272 +
273 + dodir /usr/$(get_libdir)
274 + cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed"
275 + local i
276 + for i in crmf freebl nssb nssckfw ; do
277 + cp -L */lib/lib${i}.a "${ED}"/usr/$(get_libdir) || die "copying libs failed"
278 + done
279 +
280 + # Install nss-config and pkgconfig file
281 + dodir /usr/bin
282 + cp -L */bin/nss-config "${ED}"/usr/bin || die
283 + dodir /usr/$(get_libdir)/pkgconfig
284 + cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die
285 +
286 + # create an nss-softokn.pc from nss.pc for libfreebl and some private headers
287 + # bug 517266
288 + sed -e 's#Libs:#Libs: -lfreebl#' \
289 + -e 's#Cflags:#Cflags: -I${includedir}/private#' \
290 + */lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \
291 + || die "could not create nss-softokn.pc"
292 +
293 + # all the include files
294 + insinto /usr/include/nss
295 + doins public/nss/*.{h,api}
296 + insinto /usr/include/nss/private
297 + doins private/nss/{blapi,alghmac,cmac}.h
298 +
299 + popd >/dev/null || die
300 +
301 + local f nssutils
302 + # Always enabled because we need it for chk generation.
303 + nssutils=( shlibsign )
304 +
305 + if multilib_is_native_abi ; then
306 + if use utils; then
307 + # The tests we do not need to install.
308 + #nssutils_test="bltest crmftest dbtest dertimetest
309 + #fipstest remtest sdrtest"
310 + # checkcert utils has been removed in nss-3.22:
311 + # https://bugzilla.mozilla.org/show_bug.cgi?id=1187545
312 + # https://hg.mozilla.org/projects/nss/rev/df1729d37870
313 + # certcgi has been removed in nss-3.36:
314 + # https://bugzilla.mozilla.org/show_bug.cgi?id=1426602
315 + nssutils+=(
316 + addbuiltin
317 + atob
318 + baddbdir
319 + btoa
320 + certutil
321 + cmsutil
322 + conflict
323 + crlutil
324 + derdump
325 + digest
326 + makepqg
327 + mangle
328 + modutil
329 + multinit
330 + nonspr10
331 + ocspclnt
332 + oidcalc
333 + p7content
334 + p7env
335 + p7sign
336 + p7verify
337 + pk11mode
338 + pk12util
339 + pp
340 + rsaperf
341 + selfserv
342 + signtool
343 + signver
344 + ssltap
345 + strsclnt
346 + symkeyutil
347 + tstclnt
348 + vfychain
349 + vfyserv
350 + )
351 + # install man-pages for utils (bug #516810)
352 + doman doc/nroff/*.1
353 + fi
354 + pushd dist/*/bin >/dev/null || die
355 + for f in ${nssutils[@]}; do
356 + dobin ${f}
357 + done
358 + popd >/dev/null || die
359 + fi
360 +
361 + # Prelink breaks the CHK files. We don't have any reliable way to run
362 + # shlibsign after prelink.
363 + dodir /etc/prelink.conf.d
364 + printf -- "-b ${EPREFIX}/usr/$(get_libdir)/lib%s.so\n" ${NSS_CHK_SIGN_LIBS} \
365 + > "${ED}"/etc/prelink.conf.d/nss.conf
366 +}
367 +
368 +pkg_postinst() {
369 + multilib_pkg_postinst() {
370 + # We must re-sign the libraries AFTER they are stripped.
371 + local shlibsign="${EROOT}/usr/bin/shlibsign"
372 + # See if we can execute it (cross-compiling & such). #436216
373 + "${shlibsign}" -h >&/dev/null
374 + if [[ $? -gt 1 ]] ; then
375 + shlibsign="shlibsign"
376 + fi
377 + generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir)
378 + }
379 +
380 + multilib_foreach_abi multilib_pkg_postinst
381 +}
382 +
383 +pkg_postrm() {
384 + multilib_pkg_postrm() {
385 + cleanup_chk "${EROOT}"/usr/$(get_libdir)
386 + }
387 +
388 + multilib_foreach_abi multilib_pkg_postrm
389 +}