Files
BMLFS/build-scripts/nspr.build
2025-06-15 17:08:00 -05:00

90 lines
2.8 KiB
Bash

#! /bin/bash
# NSPR 4.36
# Source: https://archive.mozilla.org/pub/nspr/releases/v4.36/src/nspr-4.36.tar.gz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: NONE
# Recommended: NONE
# Optional: NONE
export PVER="4.36"
# Apply patch from ALpine Linux to fix missing type
patch -Np1 -i ../patches/nspr-alpine/lfs64.patch
# Per Alpine linux:
# ./nspr/pr/include/md/_linux.h tests only __GLIBC__ version
# To detect c-library features, list musl features here for now.
#
# .. by setting the CFLAGS
export CFLAGS="$CFLAGS -D_PR_POLL_AVAILABLE "
export CFLAGS+="-D_PR_HAVE_OFF64_T "
export CFLAGS+="-D_PR_INET6 "
export CFLAGS+="-D_PR_HAVE_INET_NTOP "
export CFLAGS+="-D_PR_HAVE_GETHOSTBYNAME2 "
export CFLAGS+="-D_PR_HAVE_GETADDRINFO "
export CFLAGS+="-D_PR_INET6_PROBE"
# Set the build options
export COPTS="--with-mozilla "
export COPTS+="--enable-ipv6 "
export COPTS+="--libdir=/usr/lib "
export COPTS+="--with-pthreads "
export COPTS+="--enable-optimize "
export COPTS+="--includedir=/usr/include/nspr "
cd nspr &&
# Per BLFS, disable installing the static libraries
# with sed commands
sed -i '/^RELEASE/s|^|#|' pr/src/misc/Makefile.in &&
sed -i 's|$(LIBRARY) ||' config/rules.mk
# Configure & build source
./configure --prefix=/usr $COPTS $([ $(uname -m) = x86_64 ] && echo --enable-64bit) $BUILDTRUPLE &&
read -p "Compile?" && make -j2 &&
read -p "Install?" &&
# If not using any package manager:
#sudo -S make install &&
sudo -S make DESTDIR=$BUILD install &&
unset CFLAGS COPTS &&
cd $BUILD && sudo -S mkdir -v ${BUILD}/install
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------------------------------------------------------|
nspr: nspr (Netscape Portable Runtime)
nspr:
nspr: Netscape Portable Runtime (NSPR) provides a platform-neutral API for
nspr: system level and libc like functions. The API is used in the Mozilla
nspr: clients and many of Red Hat's, Sun's, and other software offerings.
nspr:
nspr: Homepage: https://www.mozilla.org/projects/nspr/
nspr:
nspr:
nspr:
nspr:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S sed -i "s|\(-specs=.*hardened-ld\)||g" usr/bin/nspr-config &&
sudo -S ln -s nspr.pc usr/lib/pkgconfig/mozilla-nspr.pc &&
sudo -S rm -r usr/bin/{compile-et.pl,prerr.properties} \
usr/include/nspr/md &&
sudo -S makepkg -l y -c n $PKGS/nspr-$PVER-$PSUFFIX &&
sudo -S rm -rf ${BUILD}/*