forked from AppImage/AppImageKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·108 lines (86 loc) · 2.6 KB
/
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
#!/bin/bash
#
# This script installs the required build-time dependencies
# and builds AppImages for AppImageKit
#
STRIP="strip"
STATIC_BUILD=1
JOBS=${JOBS:-1}
RUN_TESTS=0
while [ $1 ]; do
case $1 in
'--debug' | '-d' )
STRIP="true"
;;
'--use-shared-libs' | '-s' )
STATIC_BUILD=0
;;
'--run-tests' | '-t' )
RUN_TESTS=1
;;
'--clean' | '-c' )
rm -rf build
git clean -df
rm -rf squashfuse/* squashfuse/.git
rm -rf squashfs-tools/* squashfs-tools/.git
exit
;;
'--help' | '-h' )
echo 'Usage: ./build.sh [OPTIONS]'
echo
echo 'OPTIONS:'
echo ' -h, --help: Show this help screen'
echo ' -d, --debug: Build with debug info.'
echo ' -n, --no-dependencies: Do not try to install distro specific build dependencies.'
echo ' -s, --use-shared-libs: Use distro provided shared versions of inotify-tools and openssl.'
echo ' -c, --clean: Clean all artifacts generated by the build.'
exit
;;
esac
shift
done
if cat /etc/*release | grep "CentOS" 2>&1 >/dev/null; then
if [ -e /opt/rh/devtoolset-4/enable ]; then
. /opt/rh/devtoolset-4/enable
fi
fi
echo "$KEY" | md5sum
set -e
set -x
HERE="$(dirname "$(readlink -f "${0}")")"
cd "$HERE"
# Fetch git submodules
git submodule update --init --recursive
# Clean up from previous run
[ -d build/ ] && rm -rf build/
# Build AppImage
mkdir build
cd build
# make sure that deps in separate install tree are found
export PKG_CONFIG_PATH=/deps/lib/pkgconfig/
# make CMake use the right tools for ARM cross-compiling using toolchain file
if [ "$ARCH" == "armhf" ]; then
export PATH=/deps/bin:"$PATH"
export EXTRA_CMAKE_FLAGS="-DCMAKE_TOOLCHAIN_FILE=$HERE/cmake/toolchains/arm-linux-gnueabihf.cmake"
elif [ "$ARCH" == "aarch64" ]; then
export PATH=/deps/bin:"$PATH"
export EXTRA_CMAKE_FLAGS="-DCMAKE_TOOLCHAIN_FILE=$HERE/cmake/toolchains/aarch64-linux-gnu.cmake"
fi
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON -DAPPIMAGEKIT_PACKAGE_DEBS=ON "${EXTRA_CMAKE_FLAGS[@]}"
make -j$JOBS
make install DESTDIR=install_prefix/
if [ -d /deps/lib ]; then
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":/deps/lib/
fi
xxd src/runtime | head -n 1
# Do NOT strip runtime
find install_prefix/usr/bin/ -not -iname runtime -print -exec "$STRIP" "{}" \; 2>/dev/null
ls -lh install_prefix/usr/bin/
for FILE in install_prefix/usr/bin/*; do
echo "$FILE"
ldd "$FILE" || true
done
bash -ex "$HERE/build-appdir.sh"
ls -lh
mkdir -p out
cp -r install_prefix/usr/{bin,lib/appimagekit}/* appdirs/*.AppDir out/