-
Notifications
You must be signed in to change notification settings - Fork 0
/
export.sh
48 lines (45 loc) · 1.39 KB
/
export.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
#! /bin/bash
# List of supported OS
OSLIST="linux windows darwin"
# List of supported architectures
ARCHLIST="386 amd64"
# Clean old versions
rm -fR ./misc/build
rm -fR ./misc/app
mkdir ./misc/app
for os in $OSLIST; do
for arch in $ARCHLIST; do
echo "Package for os $os and arch $arch"
# Build
echo "Building..."
BUILDPATH="./misc/build/dice-stats-$os-$arch"
env GOOS=$os GOARCH=$arch go build -o $BUILDPATH/dice-stats-$os-$arch
# Package
echo "Exporting..."
# Do some OS specific stuff
if [ $os = "linux" ]; then
# Create a .desktop file on Linux
cat << EOF > $BUILDPATH/DiceStats.desktop
[Desktop Entry]
Version=1.0
Name=Dice Stats
Comment=Dice Probability Distribution Software
Exec=bash -c 'cd "\$(dirname %k)" && ./dice-stats-$os-$arch;\$SHELL'
Icon=utilities-terminal
Terminal=true
Type=Application
Categories=Application;
EOF
chmod +x $BUILDPATH/DiceStats.desktop
fi
if [ $os = "darwin" ]; then
# Rename to .command on OSX
mv $BUILDPATH/dice-stats-$os-$arch $BUILDPATH/dice-stats-$os-$arch.command
fi
if [ $os = "windows" ]; then
# Rename to .exe on Windows
mv $BUILDPATH/dice-stats-$os-$arch $BUILDPATH/dice-stats-$os-$arch.exe
fi
tar czf ./misc/app/dice-stats-$os-$arch.tar.gz -C $BUILDPATH/ .
done
done