Build script for Firefox extensions in Mac OS X
Sunday, January 18th, 2009 | Firefox extensions
Now and then I play some with Firefox extensions. While doing that I use a batch file that creates the XPI files easily. No problems this far.
But…. A few weeks ago I got my new Macbook and I love it. The only thing was that I couldn’t use the batch file anymore. So I adjusted the batch file and converted it to a shell script. Here’s the code:
: # @(#) --Builds Firefox extensions BASELOC=$PWD EXTENSION=$1 mkdir build mkdir ./build/chrome cd ./chrome rm .DS_Store zip -r $EXTENSION.jar ./ mv $EXTENSION.jar .././build/chrome cd $BASELOC cp ./install.* ./build cp ./update.* ./build cp ./*.manifest ./build mkdir ./build/defaults mkdir ./build/defaults/preferences cd ./defaults/preferences cp ./*.* ../../build/defaults/preferences cd ../../build rm .DS_Store zip -r $EXTENSION.xpi ./* mv $EXTENSION.xpi ../ cd ../ rm -r ./build ## Restart Firefox and install extension killall firefox-bin && /Applications/Firefox.app/Contents/MacOS/firefox -install-global-extension $PWD/$EXTENSION.xpi && open -a Firefox
Save this file as build.sh and place it in the directory where you are developing the extension. Now open the Terminal, browse to the right path and make this file executable:
chmod +x ./build.sh
To build your Firefox extension use the following code in the terminal:
./build.sh name_of_extensionEverything is working so far? Cool! Now you have something which makes the extension development in Mac OS X a lot easier! If not, please leave a comment or contact me.
Good luck with it!
1 Comment to Build script for Firefox extensions in Mac OS X
Hello,
I have shortended your script and made it more stable.
mkdir -p foo/bar/bazz will create the full path if it doesn’t exist yet. In addition I replaced the copy with a find in case there are no update files and I make the copying of the preferences optional.
Here is my result
Best Regards / Viele Grüße
Sebastian Hennebrueder
#!/bin/bash
# @(#) –Builds Firefox extensions
BASELOC=$PWD
EXTENSION=$1
mkdir -p ./build/chrome
cd ./chrome
rm -f .DS_Store
zip -r $EXTENSION.jar ./
mv $EXTENSION.jar .././build/chrome
cd $BASELOC
cp ./install.* ./build
find . -name ‘update.*’ | xargs -I % cp % ./build
cp ./*.manifest ./build
if [ -d "./defaults/preferences" ]; then
mkdir -p ./build/defaults/preferences
cd ./defaults/preferences
cp ./*.* ../../build/defaults/preferences
fi
cd “$BASELOC/build”
rm -f .DS_Store
zip -r $EXTENSION.xpi ./*
mv $EXTENSION.xpi ../
cd ../
rm -r build
## Restart Firefox and install extension
#killall firefox-bin && /Applications/Firefox.app/Contents/MacOS/firefox -install-global-extension $PWD/$EXTENSION.xpi && open -a Firefox
1 Pingbacks
Leave a comment
About Arjan
Hi, I'm Arjan Snaterse and in my daily life I'm working as SEO and Frontend manager at Jaludo.
There I'm working on casual gaming sites like Funny games and Titter girl games.
In my spare time I'm developing websites in Wordpress or Typolight. HTML standards, semantics and CSS are words that make me happy. So if you need someone who converts your design (PSD) to HTML/Wordpress just contact me.
- Arjan: Thanks, Yoon! Yoon Sterkenburg: Skipping the download limit works only f...Jopicarra: Sorry Arjan I was mixing things, the dai...Jopicarra: I needed that but in the e-mailing part....Arjan: @Jopicarra I don't know the limit of 10,...
July 16, 2009 at 21:25