wine.SlackBuild 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.17}
  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. use () { case "$1" in "$2") lib="${lib} $3" ;; *) : ;; esac; }
  46. # Selects the default wine.
  47. # $1 = WIN32
  48. # $2 = WIN64
  49. wine_arch () {
  50. if [ "${WIN32:=$1}" != no ]; then
  51. WIN32=yes
  52. fi
  53. if [ "${WIN64:=$2}" != no ]; then
  54. WIN64=yes
  55. fi
  56. }
  57. wine_build () {
  58. (
  59. mkdir -p ${PRGNAM}${LIBDIRSUFFIX}-build
  60. cd ${PRGNAM}${LIBDIRSUFFIX}-build
  61. CFLAGS="$SLKCFLAGS" \
  62. CXXFLAGS="$SLKCFLAGS" \
  63. ../configure \
  64. --prefix=/opt/$PKGNAM/$VERSION \
  65. --libdir=/opt/$PKGNAM/$VERSION/lib${LIBDIRSUFFIX} \
  66. --mandir=/opt/$PKGNAM/$VERSION/man \
  67. --docdir=/usr/doc/$PKGNAM-$VERSION \
  68. --with-gnutls=yes \
  69. --build=$ARCH-slackware-linux \
  70. "$@"
  71. make
  72. make install DESTDIR=$PKG
  73. )
  74. }
  75. if [ "$ARCH" = x86_64 ]; then
  76. if [ -f /usr/lib/libgcc_s.so ]; then
  77. wine_arch yes yes
  78. else
  79. wine_arch no yes
  80. fi
  81. else
  82. wine_arch yes no
  83. fi
  84. if [ "$WIN32" != yes ] && [ "$WIN64" != yes ]; then
  85. printf %s\\n 'ERROR: Both 32 and 64 bit builds are disabled.' >&2
  86. exit 1
  87. fi
  88. if [ "$ARCH" != x86_64 ] && [ "$WIN64" = yes ]; then
  89. printf %s\\n "ERROR: 64 bit builds are not supported on '$ARCH'." >&2
  90. exit 1
  91. fi
  92. if [ "$WIN32" = yes ] && [ "$WIN64" = yes ]; then
  93. PKGNAM=$PRGNAM
  94. elif [ "$WIN32" = yes ]; then
  95. PKGNAM=${PRGNAM}32
  96. elif [ "$WIN64" = yes ]; then
  97. PKGNAM=${PRGNAM}64
  98. fi
  99. [ "${STAGING:=no}" != no ] && PKGNAM=$PKGNAM-staging
  100. if "${CC:-gcc}" --version 2>/dev/null | grep -qi clang; then
  101. PKGNAM=$PKGNAM-clang
  102. fi
  103. if [ "${DEBUG:=no}" != no ]; then
  104. PKGNAM=$PKGNAM-debug
  105. SLKCFLAGS="$(printf %s "$SLKCFLAGS" | sed 's/-O2/-O0 -g/')"
  106. fi
  107. PKG=$TMP/package-$PKGNAM
  108. rm -rf $PKG
  109. mkdir -p $TMP $PKG $OUTPUT
  110. cd $TMP
  111. rm -rf $PKGNAM-$VERSION
  112. mkdir $PKGNAM-$VERSION
  113. cd $PKGNAM-$VERSION
  114. tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
  115. [ "$STAGING" != no ] &&
  116. tar xvf $CWD/$PRGNAM-staging-$VERSION.tar.gz
  117. chown -R root:root .
  118. find -L . \
  119. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  120. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  121. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  122. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  123. lib=
  124. use "${OPENGL:-1}" 1 --with-opengl
  125. use "${VULKAN:-1}" 1 --with-vulkan
  126. use "${CUPS:-0}" 0 --without-cups
  127. use "${DBUS:-0}" 0 --without-dbus
  128. if [ "$STAGING" != no ]; then
  129. use "${GTK3:-0}" 0 --without-gtk3
  130. ./$PRGNAM-staging-$VERSION/patches/patchinstall.sh --all \
  131. DESTDIR=$PRGNAM-$VERSION
  132. fi
  133. cd $PRGNAM-$VERSION
  134. if [ "$WIN64" = yes ]; then
  135. eval "set -- $lib"
  136. LIBDIRSUFFIX=64
  137. wine_build --enable-win64 "$@"
  138. lib="${lib} --with-wine64=../${PRGNAM}${LIBDIRSUFFIX}-build"
  139. fi
  140. if [ "$WIN32" = yes ]; then
  141. eval "set -- $lib"
  142. LIBDIRSUFFIX=
  143. wine_build "$@"
  144. fi
  145. if [ "$DEBUG" = no ]; then
  146. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" |
  147. grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  148. fi
  149. find $PKG/opt/$PKGNAM/$VERSION/man -type f -exec gzip -9 {} \;
  150. for i in $( find $PKG/opt/$PKGNAM/$VERSION/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  151. mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
  152. cp -a ANNOUNCE AUTHORS COPYING.* LICENSE* MAINTAINERS README VERSION \
  153. $PKG/usr/doc/$PKGNAM-$VERSION
  154. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PKGNAM-$VERSION/$PRGNAM.SlackBuild
  155. mkdir -p $PKG/install
  156. sed -e "s/ |-----handy-/$(printf "%${#PKGNAM}s\\n")|-----handy-/" \
  157. -e "s/$PRGNAM: $PRGNAM/$PKGNAM: $PKGNAM/" \
  158. -e "s/$PRGNAM:/$PKGNAM:/" \
  159. $CWD/slack-desc > $PKG/install/slack-desc
  160. cd $PKG
  161. /sbin/makepkg -l y -c n $OUTPUT/$PKGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}