#!/bin/env bash # Builds Wine with the wine-staging patches. This is meant for a multilib system, and will build a WOW64-enabled WINE (one "wine" # executable for both 32-bit and 64-bit apps). # # This is based on the SBo SlackBuild. set -e # Change this as needed. VERSION=3.3 BUILD=${BUILD:-1} TAG=${TAG:-dc} TMP=${TMP:-/tmp} PKG=$TMP/package-wine BRANCH=3.x if [[ -z $ARCH ]]; then case $( uname -m ) in i?86) ARCH=i486 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi case $ARCH in "i486") SLKCFLAGS="-O2 -march=i486 -mtune=i686" ;; "i686") SLKCFLAGS="-O2 -march=i686 -mtune=i686" ;; "x86_64") SLKCFLAGS="-O2 -fPIC" ;; *) SLKCFLAGS="-O2" ;; esac rm -rf "$PKG" "$TMP/wine_src" cd "$TMP" mkdir wine_src cd wine_src wget "http://mirrors.ibiblio.org/wine/source/$BRANCH/wine-$VERSION.tar.xz" wget https://raw.githubusercontent.com/Ponce/slackbuilds/master/system/wine/slack-desc wget --content-disposition "https://github.com/wine-staging/wine-staging/archive/v$VERSION.tar.gz" tar xvf wine-${VERSION}.tar.xz tar xvf wine-staging-${VERSION}.tar.gz cd wine-staging-$VERSION/patches ./patchinstall.sh --all DESTDIR=$TMP/wine_src/wine-$VERSION cd "$TMP/wine_src/wine-$VERSION" chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ -o -perm 511 \) -exec chmod 755 {} \; -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; autoreconf -i mkdir "$TMP/wine_src/win64-build" cd "$TMP/wine_src/win64-build" CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ "$TMP/wine_src/wine-$VERSION/configure" \ --enable-win64 \ --prefix=/usr \ --mandir=/usr/man \ --docdir=/usr/doc/wine-"$VERSION" \ --build="$ARCH"-slackware-linux make mkdir -p "$TMP/wine_src/win32-build" cd "$TMP/wine_src/win32-build" CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ "$TMP/wine_src/wine-$VERSION/configure" \ --with-wine64=../win64-build \ --prefix=/usr \ --mandir=/usr/man \ --docdir=/usr/doc/wine-"$VERSION" \ --build="$ARCH"-slackware-linux make -j "$JOBS" make install DESTDIR="$PKG" -j $JOBS cd ../win64-build make install DESTDIR="$PKG" -j $JOBS find "$PKG" -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true find "$PKG"/usr/man -type f -exec gzip -9 {} \; for i in $( find "$PKG/usr/man" -type l ) ; do ln -s "$( readlink "$i" ).gz" "$i.gz" ; rm $i ; done mkdir -p "$PKG/usr/doc/wine-$VERSION" cp -a "$TMP"/wine_src/wine-"$VERSION"/[[:upper:]][[:upper:]]* "$PKG/usr/doc/wine-$VERSION" mkdir -p "$PKG/install" cat "$TMP/wine_src/slack-desc" > "$PKG/install/slack-desc" cd "$PKG" /sbin/makepkg -l y -c n "$TMP/wine-${VERSION}-${ARCH}-$BUILD$TAG.txz"