wine.SlackBuild 5.2 KB

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