#!/usr/bin/bash # This SlackBuild like script is designed for Vector Linux packages by exeterdad. # This script assumes it will be launched within "/NAME/VERSION/src" dir. With all sources in "src" # Your Vector Linux .tlz package, slack-desc, and slack-required will be found in "VERSION" dir. # The extraction and build will be in a temp dir created in "NAME" dir, and then removed on exit. # Comment out last line to keep this dir intact. NAME="firefox" # Don't change this, everything will go wrong. VERSION=2.0.0.7 # Firefox version number with decimals. ARCH=i586 # Uncomment this if you are building on a i486, i586, i686 machine. #ARCH=x86_64 # Uncomment this if you are building on a 64 bit machine. # Chose ONE of them only! BUILD=1vl58 # Build/vl/58..59..60 etc. VL_PACKAGER=exeterdad # Fill in your name so we will know who made the package. ### What would you like to build? ### # SELECTION=1 Will build the browser only and won't download any locals SELECTION=2 # SELECTION=2 Will build browser, download locales, build 40 something language packs. # SELECTION=3 Will download locals, and build language packs only REPO='http://vectorlinux.osuosl.org/veclinux-5.8/testing/net/' # This is where repo maintainer will move lang packs # to. We will be generating a ANNOUNCE file that will # be formatted for the message board. This will save # huge time in typing. #<----------------------------- Shouldn't need editing past this point --------------------------------> CWD=`pwd` cd ../ RELEASEDIR=`pwd` cd $CWD mkdir $RELEASEDIR/tmp TMP=$RELEASEDIR/tmp PKG=$TMP/package-$NAME if [ $UID != 0 ]; then echo "You need to be root to run this script." exit fi if [ ! -x /usr/bin/requiredbuilder ]; then echo "Requiredbuilder not installed, or not executable." exit fi case "$ARCH" in i586) CFLAGS="-O2 -march=i586 -mtune=i686" ;; x86_64) CFLAGS="-O2 -fPIC" ;; *) echo "ERROR: Unknown ARCH: $ARCH"; exit 1 ;; esac CXXFLAGS=$CFLAGS export CFLAGS export CXXFLAGS rm -rf $PKG mkdir -p $PKG cd $TMP rm -rf $NAME-$VERSION tar xjvf $CWD/$NAME-$VERSION-source.tar.bz2 || exit 1 cd $TMP/mozilla # Place a copy of mozconfig with our variables added. sed "s//$CFLAGS/g" $CWD/mozconfig | sed "s//$VERSION/g" > $TMP/mozilla/.mozconfig if [ $SELECTION != 1 ]; then # Let's find out what locales "ship" with this firefox, reformat the output, and add that info # as another line on the .mozconfig LOCALES=`sed '/mac/d' $TMP/mozilla/browser/locales/shipped-locales | sed ':a;N;$!ba;s/\n/,/g' | sed 's/ win32 linux//g'` echo "mk_add_options MOZ_CO_LOCALES=${LOCALES}" >> $TMP/mozilla/.mozconfig fi # Are we building for VL5.8? If so, we need a patch or build will fail # X libs aren't found without it. VLversion=`echo $BUILD | cut -d l -f 2` if [ ${VLversion} = "58" ]; then patch -Np1 -i $CWD/VL58-firefox.patch || exit 1 fi echo "Setting permissions..." chown -R root:root . find . -perm 664 -exec chmod 644 {} \; find . -perm 777 -exec chmod 755 {} \; find . -perm 2777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 2755 -exec chmod 755 {} \; find . -perm 774 -exec chmod 644 {} \; find . -perm 666 -exec chmod 644 {} \; find . -perm 600 -exec chmod 644 {} \; find . -perm 444 -exec chmod 644 {} \; find . -perm 400 -exec chmod 644 {} \; find . -perm 440 -exec chmod 644 {} \; find . -perm 511 -exec chmod 755 {} \; find . -perm 711 -exec chmod 755 {} \; find . -perm 555 -exec chmod 755 {} \; echo "Here we go!" if [ $SELECTION != 1 ]; then make -f client.mk checkout || exit 1 # Checkout locales from CVS and begin the build fi if [ $SELECTION != 3 ]; then make -f client.mk build || exit 1 fi if [ $SELECTION != 3 ]; then make -C xpinstall/packager STRIP=/bin/true MOZ_PKG_APPNAME="$NAME-$VERSION" PKG_BASENAME="$NAME-$VERSION" MOZ_PKG_FORMAT="BZ2" || exit 1 mkdir -p $PKG/usr/lib cd $PKG/usr/lib echo "Moving files to package directory..." tar -jxf $TMP/mozilla/dist/$NAME-$VERSION.tar.bz2 mkdir $PKG/usr/bin ln -sf ../lib/$NAME-$VERSION/$NAME $PKG/usr/bin/$NAME ln -sf $NAME-$VERSION $PKG/usr/lib/$NAME # Install icons: mkdir -p $PKG/usr/share/{applications,pixmaps} install -m644 $CWD/mozilla-$NAME.desktop $PKG/usr/share/applications install -m644 $PKG/usr/lib/$NAME-$VERSION/chrome/icons/default/default.xpm $PKG/usr/share/pixmaps/$NAME.xpm # Create the extensions files so that the non-root users don't get # a warning when they start the browser: ( cd $PKG/usr/lib/$NAME-$VERSION export LD_LIBRARY_PATH="$PWD" export MOZILLA_FIVE_HOME="$PWD" ./regxpcom # ./regchrome touch `find . -name *.rdf` ./firefox -register ) # These files/directories are usually created if Firefox is run as root, which on many # systems might (and possibly should) be never. Therefore, if we don't see them we'll # put stubs in place to prevent startup errors. # This shouldn't be necessary since we do the register thing above, but I'll leave it # in just incase. ( cd $PKG/usr/lib/$NAME-$VERSION if [ -d chrome ]; then if [ ! -r chrome/app-chrome.manifest ]; then echo > chrome/app-chrome.manifest fi fi if [ ! -d updates ]; then mkdir -pm755 updates/0 fi ) ## Begin easuters customize #Add some customizations to firefox (OS identification and a backspace #button tweak cat >> $PKG/usr/lib/$NAME-$VERSION/defaults/pref/vector_custom_all.js << EOF //Customizations for VectorLinux pref("general.useragent.extra.vendorComment", "(VectorLinux package $VERSION-$BUILD)"); EOF sed -i '/backspace_action/s/1/0/g' \ $PKG/usr/lib/$NAME-$VERSION/defaults/pref/firefox.js ## End easuters customize cat > $PKG/usr/lib/$NAME-$VERSION/defaults/pref/vl-langpack.js << EOF // This forces Firefox language to switch to locale of machine // if available. pref("intl.locale.matchOS", true); EOF mkdir -p $PKG/install # This creates the white space in front of "handy-ruler" in slack-desc below. LENGTH=`expr length "$NAME"` SPACES=0 SHIM="" until [ "$SPACES" = "$LENGTH" ]; do SHIM="$SHIM " let SPACES=$SPACES+1 done cat > $RELEASEDIR/slack-desc << EOF # HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':'. $SHIM|-----handy-ruler------------------------------------------------------| $NAME: Firefox (Mozilla Firefox Web Browser) $NAME: $NAME: Firefox 2 is the next generation release of the award-winning $NAME: Firefox web browser from Mozilla. $NAME: $NAME: $NAME: $NAME: $NAME: License: MPL 1.1/GPL 2.0/LGPL 2.1 $NAME: Author: Mozilla Foundation $NAME: Website: http://www.mozilla.com/en-US/firefox/ #---------------------------------------- BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` CFLAGS: $CFLAGS CONFIGURE: N/A See mozconfig EOF cat $RELEASEDIR/slack-desc > $PKG/install/slack-desc cd $PKG echo " " echo "Stripping...." echo " " find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null echo "Finding dependancies..." requiredbuilder -v -y -s $RELEASEDIR $PKG echo "Creating package $NAME-$VERSION-$ARCH-$BUILD.tlz" makepkg -l y -c n $RELEASEDIR/$NAME-$VERSION-$ARCH-$BUILD.tlz if [ $SELECTION = 1 ]; then exit fi fi ################################ Let's build some langpacks ######################################### if [ $SELECTION != 1 ]; then FIREFOXDEP="$VERSION-$ARCH-$BUILD.tlz" # Begin language packs. PKG=$TMP/package-$NAME-langpacks mkdir -p $PKG if [ $SELECTION = 3 ]; then cd $TMP/mozilla ./configure cd $TMP/mozilla/nsprpub make cd $TMP/mozilla/config make mkdir -p $TMP/mozilla/dist/install fi cd $TMP/mozilla/browser/locales for i18 in `sed '/mac/d' $TMP/mozilla/browser/locales/shipped-locales sed 's/ win32 linux//g'`; do make langpack-${i18} LANGPACK_FILE=$TMP/mozilla/dist/install/${i18}.xpi done for langpack in `ls $TMP/mozilla/dist/install/*.xpi`; do language=`basename $langpack .xpi` extensiondir=$PKG/usr/lib/$NAME-$VERSION/extensions/langpack-$language@firefox.mozilla.org mkdir -p $extensiondir unzip $langpack -d $extensiondir find $extensiondir -type f | xargs chmod 644 # generate slack-desc mkdir $PKG/install SLACKDESC=$NAME-langpack-$language SUMMARY=`grep em:name $extensiondir/install.rdf | cut -f 2 -d \"` AUTHOR=`grep em:creator $extensiondir/install.rdf | cut -f 2 -d \"` echo "${SLACKDESC}: ${SLACKDESC} ($SUMMARY)" > $PKG/install/slack-desc echo "${SLACKDESC}: " >> $PKG/install/slack-desc echo "${SLACKDESC}: $SUMMARY for Firefox-$VERSION" >> $PKG/install/slack-desc echo "${SLACKDESC}: " >> $PKG/install/slack-desc echo "${SLACKDESC}: This enables Firefox run in your" >> $PKG/install/slack-desc echo "${SLACKDESC}: native language. If your Vectorlinux locale" >> $PKG/install/slack-desc echo "${SLACKDESC}: is set to $language, no configuration is needed." >> $PKG/install/slack-desc echo "${SLACKDESC}: Just restart your browser." >> $PKG/install/slack-desc echo "${SLACKDESC}: License: GPL" >> $PKG/install/slack-desc echo "${SLACKDESC}: Author: $AUTHOR" >> $PKG/install/slack-desc echo "${SLACKDESC}: Website http://www.mozilla.org" >> $PKG/install/slack-desc # Make a message board formatted "annouce post" to save much time # For packager, and repo maintainer. echo "Package: ${REPO}${NAME}-langpack-${language}-${VERSION}-${ARCH}-${BUILD}.tlz" >> $RELEASEDIR/ANNOUNCE echo "[quote]" >> $RELEASEDIR/ANNOUNCE cat $PKG/install/slack-desc >> $RELEASEDIR/ANNOUNCE echo "[/quote]" >> $RELEASEDIR/ANNOUNCE echo "" >> $RELEASEDIR/ANNOUNCE # Append build infos to slack-desc that will be packaged. cat >> $PKG/install/slack-desc << EOF #---------------------------------------- BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` CFLAGS: $CFLAGS CONFIGURE: N/A EOF cat > $PKG/install/slack-required << EOF $NAME >= ${FIREFOXDEP} EOF cd $PKG echo "Creating package ${NAME}-langpack-${language}-${VERSION}-${ARCH}-${BUILD}.tlz..." makepkg -l y -c n ${RELEASEDIR}/${NAME}-langpack-${language}-${VERSION}-${ARCH}-${BUILD}.tlz #rm -rf $extensiondir rm -rf $PKG done fi cd $CWD #echo "Cleaning up temp files..." #rm -rf $TMP echo "Done"