forked from AppImage/AppImageKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·85 lines (67 loc) · 2.1 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
#!/bin/bash
#
# This script installs the required build-time dependencies
# and builds AppImage
#
HERE="$(dirname "$(readlink -f "${0}")")"
# Figure out whether we should use sudo
SUDO=''
if (( $EUID != 0 )); then
SUDO='sudo'
fi
if [ -e /usr/bin/apt-get ] ; then
$SUDO apt-get update
$SUDO apt-get -y install libfuse-dev libglib2.0-dev cmake git libc6-dev binutils fuse python
fi
if [ -e /usr/bin/yum ] ; then
$SUDO yum -y install git cmake binutils fuse glibc-devel glib2-devel fuse-devel gcc zlib-devel libpng12
fi
# Install dependencies for Arch Linux
if [ -e /usr/bin/pacman ] ; then
echo "Checking for existence of build dependencies."
builddeps=('git' 'cmake' 'binutils' 'fuse' 'glibc' 'glib2' 'gcc' 'zlib')
for i in "${builddeps[@]}" ; do
pacman -Q "$i"
if [ $? != 0 ] ; then
$SUDO pacman -S "$i"
else
echo "$i is already installed."
fi
done
echo "Checking for existence of dependencies from AUR."
declare -a builddepsaur=('libpng12' 'ncurses5-compat-libs')
for i in "${builddepsaur[@]}" ; do
pacman -Q "$i"
if [ $? != 0 ] ; then
echo "Fetching $i from Arch Linux User Repo"
git clone https://aur.archlinux.org/"$i".git && cd "$i" && \
makepkg -si --skippgpcheck && \
echo "Removing build directory." && \
cd .. && rm -rf $i
else
echo "$i is already installed."
fi
done
fi
if [ "$1" == "--fetch-dependencies-only" ] ; then
echo "Fetched dependencies. Exiting now."
exit 0
fi
cd "${HERE}"
cmake .
make clean
make
version="$(git describe --tags)"
outdir="$PWD/out"
mkdir -p "$outdir"
for i in AppRun; do
[ -f "$i" ] && cp -v "$i" "${outdir}/${i}_${version}-$(uname -m)"
done
for i in AppImageAssistant AppImageExtract AppImageMonitor AppImageUpdate; do
[ -f "$i" ] && cp -v "$i" "${outdir}/${i}_${version}-$(uname -m).AppImage"
done
cd -
# Note: This does not build AppDirAssistant by default since AppDirAssistant
# is no longer the recommended way to generate AppImages. If you still want to build it:
# cp AppRun AppDirAssistant.AppDir/
# ./AppImageAssistant AppDirAssistant.AppDir/ AppDirAssistant.AppImage