Debian Codegraph @

deployment/appimage/gen_appimage.sh

raw symbols SCIP
1 #!/bin/bash
2 set -Ceu
3 shopt -s globstar
4
5 ########################################################################
6 # AppImage generator script for Ubuntu Trusty 16.04
7 # maintained by Yuto Tokunaga <[email protected]>
8 # For more information, see http://appimage.org/
9 ########################################################################
10
11 REPO=/mikutter-src
12
13 echo "--> get mikutter source"
14 git --git-dir=$REPO/.git/ archive --format=tar --prefix=mikutter/ HEAD | tar xf -
15
16 BUILD_DIR="$PWD"/mikutter
17 APPDIR="$PWD"/AppDir
18 set +u
19 [[ -z "$ARCH" ]] && export ARCH="$(arch)"
20 set -u
21 APP=mikutter
22 VERSION=$(git -C "$REPO" describe --tags --abbrev=0)
23
24 echo "--> install gems"
25 pushd "$BUILD_DIR"
26 # for Travis CI, disable RVM
27 gems=$APPDIR/usr/lib/ruby/gems/2.6.0
28 # do not install test group
29 # NOTE option `--without=test` is persistent by .bundle/config
30 GEM_HOME=$gems GEM_PATH=$gems $APPDIR/usr/bin/ruby $APPDIR/usr/bin/bundle install --without=test --jobs=8
31 popd
32
33 echo "--> remove unused files"
34 rm -vrf $APPDIR/usr/share $APPDIR/usr/include $APPDIR/usr/lib/{pkgconfig,debug}
35 rm -v $APPDIR/**/*.{a,o}
36 rm -vrf $gems/cache
37
38 echo "--> copy mikutter"
39 mkdir -p $APPDIR/usr/share/mikutter
40 cp -av "$BUILD_DIR"/{.bundle,core,plugin,mikutter.rb,Gemfile,LICENSE,README} $APPDIR/usr/share/mikutter
41
42 echo "--> copy libs"
43 cp -av /usr/lib/x86_64-linux-gnu/{libffi.so*,libgirepository-1.0.so*,libgobject-2.0.so*,libgio-2.0.so*,libgdk-x11-2.0.so*,libgdk_pixbuf-2.0.so*,libgdk_pixbuf_xlib-2.0.so*,libgtk-x11-2.0.so*} $APPDIR/usr/lib/
44 cp -av /usr/lib/x86_64-linux-gnu/gtk-2.0 $APPDIR/usr/lib/
45
46 echo "--> copy Pixbuf loaders"
47 cp -av /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0 $APPDIR/usr/lib/
48
49 echo "--> copy Typelibs for gobject-introspection gem"
50 mkdir $APPDIR/usr/lib/girepository-1.0 || true
51 cp -av /usr/lib/girepository-1.0/* /usr/lib/x86_64-linux-gnu/girepository-1.0/* $APPDIR/usr/lib/girepository-1.0
52
53 # echo "--> patch away absolute paths"
54 # for gobject-introspection gem
55 # find usr/lib -name libgirepository-1.0.so.1 -exec sed -i -e 's|/usr/lib/girepository-1.0|.////lib/girepository-1.0|g' {} \;
56
57 # remove libssl and libcrypto
58 # see https://github.com/AppImage/AppImageKit/wiki/Desktop-Linux-Platform-Issues#openssl
59 # blacklist="libssl.so.1 libssl.so.1.0.0 libcrypto.so.1 libcrypto.so.1.0.0"
60 # blacklist=
61 # remove libharfbuzz and it's dependencies,
62 # see https://github.com/AppImage/AppImageKit/issues/454
63 # blacklist=$blacklist" libharfbuzz.so.0 libfreetype.so.6"
64 # for f in $blacklist; do
65 # found="$(find . -name "$f" -not -path "./usr/optional/*")"
66 # for f2 in $found; do
67 # rm -vf "$f2" "$(readlink -f "$f2")"
68 # done
69 # done
70
71 # prepare files for linuxdeploy
72 cp "$BUILD_DIR"/core/skin/data/icon.png mikutter.png
73 chmod +x AppRun
74
75 echo "--> get linuxdeploy"
76 wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
77 chmod +x linuxdeploy-x86_64.AppImage
78
79 export OUTPUT=$APP-$VERSION-$ARCH.AppImage
80
81 ./linuxdeploy-x86_64.AppImage --appimage-extract
82
83 ./squashfs-root/AppRun \
84 --appdir $APPDIR \
85 --icon-file mikutter.png \
86 --desktop-file mikutter.desktop \
87 --custom-apprun AppRun \
88 --output appimage
89
90 echo "--> generated $OUTPUT"
91 mv $OUTPUT $VOLUME
92
93 echo '==> finished'