1 # Build recipe for nss.
3 # Copyright (c) 2021-2022 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
22 pkgversion=$(echo $version | tr _ .)
25 # Define a category for the output of the package name
26 pkgcategory=networking
28 tarname=${program}-${pkgversion}.tar.gz
31 fetch=https://ftp.mozilla.org/pub/security/nss/releases/NSS_${version}_RTM/src/$tarname
34 Network security services.
36 Network Security Services (NSS) is a set of libraries designed to
37 support cross-platform development of security-enabled client and
38 server applications. Applications built with NSS can support
39 SSL v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME,
40 X.509 v3 certificates, and other security standards.
43 homepage=https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS
44 license="MPL v2.0, GPLv2+"
46 # Source documentation
47 docs="COPYING readme.md"
48 docsdir="${docdir}/${program}-${pkgversion}"
50 # Set 'srcdir' using previous 'pkgversion' variable
51 srcdir=${program}-${pkgversion}
55 unpack "${tardir}/$tarname"
59 # Apply a patch for build thanks to "Beyond Linux From Scratch"
60 patch -Np2 -i "${worktree}/patches/nss/nss-3.74-standalone-1.patch"
62 # Set sane permissions
63 chmod -R u+w,go-w,a+rX-s .
65 # Set specific options for the architecture
68 arch_options='USE_64=1'
71 arch_options='USE_64=0'
75 unset -v CFLAGS CXXFLAGS
77 make -j${jobs} BUILD_OPT=1 \
78 NSS_DISABLE_GTESTS=1 \
79 NSPR_INCLUDE_DIR=/usr/include/nspr \
83 NSS_USE_SYSTEM_SQLITE=1 \
88 # Proceed to install the software files
91 mkdir -v -p "${destdir}/usr/lib${libSuffix}" \
92 "${destdir}/usr/include/nss" \
93 "${destdir}/usr/bin" \
94 "${destdir}/usr/lib${libSuffix}/pkgconfig"
96 install -v -p -m755 Linux*/lib/*.so "${destdir}/usr/lib${libSuffix}"
97 install -v -p -m644 Linux*/lib/*.chk "${destdir}/usr/lib${libSuffix}"
98 install -v -p -m644 Linux*/lib/libcrmf.a "${destdir}/usr/lib${libSuffix}"
100 cp -v -pRL public/nss/* "${destdir}/usr/include/nss"
101 cp -v -pRL private/nss/* "${destdir}/usr/include/nss"
102 chmod 644 "${destdir}"/usr/include/nss/*
104 for file in certutil cmsutil crlutil derdump modutil pk12util pp \
105 signtool signver ssltap vfychain vfyserv nss-config ; \
107 install -v -p -m755 Linux*/bin/${file} "${destdir}/usr/bin"
111 install -v -p -m644 Linux*/lib/pkgconfig/nss.pc \
112 "${destdir}/usr/lib${libSuffix}/pkgconfig"
114 # Strip remaining binaries and libraries
115 find "$destdir" -type f | xargs file | \
116 awk '/ELF/ && /executable/ || /shared object/' | \
117 cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
118 strip --strip-debug "${destdir}/usr/lib${libSuffix}"/*.a
121 mkdir -v -p "${destdir}/${mandir}/man1"
122 cp -v -p doc/nroff/*.1 "${destdir}/${mandir}/man1"
123 chmod 644 "${destdir}/${mandir}"/man1/*
125 # Compress and link man pages (if needed)
126 if test -d "${destdir}/$mandir"
129 cd "${destdir}/$mandir"
130 find . -type f -exec lzip -9 {} +
131 find . -type l | while read -r file
133 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
140 mkdir -v -p "${destdir}/$docsdir"
141 cp -v -p $docs "${destdir}/$docsdir"