forked from purescript/purescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·64 lines (50 loc) · 1.33 KB
/
build.sh
File metadata and controls
executable file
·64 lines (50 loc) · 1.33 KB
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
63
64
## 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 -e
OS=$1
if [ -z $OS ]
then
echo "Usage: build.sh osname"
exit 1
fi
pushd $(stack path --project-root)
LOCAL_INSTALL_ROOT=$(stack path --local-install-root)
if [ "$OS" = "win64" ]
then
BIN_EXT=".exe"
else
BIN_EXT=""
fi
# Make the staging directory
mkdir -p bundle/build/purescript
# Strip the binaries, and copy them to the staging directory
BIN=purs
FULL_BIN="$LOCAL_INSTALL_ROOT/bin/${BIN}${BIN_EXT}"
if [ "$OS" != "win64" ]
then
strip "$FULL_BIN"
fi
cp "$FULL_BIN" bundle/build/purescript
# Copy extra files to the staging directory
cp scripts/* bundle/build/purescript/
cp bundle/README bundle/build/purescript/
cp LICENSE bundle/build/purescript/
cp INSTALL.md bundle/build/purescript/
stack list-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 -rf build/
popd > /dev/null