-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathappimage.sh
127 lines (94 loc) · 4.86 KB
/
appimage.sh
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
########################################################################
# Package the binaries built on Travis-CI as an AppImage
# By Simon Peter 2016
# For more information, see http://appimage.org/
########################################################################
export ARCH=$(arch)
APP=Ricin
LOWERAPP=${APP,,}
GIT_REV=$(git rev-parse --short HEAD)
echo $GIT_REV
sudo chown -R $USER /home/travis/build/
cd /home/travis/build/RicinApp/
wget -q https://github.com/probonopd/AppImages/raw/master/functions.sh -O ./functions.sh
. ./functions.sh
mv Ricin $APP.AppDir
cd $APP.AppDir
mv dist/ usr/
find .
########################################################################
# Copy desktop and icon file to AppDir for AppRun to pick them up
########################################################################
get_apprun
find . -name *desktop -exec cp {} $LOWERAPP.desktop \;
sed -i -e 's|Ricin|ricin|g' $LOWERAPP.desktop
sed -i -e 's|.svg||g' $LOWERAPP.desktop
wget https://cdn.ricin.im/images/ricin-icon-plain.svg -O $LOWERAPP.svg
########################################################################
# Copy in the dependencies that cannot be assumed to be available
# on all target systems
########################################################################
# Workaround for:
# undefined symbol: g_type_check_instance_is_fundamentally_a
# Function g_type_check_instance_is_fundamentally_a was introduced in glib2-2.41.1
# Bundle libglib-2.0.so.0 - TODO: find a better solution, e.g., downgrade libglib-2.0 at compile time
mkdir -p ./usr/lib/
cp $(ldconfig -p | grep libglib-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
# The following come with glib2 and probably need to be treated together:
cp $(ldconfig -p | grep libgio-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
cp $(ldconfig -p | grep libgmodule-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
cp $(ldconfig -p | grep libgobject-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
cp $(ldconfig -p | grep libgthread-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
cp $(ldconfig -p | grep libpcre.so.3 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
export LD_LIBRARY_PATH=/home/travis/build/RicinApp/Ricin.AppImage/usr/lib/:LD_LIBRARY_PATH
copy_deps
# Move the libraries to usr/bin
move_lib
mv usr/lib/x86_64-linux-gnu/* usr/local/lib/* usr/lib/
rm -r usr/lib/x86_64-linux-gnu/ usr/local/lib/
########################################################################
# Delete stuff that should not go into the AppImage
########################################################################
# Delete dangerous libraries; see
# https://github.com/probonopd/AppImages/blob/master/excludelist
delete_blacklisted
# In this case we need to override the blacklisting, hence doing it again
cp $(ldconfig -p | grep libglib-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
# The following come with glib2 and probably need to be treated together:
cp $(ldconfig -p | grep libgio-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
cp $(ldconfig -p | grep libgmodule-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
cp $(ldconfig -p | grep libgobject-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
cp $(ldconfig -p | grep libgthread-2.0.so.0 | head -n 1 | cut -d ">" -f 2 | xargs) ./usr/lib/
# We don't bundle the developer stuff
rm -rf usr/include || true
rm -rf usr/lib/cmake || true
rm -rf usr/lib/pkgconfig || true
find . -name '*.la' | xargs -i rm {}
strip usr/bin/* usr/lib/* || true
rm -rf build docs filter_audio gcovr-* libsodium po res src tools toxcore vapis *.tar.gz codecov.yml ISSUE_TEMPLATE.md Makefile waf wscript
########################################################################
# desktopintegration asks the user on first run to install a menu item
########################################################################
( cd usr/bin ; mv Ricin ricin )
get_desktopintegration $LOWERAPP
########################################################################
# Determine the version of the app; also include needed glibc version
########################################################################
GLIBC_NEEDED=$(glibc_needed)
VERSION=git$GIT_REV-glibc$GLIBC_NEEDED
########################################################################
# Patch away absolute paths; it would be nice if they were relative
########################################################################
patch_usr
########################################################################
# AppDir complete
# Now packaging it as an AppImage
########################################################################
cd .. # Go out of AppImage
mkdir -p ../out/
generate_appimage
########################################################################
# Upload the AppDir
########################################################################
transfer ../out/*