#!/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 Thunderbird trademarks. NAME="thunderbird" # Don't change this, everything will go wrong. VERSION=2.0.0.19 BUILD=1vl60 # Build/vl/58..59..60 etc. VL_PACKAGER="Caitlyn Martin" # Fill in your name so we will know who made the package. ### What would you like to build? ### # SELECTION=1 Will build the mailclient only and won't download any locals SELECTION=2 # SELECTION=2 Will build mail client, download locales, build 40 something language packs. # SELECTION=3 Will download locals, and build language packs only #<----------------------------- Shouldn't need editing past this point --------------------------------> # Architechture and appropriate configure triplet: [ -z "$ARCH" ] && ARCH=$(uname -m) case "$ARCH" in (i?86) ARCH=i586 CFLAGS="-O2 -march=i586 -mtune=i686" CONFIGURE_TRIPLET=i486-slackware-linux ;; (x86_64) CFLAGS="-O2 -fPIC" CONFIGURE_TRIPLET=x86_64-pc-linux ;; esac # CFLAGS: export CFLAGS export CXXFLAGS=$CFLAGS distro=`echo $BUILD | cut -d l -f 2` if [ ${distro} = "58" ]; then distro=5.8 fi if [ ${distro} = "59" ]; then distro=5.9 fi if [ ${distro} = "60" ]; then distro=6.0 fi REPO="http://vectorlinux.osuosl.org/veclinux-${distro}/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. 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 rm -rf $PKG mkdir -p $PKG echo "Here we go!" if [ ! -e $CWD/thunderbird-$VERSION.tar.gz ]; then SOURCE="releases.mozilla.org/pub/mozilla.org/thunderbird/releases/latest-2.0/linux-i686/en-US" wget ftp://$SOURCE/thunderbird-$VERSION.tar.gz fi if [ $SELECTION != 3 ]; then mkdir -p $PKG/usr/lib cd $PKG/usr/lib echo "Extracting files to package directory..." tar xzvf $CWD/thunderbird-$VERSION.tar.gz || exit 1 mv thunderbird thunderbird-$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 thunderbird script ln -sf $NAME-$VERSION $PKG/usr/lib/$NAME mkdir $PKG/usr/bin cd $PKG/usr/bin ln -sf /usr/lib/thunderbird-$VERSION/thunderbird . # Install icons: mkdir -p $PKG/usr/share/{applications,pixmaps} cp $CWD/mozilla-$NAME.desktop $PKG/usr/share/applications/mozilla-$NAME.desktop cp $CWD/$NAME.png $PKG/usr/share/pixmaps/$NAME.png # These files/directories are usually created if Thunderbird 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. ( cd $PKG/usr/lib/thunderbird-$VERSION if [ -d chrome ]; then if [ ! -r chrome/app-chrome.manifest ]; then echo > chrome/app-chrome.manifest fi fi if [ ! -d updates ]; then mkdir -p updates/0 fi ) # Add VectorLinux needed prefs file. cat > $PKG/usr/lib/$NAME-$VERSION/defaults/pref/vl-prefs.js << EOF // This forces Thunderbird language to switch to locale of machine // if available. pref("intl.locale.matchOS", true); // Add VL idenity pref("general.useragent.vendor", "VectorLinux"); pref("general.useragent.vendorSub", "$VERSION-$BUILD"); // Allows Thunderbird to use default browser pref("network.protocol-handler.app.http", "browser"); pref("network.protocol-handler.app.https", "browser"); pref("network.protocol-handler.app.ftp", "browser"); 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: thunderbird (Mozilla Thunderbird mail application) $NAME: $NAME: Mozilla Thunderbird is a redesign of the Mozilla mail component $NAME: written using the XUL user interface language. Thunderbird makes $NAME: emailing safer, faster, and easier than ever before with the $NAME: industry's best implementations of features such as intelligent spam $NAME: filters, built-in RSS reader, quick search, and much more. $NAME: $NAME: License: MPL 1.1/GPL 2.0/LGPL 2.1 $NAME: Author: Initial Developer - Netscape Communications Corporation $NAME: Website: Website: http://www.mozilla.org/projects/thunderbird/ #---------------------------------------- BUILDDATE: `date` PACKAGER: $VL_PACKAGER HOST: `uname -srm` DISTRO: `cat /etc/vector-version` CFLAGS: $CFLAGS CONFIGURE: N/A EOF cat $RELEASEDIR/slack-desc > $PKG/install/slack-desc # Make a message board formatted "annouce post" to save much time # For packager, and repo maintainer. echo "Package: ${REPO}${NAME}-${VERSION}-${ARCH}-${BUILD}.tlz" >> $RELEASEDIR/ANNOUNCE echo "[quote]" >> $RELEASEDIR/ANNOUNCE cat $PKG/install/slack-desc | grep ${NAME}: >> $RELEASEDIR/ANNOUNCE echo "[/quote]" >> $RELEASEDIR/ANNOUNCE echo "" >> $RELEASEDIR/ANNOUNCE cd $PKG 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 THUNDERBIRDDEP="$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="releases.mozilla.org/pub/mozilla.org/$NAME/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@thunderbird.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 Thunderbird-$VERSION" >> $PKG/install/slack-desc echo "${SLACKDESC}: " >> $PKG/install/slack-desc echo "${SLACKDESC}: This enables Thunderbird 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 Thunderbird." >> $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 >= ${THUNDERBIRDDEP} 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"