-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·39 lines (33 loc) · 1.08 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
#!/bin/sh
ARCHITECTURE=x64
if [ "$(uname -m)" = "aarch64" ]; then
ARCHITECTURE=arm64
elif [ -n "$1" ]; then
ARCHITECTURE=$1
fi
TARGET=linux-$ARCHITECTURE
if [ "$(uname)" = "Darwin" ]; then
TARGET=osx-$ARCHITECTURE
elif [ -n "$2" ]; then
TARGET=$2-$ARCHITECTURE
fi
dotnet publish cli/Elk.Cli.csproj -r $TARGET -c Release
rm -rf build/$TARGET
if [ "$(uname)" = "Darwin" ]; then
mkdir -p build/$TARGET
cp cli/bin/Release/*/$TARGET/publish/Elk.Cli build/$TARGET/elk
cp -r cli/bin/Release/*/$TARGET/publish/Resources/* build/$TARGET
cp cli/bin/Release/*/$TARGET/publish/*.dylib build/$TARGET
cd build/$TARGET
tar -czf macOS-$ARCHITECTURE.tar.xz *
else
mkdir -p build/$TARGET/usr/bin
mkdir -p build/$TARGET/usr/lib/elk
mkdir -p build/$TARGET/usr/share/elk
cp cli/bin/Release/*/$TARGET/publish/Elk.Cli build/$TARGET/usr/bin/elk
cp -r cli/bin/Release/*/$TARGET/publish/Resources/* build/$TARGET/usr/share/elk
cp cli/bin/Release/*/$TARGET/publish/*.so build/$TARGET/usr/lib/elk
cd build/$TARGET
tar -czf $TARGET.tar.xz usr
rm -rf usr
fi