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