#!/bin/sh # $Id$ # Copyright 2013, 2014 Eric Hameleers, Eindhoven, NL # All rights reserved. # # Permission to use, copy, modify, and distribute this software for # any purpose with or without fee is hereby granted, provided that # the above copyright notice and this permission notice appear in all # copies. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 AUTHORS AND COPYRIGHT HOLDERS AND THEIR # CONTRIBUTORS 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. # ----------------------------------------------------------------------------- # Slackware SlackBuild script # =========================== # By: Eric Hameleers # For: wine-pipelight # Descr: A patched version of Wine that works with PipeLight. # URL: http://winehq.com/ , # http://fds-team.de/cms/pipelight-compile-wine.html , # https://launchpad.net/pipelight # Needs: OpenAL # Build-req: fontforge (builds better fonts when compiling wine) # Changelog: # 1.7.5-1 04/nov/2013 by Eric Hameleers # Initial build. # 1.7.6-1 15/nov/2013 by Eric Hameleers # Update to wine 1.7.6 plus compholio patch set. # 1.7.8-1 14/dec/2013 by Eric Hameleers # Update to wine 1.7.8 plus compholio patch set. # 1.7.11-1 19/jan/2014 by Eric Hameleers # Update to wine 1.7.11 plus compholio patch set. # 1.7.13-1 22/feb/2014 by Eric Hameleers # Update to wine 1.7.13 plus compholio patch set. # 1.7.16-1 08/apr/2014 by Eric Hameleers # Update to wine 1.7.16 plus compholio patch set. # 1.7.19-1 03/jun/2014 by Eric Hameleers # Update to wine 1.7.19 plus compholio patch set to accompany # the pipelight 0.2.7 release. # 1.7.33-1 22/dec/2014 by Eric Hameleers # Update to wine 1.7.33 plus compholio patch set (now called # 'wine-staging') to accompany the pipelight 0.2.8 release. # # Run 'sh wine-pipelight.SlackBuild' to build a Slackware package. # The package (.tgz) plus descriptive .txt file are created in /tmp . # Install using 'installpkg'. # # ----------------------------------------------------------------------------- PRGNAM=wine-pipelight SRCNAM=wine PATNAM=wine-staging SRCVER=${SRCVER:-"1.7.33"} COMPHOLIO=${COMPHOLIO:-"v${SRCVER}"} VERSION=$(echo $SRCVER | tr '-' '.') BUILD=${BUILD:-1} TAG=${TAG:-alien} # We are going to isolate wine-piplelight from the rest of the system # so that it does not clash with a regular wine installation: WPREFIX="/usr/libexec/${PRGNAM}" # If you do not want wine64 on Slackware64, set this to "no": DO_WINE64=${DO_WINE64:-"yes"} # For matching wine_gecko & wine versions, see http://wiki.winehq.org/Gecko GECKO=${GECKO:-2.34} DOCS="ANNOUNCE AUTHORS COPYING.LIB ChangeLog LICENSE* README VERSION" # Set the variable OPENGL to "NO" if you don't have a card that # supports hardware accelerated OpenGL: OPENGL=${OPENGL:-"YES"} # Use 'YES' not 'yes' : case-sensitive! # If you set REQUIRE_FONTFORGE to "NO" then the script won't refuse to build # wine-pipelight in case you don't have fontforge installed (it is needed to # generate the required base fonts). REQUIRE_FONTFORGE=${REQUIRE_FONTFORGE:-"YES"} # Where do we look for sources? SRCDIR=$(cd $(dirname $0); pwd) # Place to build (TMP) package (PKG) and output (OUTPUT) the program: TMP=${TMP:-/tmp/build} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} ## ## --- with a little luck, you won't have to edit below this point --- ## ## # Automatically determine the architecture we're building on: MARCH=$( uname -m ) if [ -z "$ARCH" ]; then case "$MARCH" in i?86) export ARCH=i486 ;; armv7hl) export ARCH=$MARCH ;; arm*) export ARCH=arm ;; # Unless $ARCH is already set, use uname -m for all other archs: *) export ARCH=$MARCH ;; esac fi case "$ARCH" in i486) SLKCFLAGS="-O2 -march=i486 -mtune=i686" ;; x86_64) SLKCFLAGS="-O2 -fPIC" ;; *) SLKCFLAGS="-O2" ;; esac case "$ARCH" in arm*) TARGET=$ARCH-slackware-linux-gnueabi ;; *) TARGET=$ARCH-slackware-linux ;; esac # Download locations: SOURCE[0]="$SRCDIR/${SRCNAM}-${SRCVER}.tar.bz2" SRCURL[0]="http://downloads.sourceforge.net/project/${SRCNAM}/Source/${SRCNAM}-${SRCVER}.tar.bz2" SOURCE[1]="$SRCDIR/${PATNAM}-${COMPHOLIO}.tar.gz" SRCURL[1]="https://github.com/wine-compholio/wine-staging/archive/${COMPHOLIO}.tar.gz" SOURCE[2]="$SRCDIR/wine_gecko-${GECKO}-x86.msi" SRCURL[2]="http://downloads.sourceforge.net/wine/wine_gecko-${GECKO}-x86.msi" if [ "$ARCH" = "x86_64" -a "$DO_WINE64" = "yes" ]; then SOURCE[3]="$SRCDIR/wine_gecko-${GECKO}-x86_64.msi" SRCURL[3]="http://downloads.sourceforge.net/wine/wine_gecko-${GECKO}-x86_64.msi" fi # Exit the script on errors: set -e trap 'echo "$0 FAILED on line $LINENO!" | tee $OUTPUT/error-${PRGNAM}.log' ERR # Catch unitialized variables: set -u P1=${1:-1} # Save old umask and set to 0022: _UMASK_=$(umask) umask 0022 # Create working directories: mkdir -p $OUTPUT # place for the package to be saved mkdir -p $TMP/tmp-$PRGNAM # location to build the source mkdir -p $PKG # place for the package to be built rm -rf $PKG/* # always erase old package's contents rm -rf $TMP/tmp-$PRGNAM/* # remove the remnants of previous build rm -rf $OUTPUT/{configure,make,install,error,makepkg}-$PRGNAM.log # remove old log files # Source files availability: for (( i = 0; i < ${#SOURCE[*]}; i++ )) ; do if ! [ -f ${SOURCE[$i]} ]; then echo "Source '$(basename ${SOURCE[$i]})' not available yet..." # Check if the $SRCDIR is writable at all - if not, download to $OUTPUT [ -w "$SRCDIR" ] || SOURCE[$i]="$OUTPUT/$(basename ${SOURCE[$i]})" if [ -f ${SOURCE[$i]} ]; then echo "Ah, found it!"; continue; fi if ! [ "x${SRCURL[$i]}" == "x" ]; then echo "Will download file to $(dirname $SOURCE[$i])" wget -nv -T 20 -O "${SOURCE[$i]}" "${SRCURL[$i]}" || true if [ $? -ne 0 -o ! -s "${SOURCE[$i]}" ]; then echo "Fail to download '$(basename ${SOURCE[$i]})'. Aborting the build." mv -f "${SOURCE[$i]}" "${SOURCE[$i]}".FAIL exit 1 fi else echo "File '$(basename ${SOURCE[$i]})' not available. Aborting the build." exit 1 fi fi done if [ "$P1" == "--download" ]; then echo "Download complete." exit 0 fi # --- PACKAGE BUILDING --- echo "++" echo "|| $PRGNAM-$VERSION" echo "++" if ! which fontforge >/dev/null 2>&1 ; then echo "##" echo "## The 'fontforge' program does not seem to be installed." echo "## Wine uses fontforge to generate several TTF fonts (tahoma,tahomabd,marlett)" echo "## that your Windows programs may want to use!" if [ "$REQUIRE_FONTFORGE" != "YES" ]; then echo "##" echo "## Continuing the build anyway, but you were warned..." echo "## Sleeping for 5 seconds, press -C if you want to abort now." echo "##" sleep 5 else echo "##" echo "## Aborting the build - set the internal script variable:" echo "##" echo "## 'REQUIRE_FONTFORGE' to a value of 'NO'" echo "##" echo "## if you don't want to use fontforge to generate TTF fonts." echo "##" exit 1 fi fi cd $TMP/tmp-$PRGNAM echo "Extracting the source archive(s) for $PRGNAM..." tar -xf ${SOURCE[0]} [ "$SRCVER" != "$VERSION" ] && mv ${SRCNAM}-${SRCVER} ${SRCNAM}-${VERSION} # Apply the pipelight patches: tar -xf ${SOURCE[1]} cd ${PATNAM}-* make -C patches/ DESTDIR=$(cd ../${SRCNAM}-${VERSION}; pwd) install \ 2>&1 | tee $OUTPUT/patch-${PRGNAM}.log cd ../${SRCNAM}-${VERSION} chown -R root:root . chmod -R u+w,go+r-w,a+X-s . echo Building ... if [ "$ARCH" = "x86_64" -a "$DO_WINE64" = "yes" ]; then echo "Also building wine64 (shared support, aka WoW64)" fi if [ "${OPENGL}" = "YES" -o "${OPENGL}" = "yes" ]; then do_opengl="" else do_opengl="out" fi export CCAS="as" export CFLAGS="$SLKCFLAGS" export CXXFLAGS="$SLKCFLAGS" export LDFLAGS="-L/usr/lib -ldl" if [ "$ARCH" = "x86_64" ]; then export PKG_CONFIG_PATH="/usr/lib/pkgconfig:PKG_CONFIG_PATH" fi function wineconfigure () { ../configure \ --prefix=${WPREFIX} \ --localstatedir=${WPREFIX}/var \ --sysconfdir=${WPREFIX}/etc \ --mandir=${WPREFIX}/man \ --with-x \ --with${do_opengl}-opengl \ --program-prefix= \ --program-suffix= \ --build=$TARGET \ $* } autoreconf -vif 2>&1 | tee $OUTPUT/autoreconf-${PRGNAM}.log if [ "$ARCH" = "x86_64" -a "$DO_WINE64" = "yes" ]; then # First, wine64: mkdir wine64 cd wine64 wineconfigure --enable-win64 CC=/usr/bin/gcc 2>&1 | tee $OUTPUT/configure64-${PRGNAM}.log make depend 2>&1 | tee $OUTPUT/make64-${PRGNAM}.log make 2>&1 | tee -a $OUTPUT/make64-${PRGNAM}.log make DESTDIR=$PKG install 2>&1 |tee $OUTPUT/install64-${PRGNAM}.log cd - # Next, wine: mkdir wine32 cd wine32 wineconfigure --with-wine64=../wine64 2>&1 | tee $OUTPUT/configure-${PRGNAM}.log make depend 2>&1 | tee $OUTPUT/make-${PRGNAM}.log make 2>&1 | tee -a $OUTPUT/make-${PRGNAM}.log make DESTDIR=$PKG install 2>&1 |tee $OUTPUT/install-${PRGNAM}.log cd - else # No 64-bit wine requested, or we are on 32-bit Slackware: mkdir wine32 cd wine32 wineconfigure 2>&1 | tee $OUTPUT/configure-${PRGNAM}.log make depend 2>&1 | tee $OUTPUT/make-${PRGNAM}.log make 2>&1 | tee -a $OUTPUT/make-${PRGNAM}.log make DESTDIR=$PKG install 2>&1 |tee $OUTPUT/install-${PRGNAM}.log cd - fi # Add the wine-gecko MSI installer(s) to the Wine package: mkdir -p $PKG/${WPREFIX}/share/wine/gecko install -m0644 ${SOURCE[2]} $PKG/${WPREFIX}/share/wine/gecko/ if [ "$ARCH" = "x86_64" -a "$DO_WINE64" = "yes" ]; then install -m0644 ${SOURCE[3]} $PKG/${WPREFIX}/share/wine/gecko/ fi # Add some documentation to the package: mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION || true cp -a $SRCDIR/$(basename $0) $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION find $PKG/usr/doc -type f -exec chmod 644 {} \; # Compress the man page(s) if [ -d $PKG/${WPREFIX}/man ]; then cd $PKG/${WPREFIX}/man find . -type f -name "*.?" -exec gzip -9f {} \; for i in $(find . -type l -name "*.?") ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done fi # Strip binaries find $PKG | xargs file | grep -e "executable" -e "shared object" \ | grep ELF | cut -f1 -d: | xargs strip --strip-unneeded 2>/dev/null || true # Add a package description: mkdir -p $PKG/install cat $SRCDIR/slack-desc > $PKG/install/slack-desc if [ -f $SRCDIR/doinst.sh ]; then cat $SRCDIR/doinst.sh >> $PKG/install/doinst.sh fi if [ -f $SRCDIR/slack-required ]; then cat $SRCDIR/slack-required > $PKG/install/slack-required fi # Build the package: cd $PKG makepkg --linkadd y --chown n $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.tgz 2>&1 | tee $OUTPUT/makepkg-${PRGNAM}.log cd $OUTPUT md5sum ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.tgz > ${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.tgz.md5 cd - cat $PKG/install/slack-desc | grep "^${PRGNAM}" > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txt if [ -f $PKG/install/slack-required ]; then cat $PKG/install/slack-required > $OUTPUT/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.dep fi # Restore the original umask: umask ${_UMASK_}