-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild
executable file
·59 lines (47 loc) · 1.42 KB
/
build
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
#!/bin/bash
program=cdrdao
arch=$(uname -m)
# When this script exits, automatically delete the temp directory.
cleanup()
{
if [[ -e "$tmp" ]]; then
echo "Clearing temp files..."
rm -r "$tmp"
fi
}
trap cleanup EXIT
# Print out any uncaught errors.
err()
{
echo -e "\nUncaught error in $0, line number: $BASH_LINENO" >&2
}
trap err ERR
set -e
cd "$(dirname "$0")"
version=$(cd cdrdao; git rev-parse --short HEAD)-pled-1.0.5-linux
release=$program-$version-$arch
rm -rf $release $release.zip
# Just clean built binaries/releases from source and exit now if given the argument 'clean'
if [ "$1" == "clean" ]; then
exit 0
fi
if command -v dnf > /dev/null 2>&1; then
sudo dnf install -y autoconf automake libao-devel make bash git gcc g++ zip
elif command -v apt > /dev/null 2>&1; then
sudo apt install --yes build-essential libao-dev zip
fi
# Put temp directory in /tmp (or whatever the OS prefers)
tmp=$(mktemp -d --tmpdir cdib.XXX)
mkdir -p $release/licenses
cp -r cdrdao $tmp
(cd $tmp/cdrdao; autoreconf)
(cd $tmp/cdrdao; ./configure)
make -j`nproc` -C $tmp/cdrdao
pled/pled $tmp/cdrdao/dao/cdrdao $release
pled/pled $tmp/cdrdao/utils/toc2cue $release
pled/pled $tmp/cdrdao/utils/cue2toc $release
cp cdrdao/COPYING $release/licenses/cdrdao-license.txt
cp pled/unlicense.md $release/licenses/pled.md
cp -r readme.md changelog.md $release
chmod -R 777 $release
zip -r $release.zip $release