blob: 4402c6baa92122c6ee9a5accc7d4069709b77266 (
plain)
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
60
61
62
|
#!/bin/bash
# This script can be run on any supported OS to create a binary .tar.gz
# bundle. For Windows, msysgit contains all of the pieces needed to run this
# script.
set -ex
OS=$1
if [ -z $OS ]
then
echo "Usage: build.sh osname"
exit 1
fi
pushd $(stack path --project-root)
# Make the staging directory
mkdir -p bundle/build/purescript
# Strip the binary, and copy it to the staging directory
if [ "$OS" = "win64" ]
then
BIN="purs.exe"
else
BIN="purs"
fi
FULL_BIN="$(stack path --local-install-root)/bin/$BIN"
if [ "$OS" != "win64" ]
then
strip "$FULL_BIN"
fi
cp "$FULL_BIN" bundle/build/purescript
# Copy extra files to the staging directory
cp bundle/README bundle/build/purescript/
cp LICENSE bundle/build/purescript/
cp INSTALL.md bundle/build/purescript/
stack ls dependencies >bundle/build/purescript/dependencies.txt
# Make the binary bundle
pushd bundle/build > /dev/null
tar -zcvf ../${OS}.tar.gz purescript
popd > /dev/null
# Calculate the SHA hash
if [ "$OS" = "win64" ]
then
# msys/mingw does not include shasum. :(
SHASUM="openssl dgst -sha1"
else
SHASUM="shasum"
fi
$SHASUM bundle/${OS}.tar.gz > bundle/${OS}.sha
# Remove the staging directory
rm -r bundle/build
popd > /dev/null
|