-
Notifications
You must be signed in to change notification settings - Fork 31
/
build_desura.sh
executable file
·97 lines (90 loc) · 2.76 KB
/
build_desura.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
#!/bin/sh
echo 'Make sure to run \033[1;31msudo ./install_deps.sh\033[0m before compiling!\n'
PREFIX="../install"
OFFICIAL_BUILD=ON
clean() {
rm -rf build
rm -rf build_cef
rm -rf install
rm -rf build_package
rm *.deb
rm *.rpm
echo 'Cleaned'
}
build_desura() {
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_CEF=OFF -DWITH_GTEST=OFF -DOFFICIAL_BUILD=$OFFICIAL_BUILD -DFORCE_BUNDLED_WXGTK=$OFFICIAL_BUILD -DFORCE_BUNDLED_BOOST=$OFFICIAL_BUILD -DFORCE_BUNDLED_CURL=$OFFICIAL_BUILD || exit 1
NUM_PROC=`nproc`
echo "${NUM_PROC} processors detected"
# make V=1 -j${NUM_PROC} install $@
make -j${NUM_PROC} install $@
cd ..
echo 'Building Desura completed'
}
build_cef() {
if [ ! -d "build_cef" ]; then
mkdir build_cef
fi
cd build_cef
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_ONLY_CEF=ON -DFORCE_BUNDLED_BOOST=ON || exit 1
NUM_PROC=`nproc`
echo "${NUM_PROC} processors detected"
make -j${NUM_PROC} install $@
cd ..
echo 'Building CEF completed'
}
pack() {
if [ ! -d "build_package" ]; then
mkdir build_package
fi
cd build_package
cmake .. -DPACKAGE_TYPE=$PACKAGE -DINSTALL_DESKTOP_FILE=ON -DCMAKE_INSTALL_PREFIX="/opt/desura" -DDESKTOP_EXE="/opt/desura/desura" -DDESKTOP_ICON="/opt/desura/desura.png" -DOFFICIAL_BUILD=$OFFICIAL_BUILD -DFORCE_BUNDLED_WXGTK=$OFFICIAL_BUILD -DFORCE_BUNDLED_BOOST=$OFFICIAL_BUILD -DFORCE_BUNDLED_CURL=$OFFICIAL_BUILD || exit 1
NUM_PROC=`nproc`
echo "${NUM_PROC} processors detected"
make -j${NUM_PROC} package $@
if [ $PACKAGE = "DEB" ]; then
mv Desura-*.deb ..
elif [ $PACKAGE = "RPM" ]; then
mv Desura-*.rpm ..
fi
echo 'Building $PACKAGE completed'
cd ..
}
if [ -z "$1" ]; then
build_desura || exit 2
build_cef || exit 2
elif [ "$1" = "clean" ]; then
shift
clean
elif [ "$1" = "pack" ]; then
shift
PACKAGE="$1"
shift
pack || exit 2
elif [ "$1" = "release" ]; then
shift
PACKAGE="$1"
OFFICIAL_BUILD="ON"
shift
pack || exit 2
elif [ "$1" = "only_desura" ]; then
shift
build_desura || exit 2
elif [ "$1" = "only_cef" ]; then
shift
build_cef || exit 2
elif [ "$1" = "help" ]; then
echo 'This script will allow you to easy compile Desura on Linux.'
echo 'Type "./build_desura.sh clean" to remove build files.'
echo 'Type "./build_desura.sh" to build Desura client.'
echo 'Type "./build_desura.sh pack DEB" to prepare .deb package.'
echo 'Type "./build_desura.sh pack RPM" to prepare .rpm package.'
echo 'Type "./build_desura.sh only_desura" to compile Desura without CEF(Chormium Embedded Framework).'
echo 'Type "./build_desura.sh only_cef" to compile CEF without Desura.'
echo 'Type "./build_desura.sh help" to display this message.'
echo 'Any additonal shell argument will be given to "make" command.\n'
fi
echo 'Run \033[1;31m./install/desura\033[0m to start Desura!'