#!/bin/bash cat </dev/null 2>/dev/null; then echo "*** It looks Xcode is not installed; aborting ***" exit fi # This is really just a "do you want to continue?" prompt, but we need to run # various commands with sudo later, so we might as well get the password now. echo "Enter your sudo password to continue, or just press enter to quit.." sudo -k sudo -p "> " -v || exit if [ ! -e /Applications/Firefox.app ]; then echo -e "\nYou don't appear to have Firefox installed." echo -n "Do you want me to install it (y/n)? " read ans if [ "${ans:0:1}" = "y" -o "${ans:0:1}" = "Y" ]; then FFVER=2.0.0.4 echo -e "\n---- Installing Firefox v$FFVER ----" curl -f -O http://releases.mozilla.org/pub/mozilla.org/firefox/releases/$FFVER/mac/en-US/Firefox%20$FFVER.dmg hdiutil mount Firefox%20$FFVER.dmg echo -e "\nYou'll need to complete the installation by dragging Firefox to /Applications." echo "Press enter when you're done..." read hdiutil unmount /Volumes/Firefox rm Firefox%20$FFVER.dmg fi fi if [ ! -e /sw/bin/init.sh ]; then echo -e "\n---- Installing Fink ----" curl -f -O http://superb-east.dl.sourceforge.net/sourceforge/fink/Fink-0.8.1-PowerPC-Installer.dmg hdiutil mount Fink-0.8.1-PowerPC-Installer.dmg open /Volumes/Fink-0.8.1-PowerPC-Installer/Fink\ 0.8.1-PowerPC\ Installer.pkg echo -e "\nYou'll need to interact with the installer gui to complete the installation." echo "Press enter when you're done..." read hdiutil unmount /Volumes/Fink-0.8.1-PowerPC-Installer rm Fink-0.8.1-PowerPC-Installer.dmg if [ ! -e /sw/bin/init.sh ]; then echo -e "\n*** Installation failed... try a manual install? ***" open http://www.finkproject.org/download exit fi if ! grep -q "\. /sw/bin/init\.sh" ~/.profile; then echo -e "\nAdding '. /sw/bin/init.sh' to ~/.profile" echo ". /sw/bin/init.sh" >> ~/.profile fi fi . /sw/bin/init.sh if ! svn --version >/dev/null 2>/dev/null; then echo -e "\n---- Installing Subversion ----" sudo apt-get -y install svn-client fi echo -e "\n---- Installing build tools ----" sudo apt-get -y install pkgconfig # for general build setup sudo apt-get -y install orbit # for gecko-sdk/bin/xpidl sudo apt-get -y install automake1.9 # for libspeex sudo apt-get -y install libtool14 # for libspeex export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig if ! cat ~/.profile 2>/dev/null | grep -q "export PKG_CONFIG_PATH"; then echo -e "\nAdding 'export PKG_CONFIG_PATH=$PKG_CONFIG_PATH' to ~/.profile" echo "export PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> ~/.profile fi if [ ! -e /Developer/gecko-sdk ]; then echo -e "\n---- Installing gecko-sdk ----" CPU=$(system_profiler SPHardwareDataType | awk '/CPU Type/{print $3}') if [ "x$CPU" = "x" ]; then CPU=$(system_profiler SPHardwareDataType | awk '/Processor Name/{print $3}') fi if [ "$CPU" = "PowerPC" ]; then echo "Downloading gecko-sdk for PowerPC Mac" GSPATH=http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.0.4/sdk GSFILE=gecko-sdk-mac-1.8.0.4.zip GSDEST=/Developer elif [ "$CPU" = "Intel" ]; then echo "Downloading gecko-sdk for Intel Mac" mkdir /Developer/gecko-sdk GSPATH=http://www.oxymoronical.com/site/files GSFILE=gecko-sdk-mac-intel-1.8.1.3.zip GSDEST=/Developer/gecko-sdk else echo -e "\n*** Could not determine CPU type ***" exit fi if ! curl -f -O $GSPATH/$GSFILE; then echo -e "\n*** Download failed ***" exit fi if ! unzip $GSFILE -d $GSDEST; then echo -e "\n*** unzip failed ***" exit fi rm $GSFILE fi echo -e "\n---- Checking out libraries ----" chkout () { if [ ! -d $1 ]; then svn co $2 $1 else echo "$1 already exists; skipping" fi } [ -d src ] || mkdir src cd src chkout libogg http://svn.xiph.org/trunk/ogg chkout libtheora http://svn.xiph.org/trunk/theora chkout libvorbis http://svn.xiph.org/trunk/vorbis chkout libspeex http://svn.xiph.org/trunk/speex chkout libfishsound http://svn.annodex.net/libfishsound/trunk chkout liboggz http://svn.annodex.net/liboggz/trunk chkout liboggplay http://svn.annodex.net/liboggplay/trunk # some builds are a bit broken on the mac svn up -r {2007-06-06} libspeex/doc/Makefile.am sed -e '/SUBDIRS/s/doc//' -i "" libvorbis/Makefile.am echo -e "\n---- Building libraries ----" build () { cd $1 ./autogen.sh || exit [ "$2" = "c" ] && (./configure || exit) make || exit sudo make install || exit cd .. } build libogg build libtheora build libvorbis build libspeex c build libfishsound c build liboggz c build liboggplay c echo -e "\n---- Building plugin ----" cd liboggplay/plugin/mac xcodebuild -configuration Deployment || exit cp -r ../nsILibOggPlugin.xpt build/Deployment/liboggplay.plugin ~/Library/Internet\ Plug-Ins cd ../../.. echo -e "\nOpening Firefox with a test page..." /Applications/Firefox.app/Contents/MacOS/firefox http://media.annodex.net/cmmlwiki/OSSForum-Trailer & echo -e "\nDone."