File: gen_appimage.sh

package info (click to toggle)
mikutter 4.1.3%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,260 kB
  • sloc: ruby: 20,126; sh: 183; makefile: 19
file content (93 lines) | stat: -rwxr-xr-x 3,218 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
set -Ceu
shopt -s globstar

########################################################################
# AppImage generator script for Ubuntu Trusty 16.04
# maintained by Yuto Tokunaga <yuntan.sub1@gmail.com>
# For more information, see http://appimage.org/
########################################################################

REPO=/mikutter-src

echo "--> get mikutter source"
git --git-dir=$REPO/.git/ archive --format=tar --prefix=mikutter/ HEAD | tar xf -

BUILD_DIR="$PWD"/mikutter
APPDIR="$PWD"/AppDir
set +u
[[ -z "$ARCH" ]] && export ARCH="$(arch)"
set -u
APP=mikutter
VERSION=$(git -C "$REPO" describe --tags --abbrev=0)

echo "--> install gems"
pushd "$BUILD_DIR"
# for Travis CI, disable RVM
gems=$APPDIR/usr/lib/ruby/gems/2.6.0
# do not install test group
# NOTE option `--without=test` is persistent by .bundle/config
GEM_HOME=$gems GEM_PATH=$gems $APPDIR/usr/bin/ruby $APPDIR/usr/bin/bundle install --without=test --jobs=8
popd

echo "--> remove unused files"
rm -vrf $APPDIR/usr/share $APPDIR/usr/include $APPDIR/usr/lib/{pkgconfig,debug}
rm -v $APPDIR/**/*.{a,o}
rm -vrf $gems/cache

echo "--> copy mikutter"
mkdir -p $APPDIR/usr/share/mikutter
cp -av "$BUILD_DIR"/{.bundle,core,plugin,mikutter.rb,Gemfile,LICENSE,README} $APPDIR/usr/share/mikutter

echo "--> copy libs"
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/
cp -av /usr/lib/x86_64-linux-gnu/gtk-2.0 $APPDIR/usr/lib/

echo "--> copy Pixbuf loaders"
cp -av /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0 $APPDIR/usr/lib/

echo "--> copy Typelibs for gobject-introspection gem"
mkdir $APPDIR/usr/lib/girepository-1.0 || true
cp -av /usr/lib/girepository-1.0/* /usr/lib/x86_64-linux-gnu/girepository-1.0/* $APPDIR/usr/lib/girepository-1.0

# echo "--> patch away absolute paths"
# for gobject-introspection gem
# find usr/lib -name libgirepository-1.0.so.1 -exec sed -i -e 's|/usr/lib/girepository-1.0|.////lib/girepository-1.0|g' {} \;

# remove libssl and libcrypto
# see https://github.com/AppImage/AppImageKit/wiki/Desktop-Linux-Platform-Issues#openssl
# blacklist="libssl.so.1 libssl.so.1.0.0 libcrypto.so.1 libcrypto.so.1.0.0"
# blacklist=
# remove libharfbuzz and it's dependencies,
# see https://github.com/AppImage/AppImageKit/issues/454
# blacklist=$blacklist" libharfbuzz.so.0 libfreetype.so.6"
# for f in $blacklist; do
#   found="$(find . -name "$f" -not -path "./usr/optional/*")"
#   for f2 in $found; do
#     rm -vf "$f2" "$(readlink -f "$f2")"
#   done
# done

# prepare files for linuxdeploy
cp "$BUILD_DIR"/core/skin/data/icon.png mikutter.png
chmod +x AppRun

echo "--> get linuxdeploy"
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage

export OUTPUT=$APP-$VERSION-$ARCH.AppImage

./linuxdeploy-x86_64.AppImage --appimage-extract

./squashfs-root/AppRun \
  --appdir $APPDIR \
  --icon-file mikutter.png \
  --desktop-file mikutter.desktop \
  --custom-apprun AppRun \
  --output appimage

echo "--> generated $OUTPUT"
mv $OUTPUT $VOLUME

echo '==> finished'