mangohud.SlackBuild 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. #!/bin/bash
  2. # Slackware build script for mangohud
  3. # Copyright 2022 Steven Voges <svoges.sbo@gmail.com>
  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=mangohud
  24. SRCNAM=MangoHud
  25. VERSION=${VERSION:-0.6.8}
  26. SRCVER=${SRCVER:-0.6.8}
  27. IMGUIVER=${IMGUIVER:-1.81}
  28. SPDLOGVER=${SPDLOGVER:-1.8.5}
  29. BUILD=${BUILD:-1}
  30. TAG=${TAG:-_SBo}
  31. PKGTYPE=${PKGTYPE:-tgz}
  32. COMPAT32=${COMPAT32:-no}
  33. XNVCTRL=${XNVCTRL:-disabled}
  34. SYSVULKAN=${SYSVULKAN:-enabled}
  35. MANGOAPP=${MANGOAPP:-true}
  36. if [ -z "$ARCH" ]; then
  37. case "$( uname -m )" in
  38. i?86) ARCH=i586 ;;
  39. arm*) ARCH=arm ;;
  40. *) ARCH=$( uname -m ) ;;
  41. esac
  42. fi
  43. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  44. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  45. exit 0
  46. fi
  47. TMP=${TMP:-/tmp/SBo}
  48. PKG=$TMP/package-$PRGNAM
  49. OUTPUT=${OUTPUT:-/tmp}
  50. if [ "$ARCH" = "i586" ]; then
  51. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  52. LIBDIRSUFFIX=""
  53. elif [ "$ARCH" = "i686" ]; then
  54. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  55. LIBDIRSUFFIX=""
  56. elif [ "$ARCH" = "x86_64" ]; then
  57. SLKCFLAGS="-O2 -fPIC"
  58. LIBDIRSUFFIX="64"
  59. else
  60. SLKCFLAGS="-O2"
  61. LIBDIRSUFFIX=""
  62. fi
  63. set -e
  64. rm -rf $PKG
  65. mkdir -p $TMP $PKG $OUTPUT
  66. cd $TMP
  67. rm -rf $SRCNAM-$SRCVER
  68. tar xvf $CWD/$SRCNAM-$SRCVER.tar.?z
  69. cd $SRCNAM-$SRCVER/subprojects
  70. tar xvf $CWD/imgui-$IMGUIVER.tar.gz
  71. unzip $CWD/imgui_$IMGUIVER-1_patch.zip
  72. tar xvf $CWD/spdlog-$SPDLOGVER.tar.gz
  73. unzip $CWD/spdlog_$SPDLOGVER-1_patch.zip
  74. cd ..
  75. chown -R root:root .
  76. #Slackware 15.0 ships meson 59.4, and mangohud requires 60.0, so we patch it.
  77. patch -p0 <$CWD/meson594.patch
  78. find -L . \
  79. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  80. -o -perm 511 \) -exec chmod 755 {} \; -o \
  81. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  82. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  83. mkdir build
  84. cd build
  85. CFLAGS="$SLKCFLAGS" \
  86. CXXFLAGS="$SLKCFLAGS" \
  87. LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}" \
  88. meson .. \
  89. --buildtype=release \
  90. --infodir=/usr/info \
  91. --libdir=/usr/lib${LIBDIRSUFFIX} \
  92. --localstatedir=/var \
  93. --mandir=/usr/man \
  94. --prefix=/usr \
  95. --sysconfdir=/etc \
  96. -Duse_system_vulkan=$SYSVULKAN \
  97. -Dwith_xnvctrl=$XNVCTRL \
  98. -Dmangoapp=$MANGOAPP
  99. ninja
  100. DESTDIR=$PKG ninja install
  101. cd ..
  102. if [ "$COMPAT32" = "yes" ]; then
  103. mkdir build32
  104. cd build32
  105. CC="gcc -m32" \
  106. CXX="g++ -m32" \
  107. CFLAGS="$SLKCFLAGS" \
  108. CXXFLAGS="$SLKCFLAGS" \
  109. LDFLAGS="-L/usr/lib" \
  110. PKG_CONFIG_PATH="/usr/lib/pkgconfig" \
  111. meson .. \
  112. --buildtype=release \
  113. --infodir=/usr/info \
  114. --libdir=/usr/lib \
  115. --localstatedir=/var \
  116. --mandir=/usr/man \
  117. --prefix=/usr \
  118. --sysconfdir=/etc \
  119. -Duse_system_vulkan=$SYSVULKAN \
  120. -Dwith_xnvctrl=$XNVCTRL \
  121. -Dmangoapp=$MANGOAPP
  122. ninja
  123. DESTDIR=$PKG ninja install
  124. cd ..
  125. fi
  126. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  127. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  128. find $PKG/usr/man -type f -exec gzip -9 {} \;
  129. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  130. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  131. cp -a LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION
  132. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  133. mv $PKG/usr/share/doc/$PRGNAM/$SRCNAM.conf.example \
  134. $PKG/usr/doc/$PRGNAM-$VERSION/
  135. rm -rf $PKG/usr/share/doc
  136. mkdir -p $PKG/install
  137. cat $CWD/slack-desc > $PKG/install/slack-desc
  138. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  139. cd $PKG
  140. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE