wine-nine-standalone.SlackBuild 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #!/bin/bash
  2. # Slackware build script for wine-nine-standalone
  3. # Copyright 2019-2020 Hunter Sezen California, USA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. cd $(dirname $0) ; CWD=$(pwd)
  23. PRGNAM=wine-nine-standalone
  24. VERSION=${VERSION:-0.8}
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. PKGTYPE=${PKGTYPE:-tgz}
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) ARCH=i586 ;;
  31. arm*) ARCH=arm ;;
  32. *) ARCH=$( uname -m ) ;;
  33. esac
  34. fi
  35. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  36. # the name of the created package would be, and then exit. This information
  37. # could be useful to other scripts.
  38. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  39. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  40. exit 0
  41. fi
  42. TMP=${TMP:-/tmp/SBo}
  43. PKG=$TMP/package-$PRGNAM
  44. OUTPUT=${OUTPUT:-/tmp}
  45. if [ "$ARCH" = "i586" ]; then
  46. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "i686" ]; then
  49. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  50. LIBDIRSUFFIX=""
  51. elif [ "$ARCH" = "x86_64" ]; then
  52. SLKCFLAGS="-O2 -fPIC"
  53. LIBDIRSUFFIX="64"
  54. else
  55. SLKCFLAGS="-O2"
  56. LIBDIRSUFFIX=""
  57. fi
  58. set -eu
  59. exists () {
  60. r=0; cwd="$(pwd)"
  61. while [ $# -gt 0 ]; do
  62. v=1; arg="$1"; shift
  63. case "$arg" in
  64. ''|*/ )
  65. :
  66. ;;
  67. /* )
  68. if [ -f "$arg" ] && [ -x "$arg" ]; then
  69. printf %s\\n "$arg"
  70. v=0
  71. fi
  72. ;;
  73. ./* )
  74. if [ -f "$arg" ] && [ -x "$arg" ]; then
  75. pre="$(cd -- "${arg%%/*}/" && pwd)"
  76. printf %s\\n "${pre%/}/$arg"
  77. v=0
  78. fi
  79. ;;
  80. */* )
  81. if [ -f "$arg" ] && [ -x "$arg" ]; then
  82. printf %s\\n "$(cd -- "${arg%%/*}/.." && pwd)/$arg"
  83. v=0
  84. fi
  85. ;;
  86. * )
  87. if [ -n "${PATH+x}" ]; then
  88. p=":${PATH:-$cwd}"
  89. while [ "$p" != "${p#*:}" ] && [ -n "${p#*:}" ]; do
  90. p="${p#*:}"; x="${p%%:*}"; z="${x:-$cwd}"; d="${z%/}/$arg"
  91. if [ -f "$d" ] && [ -x "$d" ]; then
  92. case "$d" in
  93. /* ) : ;;
  94. ./* ) pre="$(cd -- "${d%/*}/" && pwd)"; d="${pre%/}/$d" ;;
  95. * ) d="$(cd -- "${d%/*}/" && pwd)/$arg" ;;
  96. esac
  97. printf %s\\n "$d"
  98. v=0
  99. break
  100. fi
  101. done
  102. fi
  103. ;;
  104. esac
  105. [ $v = 0 ] || r=1
  106. done
  107. return $r
  108. }
  109. rm -rf $PKG
  110. mkdir -p $TMP $PKG $OUTPUT
  111. cd $TMP
  112. rm -rf $PRGNAM-$VERSION
  113. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  114. cd $PRGNAM-$VERSION
  115. chown -R root:root .
  116. find -L . \
  117. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  118. -o -perm 511 \) -exec chmod 755 {} \; -o \
  119. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  120. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  121. if [ "${DEBUG:=0}" != 0 ]; then
  122. NDEBUG=false
  123. RELEASE=debug
  124. SLKCFLAGS="$(printf %s "$SLKCFLAGS" | sed 's/-O2/-O0/')"
  125. else
  126. NDEBUG=true
  127. RELEASE=plain
  128. fi
  129. if [ "$ARCH" = x86_64 ]; then
  130. if exists wine >/dev/null 2>&1 && exists wine64 >/dev/null 2>&1; then
  131. arch='32 64'
  132. elif exists wine >/dev/null 2>&1; then
  133. arch=32
  134. else
  135. arch=64
  136. fi
  137. else
  138. arch=32
  139. fi
  140. ./bootstrap.sh
  141. eval "set -- $arch"
  142. for bin do
  143. case "$bin" in
  144. 32 ) suffix= ;;
  145. 64 ) suffix=64 ;;
  146. esac
  147. CFLAGS="$SLKCFLAGS" \
  148. CXXFLAGS="$SLKCFLAGS" \
  149. meson \
  150. --prefix=/tmp \
  151. --libdir=lib$bin \
  152. --bindir=bin$bin \
  153. --cross-file=tools/cross-wine$bin \
  154. -Dstrip=$NDEBUG \
  155. -Db_ndebug=$NDEBUG \
  156. -Dbuildtype=$RELEASE \
  157. build$bin
  158. "${NINJA:=ninja}" -C build$bin
  159. DESTDIR=. "$NINJA" -C build$bin install
  160. mkdir -p $PKG/usr/lib$suffix/wine/fakedlls
  161. cp ./build$bin/tmp/bin$bin/ninewinecfg.exe.so \
  162. $PKG/usr/lib$suffix/wine/fakedlls/ninewinecfg.exe
  163. cp ./build$bin/tmp/lib$bin/d3d9-nine.dll.so \
  164. $PKG/usr/lib$suffix/wine/fakedlls/d3d9-nine.dll
  165. chmod 0644 $PKG/usr/lib$suffix/wine/fakedlls/ninewinecfg.exe
  166. chmod 0644 $PKG/usr/lib$suffix/wine/fakedlls/d3d9-nine.dll
  167. mkdir -p $PKG/usr/bin
  168. cat > $PKG/usr/bin/ninewinecfg$suffix <<EOF
  169. #!/bin/sh
  170. wine$suffix /usr/lib$suffix/wine/fakedlls/ninewinecfg.exe
  171. EOF
  172. chmod 0755 $PKG/usr/bin/ninewinecfg$suffix
  173. done
  174. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  175. cp LICENSE README.rst $PKG/usr/doc/$PRGNAM-$VERSION
  176. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  177. mkdir -p $PKG/install
  178. cat $CWD/slack-desc > $PKG/install/slack-desc
  179. cd $PKG
  180. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE