Changeset 705
- Timestamp:
- 03/29/08 19:58:48 (8 months ago)
- Files:
-
- branches/buildscript/build.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/buildscript/build.sh
r633 r705 1 1 #!/bin/sh 2 GMMAX=0 3 GMMIN=8 2 3 # Set up variables 4 GMMAX=${1-0} 5 GMMIN=${2-8} 6 GMREL=${3-0} 4 7 GMBUILD=`date +"%Y%m%d"` 5 GMREL=06 7 8 GMNAME=greasemonkey 8 9 9 GMVER="$GMMAX.$GMMIN.$GMBUILD.$GMREL" 10 10 GMXPI="$GMNAME-$GMVER.xpi" 11 11 12 12 # Copy base structure to a temporary build directory and change to it 13 echo "Creating working directory ..." 13 14 rm -rf build 14 15 mkdir build 15 cp chrome.manifest build/ 16 cp install.js build/ 17 cp install.rdf build/ 18 cp license.txt build/ 19 cp -r defaults build/ 20 cp -r components build/ 21 cp -r chrome build/ 16 cp -r chrome.manifest install.js install.rdf license.txt \ 17 defaults components chrome \ 18 build/ 22 19 cd build 23 20 24 # Generate locales for chrome.manifest from babelzilla directories, which 25 # we assume have been placed in locale/. 21 echo "Gathering all locales into chrome.manifest ..." 26 22 GMLOC=\"en-US\" 27 for entry in $(ls chrome/chromeFiles/locale/); do23 for entry in chrome/chromeFiles/locale/*; do 28 24 if [ $entry != en-US ]; then 29 echo "locale $GMNAME "$entry" chrome/chromeFiles/locale/"$entry"/" >> chrome.manifest25 echo "locale $GMNAME $entry chrome/chromeFiles/locale/$entry/" >> chrome.manifest 30 26 GMLOC=$GMLOC,\ \"$entry\" 31 27 fi 32 28 done 33 29 34 replace () { 35 TMP=`mktemp -t Greasemonkey-build.sh` 36 SRC=`echo "$1" | sed 's/[\/\\\\]/\\\\&/g'` 37 DST=`echo "$2" | sed 's/[\/\\\\]/\\\\&/g'` 38 sed "s/$SRC/$DST/g" "$3" > "$TMP" 39 if cmp -s "$3" "$TMP" ; then 40 # No change! Treat as a failure to react to in caller. 41 rm "$TMP" 42 return 1 43 fi 44 cp "$TMP" "$3" 45 rm "$TMP" 46 return 0 47 } 30 echo "Patching install.rdf version ..." 31 sed "s!<em:version>.*</em:version>!<em:version>$GMVER</em:version>!" \ 32 install.rdf > install.rdf.tmp 33 mv install.rdf.tmp install.rdf 48 34 49 replace '<em:version>.*</em:version>' \ 50 '<em:version>'$GMVER'</em:version>' \ 51 install.rdf 35 echo "Cleaning up unwanted files ..." 36 find . -depth -name '.svn' -exec rm -rf "{}" \; 37 find . -depth -name '*~' -exec rm -rf "{}" \; 38 find . -depth -name '#*' -exec rm -rf "{}" \; 52 39 53 find . -name '.svn' -prune -or -name '.DS_Store' -or -name '*~' -or -name '#*' \ 54 -or -print | zip -9X -@ "$GMXPI" 40 echo "Creating $GMNAME.jar ..." 41 cd chrome 42 zip -qr0X "$GMNAME.jar" chromeFiles icons 43 rm -rf chromeFiles icons 44 cd .. 55 45 56 mv "$GMXPI" ../ 46 echo "Patching chrome.manifest with jar ..." 47 sed -e \ 48 "/^content\|^skin\|^locale/s#\(.*\) chrome/\(.*\)#\1 jar:chrome/$GMNAME.jar!/\2#" \ 49 chrome.manifest > chrome.manifest.jar 50 mv chrome.manifest.jar chrome.manifest 57 51 58 echo "Created $GMXPI" 59 exit 0 52 echo "Creating $GMXPI ..." 53 zip -qr9X "../$GMXPI" * 54 55 echo "Cleaning up temporary files ..." 56 cd .. 57 rm -rf build
