libretro-samples.SlackBuild 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. #!/bin/sh
  2. # Slackware build script for libretro-samples
  3. # Copyright 2016, 2018 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. PRGNAM=libretro-samples
  23. VERSION=${VERSION:-2018.04.18_882017d}
  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. PKG=$TMP/package-$PRGNAM
  36. OUTPUT=${OUTPUT:-/tmp}
  37. LIBDIRSUFFIX=
  38. [ "$ARCH" = x86_64 ] && LIBDIRSUFFIX=64
  39. set -eu
  40. rm -rf $PKG
  41. mkdir -p $TMP $PKG $OUTPUT
  42. cd $TMP
  43. rm -rf $PRGNAM-$VERSION
  44. tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
  45. cd $PRGNAM-$VERSION
  46. chown -R root:root .
  47. find -L . \
  48. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  49. -o -perm 511 \) -exec chmod 755 {} \; -o \
  50. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  51. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  52. basic=; g=; pascal=; vulkan=
  53. [ "${DEBUG:=0}" != 0 ] && { DEBUG=1; g='-g'; }
  54. [ "${VULKAN:-0}" != 0 ] && \
  55. vulkan='video/vulkan/vk_async_compute video/vulkan/vk_rendering'
  56. # The freebasic core requires jdk and doesn't do anything.
  57. # [ -x /usr/bin/fbc ] && basic='lang/freebasic'
  58. [ -x /usr/bin/fpc ] && pascal='lang/pascal'
  59. SAMPLES="audio/audio_callback \
  60. audio/audio_no_callback \
  61. audio/audio_playback_wav \
  62. $basic \
  63. $pascal \
  64. tests/cruzes \
  65. tests/test \
  66. tests/test_advanced \
  67. video/opengl/libretro_test_gl_compute_shaders \
  68. video/opengl/libretro_test_gl_fixedfunction \
  69. video/opengl/libretro_test_gl_shaders \
  70. video/software/rendering \
  71. video/software/rendering_direct_to_vram \
  72. $vulkan"
  73. # Included with RetroArch
  74. # input/button_test \
  75. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  76. eval "set -- $SAMPLES"
  77. for core do
  78. base="${core##*/}"
  79. case "$base" in
  80. audio_callback)
  81. LIBNAM=test${base}_libretro
  82. ;;
  83. audio_no_callback)
  84. LIBNAM=test${base}_libretro
  85. ;;
  86. audio_playback_wav)
  87. LIBNAM=test${base}_libretro
  88. ;;
  89. button_test)
  90. LIBNAM=testinput_buttontest_libretro
  91. ;;
  92. cruzes)
  93. LIBNAM=${base}_libretro
  94. ;;
  95. freebasic)
  96. LIBNAM=${base}_libretro
  97. ;;
  98. libretro_test_gl_compute_shaders)
  99. LIBNAM=testgl_compute_shaders_libretro
  100. ;;
  101. libretro_test_gl_fixedfunction)
  102. LIBNAM=testgl_ff_libretro
  103. ;;
  104. libretro_test_gl_shaders)
  105. LIBNAM=testgl_libretro
  106. ;;
  107. pascal)
  108. LIBNAM=${base}_pong_libretro
  109. ;;
  110. rendering)
  111. LIBNAM=testsw_libretro
  112. ;;
  113. rendering_direct_to_vram)
  114. LIBNAM=testsw_vram_libretro
  115. ;;
  116. test)
  117. LIBNAM=${base}_libretro
  118. ;;
  119. test_advanced)
  120. LIBNAM=advanced_tests_libretro
  121. ;;
  122. vk_async_compute)
  123. LIBNAM=testvulkan_async_compute_libretro
  124. ;;
  125. vk_rendering)
  126. LIBNAM=testvulkan_libretro
  127. ;;
  128. *)
  129. printf %s\\n "$base not found"; exit 1
  130. ;;
  131. esac
  132. case "$core" in
  133. $pascal)
  134. fpc $g -o"$core/$LIBNAM.so" "$core/pong.pas"
  135. ;;
  136. $basic)
  137. fbc $g -dll "$core/fbastest.bas" -x "$core/$LIBNAM.so"
  138. ;;
  139. *)
  140. ( cd "$core" ; make DEBUG=$DEBUG )
  141. ;;
  142. esac
  143. install -Dm0644 $core/$LIBNAM.so \
  144. $PKG/usr/lib${LIBDIRSUFFIX}/libretro/$LIBNAM.so
  145. install -Dm0644 $LIBNAM.info \
  146. $PKG/usr/lib${LIBDIRSUFFIX}/libretro/info/$LIBNAM.info
  147. cp -a $core/README.md $PKG/usr/doc/$PRGNAM-$VERSION/README_$LIBNAM
  148. done
  149. if [ $DEBUG = 0 ]; then
  150. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" |
  151. grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  152. fi
  153. cp -a tests/cruzes/LICENSE $PKG/usr/doc/$PRGNAM-$VERSION/LICENSE-cruzes
  154. cp -a license tests/cruzes/LICENSE-Carlito $PKG/usr/doc/$PRGNAM-$VERSION
  155. [ ${pascal} ] && \
  156. cp -a $pascal/LICENSE $PKG/usr/doc/$PRGNAM-$VERSION/LICENSE-pascal
  157. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  158. mkdir -p $PKG/install
  159. cat $CWD/slack-desc > $PKG/install/slack-desc
  160. cd $PKG
  161. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}