dxvk.build 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #!/bin/sh
  2. # build script for dxvk
  3. # Copyright 2021-2022 orbea
  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. set -euf
  23. cd -- "$(cd -- "${0%/*}/" && pwd -P)"
  24. PRGNAM=dxvk
  25. VERSION=${VERSION:-1.10.2}
  26. URL="https://github.com/doitsujin/$PRGNAM/archive/v$VERSION/$PRGNAM-$VERSION.tar.gz"
  27. . ../../functions
  28. PKG="$HOME"/games/tools/$PRGNAM
  29. SRC="$TARSRC"/$PRGNAM-$VERSION.tar.gz
  30. TMP="$TMP"/$PRGNAM
  31. _download "$SRC" "$PRGNAM-$VERSION.tar.gz" "$URL"
  32. rm -rf -- "$TMP"
  33. mkdir -p -- "$TMP"
  34. cd -- "$TMP"
  35. tar xvf "$SRC"
  36. cd -- "$PRGNAM-$VERSION"
  37. _flags meson
  38. if _exists i686-w64-mingw32-g++ x86_64-w64-mingw32-g++ >/dev/null 2>&1; then
  39. arch='32 64'
  40. elif _exists i686-w64-mingw32-g++ >/dev/null 2>&1; then
  41. arch=32
  42. elif _exists x86_64-w64-mingw32-g++ >/dev/null 2>&1; then
  43. arch=64
  44. else
  45. _die 1 'ERROR: mingw-w64 is not installed.'
  46. fi
  47. eval "set -- $arch"
  48. for bin do
  49. CFLAGS="$BLDFLAGS" \
  50. CXXFLAGS="$BLDFLAGS" \
  51. _meson "$TMP"/build$bin \
  52. --libdir=share/$PRGNAM/x$bin \
  53. --bindir=share/$PRGNAM/x$bin \
  54. --cross-file=build-win$bin.txt
  55. done
  56. mkdir -p -- "$DST$PKG"/bin
  57. cat > "$DST$PKG"/bin/setup_$PRGNAM<<EOF
  58. #!/bin/sh
  59. set -eu
  60. d3d10=
  61. dxgi=
  62. install=
  63. while [ \$# -gt 0 ]; do
  64. option="\$1"
  65. shift
  66. case "\$option" in
  67. -- )
  68. break
  69. ;;
  70. --with-d3d10 )
  71. d3d10="\$option"
  72. ;;
  73. --without-dxgi )
  74. dxgi="\$option"
  75. ;;
  76. install|uninstall )
  77. install="\$option"
  78. ;;
  79. * )
  80. printf '%s\\n' "Unrecognized option '\$option'." >&2
  81. exit 1
  82. ;;
  83. esac
  84. done
  85. $DST$PKG/share/$PRGNAM/setup_$PRGNAM.sh "\$install" --symlink \$d3d10 \$dxgi
  86. EOF
  87. cp setup_$PRGNAM.sh "$DST$PKG"/share/$PRGNAM
  88. chmod 0755 "$DST$PKG"/share/$PRGNAM/setup_$PRGNAM.sh
  89. chmod 0755 "$DST$PKG"/bin/setup_$PRGNAM
  90. _install_strip "$PRGNAM" "$VERSION" "$PKG" "$TMP/$PRGNAM-$VERSION" LICENSE \
  91. README.md
  92. exit 0