libretro-samples.SlackBuild 5.3 KB

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