[haiku-commits] r36005 - in haiku/trunk/build: jam scripts

  • From: mattmadia@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 30 Mar 2010 07:32:50 +0200 (CEST)

Author: mmadia
Date: 2010-03-30 07:32:50 +0200 (Tue, 30 Mar 2010)
New Revision: 36005
Changeset: http://dev.haiku-os.org/changeset/36005/haiku

Added:
   haiku/trunk/build/scripts/build_archive
Removed:
   haiku/trunk/build/scripts/build_tgz_archive
   haiku/trunk/build/scripts/build_zip_archive
Modified:
   haiku/trunk/build/jam/ImageRules
Log:
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


Modified: haiku/trunk/build/jam/ImageRules
===================================================================
--- haiku/trunk/build/jam/ImageRules    2010-03-30 02:10:50 UTC (rev 36004)
+++ haiku/trunk/build/jam/ImageRules    2010-03-30 05:32:50 UTC (rev 36005)
@@ -1074,7 +1074,7 @@
 {
        # 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 @@
 {
        # 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 @@
 {
        # BuildHFloppyBootArchive <archive> : <scripts>  ;
 
-       local mainScript = build_tgz_archive ;
+       local mainScript = build_archive ;
        SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
 
        Depends $(archive) : $(mainScript) $(scripts) ;

Added: haiku/trunk/build/scripts/build_archive
===================================================================
--- haiku/trunk/build/scripts/build_archive                             (rev 0)
+++ haiku/trunk/build/scripts/build_archive     2010-03-30 05:32:50 UTC (rev 
36005)
@@ -0,0 +1,88 @@
+#!/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
+# rmAttrs 
+# zip
+# NOTE: rmAttrs and zip are only passed in when building 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
+
+
+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
+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
+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
+cleanDir $outputDir


Property changes on: haiku/trunk/build/scripts/build_archive
___________________________________________________________________
Added: svn:executable
   + *


Other related posts:

  • » [haiku-commits] r36005 - in haiku/trunk/build: jam scripts - mattmadia