123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- #!/bin/sh
- # Slackware build script for wine
- # Copyright 2016, 2018-2020 orbea
- # All rights reserved.
- # 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.
- PRGNAM=wine
- VERSION=${VERSION:-5.0}
- STAGING_VERSION=${STAGING_VERSION:-$VERSION}
- BUILD=${BUILD:-1}
- TAG=${TAG:-_SBo}
- if [ -z "$ARCH" ]; then
- case "$( uname -m )" in
- i?86) ARCH=i586 ;;
- arm*) ARCH=arm ;;
- *) ARCH=$( uname -m ) ;;
- esac
- fi
- CWD=$(pwd)
- TMP=${TMP:-/tmp/SBo}
- OUTPUT=${OUTPUT:-/tmp}
- if [ "$ARCH" = "i586" ]; then
- SLKCFLAGS="-O2 -march=i586 -mtune=i686"
- elif [ "$ARCH" = "i686" ]; then
- SLKCFLAGS="-O2 -march=i686 -mtune=i686"
- elif [ "$ARCH" = "x86_64" ]; then
- SLKCFLAGS="-O2 -fPIC"
- else
- SLKCFLAGS="-O2"
- fi
- set -eu
- use () { case "$1" in "$2") lib="${lib} $3" ;; *) : ;; esac; }
- # Selects the default wine.
- # $1 = WIN32
- # $2 = WIN64
- wine_arch () {
- if [ "${WIN32:=$1}" != no ]; then
- WIN32=yes
- fi
- if [ "${WIN64:=$2}" != no ]; then
- WIN64=yes
- fi
- }
- wine_build () {
- (
- mkdir -p ${PRGNAM}${LIBDIRSUFFIX}-build
- cd ${PRGNAM}${LIBDIRSUFFIX}-build
- eval "set -- ${@:-} $lib"
- CFLAGS="$SLKCFLAGS" \
- CXXFLAGS="$SLKCFLAGS" \
- ../configure \
- --prefix=/opt/$PKGNAM/$VERSION \
- --libdir=/opt/$PKGNAM/$VERSION/lib${LIBDIRSUFFIX} \
- --mandir=/opt/$PKGNAM/$VERSION/man \
- --docdir=/usr/doc/$PKGNAM-$VERSION \
- --with-gnutls=yes \
- --build=$ARCH-slackware-linux \
- "$@"
- make
- make install DESTDIR=$PKG
- )
- }
- if [ "$ARCH" = x86_64 ]; then
- if [ -f /usr/lib/libgcc_s.so ]; then
- wine_arch yes yes
- else
- wine_arch no yes
- fi
- else
- wine_arch yes no
- fi
- if [ "$WIN32" != yes ] && [ "$WIN64" != yes ]; then
- printf %s\\n 'ERROR: Both 32 and 64 bit builds are disabled.' >&2
- exit 1
- fi
- if [ "$ARCH" != x86_64 ] && [ "$WIN64" = yes ]; then
- printf %s\\n "ERROR: 64 bit builds are not supported on '$ARCH'." >&2
- exit 1
- fi
- if [ "$WIN32" = yes ] && [ "$WIN64" = yes ]; then
- PKGNAM=$PRGNAM
- elif [ "$WIN32" = yes ]; then
- PKGNAM=${PRGNAM}32
- elif [ "$WIN64" = yes ]; then
- PKGNAM=${PRGNAM}64
- fi
- [ "${STAGING:=no}" = no ] || PKGNAM=$PKGNAM-staging
- if "${CC:-gcc}" --version 2>/dev/null | grep -qi clang; then
- PKGNAM=$PKGNAM-clang
- fi
- if [ "${DEBUG:=no}" != no ]; then
- PKGNAM=$PKGNAM-debug
- SLKCFLAGS="$(printf %s "$SLKCFLAGS" | sed 's/-O2/-O0 -g/')"
- fi
- PKG=$TMP/package-$PKGNAM
- rm -rf $PKG
- mkdir -p $TMP $PKG $OUTPUT
- cd $TMP
- rm -rf $PKGNAM-$VERSION
- mkdir $PKGNAM-$VERSION
- cd $PKGNAM-$VERSION
- tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
- [ "$STAGING" = no ] ||
- tar xvf $CWD/$PRGNAM-staging-$STAGING_VERSION.tar.gz
- 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 {} \+
- lib=
- use "${OPENGL:-1}" 1 --with-opengl
- use "${VULKAN:-1}" 1 --with-vulkan
- use "${CUPS:-0}" 0 --without-cups
- use "${DBUS:-0}" 0 --without-dbus
- if [ "$STAGING" != no ]; then
- use "${GTK3:-0}" 0 --without-gtk3
- ./$PRGNAM-staging-$STAGING_VERSION/patches/patchinstall.sh --all \
- DESTDIR=$PRGNAM-$VERSION
- fi
- cd $PRGNAM-$VERSION
- case "$VERSION" in
- *-* ) VERSION="$(printf %s\\n "$VERSION" | tr - _)" ;;
- esac
- if [ "$WIN64" = yes ]; then
- LIBDIRSUFFIX=64
- wine_build --enable-win64
- lib="${lib} --with-wine64=../${PRGNAM}${LIBDIRSUFFIX}-build"
- fi
- if [ "$WIN32" = yes ]; then
- LIBDIRSUFFIX=
- wine_build
- fi
- if [ "$DEBUG" = no ]; then
- 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
- fi
- find $PKG/opt/$PKGNAM/$VERSION/man -type f -exec gzip -9 {} \;
- for i in $( find $PKG/opt/$PKGNAM/$VERSION/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
- mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
- cp -a ANNOUNCE AUTHORS COPYING.* LICENSE* MAINTAINERS README VERSION \
- $PKG/usr/doc/$PKGNAM-$VERSION
- cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PKGNAM-$VERSION/$PRGNAM.SlackBuild
- mkdir -p $PKG/install
- sed -e "s/ |-----handy-/$(printf "%${#PKGNAM}s\\n")|-----handy-/" \
- -e "s/$PRGNAM: $PRGNAM/$PKGNAM: $PKGNAM/" \
- -e "s/$PRGNAM:/$PKGNAM:/" \
- $CWD/slack-desc > $PKG/install/slack-desc
- cd $PKG
- /sbin/makepkg -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|