#!/bin/sh ################################################################################ # buildmoz.sh # # A relatively simple shell script, that can download the source code for # # firefox and thunderbird, compile them, and package them. # # Thunderbird does not yet compile on FreeBSD or Solaris, out of the box. # # Therefore, it's options have been disabled and error out with a warning. # # When they start working, I'll fix this script to compile them. I export it # # will be a few months. # # All patches, corrections and suggestions welcome: webmaster@silverwraith.com # # - Avleen Vig, June 2003 # # # # CHANGELOG: # # 1.0: 2003-06-14 # # Initial version that was released to the public. Should "work". # ################################################################################ # The script builds all it's packages under a temporary directory. # By defult, this is the 'tmp' directory under my home directory. # Change 'homedir' to your home directory, and 'tmpdir' and any # temporary directory of your choosing. Leaving it at the default # will make it a directory 'tmp' under your home directory. # The value for 'homedir' must be your home directory. It is where # the script put the '.mozconfig' file. # 'homedir' and 'tmpdir' should be the only variables you need to # edit, to get this script working. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/ucb:/usr/ccs/bin:/usr/X11R6/bin export PATH homedir=/usr/tmp tmpdir=$homedir hour=`date +%H` package=$1 archos="i386-unknown-freebsd5.4" if [ `/usr/bin/uname -s` = "FreeBSD" ] then LIBIDL_CONFIG=/usr/local/bin/libIDL-config-2 GTK_CONFIG=/usr/X11R6/bin/gtk-config export LIBIDL_CONFIG GTK_CONFIG fi # Here we define where 'make' is kept. On FreeBSD we need to use # 'gmake' to compile the apps. If it's not installed, you get a # warning and the script bombs out. # Otherwise, it is set to whichever 'make' is availible from the # above PATH statement. if [ `/usr/bin/uname -s` = "FreeBSD" ] then if [ -x /usr/local/bin/gmake ] then makecommand=/usr/local/bin/gmake else echo "You do not have gmake installed. Please install it from /usr/ports/devel/gmake." exit 0 fi else makecommand=`which make` fi # If the temporary directory doesn't exist, make it. if [ ! -d $tmpdir ] then echo "$tmpdir does not exist. Creating..." mkdir -p $tmpdir fi # A weak contingency measure for people who run the script without # backing up their .mozconfig. Only saves you the first time you # run the script! ShiftOldMozconfig () { if [ -f $homedir/.mozconfig ] then echo "Moving old ~/.mozconfig to ~/.mozconfig.old" mv $homedir/.mozconfig $homedir/.mozconfig.old fi } # We create mozilla, firefox, thunderbird in seperate obj-dir's. # This function makes sure they exist. If they do, it deletes and # recreates them. Otherwise, it just creates them. CreateObjDir () { if [ ! -d $tmpdir/mozilla/obj-$package ] then echo "$tmpdir/mozilla/obj-$package does not exist." echo "I will create so that I can compile $1 seperately from other componenents." mkdir $tmpdir/mozilla/obj-$package else rm -rf $tmpdir/mozilla/obj-$package CreateObjDir fi } # One very long case statement. It creates the .mozconfig file # in $homedir. That could probably be kept as a seperate # function, but this is how I decided to start it off for now. case "$1" in mozillaall) $tmpdir/buildmoz.sh mozilla > /dev/null 2>&1 $tmpdir/buildmoz.sh mozillapkg > /dev/null 2>&1 $tmpdir/buildmoz.sh mozillascp > /dev/null 2>&1 ;; firefoxall) $tmpdir/buildmoz.sh firefox > /dev/null 2>&1 $tmpdir/buildmoz.sh firefoxpkg > /dev/null 2>&1 $tmpdir/buildmoz.sh firefoxscp > /dev/null 2>&1 ;; checkout) echo "Finished creating ~/.mozconfig. Now proceeding to checkout source code from CVS..." cd $tmpdir rm -rf mozilla cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot checkout -r AVIARY_1_0_1_20050124_BRANCH mozilla/client.mk mozilla/browser/config/mozconfig cd $tmpdir/mozilla /usr/bin/time $makecommand -f client.mk pull_all ;; mozilla) #ShiftOldMozconfig CreateObjDir cd $tmpdir/mozilla /usr/bin/time $makecommand -f client.mk distclean /usr/bin/time $makecommand -f client.mk build ;; firefox) #ShiftOldMozconfig CreateObjDir /usr/bin/patch < patch-bugzilla149334 /usr/bin/patch < makepkg.patch cd $tmpdir/mozilla /usr/bin/time $makecommand -f client.mk build ;; thunderbird) echo "Unfortunately this option does not work and I haven't been able to compile Thunderbird on FreeBSD or Solaris yet" exit 0 #ShiftOldMozconfig CreateObjDir cd $tmpdir/mozilla /usr/bin/time $makecommand -f client.mk distclean /usr/bin/time $makecommand -f client.mk build ;; mozillapkg) echo "Building mozilla tarball in $tmpdir/obj-mozilla/dist..." cp -v $tmpdir/README.FreeBSD $tmpdir/obj-mozilla/dist/bin cd $tmpdir/obj-mozilla/xpinstall/packager $makecommand ;; mozillascp) echo "SCP'ing $tmpdir/obj-firefox/dist/mozilla-$archos.tar.gz to stage.mozilla.org" ssh avleen@mozilla "mkdir /data/ftp/pub/mozilla/nightly/contrib/`date +%Y-%m-%d-$hour`-trunk" scp $tmpdir/obj-mozilla/dist/mozilla-$archos.tar.gz avleen@mozilla:/data/ftp/pub/mozilla/nightly/contrib/`date +%Y-%m-%d-$hour`-trunk ssh avleen@mozilla 'cp /data/ftp/pub/mozilla/nightly/contrib/`date +%Y-%m-%d-$hour-trunk`/* /data/ftp/pub/mozilla/nightly/contrib/latest-trunk/' ;; firefoxpkg) echo "Building firefox tarball in $tmpdir/mozilla/obj-firefox/dist..." cp -v $tmpdir/README.FreeBSD $tmpdir/mozilla/obj-firefox/dist/bin cd $tmpdir/mozilla/obj-firefox/xpinstall/packager && MOZ_PKG_APPNAME=firefox $makecommand ;; firefoxscp) echo "SCP'ing $tmpdir/mozilla/obj-firefox/dist/firefox-$archos.tar.gz to stage.mozilla.org" ssh avleen@mozilla "mkdir /data/ftp/pub/firefox/nightly/contrib/`date +%Y-%m-%d-$hour`-trunk" scp $tmpdir/mozilla/obj-firefox/dist/firefox-$archos.tar.gz avleen@mozilla:/data/ftp/pub/firefox/nightly/contrib/`date +%Y-%m-%d-$hour`-trunk/ ssh avleen@mozilla "cp /data/ftp/pub/firefox/nightly/contrib/`date +%Y-%m-%d-$hour-trunk`/firefox-$archos.tar.gz /data/ftp/pub/firefox/nightly/contrib/latest-trunk/" ;; thunderbird*) echo "Unfortunately this option does not work and I haven't been able to compile Thunderbird on FreeBSD or Solaris yet" ;; *) echo "Usage: `basename $0` checkout : Do this before any builds to update your source code" echo " `basename $0` : Build either firefox or thunderbird" echo " `basename $0` : Make tarballs of firefox or thunderbird, for installation" echo " `basename $0` : Upload nightly builds" ;; esac