#!/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. # This is not a source build. It's a repack of the official Mozilla build. # This way autoupdate works and we don't violate Firefox trademarks. NAME="firefox" # Don't change this, everything will go wrong. VERSION=3.0.9 # 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=1vl60 # Build/vl/58..59..60 etc. VL_PACKAGER=toothandnail # 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/veclinux6.0/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 echo "Here we go!" if [ ! -e $CWD/firefox-$VERSION.tar.bz2 ]; then SOURCE="mozilla.osuosl.org/pub/mozilla.org/firefox/releases/$VERSION/linux-i686/en-US" wget ftp://$SOURCE/firefox-$VERSION.tar.bz2 fi if [ $SELECTION != 3 ]; then mkdir -p $PKG/usr/lib cd $PKG/usr/lib echo "Extracting files to package directory..." tar xvjf $CWD/firefox-$VERSION.tar.bz2 || exit 1 mv firefox firefox-$VERSION 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 {} \; sed -i 's|/local||g' $PKG/usr/lib/$NAME-$VERSION/$NAME # Fix path in firefox script mkdir $PKG/usr/bin cat > $PKG/usr/bin/firefox << EOF #!/usr/bin/bash # Launcher for Firefox, but first.... # Include /usr/lib/mozilla/plugins in the plugin path: if [ "\$MOZ_PLUGIN_PATH" ] ; then MOZ_PLUGIN_PATH=\$MOZ_PLUGIN_PATH:/usr/lib/$NAME-$VERSION/plugins:/usr/lib/mozilla/plugins else MOZ_PLUGIN_PATH=/usr/lib/$NAME-$VERSION/plugins:/usr/lib/mozilla/plugins fi export MOZ_PLUGIN_PATH #Ok, launching firefox /usr/lib/$NAME-$VERSION/$NAME \$* EOF chmod +x $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/default48.png $PKG/usr/share/pixmaps/$NAME.png # 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 3 is the next generation release of the award-winning $NAME: Firefox web browser from Mozilla. $NAME: To comply with Mozilla trademarks, and to assure quality control, $NAME: this is the official Mozilla build, packaged for VectorLinux. $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..." EXCLUDE="orbit2-2.14.8-1vl59" 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 cd $TMP # Check to see if we have sources to extract, if not, let's get them. if [ ! -e $CWD/$NAME-$VERSION-langpacks-src.tar.bz2 ]; then SOURCE="mozilla.osuosl.org/pub/mozilla.org/firefox/releases/$VERSION/linux-i686/xpi" wget -m ftp://$SOURCE mv -f $TMP/$SOURCE $TMP/$NAME-$VERSION-langpacks-src rm -rf $TMP/$SOURCE # Now let's tar them up to upload with our packages and sources. cat > $NAME-$VERSION-langpacks-src/README << EOF This collection of language packs belongs to $NAME-$VERSION. It was downloaded and archived on `date` From ftp://${SOURCE} EOF tar cjvf $CWD/$NAME-$VERSION-langpacks-src.tar.bz2 $NAME-$VERSION-langpacks-src else tar jxvf $CWD/$NAME-$VERSION-langpacks-src.tar.bz2 fi for langpack in `ls $TMP//$NAME-$VERSION-langpacks-src/*.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"