#!/bin/sh

# build nspr
#
# build instructions taken from :
# http://lfs.linux-mirror.org/blfs/view/svn/general/nspr.html
#

SRCNAM=nspr-4.8.2.tar.gz
WRKDIR=nspr-4.8.2
TMPDIR=/tmp/package

rm -rf $WRKDIR
rm -rf $TMPDIR

tar -xf $SRCNAM

# build nspr-4.8.2

cd $WRKDIR

patch -Np1 -i ../nspr-4.8.2-pkgconfig-1.patch &&
cd mozilla/nsprpub &&
./configure --prefix=/usr/local \
            --with-mozilla \
            --with-pthreads &&
make

cd $WRKDIR/mozilla/nsprpub

make install DESTDIR=$TMPDIR

cd $TMPDIR

find . | xargs file | grep "executable" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | grep "not stripped" | cut -f 1 -d : | xargs strip -g 2> /dev/null
