git.iko.soy/rowtype-yoga/purescript-native
on cd4c708 help sign in
65 lines 1.4 kB history raw
1## This script can be run on any supported OS to create a binary .tar.gz
2## bundle.
3## For Windows, msysgit contains all of the pieces needed to run this script.
4set -e
6OS=$1
8if [ -z $OS ]
9then
10 echo "Usage: build.sh osname"
11 exit 1
12fi
14pushd $(stack path --project-root)
16LOCAL_INSTALL_ROOT=$(stack path --local-install-root)
18if [ "$OS" = "win64" ]
19then
20 BIN_EXT=".exe"
21else
22 BIN_EXT=""
23fi
25# Make the staging directory
26mkdir -p bundle/build/purescript
28# Strip the binaries, and copy them to the staging directory
29for BIN in psc psci psc-docs psc-publish psc-bundle psc-ide-server psc-ide-client
30do
31 FULL_BIN="$LOCAL_INSTALL_ROOT/bin/${BIN}${BIN_EXT}"
32 if [ "$OS" != "win64" ]
33 then
34 strip "$FULL_BIN"
35 fi
36 cp "$FULL_BIN" bundle/build/purescript
37done
39# Copy extra files to the staging directory
40cp bundle/README bundle/build/purescript/
41cp LICENSE bundle/build/purescript/
42cp INSTALL.md bundle/build/purescript/
44stack list-dependencies >bundle/build/purescript/dependencies.txt
46# Make the binary bundle
47pushd bundle/build > /dev/null
48tar -zcvf ../${OS}.tar.gz purescript
49popd > /dev/null
51# Calculate the SHA hash
52if [ "$OS" = "win64" ]
53then
54 # msys/mingw does not include shasum. :(
55 SHASUM="openssl dgst -sha1"
56else
57 SHASUM="shasum"
58fi
60$SHASUM bundle/${OS}.tar.gz > bundle/${OS}.sha
62# Remove the staging directory
63rm -rf build/
65popd > /dev/null