#!/bin/sh # Heavily based on the Slackware 13.37 SlackBuild # Written by tom ( www.slacky.eu ) # Last build from tom ( www.slacky.eu ) # Slackware build script for LibreOffice # Official Site: http://libreoffice.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. # Required to build: # apache-ant, jdk, perl-archive-zip, xulrunner # Exit the script on errors: set -e trap 'echo "$0 FAILED at line ${LINENO}"' ERR # Catch variables: PKGNAME=libreoffice VERSION=3.3.3 ; SUBVER=.1 BUILD=${BUILD:-1} TAG=${TAG:-sl} ARCH=${ARCH:-i486} CWD=${CWD:-`pwd`} TMP=${TMP:-/tmp/buildpkgs/$PKGNAME} PKG=${PKG:-$TMP/package-$PKGNAME} OUTPUT=${OUTPUT:-$CWD} SOURCE="http://download.documentfoundation.org/$PKGNAME/src/$PKGNAME-build-$VERSION$SUBVER.tar.gz" CHOST="i486" if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" SLKLDFLAGS="" LIBDIRSUFFIX="" elif [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" SLKLDFLAGS="" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" SLKLDFLAGS="" LIBDIRSUFFIX="" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" SLKLDFLAGS="-L/usr/lib64" LIBDIRSUFFIX="64" CHOST="x86_64" fi # Source file availability: if [ ! -e $CWD/$(basename $SOURCE) ] ; then wget $SOURCE fi # Choice if you want to use a previous build or create a new one: if [ "$1" == "--oldbuild" ]; then echo "Re-using a previous compilation." else rm -rf $TMP mkdir -p $TMP $PKG $OUTPUT fi # Extract the sources: cd $TMP tar xvf $CWD/$(basename $SOURCE) cd $(basename $SOURCE | sed "s/\.tar.gz//") chown -R root:root . chmod -R u+w,go+r-w,a-s . echo -e "\e[0;32m+------------------------------+\e[m" echo -e "\e[0;32m| Start SlackBuild libreoffice |\e[m" echo -e "\e[0;32m+------------------------------+\e[m" # If this local directory does not exist during configuration, # support for Open Clip Art will be disabled (if at the end of # build it's yet empty, it will be removed): mkdir -p /usr/share/openclipart # Disable this diff to prevent error in 32-bit compilation of 'sw' # ( undefined reference to `ixion::formula_lexer::swap_tokens ): sed -i -e 's/^fields-table-formula.diff.*/#&/' patches/dev300/apply # Replace a "SlacwkareOnly" patch that fails to apply, thereby preventing # all subsequent patching to be aborted: cp $CWD/scp2-user-config-ooo3.diff patches/dev300 # Add a patch to make the presenter console compile: cp $CWD/libreoffice.presenter.diff patches/hotfixes # Configure: sed -e "s/_VERSION_/$VERSION-$BUILD/" $CWD/Slackware.conf.in > distro-configs/Slackware.conf.in export KDE4DIR="$KDEDIRS" export QT4INC="$QT4DIR/include" export QT4LIB="$QT4DIR/lib$LIBDIRSUFFIX" export OOInBase="/usr/lib$LIBDIRSUFFIX/$PKGNAME" export OOInstall="/usr/lib$LIBDIRSUFFIX/$PKGNAME" export OODESTDIR="$PKG" export LDFLAGS="$SLKLDFLAGS" export CXXFLAGS="$SLKCFLAGS" export CFLAGS="$SLKCFLAGS" ./configure \ --prefix=/usr \ --libdir=/usr/lib$LIBDIRSUFFIX \ --sysconfdir=/etc \ --localstatedir=/var \ --mandir=/usr/man \ --docdir=/usr/doc/$PKGNAME-$VERSION \ --enable-kde4 \ --with-arch-flags="$SLKCFLAGS" \ --with-distro=Slackware \ --with-docdir=/usr/doc/$PKGNAME-$VERSION \ --with-installed-ooo-dirname=$PKGNAME \ --without-binsuffix \ --without-git \ --build=$CHOST-slackware-linux # Download all the sources: ./download # Building (takes many hours): make -i verbose=yes # Install all: ( cd bin ; ./package-ooo ) # If at the end of build the directory /usr/share/openclipart # is yet empty, it will be removed): if [ `ls /usr/share/openclipart | wc -l` == "0" ] ; then rmdir /usr/share/openclipart fi # Link the browser plugin into the mozilla plugins directory: ( mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/mozilla/plugins cd $PKG/usr/lib$LIBDIRSUFFIX/mozilla/plugins ln -sf /usr/lib$LIBDIRSUFFIX/$PKGNAME/program/libnpsoplugin.so ) # Replace redundant fonts with symlinks to save space: ( cd $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/basis-link/share/fonts/truetype for i in DejaVu*.ttf Liberation*.ttf ; do rm -f $i ln -sf /usr/share/fonts/TTF/$i done ) # Fix permissions of a license file: chmod 0644 $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/LICENSE.odt # Fix icons: find $PKG/usr/share/icons -name "ooo-*" -exec rm -f {} \; || true ( cd build/$PKGNAME-$VERSION$SUBVER/sysui/desktop find icons/hicolor -path "*apps*" -name "*.png" | while read i ; do mkdir -p $PKG/usr/share/$(dirname $i) install -m0644 $i $PKG/usr/share/$(dirname $i)/$PKGNAME-$(basename $i) done ) sed -i -e "s/^Icon=ooo-/Icon=$PKGNAME-/" $PKG/usr/share/applications/*.desktop # Fix menu entries (.desktop files): sed -i "s/Exec=oo/Exec=lo/g" $PKG/usr/share/applications/*.desktop sed -e "s/Exec=oo/Exec=so/" \ $PKG/usr/lib$LIBDIRSUFFIX/libreoffice/share/xdg/javafilter.desktop > $PKG/usr/share/applications/javafilter.desktop sed -e "s/3.3 Quickstarter/Quickstarter/g" -e "/NoDisplay=true/d" \ $PKG/usr/lib$LIBDIRSUFFIX/libreoffice/share/xdg/qstart.desktop > $PKG/usr/share/applications/qstart.desktop rm -rf $PKG/usr/lib$LIBDIRSUFFIX/libreoffice/share/xdg # Remove unneeded autocorrect function files for locales: ( cd $PKG/usr/lib$LIBDIRSUFFIX/$PKGNAME/basis-link/share/autocorr rm -f acor_[a-df-z]*.dat acor_e[su]*.dat ) # Rename new configuration files: mv $PKG/etc/bash_completion.d/libreoffice.sh $PKG/etc/bash_completion.d/libreoffice.sh.new # Add documentation: mkdir -p $PKG/usr/doc/$PKGNAME-$VERSION cp -a \ AUTHORS COPYING ChangeLog INSTALL MAINTAINERS NEWS README TODO \ $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 # Compress man pages: ( 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 ) # Strip binaries: cd $PKG chown -R root:root $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 # Add slack-desc, doinst.sh and slack-required: mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh if [ -x "$(which requiredbuilder 2>/dev/null)" ];then requiredbuilder -y -v -s $CWD $PKG fi # Make the package: /sbin/makepkg -p -l y -c n $OUTPUT/$PKGNAME-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz} # Clean up the extra stuff: if [ "$1" = "--cleanup" ]; then rm -rf $TMP $PKG fi