Bash build script: Difference between revisions
From MozillaZine Knowledge Base
Jump to navigationJump to search
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
Here is a bash script I'm using to package my extensions. | Here is a bash script I'm using to package my extensions (under Linux and Cygwin). For Windows script see [[Dev : Extensions : Windows cmd build script]]. | ||
<pre>#!/bin/bash | <pre>#!/bin/bash |
Revision as of 03:20, 18 September 2004
Here is a bash script I'm using to package my extensions (under Linux and Cygwin). For Windows script see Dev : Extensions : Windows cmd build script.
#!/bin/bash # build.sh: build JAR and XPI files from source # based on Nathan Yergler's build script #### editable items (none of these can be blank) APP_NAME=menuedit # short-name, jar and xpi files name. HAS_DEFAULTS=1 # whether the ext. provides default values for user prefs etc. HAS_COMPONENTS=0 # whether the ext. includes any components HAS_LOCALE=1 # package APP_NAME.jar/locale/ ? HAS_SKIN=0 # package APP_NAME.jar/skin/ ? KEEP_JAR=1 # leave the jar when done? ROOT_FILES="license.txt install.rdf" # put these files in root of xpi #### editable items end TMP_DIR=build.tmp #uncomment to debug #set -x # remove any left-over files rm $APP_NAME.jar rm $APP_NAME.xpi rm -rf $TMP_DIR # create xpi directory layout and populate it mkdir $TMP_DIR mkdir $TMP_DIR/chrome if [ $HAS_COMPONENTS = 1 ]; then mkdir $TMP_DIR/components cp components/* $TMP_DIR/components fi if [ $HAS_DEFAULTS = 1 ]; then DEFAULT_FILES="`find ./defaults -path './*CVS*' -prune -o -type f -print | grep -v \~`" cp --parents $DEFAULT_FILES $TMP_DIR fi # Copy other files to the root of future XPI. cp $ROOT_FILES $TMP_DIR # generate the JAR file, excluding CVS and temporary files zip -0 -r $TMP_DIR/chrome/$APP_NAME.jar `find ./content -path './*CVS*' -prune -o -type f -print | grep -v \~` if [ $HAS_LOCALE = 1 ]; then zip -0 -r $TMP_DIR/chrome/$APP_NAME.jar `find ./locale -path './*CVS*' -prune -o -type f -print | grep -v \~` fi if [ $HAS_SKIN = 1 ]; then zip -0 -r $TMP_DIR/chrome/$APP_NAME.jar `find ./skin -path './*CVS*' -prune -o -type f -print | grep -v \~` fi # generate the XPI file cd $TMP_DIR zip -r ../$APP_NAME.xpi * cd .. if [ $KEEP_JAR = 1 ]; then # save the jar file mv $TMP_DIR/chrome/$APP_NAME.jar . fi # remove the working files rm -rf $TMP_DIR