2022-07-31 16:48:41 +03:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Preparing
|
|
|
|
if [ -d "./dist/" ];
|
|
|
|
then
|
|
|
|
rm dist/* 2> /dev/null
|
|
|
|
else
|
|
|
|
mkdir dist/
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Detect Musl C library
|
|
|
|
# thx @Unmanned Player https://stackoverflow.com/a/60471114
|
|
|
|
|
|
|
|
libc=$(ldd /bin/ls | grep 'musl' | head -1 | cut -d ' ' -f1)
|
|
|
|
if [ -z $libc ];
|
|
|
|
then
|
|
|
|
# build libc
|
2022-08-05 23:29:36 +03:00
|
|
|
OUTPUT=pmng-$(shards version)-linux-x86_64
|
|
|
|
crystal build ./src/pmng.cr --release --progress -o ./dist/$OUTPUT
|
|
|
|
tar -cJf ./dist/$OUTPUT.tar.xz ./dist/$OUTPUT
|
2022-07-31 16:48:41 +03:00
|
|
|
else
|
|
|
|
# Build musl
|
2022-08-05 23:29:36 +03:00
|
|
|
crystal build ./src/pmng.cr --release --progress -o ./dist/pmng-$(shards version)-linux-musl-x86_64
|
2022-07-31 16:48:41 +03:00
|
|
|
fi
|
|
|
|
|