wine.SlackBuild 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. #!/bin/sh
  2. # Slackware build script for wine
  3. # Copyright 2016, 2018-2019 orbea
  4. # All rights reserved.
  5. # Redistribution and use of this script, with or without modification, is
  6. # permitted provided that the following conditions are met:
  7. #
  8. # 1. Redistributions of this script must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. #
  11. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  12. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  14. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  16. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  17. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  18. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  19. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  20. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. PRGNAM=wine
  22. VERSION=${VERSION:-4.15}
  23. BUILD=${BUILD:-1}
  24. TAG=${TAG:-_SBo}
  25. if [ -z "$ARCH" ]; then
  26. case "$( uname -m )" in
  27. i?86) ARCH=i586 ;;
  28. arm*) ARCH=arm ;;
  29. *) ARCH=$( uname -m ) ;;
  30. esac
  31. fi
  32. CWD=$(pwd)
  33. TMP=${TMP:-/tmp/SBo}
  34. OUTPUT=${OUTPUT:-/tmp}
  35. if [ "$ARCH" = "i586" ]; then
  36. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  37. elif [ "$ARCH" = "i686" ]; then
  38. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  39. elif [ "$ARCH" = "x86_64" ]; then
  40. SLKCFLAGS="-O2 -fPIC"
  41. else
  42. SLKCFLAGS="-O2"
  43. fi
  44. set -eu
  45. # Selects the default wine.
  46. # $1 = WIN32
  47. # $2 = WIN64
  48. wine_arch () {
  49. if [ "${WIN32:=$1}" != no ]; then
  50. WIN32=yes
  51. fi
  52. if [ "${WIN64:=$2}" != no ]; then
  53. WIN64=yes
  54. fi
  55. }
  56. if [ "$ARCH" = x86_64 ]; then
  57. if [ -f /usr/lib/libgcc_s.so ]; then
  58. wine_arch yes yes
  59. else
  60. wine_arch no yes
  61. fi
  62. else
  63. wine_arch yes no
  64. fi
  65. if [ "$WIN32" != yes ] && [ "$WIN64" != yes ]; then
  66. printf %s\\n 'ERROR: Both 32 and 64 bit builds are disabled.' >&2
  67. exit 1
  68. fi
  69. if [ "$ARCH" != x86_64 ] && [ "$WIN64" = yes ]; then
  70. printf %s\\n "ERROR: 64 bit builds are not supported on '$ARCH'." >&2
  71. exit 1
  72. fi
  73. if [ "$WIN32" = yes ] && [ "$WIN64" = yes ]; then
  74. PKGNAM=$PRGNAM
  75. elif [ "$WIN32" = yes ]; then
  76. PKGNAM=${PRGNAM}32
  77. elif [ "$WIN64" = yes ]; then
  78. PKGNAM=${PRGNAM}64
  79. fi
  80. [ "${STAGING:=no}" != no ] && PKGNAM=$PKGNAM-staging
  81. if [ "${DEBUG:=no}" != no ]; then
  82. PKGNAM=$PKGNAM-debug
  83. SLKCFLAGS="$(printf %s "$SLKCFLAGS" | sed 's/-O2/-O0 -g/')"
  84. fi
  85. PKG=$TMP/package-$PKGNAM
  86. rm -rf $PKG
  87. mkdir -p $TMP $PKG $OUTPUT
  88. cd $TMP
  89. rm -rf $PKGNAM-$VERSION
  90. mkdir $PKGNAM-$VERSION
  91. cd $PKGNAM-$VERSION
  92. tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
  93. [ "$STAGING" != no ] &&
  94. tar xvf $CWD/$PRGNAM-staging-$VERSION.tar.gz
  95. chown -R root:root .
  96. find -L . \
  97. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  98. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  99. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  100. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  101. cd $PRGNAM-$VERSION
  102. WINE_FLAGS=" \
  103. --prefix=/opt/$PKGNAM/$VERSION \
  104. --mandir=/opt/$PKGNAM/$VERSION/man \
  105. --docdir=/usr/doc/$PKGNAM-$VERSION \
  106. --with-gnutls=yes \
  107. --build=$ARCH-slackware-linux"
  108. [ "${OPENGL:-yes}" = yes ] && WINE_FLAGS="${WINE_FLAGS} --with-opengl"
  109. [ "${VULKAN:-yes}" = yes ] && WINE_FLAGS="${WINE_FLAGS} --with-vulkan"
  110. [ "${CUPS:-no}" = no ] && WINE_FLAGS="${WINE_FLAGS} --without-cups"
  111. [ "${DBUS:-no}" = no ] && WINE_FLAGS="${WINE_FLAGS} --without-dbus"
  112. [ "${GSTREAMER:-no}" = no ] && WINE_FLAGS="${WINE_FLAGS} --without-gstreamer"
  113. if [ "$STAGING" != no ]; then
  114. [ "${GTK3:-no}" = no ] && WINE_FLAGS="${WINE_FLAGS} --without-gtk3"
  115. # Apply Staging patches
  116. (
  117. cd $TMP/$PKGNAM-$VERSION/$PRGNAM-staging-$VERSION/patches
  118. ./patchinstall.sh --all \
  119. DESTDIR=$TMP/$PKGNAM-$VERSION/$PRGNAM-$VERSION
  120. )
  121. fi
  122. if [ "$ARCH" = x86_64 ] && [ "$WIN32" = yes ]; then
  123. # TODO: Need a 32-bit clang
  124. export CC=gcc
  125. export CXX=g++
  126. fi
  127. autoreconf -fi
  128. if [ "$WIN64" = yes ]; then
  129. mkdir ${PRGNAM}64-build
  130. (
  131. cd ${PRGNAM}64-build
  132. set -- $(printf %s "$WINE_FLAGS")
  133. CFLAGS="$SLKCFLAGS" \
  134. CXXFLAGS="$SLKCFLAGS" \
  135. ../configure \
  136. --libdir=/opt/$PKGNAM/$VERSION/lib64 \
  137. --enable-win64 \
  138. "$@"
  139. make
  140. make install DESTDIR=$PKG
  141. )
  142. WINE_FLAGS="${WINE_FLAGS} --with-wine64=../${PRGNAM}64-build"
  143. fi
  144. if [ "$WIN32" = yes ]; then
  145. mkdir $PRGNAM-build
  146. (
  147. cd $PRGNAM-build
  148. set -- $(printf %s "$WINE_FLAGS")
  149. CFLAGS="$SLKCFLAGS" \
  150. CXXFLAGS="$SLKCFLAGS" \
  151. ../configure \
  152. --libdir=/opt/$PKGNAM/$VERSION/lib \
  153. "$@"
  154. make
  155. make install DESTDIR=$PKG
  156. )
  157. fi
  158. if [ "$DEBUG" = no ]; then
  159. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" |
  160. grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  161. fi
  162. find $PKG/opt/$PKGNAM/$VERSION/man -type f -exec gzip -9 {} \;
  163. for i in $( find $PKG/opt/$PKGNAM/$VERSION/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  164. mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
  165. cp -a ANNOUNCE AUTHORS COPYING.* LICENSE* MAINTAINERS README VERSION \
  166. $PKG/usr/doc/$PKGNAM-$VERSION
  167. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PKGNAM-$VERSION/$PRGNAM.SlackBuild
  168. mkdir -p $PKG/install
  169. cat $CWD/slack-desc > $PKG/install/slack-desc
  170. sed -e "s/ |-----handy-/$(printf "%${#PKGNAM}s\\n")|-----handy-/" \
  171. -e "s/$PRGNAM: $PRGNAM/$PKGNAM: $PKGNAM/" \
  172. -e "s/$PRGNAM:/$PKGNAM:/" \
  173. -i $PKG/install/slack-desc
  174. cd $PKG
  175. /sbin/makepkg -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}