vkd3d-proton.build 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/sh
  2. # build script for vkd3d-proton
  3. # Copyright 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=vkd3d-proton
  25. SRCNAM=$(printf %s\\n "$PRGNAM" | tr - _)
  26. BRANCH=${BRANCH:-master}
  27. URL="https://github.com/HansKristian-Work/$PRGNAM"
  28. . ../../functions
  29. . ../env.tools
  30. _git "$SRC" "$PRGNAM" "$URL" "$TMP" "$BRANCH" "${COMMIT:-}" 1
  31. _flags meson
  32. if _exists i686-w64-mingw32-g++ x86_64-w64-mingw32-g++ >/dev/null 2>&1; then
  33. arch='32 64'
  34. elif _exists i686-w64-mingw32-g++ >/dev/null 2>&1; then
  35. arch=32
  36. elif _exists x86_64-w64-mingw32-g++ >/dev/null 2>&1; then
  37. arch=64
  38. else
  39. _die 1 'ERROR: mingw-w64 is not installed.'
  40. fi
  41. eval "set -- $arch"
  42. for bin do
  43. CFLAGS="$BLDFLAGS" \
  44. CXXFLAGS="$BLDFLAGS" \
  45. _meson "$TMP"/build$bin \
  46. --libdir=share/$SRCNAM/x$bin \
  47. --bindir=share/$SRCNAM/x$bin \
  48. --cross-file=build-win$bin.txt
  49. done
  50. mkdir -p -- "$DST$PKG"/bin
  51. cat > "$DST$PKG"/bin/setup_$SRCNAM<<EOF
  52. #!/bin/sh
  53. set -eu
  54. install=
  55. while [ \$# -gt 0 ]; do
  56. option="\$1"
  57. shift
  58. case "\$option" in
  59. -- )
  60. break
  61. ;;
  62. install|uninstall )
  63. install="\$option"
  64. ;;
  65. * )
  66. printf '%s\\n' "Unrecognized option '\$option'." >&2
  67. exit 1
  68. ;;
  69. esac
  70. done
  71. $DST$PKG/share/$SRCNAM/setup_$SRCNAM.sh "\$install" --symlink
  72. EOF
  73. cp setup_$SRCNAM.sh "$DST$PKG"/share/$SRCNAM/setup_$SRCNAM.sh
  74. chmod 0755 "$DST$PKG"/share/$SRCNAM/setup_$SRCNAM.sh
  75. chmod 0755 "$DST$PKG"/bin/setup_$SRCNAM
  76. _install_strip "$PRGNAM" "$VERSION" "$PKG" "$SRC" LICENSE README.md
  77. exit 0