2009-05-25 01:21:32 +00:00
|
|
|
#!/bin/sh
|
2010-03-08 02:28:23 +00:00
|
|
|
set -o errexit
|
2009-05-25 01:21:32 +00:00
|
|
|
|
|
|
|
if [ $# -lt 2 ]; then
|
|
|
|
echo "Usage: $0 <archive> <scripts> ..."
|
|
|
|
fi
|
|
|
|
|
|
|
|
# get the archive name
|
|
|
|
archive=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
# The second argument is the shell script that initializes the variables:
|
|
|
|
# tmpDir
|
|
|
|
# addBuildCompatibilityLibDir
|
|
|
|
#
|
|
|
|
# copyattr
|
|
|
|
# rmAttrs
|
|
|
|
# zip
|
|
|
|
#
|
|
|
|
. $1
|
|
|
|
shift
|
|
|
|
|
|
|
|
outputDir=$tmpDir/archive
|
|
|
|
|
|
|
|
# this adds the build library dir to LD_LIBRARY_PATH
|
|
|
|
eval "$addBuildCompatibilityLibDir"
|
|
|
|
|
|
|
|
# map the shell commands
|
|
|
|
sPrefix=
|
|
|
|
tPrefix="$outputDir/"
|
|
|
|
cd=cd
|
|
|
|
scd=:
|
|
|
|
cp="$copyattr -d"
|
|
|
|
ln=ln
|
|
|
|
mkdir=mkdir
|
|
|
|
rm=rm
|
|
|
|
|
|
|
|
# clear output dir
|
|
|
|
$rmAttrs -rf $outputDir
|
2010-03-08 02:28:23 +00:00
|
|
|
$mkdir -p $outputDir
|
2009-05-25 01:21:32 +00:00
|
|
|
|
|
|
|
# populate output dir
|
|
|
|
echo "Preparing contents of archive $archive ..."
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
. $1
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
# get an absolute path for the archive
|
|
|
|
cwd=$(pwd)
|
|
|
|
cd $(dirname $archive)
|
|
|
|
archive=$(pwd)/$(basename $archive)
|
|
|
|
cd $cwd
|
|
|
|
|
|
|
|
# build the archive
|
|
|
|
echo "Building archive $archive ..."
|
|
|
|
$rm -f $archive
|
|
|
|
cd $outputDir
|
2010-03-08 02:28:23 +00:00
|
|
|
$zip -ryq $archive .
|
2009-05-25 01:21:32 +00:00
|
|
|
cd $cwd
|
|
|
|
|
|
|
|
# clean up
|
|
|
|
$rmAttrs -rf $outputDir
|