forked from bottlesdevs/Bottles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappimage-build.sh
executable file
·120 lines (99 loc) · 4.02 KB
/
appimage-build.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
#!/bin/bash
BUILD_DIR="build/"
if [ -d "$BUILD_DIR" ]; then
sudo rm -r build
fi
red="\e[0;91m"
blue="\e[0;94m"
expand_bg="\e[K"
blue_bg="\e[0;104m${expand_bg}"
red_bg="\e[0;101m${expand_bg}"
green_bg="\e[0;102m${expand_bg}"
green="\e[0;92m"
black="\e[30m"
white="\e[0;97m"
bold="\e[1m"
uline="\e[4m"
reset="\e[0m"
function title {
PREFIX="\n$bold-----"
SUFFIX="--$reset"
echo -e "$PREFIX $1 $SUFFIX"
}
function print_execution {
if $1; then
echo -e "$green_bg$bold$black-- $1$reset"
else
echo -e "$red_bg$bold$black-- Operation failed for: $1$reset"
fi
}
# Set linuxdeploy env
# ---------------------------------------
export LINUXDEPLOY=./linuxdeploy-x86_64.AppImage
# Set environment variables
# ---------------------------------------
if [[ -v NO_ENVIRONMENT ]]; then
title "No environment variables need to be defined"
else
title "Setting environment variables"
export ARCH=x86_64
export VERSION="devel"
fi
# Meson/ninja build
# ---------------------------------------
title "Building with meson and ninja"
print_execution "mkdir build"
print_execution "meson build"
print_execution "cd build"
print_execution "ninja"
print_execution "ninja bottles-pot"
print_execution "ninja bottles-update-po"
# Appdir
# ---------------------------------------
title "Preparing directories"
print_execution "mkdir -p appdir/usr/local/share/bottles"
print_execution "mkdir -p appdir/usr/bin"
print_execution "mkdir -p appdir/usr/share/glib-2.0/schemas"
print_execution "mkdir -p appdir/usr/share/applications"
print_execution "mkdir -p appdir/usr/share/metainfo"
print_execution "mkdir -p appdir/usr/share/icons"
title "Compiling and installing glib-resources"
print_execution "glib-compile-resources --sourcedir=../src/ui/ ../src/ui/bottles.gresource.xml --target=appdir/usr/local/share/bottles/bottles.gresource"
title "Copying Bottles binary"
print_execution "cp src/bottles ./appdir/usr/bin/"
title "Copying Bottles python package and remove not useful files"
print_execution "cp -a ../src appdir/usr/local/share/bottles/bottles"
print_execution "rm appdir/usr/local/share/bottles/bottles/bottles.in"
print_execution "rm appdir/usr/local/share/bottles/bottles/meson.build"
if [[ -v NO_ENVIRONMENT ]]; then
title "Copying appdata"
print_execution "cp -a ../data/com.usebottles.bottles.appdata.xml.in appdir/usr/share/metainfo/com.usebottles.bottles.appdata.xml"
fi
title "Compiling and installing translations"
cat ../po/LINGUAS | while read lang
do
print_execution "mkdir -p appdir/usr/share/locale/$lang/LC_MESSAGES"
print_execution "msgfmt -o appdir/usr/share/locale/$lang/LC_MESSAGES/bottles.mo ../po/$lang.po"
done
title "Copying icons"
print_execution "cp -a ../data/icons appdir/usr/share"
print_execution "mv appdir/usr/share/icons/symbolic/scalable/apps/*.svg appdir/usr/share/icons/hicolor/scalable/apps/"
title "Copying and compiling gschema"
print_execution "cp ../data/com.usebottles.bottles.gschema.xml appdir/usr/share/glib-2.0/schemas/com.usebottles.bottles.gschema.xml"
print_execution "glib-compile-schemas appdir/usr/share/glib-2.0/schemas/"
title "Copying Desktop file"
print_execution "cp data/com.usebottles.bottles.desktop appdir/usr/share/applications/"
title "Copying AppRun file"
print_execution "cp -a ../AppRun appdir/AppRun"
# Appimage
# ---------------------------------------
title "Downloading linuxdeploy Appimage and setting executable"
print_execution "curl -L https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage --output linuxdeploy-x86_64.AppImage"
print_execution "chmod a+x linuxdeploy-x86_64.AppImage"
title "Downloading linuxdeploy-plugin-gtk"
print_execution "curl -L https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh --output linuxdeploy-plugin-gtk.sh"
print_execution "chmod a+x linuxdeploy-plugin-gtk.sh"
title "Executing linuxdeploy-plugin-gtk on appdir"
print_execution "./linuxdeploy-plugin-gtk.sh --appdir appdir"
title "Building Bottles Appimage"
print_execution "./linuxdeploy-x86_64.AppImage --appdir appdir --output appimage"