build_appimage.sh 4.4 KB

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