-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_dolphin.sh
executable file
·73 lines (66 loc) · 1.57 KB
/
build_dolphin.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
#!/bin/bash -ex
## Pull in /etc/os-release so we can see what we're running on
. /etc/os-release
## Default Vars
GIT_REPOSITORY='https://github.com/dolphin-emu/dolphin.git'
## Function to print the help message
usage() {
set +x
echo ""
echo "Usage: ${0}"
echo ""
echo "Optional Arguments:"
echo " -b <Git Branch>: Build the specified git branch, tag, or sha"
echo " -p <Pull Request #>: Build the specified Github Pull Request number"
echo " -g : Generate Packages"
echo " -r <Repository URL>: Git repository to pull from"
echo " -h : Show this help message"
exit 1
}
## Set up getopts
while getopts "ab:p:mcgr:Rh" OPTION; do
case ${OPTION} in
"b")
GIT_BRANCH=${OPTARG};;
"p")
PULL_REQUEST=${OPTARG};;
"g")
GENERATE_PACKAGES=true;;
"r")
GIT_REPOSITORY=${OPTARG};;
"h")
HELP=true;;
esac
done
if [ ${HELP} ]; then
usage
exit 2
fi
## All the git stuff
git clone ${GIT_REPOSITORY}
cd dolphin
if [ ${PULL_REQUEST} ]; then
git fetch origin pull/${PULL_REQUEST}/head:pr
git checkout pr
elif [ ${GIT_BRANCH} ]; then
git checkout ${GIT_BRANCH}
fi
git submodule update --init --recursive
## Figure out what type of packages we need to generate
PACKAGE_TYPE='TAR'
case ${ID} in
'fedora')
PACKAGE_TYPE='RPM';;
'ubuntu')
PACKAGE_TYPE='DEB';;
esac
## Build it
mkdir build
cd build
cmake -DCPACK_PACKAGE_CONTACT="ooshlablu's build script" -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 ..
CPU_CORES=$(nproc --all)
make -j${CPU_CORES}
if [ ${GENERATE_PACKAGES} ]; then
cpack -G ${PACKAGE_TYPE}
fi
cd ..