#!/bin/sh # Heavily based on the Slackware 13.1 SlackBuild # Written by Matteo Rossini # Last build from Savino Liguori ( jimmy_page_89@hotmail.it ) # Slackware build script for chromium # Official Site: http://build.chromium.org/ # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. set -e PKGNAME=chromium OBUILD=${BUILD:-1sl} ARCH=${ARCH:-x86_64} #SOURCEBASE=http://build.chromium.org/buildbot/archives/ SOURCEBASE="http://chromium-browser-source.commondatastorage.googleapis.com" RELEASE=$(wget -q $SOURCEBASE/chromium_tarball.html -O -|grep "a href"|sed -r 's/^.*"chromium.(r[0-9]+)\.tgz".*$/\1/') SOURCE=$SOURCEBASE/$PKGNAME.$RELEASE.tgz CWDSIZE=800 TMPSIZE=3800 if [ ! -e ${PKGNAME}.${RELEASE}.tgz ];then if [ $(df -k .|tail -1|awk '{print $4}' ) -lt ${CWDSIZE}000 ];then echo "No space left to download source file. You need ${CWDSIZE}Mb of free space" exit 1 fi wget $SOURCE fi CWD=$(pwd) TMP=${TMP:-/tmp/buildpkgs/$PKGNAME} PKG=$TMP/package-$PKGNAME OUTPUT=${OUTPUT:-$CWD} #Using last version from svn (Recommended 1) SVN_UPDATE=${SVN_UPDATE:-0} if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O3 -pipe -fPIC" # Change cflags to your needs LIBDIRSUFFIX="64" fi rm -rf $TMP mkdir -p $TMP $PKG $OUTPUT if [ $(df -k .|tail -1|awk '{print $4}' ) -lt ${TMPSIZE}000 ];then echo "No space left to build $PKGNAME. You need ${TMPSIZE}Mb of free space" exit 1 fi cd $TMP tar xvf $CWD/${PKGNAME}*.tgz \ --exclude src/third_party/pefile \ --exclude src/third_party/GTM \ --exclude src/third_party/swig/win \ --exclude src/third_party/python_24 \ --exclude src/third_party/nss \ --exclude src/third_party/WebKit/WebKitLibraries \ --exclude src/third_party/pdfsqueeze \ --exclude src/third_party/swig/mac \ --exclude src/third_party/lighttpd \ --exclude src/third_party/ffmpeg/binaries/chromium/win/ia32 \ --exclude src/third_party/mingw-w64/mingw/bin \ --exclude src/third_party/cygwin \ --exclude src/third_party/WebKit/WebKit/mac cd home/chrome-svn/tarball/chromium/ chown -R root:root . chmod -R u+w,go+r-w,a-s . cd src # Fetch depot tools svn co http://src.chromium.org/svn/trunk/tools/depot_tools export PATH=$(pwd)/depot_tools:"$PATH" # Exporting variables export GYP_GENERATORS='make' export BUILDTYPE='Release' GYP_DEFINES="fastbuild=1 linux_sandbox_path=/usr/lib$LIBDIRSUFFIX/$PKGNAME/chromium-sandbox use_system_yasm=1 release_extra_cflags='$SLKCFLAGS'" [[ $ARCH == "x86_64" ]] && GYP_DEFINES+=" linux_fpic=1 target_arch=x64" export GYP_DEFINES # Updating tree and update version number if [ $SVN_UPDATE == 1 ]; then gclient sync REV=$(grep -A 1 dir .svn/entries | grep "^[0-9]" | head -1) else REV=$(echo $VERSION | sed 's/r//') fi source chrome/VERSION VERSION="$MAJOR.$MINOR.$BUILD.$PATCH" # Ensure correct makefiles generation gclient runhooks --force # Compile the application make chrome chrome_sandbox # Install binaries SRC="out/Release" install -d -g root -o root -m 755 $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/ install -d -g root -o root -m 755 $PKG/usr/man/man1 install -d -g root -o root -m 755 $PKG/usr/bin/ cp -r $SRC/{locales,resources} $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/ install -d -g root -o root -m 755 $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/{locales,resources} find $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/{locales,resources} -type f -exec chmod 644 {} \; install -g root -o root -m 755 $SRC/chrome $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/chromium install -g root -o root -m 4755 $SRC/chrome_sandbox $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/chromium-sandbox install -g root -o root -m 755 $SRC/xdg-settings $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/xdg-settings install -g root -o root -m 644 $SRC/chrome.pak $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/chrome.pak install -g root -o root -m 644 $SRC/chrome.1 $PKG/usr/man/man1/chromium.1 ### In this section you may remove some not needed files or move that file in other path # Create a symlink in /usr/bin ( cd $PKG/usr/bin ln -s ../lib$LIBDIRSUFFIX/$PKGNAME/chromium chromium ) # fixing install error ( cd $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME cp chrome.pak resources.pak ) mkdir -p $PKG/usr/share/applications cat $CWD/chromium.desktop > $PKG/usr/share/applications/chromium.desktop mkdir -p $PKG/usr/share/pixmaps cp $CWD/chromium_logo.png $PKG/usr/share/pixmaps/chromium.png ### copy some documentation files mkdir -p $PKG/usr/doc/$PKGNAME-$VERSION cp -a \ AUTHORS LICENSE \ $PKG/usr/doc/$PKGNAME-$VERSION cat $CWD/$PKGNAME.SlackBuild > $PKG/usr/doc/$PKGNAME-$VERSION/$PKGNAME.SlackBuild cat $CWD/slack-desc > $PKG/usr/doc/$PKGNAME-$VERSION/slack-desc #Stripping ( cd $PKG find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true find . | xargs file | grep "current ar archive" | cut -f 1 -d : | xargs -r strip --strip-unneeded 2> /dev/null || true ) ### compress man pages if [ -d $PKG/usr/man ]; then ( cd $PKG/usr/man find . -type f -exec gzip -9 {} \; for i in $( find . -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done ) fi ### popolate the install/ directory mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc ### reset owner and create slack-required file. cd $PKG chown -R root:root $PKG chmod 4755 $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/chromium-sandbox if [ -x "$(which requiredbuilder 2>/dev/null)" ];then ADD="seamonkey-solibs >= 2.0.4-$ARCH-1" \ requiredbuilder -y -v -s $CWD $PKG fi ### finally make the package. /sbin/makepkg -l y -c n $OUTPUT/$PKGNAME-$VERSION-$ARCH-$OBUILD.${PKGTYPE:-txz} if [ "$1" = "--cleanup" ]; then rm -rf $TMP fi