appimage.sh 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #!/bin/bash
  2. set -x
  3. ########################################################################
  4. # Package the binaries built on Travis-CI as an AppImage
  5. # By Simon Peter 2016
  6. # For more information, see http://appimage.org/
  7. ########################################################################
  8. export ARCH=$(arch)
  9. APP=SuperTux
  10. LOWERAPP=supertux2
  11. GIT_REV=$(git rev-parse --short HEAD)
  12. echo $GIT_REV
  13. RELEASE_VERSION=$(git describe --tags)
  14. make install DESTDIR=$HOME/$APP/$APP.AppDir
  15. cd $HOME/$APP/
  16. wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
  17. . ./functions.sh
  18. cd $APP.AppDir
  19. ########################################################################
  20. # Copy desktop and icon file to AppDir for AppRun to pick them up
  21. ########################################################################
  22. get_apprun
  23. get_desktop
  24. # Our icon filename doesn't match the binary filename, so we can't use the
  25. # get_icon function here.
  26. find ./usr/share/pixmaps/supertux.png -exec cp {} . \; 2>/dev/null || true
  27. find ./usr/share/icons -path *64* -name supertux.png -exec cp {} . \; 2>/dev/null || true
  28. find ./usr/share/icons -path *128* -name supertux.png -exec cp {} . \; 2>/dev/null || true
  29. find ./usr/share/icons -path *512* -name supertux.png -exec cp {} . \; 2>/dev/null || true
  30. find ./usr/share/icons -path *256* -name supertux.png -exec cp {} . \; 2>/dev/null || true
  31. ls -lh supertux.png || true
  32. # Fix desktop file so it works with generate_type2_appimage
  33. sed -i 's/Icon=supertux\.png/Icon=supertux/' supertux2.desktop
  34. ########################################################################
  35. # Copy in the dependencies that cannot be assumed to be available
  36. # on all target systems
  37. ########################################################################
  38. copy_deps
  39. if [ -d "./usr/lib/x86_64-linux-gnu/gstreamer-1.0/" ] ; then
  40. mv -v ./usr/lib/x86_64-linux-gnu/gstreamer-1.0/* ./usr/lib/x86_64-linux-gnu/
  41. rm -vr ./usr/lib/x86_64-linux-gnu/gstreamer-1.0
  42. fi
  43. if [ -d "./usr/lib/x86_64-linux-gnu/pulseaudio/" ] ; then
  44. mv -v ./usr/lib/x86_64-linux-gnu/pulseaudio/* ./usr/lib/x86_64-linux-gnu/
  45. rm -vr ./usr/lib/x86_64-linux-gnu/pulseaudio
  46. fi
  47. ########################################################################
  48. # Delete stuff that should not go into the AppImage
  49. ########################################################################
  50. # Delete dangerous libraries; see
  51. # https://github.com/probonopd/AppImages/blob/master/excludelist
  52. #delete_blacklisted # We'll need to specify our own blacklist, see below.
  53. # Fix the function ourselves for now
  54. # Delete blacklisted files
  55. delete_blacklisted_patched()
  56. {
  57. BLACKLISTED_FILES=$( cat_file_from_url https://github.com/probonopd/AppImages/raw/master/excludelist | sed '/^\s*$/d' | sed '/^#.*$/d' | sed '/libkrb5.so.26/d' | sed '/libkrb5.so.3/d' | sed '/libhcrypto.so.4/d' | sed '/libhx509.so.5/d' | sed '/libroken.so.18/d' | sed '/libwind.so.0/d')
  58. echo $BLACKLISTED_FILES
  59. for FILE in $BLACKLISTED_FILES ; do
  60. FOUND=$(find . -xtype f -name "${FILE}" 2>/dev/null)
  61. if [ ! -z "$FOUND" ] ; then
  62. echo "Deleting blacklisted ${FOUND}"
  63. rm -f "${FOUND}"
  64. fi
  65. done
  66. # Do not bundle developer stuff
  67. rm -rf usr/include || true
  68. rm -rf usr/lib/cmake || true
  69. rm -rf usr/lib/pkgconfig || true
  70. find . -name '*.la' | xargs -i rm {}
  71. }
  72. delete_blacklisted_patched
  73. ########################################################################
  74. # desktopintegration asks the user on first run to install a menu item
  75. ########################################################################
  76. get_desktopintegration $LOWERAPP
  77. ########################################################################
  78. # Determine the version of the app; also include needed glibc version
  79. ########################################################################
  80. GLIBC_NEEDED=$(glibc_needed)
  81. VERSION=${RELEASE_VERSION}-glibc$GLIBC_NEEDED
  82. ########################################################################
  83. # Patch away absolute paths; it would be nice if they were relative
  84. ########################################################################
  85. sed -i -e 's|/usr|././|g' usr/bin/supertux2
  86. ########################################################################
  87. # AppDir complete
  88. # Now packaging it as an AppImage
  89. ########################################################################
  90. cd .. # Go out of AppImage
  91. mkdir -p ../out/
  92. generate_type2_appimage
  93. ########################################################################
  94. # Upload the AppDir
  95. ########################################################################
  96. transfer ../out/*