-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstack-fpm
executable file
·43 lines (40 loc) · 1.45 KB
/
stack-fpm
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
#!/bin/bash -e
name=$1
if [[ $name = "" ]]; then
echo "Name not specified, using $(basename "$(pwd)")"
name="$(basename "$(pwd)")"
fi
echo ">>> Building for Linux..."
stack docker pull
stack build --docker
rm -rf .stack-fpm/linux
mkdir -p .stack-fpm/linux/usr/local
cp -r "$(stack path --docker --local-install-root)"/* ./.stack-fpm/linux/usr/local/
version=$(ggrep -Po "version: '(\K[^']*)" < ./package.yaml)
cd .stack-fpm/linux
echo ">>> Building Linux packages..."
tar -zcvf stack-fpm.tar.gz ./*
fpm -t deb -s tar --deb-pre-depends libgmp-dev -n "$name" -v "$version" ./stack-fpm.tar.gz
fpm -t rpm -s tar --rpm-os linux --rpm-autoreq -n "$name" -v "$version" ./stack-fpm.tar.gz
fpm -t apk -s tar -n "$name" -v "$version" ./stack-fpm.tar.gz
mkdir -p ../../dist
mv ./*.deb ../../dist/
mv ./*.rpm ../../dist/
mv ./*.apk ../../dist/
mv ./stack-fpm.tar.gz ../../dist/"$name-$version-linux_amd64.tar.gz"
cd ../..
if [ "$(uname)" = "Darwin" ]; then
echo ">>> Building Darwin..."
stack build
rm -rf .stack-fpm/darwin
mkdir -p .stack-fpm/darwin/usr/local
cp -r "$(stack path --local-install-root)"/* ./.stack-fpm/darwin/usr/local/
version=$(ggrep -Po "version: '(\K[^']*)" < ./package.yaml)
cd .stack-fpm/darwin
echo ">>> Building Darwin packages..."
tar -zcvf stack-fpm.tar.gz ./*
fpm -t osxpkg -s tar -n "$name" -v "$version" ./stack-fpm.tar.gz
mkdir -p ../../dist
mv ./*.pkg ../../dist/
mv ./stack-fpm.tar.gz ../../dist/"$name-$version-darwin.tar.gz"
fi