Files
BMLFS/build-scripts/nss.build
2025-06-16 01:58:28 -05:00

98 lines
3.4 KiB
Bash

#! /bin/bash
# NSS
# Source: https://archive.mozilla.org/pub/security/nss/releases/NSS_3_112_RTM/src/nss-3.112.tar.gz
#
# Build Method: BLFS
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: NSPR, SQlite
# Recommended: NONE
# Optional: NONE
# If building with LLVM+elftoolchain
patch -Np1 -i ../patches/nss-chimera/clang-ias.patch
patch -Np1 -i ../patches/nss-chimera/native-nsinstall-cflags.patch
patch -Np1 -i ../patches/nss-chimera/respect-ldflags.patch
# Apply patches to fix pkgconfig files
patch -Np1 -i ../patches/nss-lfs/nss-standalone-1.patch &&
export PVER="3.112"
# Set buid options
export MOPTS="BUILD_OPT=1 "
export MOPTS+="NSPR_INCLUDE_DIR=/usr/include/nspr "
export MOPTS+="USE_SYSTEM_ZLIB=1 "
export MOPTS+="ZLIB_LIBS=-lz "
export MOPTS+="NSS_ENABLE_WERROR=0 "
export MOPTS+="OPT_CODE_SIZE=1 "
export MOPTS+="FREEBL_NO_DEPEND=0 "
export MOPTS+="NSS_DISABLE_GTESTS=1 "
export MOPTS+="NSS_DISABLE_DEPRECATED_SEED=1 "
export MOPTS+="NSS_DISABLE_DEPRECATED_RC2=1 "
# Build
cd nss &&
make $MOPTS \
$([ $(uname -m) = x86_64 ] && echo USE_64=1) \
$([ -f /usr/include/sqlite3.h ] && echo NSS_USE_SYSTEM_SQLITE=1) -C coreconf
make $MOPTS \
$([ $(uname -m) = x86_64 ] && echo USE_64=1) \
$([ -f /usr/include/sqlite3.h ] && echo NSS_USE_SYSTEM_SQLITE=1) -C lib/util
make $MOPTS \
$([ $(uname -m) = x86_64 ] && echo USE_64=1) \
$([ -f /usr/include/sqlite3.h ] && echo NSS_USE_SYSTEM_SQLITE=1)
# install as super user
su
cd ../dist &&
install -m755 -d ${BUILD}/usr/lib/pkgconfig
install -m755 -d ${BUILD}/usr/bin
mkdir $BUILD/install
install -v -m755 Linux*/lib/*.so ${BUILD}/usr/lib &&
install -v -m644 Linux*/lib/{*.chk,libcrmf.a} ${BUILD}/usr/lib &&
install -v -m755 -d ${BUILD}/usr/include/nss &&
cp -v -RL {public,private}/nss/* ${BUILD}/usr/include/nss &&
chmod -v 644 ${BUILD}/usr/include/nss/* &&
install -v -m755 Linux*/bin/{certutil,nss-config,pk12util} ${BUILD}/usr/bin &&
install -v -m644 Linux*/lib/pkgconfig/nss.pc ${BUILD}/usr/lib/pkgconfig
cd $BUILD
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
nss: nss (Network Security Services)
nss:
nss: The Network Security Services (NSS) package is a set of libraries
nss: designed to support cross-platform development of security-enabled
nss: client and server applications. Applications built with NSS can
nss: support SSL v2 and v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12,
nss: S/MIME, X.509 v3 certificates, and other security standards. This is
nss: useful for implementing SSL and S/MIME or other Internet security
nss: standards into an application.
nss:
EOF
mv -v /tmp/slack-desc install/ &&
makepkg -l y -c n $PKGS/nss-$PVER-$PSUFFIX &&
rm -rf ${BUILD}/*
# Exit super user
exit