-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmake-appimage.sh
executable file
·208 lines (176 loc) · 4.78 KB
/
make-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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#!/bin/bash
set -ev
if [ -z "$DOCKER_BUILD" ]; then
echo "This script is only meant to be used with the linuxdeploy build"
echo "helper container."
echo "See the 0ad-appimage README for details."
exit 1
fi
if [ -z "$VERSION" ]; then
echo "VERSION must be set"
exit 1
fi
if [[ "$WORKSPACE" != /* ]]; then
echo "The workspace path must be absolute"
exit 1
fi
test -d "$WORKSPACE"
SOURCE_ROOT="$WORKSPACE/0ad-$VERSION"
if [[ "$SOURCE_ROOT" != /* ]]; then
echo "The source root path must be absolute"
exit 1
fi
APPDIR=${APPDIR:-"/tmp/$USER-AppDir"}
if [ -d "$APPDIR" ]; then
rm -rf "$APPDIR"
else
mkdir -v -p "$APPDIR"
fi
env
export -p
URI="https://releases.wildfiregames.com"
cd $WORKSPACE
if [ ! -e "AppRun" ]; then
echo "You must be in the same directory where the AppRun file resides"
exit 1
fi
cd "$WORKSPACE"
sudo DEBIAN_FRONTEND=noninteractive -i sh -c "apt update && apt -y upgrade &&
apt install -y
cargo
cmake
curl
$CC
libboost-dev
libboost-filesystem-dev
libboost-system-dev
libcurl4-gnutls-dev
libenet-dev
libfmt-dev
libfreetype6-dev
libgloox-dev
libicu-dev
libminiupnpc-dev
libogg-dev
libopenal-dev
libpng-dev
libsdl2-dev
libsodium-dev
libvorbis-dev
libwxgtk3.0-gtk3-dev
libxml2-dev
llvm
m4
patchelf
python3
rustc
zlib1g-dev
"
PREMAKE="premake-5.0.0-beta4-linux.tar.gz"
if [ ! -f "$PREMAKE" ]; then
wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta4/$PREMAKE
tar -xvf "$PREMAKE"
sudo mv premake5 /usr/bin
fi
source=0ad-$VERSION-unix-build.tar.xz
source_sum=$source.sha1sum
for file in $source $source_sum; do
if [ ! -f "$file" ]; then
curl -LO "$URI/$file"
fi
done
sha1sum -c $source_sum
if [ ! -r "$SOURCE_ROOT/source/main.cpp" ]; then
tar -xJf $source
fi
cd "$SOURCE_ROOT/libraries"
./build-source-libs.sh -j$(nproc)
cd "$SOURCE_ROOT/build/workspaces"
./update-workspaces.sh \
--without-pch \
--with-lto \
-j$(nproc)
make config=release -C gcc -j$(nproc)
cd $WORKSPACE
data=0ad-$VERSION-unix-data.tar.xz
data_sum=$data.sha1sum
for file in $data $data_sum; do
if [ ! -f "$file" ]; then
curl -LO "$URI/$file"
fi
done
sha1sum -c $data_sum
cd "$WORKSPACE"
if [ ! -f "$SOURCE_ROOT/binaries/data/config/default.cfg" ]; then
echo "Extracting data"
tar -xJf $data
fi
# name: prepare AppDir
#if [ -n "${URI##*/rc*}" ] && [ ! -r $URI/$data.minisig ]; then
#curl -LO $URI/$data.minisig
#fi
#$MINISIGN_PATH -Vm $data -P $MINISIGN_KEY
cd "$SOURCE_ROOT"
install -s binaries/system/pyrogenesis -Dt $APPDIR/usr/bin
install -s binaries/system/ActorEditor -Dt $APPDIR/usr/bin
cd $APPDIR/usr/bin
ln -s pyrogenesis 0ad
for lib in libmozjs78-ps-release.so \
libnvcore.so \
libnvimage.so \
libnvmath.so \
libnvtt.so
do
patchelf --set-rpath $lib:$SOURCE_ROOT/binaries/system pyrogenesis
done
patchelf --set-rpath libthai.so.0:$APPDIR/usr/lib ActorEditor
patchelf --set-rpath libAtlasUI.so:$SOURCE_ROOT/binaries/system ActorEditor
# Note that binaries/system{libmoz*.so, libnv*.so, libAtlasUI.so} will be copied into
# the $APPDIR folder automatically when linuxdeploy is run below.
cd $SOURCE_ROOT
install binaries/system/libCollada.so -Dt $APPDIR/usr/lib
install build/resources/0ad.appdata.xml -Dt $APPDIR/usr/share/metainfo
install build/resources/0ad.png -Dt $APPDIR/usr/share/pixmaps
mkdir -p "$APPDIR/usr/data/config"
cp -a binaries/data/config/default.cfg $APPDIR/usr/data/config
cp -a binaries/data/l10n $APPDIR/usr/data
cp -a binaries/data/tools $APPDIR/usr/data # for Atlas
mkdir -p $APPDIR/usr/data/mods
cp -a binaries/data/mods/mod $APPDIR/usr/data/mods
cd $SOURCE_ROOT
cp -a binaries/data/mods/public $APPDIR/usr/data/mods
cd "$WORKSPACE"
# Set up output directory
OUT_DIR="$WORKSPACE/out"
if [ ! -d "$OUT_DIR" ]; then
mkdir "$OUT_DIR"
fi
cd "$OUT_DIR"
# Set LinuxDeploy output version
export LINUXDEPLOY_OUTPUT_VERSION="$VERSION"
# Create the image
if [ -z "$ACTION_WORKSPACE" ]; then
export DEPLOY_GTK_VERSION=3
ARCH=$(uname -m)
# Variable used by gtk plugin
linuxdeploy \
-d $SOURCE_ROOT/build/resources/0ad.desktop \
--icon-file=$SOURCE_ROOT/build/resources/0ad.png \
--icon-filename=0ad \
--executable $APPDIR/usr/bin/pyrogenesis \
--library=/usr/lib/$ARCH-linux-gnu/libthai.so.0 \
--custom-apprun=$WORKSPACE/AppRun \
--appdir $APPDIR \
--plugin gtk
fi
OUT_APPIMAGE="0ad-$VERSION-$ARCH.AppImage"
REPO="0ad-appimage"
TAG="latest"
GITHUB_REPOSITORY_OWNER="${GITHUB_REPOSITORY_OWNER:-0ad-matters}"
UPINFO="gh-releases-zsync|$GITHUB_REPOSITORY_OWNER|$REPO|$TAG|*$ARCH.AppImage.zsync"
appimagetool --comp zstd --mksquashfs-opt -Xcompression-level --mksquashfs-opt 20 \
-u "$UPINFO" \
"$APPDIR" "$OUT_APPIMAGE"
sha1sum $OUT_APPIMAGE > "$OUT_APPIMAGE.sha1sum"
cat "$OUT_APPIMAGE.sha1sum"
exit 0