Condensed build_zip_archive & build_zip_archive into a single script,

build_archive. Updated ImageRules accordingly. Tested on the following:
 * jam -q -sTARGET_BOOT_PLATFORM=pxe_ia32 pxehaiku-loader haiku-netboot-archive
 * jam -q haiku-boot-floppy
 * jam -q haiku-alternative-gcc-archive


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36005 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia 2010-03-30 05:32:50 +00:00
parent 3fed6ef6cc
commit 18a69c72f6
3 changed files with 35 additions and 64 deletions

View File

@ -1074,7 +1074,7 @@ rule BuildNetBootArchive archive : scripts
{
# BuildNetBootArchive <archive> : <scripts> ;
local mainScript = build_tgz_archive ;
local mainScript = build_archive ;
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
Depends $(archive) : $(mainScript) $(scripts) ;
@ -1139,7 +1139,7 @@ rule BuildAlternativeGCCArchive archive : scripts
{
# BuildAlternativeGCCArchive <archive> : <scripts> ;
local mainScript = build_zip_archive ;
local mainScript = build_archive ;
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
Depends $(archive) : $(mainScript) $(scripts) ;
@ -1317,7 +1317,7 @@ rule BuildFloppyBootArchive archive : scripts
{
# BuildHFloppyBootArchive <archive> : <scripts> ;
local mainScript = build_tgz_archive ;
local mainScript = build_archive ;
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
Depends $(archive) : $(mainScript) $(scripts) ;

View File

@ -12,10 +12,11 @@ shift
# The second argument is the shell script that initializes the variables:
# tmpDir
# addBuildCompatibilityLibDir
#
#
# copyattr
# rmAttrs
# rmAttrs
# zip
# NOTE: rmAttrs and zip are only passed in when building zip
#
. $1
shift
@ -35,8 +36,20 @@ ln=ln
mkdir=mkdir
rm=rm
# clear output dir
$rmAttrs -rf $outputDir
cleanDir()
{
# clearDir <directory>
if [ $rmAttrs ] ; then
$rmAttrs -rf $1
else
$rm -rf $1
fi
}
# clean output dir
cleanDir $outputDir
$mkdir -p $outputDir
# populate output dir
@ -56,8 +69,20 @@ cd $cwd
echo "Building archive $archive ..."
$rm -f $archive
cd $outputDir
$zip -ryq $archive .
cd $cwd
case "$archive" in
*.zip)
$zip -ryq $archive .
;;
*.tgz)
contents=$(ls)
tar --format ustar -czf $archive $contents
;;
*)
echo "Unhandled archive format in build_archive"
exit 1
;;
esac
cd ..
# clean up
$rmAttrs -rf $outputDir
cleanDir $outputDir

View File

@ -1,54 +0,0 @@
#!/bin/sh
set -o errexit
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
#
. $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
$rm -rf $outputDir
$mkdir -p $outputDir
# populate output dir
echo "Preparing contents of archive $archive ..."
while [ $# -gt 0 ]; do
. $1
shift
done
# build the archive
echo "Building archive $archive ..."
$rm -f $archive
contents=$(cd $outputDir; ls)
tar -C $outputDir --format ustar -czf $archive $contents
# clean up
$rm -rf $outputDir