1#!/bin/sh 2set -o errexit 3 4# The first argument is the shell script that initializes the variables: 5# sourceDir 6# outputDir 7# tmpDir 8# addBuildCompatibilityLibDir 9# 10# addattr 11# copyattr 12# package 13# rc 14# rmAttrs 15# unzip 16# 17 18if [ $# -le 1 ]; then 19 echo "$0: Missing parameters!" >&2 20 exit 1 21fi 22 23packagePath="$1" 24packageInfoPath="$2" 25shift 2 26echo "Building package $1 with info $2..." 27 28if [ $# -gt 0 ]; then 29 . $1 30 shift 31fi 32 33# this adds the build library dir to LD_LIBRARY_PATH 34eval "$addBuildCompatibilityLibDir" 35 36 37# make a clean contents dir 38contentsDir="$tmpDir/contents" 39$rmAttrs -rf "$contentsDir" 40mkdir -p "$contentsDir" 41 42 43# map the shell commands 44sPrefix= 45tPrefix="$contentsDir/" 46cd=cd 47scd=: 48cp="$copyattr -d" 49copyAttrs="$copyattr" 50ln=ln 51mkdir=mkdir 52rm=$rmAttrs 53mkindex=mkindex 54 55 56# execute the scripts preparing the package contents 57while [ $# -gt 0 ]; do 58 . $1 59 shift 60done 61 62 63# create the package 64rm -f "$packagePath" 65$package create -i "$packageInfoPath" -C "$contentsDir" "$packagePath" 66