Blame SOURCES/nss-split-softokn.sh

dcddc0
#!/bin/sh
dcddc0
#
dcddc0
# Splits NSS into nss-util and nss-softokn
dcddc0
# Takes as command line input the version of nss
5297d5
# and assumes that a file nss-${nss_version}.tar.gz
5297d5
# exists in the current directory
dcddc0
dcddc0
set -e
dcddc0
dcddc0
if test -z $1
dcddc0
then
dcddc0
  echo "usage: $0 nss-version"
dcddc0
  exit
dcddc0
fi
dcddc0
dcddc0
export name=nss
dcddc0
export version=$1
dcddc0
5297d5
echo "Extracting ${name}-${version}.tar.gz"
dcddc0
5297d5
tar -xzf ${name}-${version}.tar.gz
dcddc0
dcddc0
# the directory will be named ${name}-${version}
dcddc0
dcddc0
nss_source_dir=${name}-${version}
dcddc0
softokn_dir=${name}-softokn-${version}
dcddc0
dcddc0
# make_nss_softokn
dcddc0
#-------------------------------------------------
dcddc0
# create the nss-softokn subset consisting of
dcddc0
#   nss/dbm                 full directory
dcddc0
#   nss/coreconf            full directory
dcddc0
#   nss                     top files only
dcddc0
#   nss/lib                 top files only
dcddc0
#   nss/lib/freebl          full directory
dcddc0
#   nss/lib/softoken        full directory
dcddc0
#   nss/lib/softoken/dbm    full directory
dcddc0
#-------------------------------------------------------
dcddc0
dcddc0
WORK=${softokn_dir}-work
dcddc0
rm -rf ${WORK}
dcddc0
mkdir ${WORK}
dcddc0
dcddc0
# copy everything
dcddc0
cp -a ${nss_source_dir} ${WORK}/${softokn_dir}
dcddc0
dcddc0
# remove subdirectories that we don't want
dcddc0
rm -rf ${WORK}/${softokn_dir}/nss/cmd
dcddc0
rm -rf ${WORK}/${softokn_dir}/nss/tests
dcddc0
rm -rf ${WORK}/${softokn_dir}/nss/lib
dcddc0
rm -rf ${WORK}/${softokn_dir}/nss/pkg
60ce18
rm -rf ${WORK}/${softokn_dir}/nss/automation
60ce18
rm -rf ${WORK}/${softokn_dir}/nss/external_tests
60ce18
rm -rf ${WORK}/${softokn_dir}/nss/doc
dcddc0
# start with an empty lib directory and copy only what we need
dcddc0
mkdir ${WORK}/${softokn_dir}/nss/lib
dcddc0
# copy the top files from nss/lib/
dcddc0
topFilesL=`find ${nss_source_dir}/nss/lib/ -maxdepth 1 -mindepth 1 -type f`
dcddc0
for f in $topFilesL; do
dcddc0
  cp -p $f ${WORK}/${softokn_dir}/nss/lib
dcddc0
done
dcddc0
mkdir ${WORK}/${softokn_dir}/nss/lib/util
dcddc0
# copy entire dbm, freebl and softoken directories recursively
dcddc0
cp -a ${nss_source_dir}/nss/lib/dbm ${WORK}/${softokn_dir}/nss/lib/dbm
dcddc0
cp -a ${nss_source_dir}/nss/lib/freebl ${WORK}/${softokn_dir}/nss/lib/freebl
dcddc0
cp -a ${nss_source_dir}/nss/lib/softoken ${WORK}/${softokn_dir}/nss/lib/softoken
dcddc0
# and some Makefiles and related files from nss
dcddc0
topFilesN=`find ${nss_source_dir}/nss/ -maxdepth 1 -mindepth 1 -type f`
dcddc0
for f in $topFilesN; do
dcddc0
  cp -p $f ${WORK}/${softokn_dir}/nss/
dcddc0
done
60ce18
# copy private headers that nss-softoken needs
60ce18
for f in verref.h; do
60ce18
  cp -p ${nss_source_dir}/nss/lib/util/$f ${WORK}/${softokn_dir}/nss/lib/util
60ce18
done
dcddc0
60ce18
# we do need bltest, ecperf, fbectest, lib, lowhashtest, and shlibsign
60ce18
# from nss/cmd
dcddc0
mkdir ${WORK}/${softokn_dir}/nss/cmd
dcddc0
# copy some files at the top and the slhlib subdirectory
dcddc0
topFilesC=`find ${nss_source_dir}/nss/cmd/ -maxdepth 1 -mindepth 1 -type f`
dcddc0
for f in $topFilesC; do
dcddc0
  cp -p $f ${WORK}/${softokn_dir}/nss/cmd/
dcddc0
done
dcddc0
dcddc0
cp -a ${nss_source_dir}/nss/cmd/bltest ${WORK}/${softokn_dir}/nss/cmd/bltest
60ce18
cp -a ${nss_source_dir}/nss/cmd/ecperf ${WORK}/${softokn_dir}/nss/cmd/ecperf
60ce18
cp -a ${nss_source_dir}/nss/cmd/fbectest ${WORK}/${softokn_dir}/nss/cmd/fbectest
dcddc0
cp -a ${nss_source_dir}/nss/cmd/fipstest ${WORK}/${softokn_dir}/nss/cmd/fipstest
dcddc0
cp -a ${nss_source_dir}/nss/cmd/lib ${WORK}/${softokn_dir}/nss/cmd/lib
dcddc0
cp -a ${nss_source_dir}/nss/cmd/lowhashtest ${WORK}/${softokn_dir}/nss/cmd/lowhashtest
dcddc0
cp -a ${nss_source_dir}/nss/cmd/shlibsign ${WORK}/${softokn_dir}/nss/cmd/shlibsign
dcddc0
5297d5
# plus common, crypto, and lowhash from nss/tests
dcddc0
mkdir ${WORK}/${softokn_dir}/nss/tests
dcddc0
topFilesT=`find ${nss_source_dir}/nss/tests/ -maxdepth 1 -mindepth 1 -type f`
dcddc0
for f in $topFilesT; do
dcddc0
  cp -p $f ${WORK}/${softokn_dir}/nss/tests/
dcddc0
done
60ce18
keepers="cipher common ec lowhash"
dcddc0
for t in $keepers; do
dcddc0
  cp -a ${nss_source_dir}/nss/tests/$t ${WORK}/${softokn_dir}/nss/tests/$t
dcddc0
done
dcddc0
dcddc0
pushd ${WORK}
dcddc0
# the compressed tar ball for nss-softokn
5297d5
tar -czf ../${name}-softokn-${version}.tar.gz ${softokn_dir}
dcddc0
popd
dcddc0
dcddc0
# cleanup after ourselves
dcddc0
rm -fr ${nss_source_dir}
dcddc0
rm -rf ${WORK}
dcddc0
60ce18
60ce18