#!/bin/bash # # wine.SlackBuild is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or any later version. # # wine.SlackBuild is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # # Based on wine.SlackBuild by Eric Hameleers # default settings PACKAGE="wine" PACKAGE_EXT="xz" VERSION=${VERSION:=9.0} STAGING=${STAGING:=9.0} VERMAJ=$(echo $VERSION | cut -d. -f1) VERMIN=$(echo $VERSION | cut -d. -f2) ; [ $VERMIN -ne 0 ] && VERMIN="x" BUILD=${BUILD:=1} # Add the "Gecko", Wine's own implementation of Internet Explorer. # For matching wine_gecko & wine versions, see http://wiki.winehq.org/Gecko GECKO=${GECKO:-2.47.4} MONO=${MONO:-8.1.0} if [ -f ~/.slackbuildrc ]; then . ~/.slackbuildrc elif [ -f ../../runtime/slackbuildrc ]; then . ../../runtime/slackbuildrc elif [ -f ../../source/runtime/slackbuildrc ]; then . ../../source/runtime/slackbuildrc fi check_required # If your video card does not support hardware accelerated OpenGL, # the run the script like: OPENGL=NO ./wine.SlackBuild OPENGL=${OPENGL:-YES} # If you want to build a WoW64 version. This only works on 64 bit systems. WOW64=${WOW64:-YES} W32=${WINE32:-no} W64=${WINE64:-no} WINETMP="$( mktemp -d $TMP/wine-test-XXXXXX )" echo "int main(void) {; return(0); }" > "$WINETMP/test.c" gcc -m32 "$WINETMP/test.c" -o /dev/null >/dev/null 2>&1 && W32=yes gcc -m64 "$WINETMP/test.c" -o /dev/null >/dev/null 2>&1 && W64=yes rm -rf "$WINETMP" WINE32=${WINE32:-$W32} WINE64=${WINE64:-$W64} if [ "${WINE32:-no}${WINE64:-no}" = "nono" ]; then echo "Both 64 and 32 bit builds disabled. Nothing to do." exit 1 fi GSRC="wine-gecko-${GECKO}-x86.msi" GURL="http://dl.winehq.org/wine/wine-gecko/$GECKO/$GSRC" get_source $GSRC $GURL if [ "$ARCH" = "x86_64" -a "$WOW64" = "YES" ]; then GSRC64="wine-gecko-${GECKO}-x86_64.msi" GURL64="http://dl.winehq.org/wine/wine-gecko/$GECKO/$GSRC64" get_source $GSRC64 $GURL64 fi MSRC="wine-mono-${MONO}-x86.msi" MURL="http://downloads.sourceforge.net/wine/$MSRC" MURL="http://dl.winehq.org/wine/wine-mono/$MONO/$MSRC" get_source $MSRC $MURL STSRC="wine-staging-${STAGING}.tar.gz" STURL="https://github.com/wine-staging/wine-staging/archive/v${STAGING}.tar.gz" get_source $STSRC $STURL #SVER="$(echo $VERSION | cut -d '.' -f 1)" SRC="wine-${VERSION}.tar.$PACKAGE_EXT" URL="http://dl.winehq.org/wine/source/${VERMAJ}.${VERMIN}/${SRC}" get_source $SRC $URL unpack_source $SRC wine-$VERSION # If OPENGL=YES above, then enable opengl; otherwise, disable it. if [ "$OPENGL" = "YES" ]; then do_opengl="with" else do_opengl="without" fi # Patches: rm -f $TMP/patch-wine.log touch $TMP/patch-wine.log # Apply the wine-staging patches: echo -e "\n**\n** wine-staging:\n**" | tee -a $TMP/patch-wine.log tar xvf $CWD/${STSRC} python3 wine-staging-$STAGING/staging/patchinstall.py --all | tee -a $TMP/patch-wine.log # Fix for flex. patch -p1 --verbose < $CWD/0001-winhlp32-Workaround-a-bug-in-Flex.patch # Fix path of opencl headers. sed 's|OpenCL/opencl.h|CL/opencl.h|g' -i configure* wine64="" if [ "$WINE64" = "yes" ]; then echo "" echo "===========================" echo " Building WoW64 version" echo "===========================" sleep 5 wine64="--with-wine64=../wine64" mkdir wine64 cd wine64 LDFLAGS="-L/usr/lib64 -ldl" \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ../configure \ --enable-win64 \ --prefix=/usr \ --libdir=/usr/lib64 \ --localstatedir=/var \ --sysconfdir=/etc \ --mandir=/usr/man \ --with-x \ --with-gnutls \ --${do_opengl}-opengl \ --program-prefix= \ --program-suffix= \ --disable-tests \ --build=$ARCH-slackware-linux make $NUMJOBS depend make $NUMJOBS make install DESTDIR=$PKG cd .. fi if [ "$WINE32" = "yes" ]; then echo "" echo "===========================" echo " Building WoW32 version" echo "===========================" sleep 5 # Then build 32 bit version mkdir wine32 cd wine32 export PKG_CONFIG_PATH="/usr/lib/pkgconfig:$PKG_CONFIG_PATH" LDFLAGS="-L/usr/lib -ldl" \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ../configure \ $wine64 \ --prefix=/usr \ --libdir=/usr/lib \ --localstatedir=/var \ --sysconfdir=/etc \ --mandir=/usr/man \ --with-x \ --with-gnutls \ --${do_opengl}-opengl \ --program-prefix= \ --program-suffix= \ --disable-tests \ --build=$ARCH-slackware-linux make $NUMJOBS depend make $NUMJOBS # Install 32 bit version make install DESTDIR=$PKG cd .. fi # Add font configuration: install -d $PKG/etc/fonts/conf.{avail,d} install -m644 $CWD/30-win32-aliases.conf $PKG/etc/fonts/conf.avail ln -sf /etc/fonts/conf.avail/30-win32-aliases.conf $PKG/etc/fonts/conf.d/30-win32-aliases.conf # From Eric Hameleers script: # Add the wine-gecko MSI installer(s) to the Wine package: mkdir -p $PKG/usr/share/wine/gecko install -m0644 $CWD/$GSRC $PKG/usr/share/wine/gecko/ install -m0644 $CWD/$GSRC64 $PKG/usr/share/wine/gecko/ mkdir -p $PKG/usr/share/wine/mono install -m0644 $CWD/$MSRC $PKG/usr/share/wine/mono/ # Add a desktop menu for the winecfg program: mkdir -p $PKG/usr/share/{icons/hicolor/scalable/apps,pixmaps} convert $CWD/wine.svg -scale 256 $PKG/usr/share/pixmaps/wine.png install -m0644 $CWD/wine.svg $PKG/usr/share/icons/hicolor/scalable/apps/ # I used karbon to extract a single picture out of the SVG: convert $CWD/winecfg.png -scale 256 $PKG/usr/share/pixmaps/winecfg.png cp -a programs/winecfg/winecfg.svg $PKG/usr/share/icons/hicolor/scalable/apps/ mkdir -p $PKG/usr/share/applications cat <<_EOT_ > $PKG/usr/share/applications/winecfg.desktop [Desktop Entry] Exec=winecfg Icon=winecfg Terminal=false Name=Wine Configuration Name[nl]=Wine Configuratie Comment=Configure Wine Comment[nl]=Configureer Wine Type=Application Categories=Application;Settings _EOT_ cat <<_EOT_ > $PKG/usr/share/applications/winebrowser.desktop [Desktop Entry] Exec=wine winebrowser c: Icon=wine Terminal=false Name=Browse Wine's C: Drive Comment=Browse Wine's C: drive Type=Application Categories=Application; _EOT_ mkdir -p $DOCS cp -a ANNOUNCE* AUTHORS COPYING.LIB LICENSE* README* VERSION $DOCS find $PKG/usr/lib/wine/ -name "*.dll" | xargs i686-w64-mingw32-strip --strip-unneeded find $PKG/usr/lib64/wine/ -name "*.dll" | xargs x86_64-w64-mingw32-strip --strip-unneeded fixup_package $PKG # Clean up the extra stuff: set +u if [ "$1" = "--cleanup" ]; then rm -rf $TMP/wine-$VERSION rm -rf $PKG fi