#!/bin/bash # browser-sversbk.SlackBuild # by Stuart Winter # Based on Unbranded 'Firefox' build script from Slackware 13. # 03-April-2009 # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PKGNAM export PORTCWD=$PWD # Major version number - needed for /usr/lib/firefox dir: MAJORVER=$VERSION # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Determine the CFLAGS for the known architectures: case $ARCH in arm) export SLKCFLAGS="-O2 -march=armv4 -mtune=xscale" ;; powerpc) export SLKCFFLAGS="-O" ;; sparc) export SLKCFLAGS="-O2" ;; *) export SLKCFLAGS="-O2" ;; esac # Determine patch level required & apply the patch: function apply_patch () { patchfile=$1 # Unpack if it's bzip2 or gzip: FTYPE=$( file $patchfile ) if [ "$( echo $FTYPE | grep "bzip2 compressed" )" ]; then bzcat -f $patchfile > $TMPBUILD/$patchfile.unpacked patchfile=$TMPBUILD/$patchfile.unpacked elif [ "$( echo $FTYPE | grep "gzip compressed" )" ]; then zcat -f $patchfile > $TMPBUILD/$patchfile.unpacked patchfile=$TMPBUILD/$patchfile.unpacked fi # Most patches should not require more levels than this: success=0 for (( pl=0 ; pl<=5 ; pl++ )) ; do echo "Patch : $patchfile , trying patch level $pl" patch --fuzz=20 -t --dry-run -p$pl < $patchfile > /dev/null 2>&1 && success=1 && break done if [ $success = 1 ]; then echo "Patch: $patchfile will apply at level $pl" patch --fuzz=20 --verbose -p$pl < $patchfile return 0 else echo "Patch: $patchfile failed to apply at levels 0-5" return 1 fi } # Extract patches: # 3.0.8 doesn't need any build patches! #tar xvvf $PORTCWD/sources/*recipe.tar.bz2 #mkdir -vpm755 $TMPBUILD/patches #( cd Firefox*/*/ # mv -fv 03-ldflags.patch $TMPBUILD/patches/ # mv -fv 04-crmf_link_order.patch $TMPBUILD/patches/ # mv -fv arm/*patch* $TMPBUILD/patches/ ) # Extract source: echo "Extracting source" tar xf $PORTCWD/sources/firefox-$VERSION-source.tar.* cd mozilla* || exit 1 slackhousekeeping # Apply ARM patches from gobolinux: # These don't apply to FF 3.0.8. #for pf in ../patches/*.patch* ; do # apply_patch $pf || failpatch #done # Fix a long standing bug that's prevented staying current on GTK+. # Thanks to the BLFS folks. :-) cat << EOF >> layout/build/Makefile.in ifdef MOZ_ENABLE_CANVAS EXTRA_DSO_LDOPTS += \$(XLDFLAGS) -lX11 -lXrender endif EOF # Configure: #autoconf2.13 || failconfig # Turn errors back into warnings: sed -i 's?-Werror?-Wall?g' configure export MOZILLA_OFFICIAL="1" && export BUILD_OFFICIAL="1" && export MOZ_PHOENIX="1" && export CFLAGS="$SLKCFLAGS" && export CXXFLAGS="$SLKCFLAGS" && ./configure \ --enable-official-branding \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --with-default-mozilla-five-home=/usr/lib${LIBDIRSUFFIX}/firefox-$VERSION \ --with-system-zlib \ --enable-application=browser \ --enable-default-toolkit=cairo-gtk2 \ --enable-crypto \ --enable-svg \ --enable-canvas \ --enable-xft \ --enable-xinerama \ --enable-optimize \ --enable-reorder \ --enable-strip \ --enable-system-cairo \ --enable-cpp-rtti \ --enable-single-profile \ --disable-ldap \ --disable-accessibility \ --disable-debug \ --disable-tests \ --disable-logging \ --disable-pedantic \ --disable-installer \ --disable-mailnews \ --disable-composer \ --disable-profilesharing || failconfig # Build: make MOZ_MAKE_FLAGS="$NUMJOBS" || failmake # Install into package framework: make install DESTDIR=$PKG || failinstall # We don't need these (just symlinks anyway): rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/firefox-devel-$VERSION # Nor these: rm -rf $PKG/usr/include ( cd $PKG/usr/lib${LIBDIRSUFFIX}/firefox-$VERSION zcat $PORTCWD/sources/mozilla-firefox-mimeTypes-fix.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1 # Clean up if the above patch was successful: rm -f defaults/pref/firefox.js.orig zcat $PORTCWD/sources/firefox.moz_plugin_path.diff.gz \ | sed -e "s#usr/lib#usr/lib${LIBDIRSUFFIX}#g" \ | patch -p1 --verbose --backup --suffix=.orig || exit 1 # Clean up if the above patch was successful: rm -f firefox.orig ) || exit mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/mozilla/plugins mkdir -p $PKG/usr/share/applications cat $PORTCWD/sources/mozilla-firefox.desktop > $PKG/usr/share/applications/mozilla-firefox.desktop mkdir -p $PKG/usr/share/pixmaps cat $PORTCWD/sources/firefox.png > $PKG/usr/share/pixmaps/firefox.png # 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. ( cd $PKG/usr/lib${LIBDIRSUFFIX}/firefox-$VERSION if [ -d extensions/talkback\@mozilla.org ]; then if [ ! -r extensions/talkback\@mozilla.org/chrome.manifest ]; then echo > extensions/talkback\@mozilla.org/chrome.manifest fi fi if [ ! -d updates ]; then mkdir -p updates/0 fi ) # Need some default icons in the right place: mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/firefox-$VERSION/chrome/icons/default install -m 644 other-licenses/branding/firefox/default16.png \ $PKG/usr/lib${LIBDIRSUFFIX}/firefox-$VERSION/icons/ install -m 644 other-licenses/branding/firefox/default16.png \ $PKG/usr/lib${LIBDIRSUFFIX}/firefox-$VERSION/chrome/icons/default/ ( cd $PKG/usr/lib${LIBDIRSUFFIX}/firefox-$VERSION install -m 644 icons/{default,mozicon50}.xpm chrome/icons/default/ ) # Copy over the LICENSE install -p -c -m 644 LICENSE $PKG/usr/lib${LIBDIRSUFFIX}/firefox-$VERSION/ # If necessary, start the fakeroot server so we can set file/dir ownerships: start_fakeroot # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slackgzpages -i # compress man & info pages and delete usr/info/dir slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links