Linux HOWTOs

About | Home | Search


HOWTO: nspr
Description: Netscape Portable Runtime - an API used by Mozilla (and others)
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# Mozilla NSPR 4.20
# =================
# Slackware 14.0: mozilla-nss 3.13.5 (and nspr 4.9.1)
# Slackware 14.1: mozilla-nss 3.15.2 (and nspr 4.10.1)
# Slackware 14.2: mozilla-nss 3.23 (and nspr 4.12)

# If you ever want to uninstall NSPR, or remove files from old versions
# before installing this one, skip down to the bottom

# Get it
cd
test -f installed/nspr-4.20.tar.gz && mv installed/nspr-4.20.tar.gz .
test ! -f nspr-4.20.tar.gz &&
 wget https://ftp.mozilla.org/pub/nspr/releases/v4.20/src/nspr-4.20.tar.gz

# Verify tarball w/ sha256sum:
echo "2c8964913da89ffbaf464d49ce44d79e8804e1794ef9a8c52a7bff7224d155\
6e  nspr-4.20.tar.gz" | sha256sum -c

# Extract it
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "nspr-*" -exec rm -r {} \;
tar xzvf ~/nspr-4.20.tar.gz
cd nspr-4.20
test $UID = 0 && chown -R root:root .

cd nspr

# Create a build directory
mkdir obj-`build/autoconf/config.guess`
cd obj-`build/autoconf/config.guess`

# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
 ../configure --enable-optimize --disable-debug --enable-strip \
 --enable-64bit --libdir=/usr/lib64

# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
 ../configure --enable-optimize --disable-debug --enable-strip

# Build it
make

# Build the tests
cd pr/tests
make
cd ../..

# Become root to install it
su

# Remove the mozilla-nss (and nspr) package, if there is one
# Once you're finished here, move on to the nss HOWTO
test -x /sbin/removepkg && /sbin/removepkg mozilla-nss

# Remove old NSPR files
test -d /usr/include/nspr && rm -r /usr/include/nspr
( cd /usr/lib ; rm -f libnspr4.* libplc4.* libplds4.* )
test -d /usr/lib64 &&
 ( cd /usr/lib64 ; rm -f libnspr4.* libplc4.* libplds4.* )

# Install it
install config/nspr-config /usr/bin/
install -d /usr/include/nspr /usr/include/nspr/md \
 /usr/include/nspr/obsolete /usr/include/nspr/private
install -m 644 dist/include/nspr/* /usr/include/nspr/
install -m 644 dist/include/nspr/md/* /usr/include/nspr/md/
install -m 644 dist/include/nspr/obsolete/* \
 /usr/include/nspr/obsolete/
install -m 644 dist/include/nspr/private/* /usr/include/nspr/private/
test $(uname -m) = 'x86_64' &&
 ( install dist/lib/* /usr/lib64/
   install -m 644 config/nspr.pc /usr/lib64/pkgconfig/
   ln -s /usr/lib64/pkgconfig/nspr.pc /usr/lib64/pkgconfig/mozilla-nspr.pc )
test $(uname -m) != 'x86_64' &&
 ( install dist/lib/* /usr/lib/
   install -m 644 config/nspr.pc /usr/lib/pkgconfig/ )
ldconfig

# Become yourself again
exit

# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/nspr-*.tar.*
mv nspr-4.20.tar.gz installed/


# If you ever want to uninstall NSPR, this should do it:
cd
su
for pfx in /usr /usr/local;
do
  rm -f ${pfx}/bin/nspr-config ${pfx}/share/aclocal/nspr.m4
  test -d ${pfx}/include/nspr && rm -r ${pfx}/include/nspr
  for libdir in ${pfx}/lib ${pfx}/lib64;
  do
    test -d $libdir &&
     ( cd $libdir
       rm -f libnspr4.* libplc4.* libplds4.* pkgconfig/nspr.pc )
  done
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "nspr-*" -exec rm -r {} \;
rm -f ~/installed/nspr-*.tar.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>