void-packages/srcpkgs/nss/template

163 lines
4.5 KiB
Bash

# Template file for 'nss'
_nsprver=4.35
pkgname=nss
version=3.96.1
revision=1
hostmakedepends="perl which"
makedepends="nspr-devel sqlite-devel zlib-devel"
depends="nspr>=${_nsprver}"
short_desc="Mozilla Network Security Services"
maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
license="MPL-2.0, MIT, BSD-3-Clause"
homepage="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS"
distfiles="${MOZILLA_SITE}/security/nss/releases/NSS_${version//\./_}_RTM/src/nss-${version}.tar.gz"
checksum=c51e89f6fbb06163f4302e368eeb672d748b52d583948bdb15ef1b069237a496
export NS_USE_GCC=1
export LIBRUNPATH=
export BUILD_OPT=1
export NSS_USE_SYSTEM_SQLITE=1
export NSS_ENABLE_WERROR=0
export NSS_ENABLE_ECC=1
export NSPR_INCLUDE_DIR=${XBPS_CROSS_BASE}/usr/include/nspr
export NSPR_LIB_DIR=${XBPS_CROSS_BASE}/usr/lib
do_build() {
local _use64 _ARCH
# Build System can detect this just fine,
# but I don't like to see useless warning barf for every line.
case "$XBPS_TARGET_MACHINE" in
x86_64*) ;;
*) export NSS_DISABLE_AVX2=1 ;;
esac
case "$XBPS_TARGET_MACHINE" in
ppc64le*) ;;
ppc64*) export NSS_DISABLE_CRYPTO_VSX=1 ;;
ppc*)
export NSS_DISABLE_CRYPTO_VSX=1
export NSS_DISABLE_ALTIVEC=1
;;
esac
if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
CFLAGS+=" -DNS_PTR_GT_32"
_use64="USE_64=1"
fi
case "$XBPS_TARGET_MACHINE" in
aarch64*|ppc*|x86_64*|i?86*)
_ARCH="${XBPS_TARGET_MACHINE%-*}"
;;
arm*) _ARCH="arm";;
mips*) _ARCH="mips";;
*) msg_error "$pkgver: unknown target machine\n";;
esac
export XCFLAGS="${CFLAGS}"
make -C nss ${makejobs} \
${CROSS_BUILD:+CROSS_COMPILE=1} OS_TEST="${_ARCH}" \
NATIVE_CC="${CC_FOR_BUILD}" \
NATIVE_FLAGS="${CFLAGS_FOR_BUILD}" \
NATIVE_LDFLAGS="${LDFLAGS_FOR_BUILD}" \
CCC="$CXX" ${_use64} \
all
}
do_check() {
local _use_64
export XCFLAGS="${CFLAGS}"
if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
_use_64="USE_64=1"
fi
cd nss/tests
env $_use_64 HOST=localhost DOMSUF=localdomain ./all.sh
}
do_install() {
vmkdir usr/lib/pkgconfig
vmkdir usr/bin
vmkdir usr/include/nss
NSS_VMAJOR=$(grep "#define.*NSS_VMAJOR" nss/lib/nss/nss.h | awk '{print $3}')
NSS_VMINOR=$(grep "#define.*NSS_VMINOR" nss/lib/nss/nss.h | awk '{print $3}')
NSS_VPATCH=$(grep "#define.*NSS_VPATCH" nss/lib/nss/nss.h | awk '{print $3}')
sed -e "s,%prefix%,/usr,g" \
-e 's,%exec_prefix%,${prefix},g' \
-e 's,%includedir%,${prefix}/include/nss,g' \
-e 's,%libdir%,${prefix}/lib,g' \
-e "s,%NSPR_VERSION%,${_nsprver},g" \
-e "s,%NSS_VERSION%,${version},g" \
nss/pkg/pkg-config/nss.pc.in \
> ${DESTDIR}/usr/lib/pkgconfig/nss.pc
ln -sf nss.pc ${DESTDIR}/usr/lib/pkgconfig/mozilla-nss.pc
chmod 644 ${DESTDIR}/usr/lib/pkgconfig/*.pc
sed -e "s,@prefix@,/usr,g" \
-e 's,@exec_prefix@,${prefix},g' \
-e 's,@includedir@,${prefix}/include/nss,g' \
-e 's,@libdir@,${prefix}/lib,g' \
-e "s,@MOD_MAJOR_VERSION@,${NSS_VMAJOR},g" \
-e "s,@MOD_MINOR_VERSION@,${NSS_VMINOR},g" \
-e "s,@MOD_PATCH_VERSION@,${NSS_VPATCH},g" \
nss/pkg/pkg-config/nss-config.in \
> ${DESTDIR}/usr/bin/nss-config
chmod 755 ${DESTDIR}/usr/bin/nss-config
for f in libsoftokn3.so libfreebl3.so libfreeblpriv3.so libnss3.so libnssutil3.so \
libssl3.so libsmime3.so libnssckbi.so libnssdbm3.so libnsssysinit.so; do
install -m755 dist/*.OBJ/lib/${f} ${DESTDIR}/usr/lib
done
install -m644 dist/*.OBJ/lib/libcrmf.a ${DESTDIR}/usr/lib
for f in certutil cmsutil crlutil derdump modutil pk12util pp shlibsign \
signtool signver ssltap vfychain vfyserv; do
install -m755 dist/*.OBJ/bin/${f} ${DESTDIR}/usr/bin
done
vmkdir usr/libexec/nss
for f in addbuiltin chktest dbtest dbtool ecperf httpserv \
ocspclnt p7content p7env p7sign p7verify pk1sign pwdecrypt \
rsaperf selfserv strsclnt symkeyutil
do
install -m755 dist/*.OBJ/bin/${f} ${DESTDIR}/usr/libexec/nss/
done
for f in nss/doc/nroff/*.1
do
vman $f
done
install -m644 dist/public/nss/*.h ${DESTDIR}/usr/include/nss
sed -ne '/Copyright/,/SUCH DAMAGE/p' nss/lib/dbm/src/db.c >dbm.LICENSE
vlicense dbm.LICENSE
{
echo "The MIT License"
find nss/lib -name '*.h' -o -name '*.c' |
xargs grep -l 'MIT License' |
xargs grep -h 'Copyright' |
sed 's,^[[:space:]]*[*/]*[[:space:]]*,,' |
sort -u
sed -ne '/Permission is hereby/,/ [*] SOFTWARE[.]$/p' \
nss/lib/freebl/verified/Hacl_Chacha20.c
} >MIT.license
vlicense MIT.license
}
nss-devel_package() {
depends="nspr-devel>=${_nsprver} nss>=${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/bin/nss-config
vmove usr/lib/pkgconfig
vmove usr/include
vmove "usr/lib/*.a"
}
}