git.iko.soy/rowtype-yoga/purescript-native
on 2a4e404 help sign in
63 lines 1.5 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 strip "$FULL_BIN" || true # not the end of the world if this fails, and
33 # AppVeyor can't seem to handle it for some reason
34 cp "$FULL_BIN" bundle/build/purescript
35done
37# Copy extra files to the staging directory
38cp bundle/README bundle/build/purescript/
39cp LICENSE bundle/build/purescript/
40cp INSTALL.md bundle/build/purescript/
42stack list-dependencies >bundle/build/purescript/dependencies.txt
44# Make the binary bundle
45pushd bundle/build > /dev/null
46tar -zcvf ../${OS}.tar.gz purescript
47popd > /dev/null
49# Calculate the SHA hash
50if [ "$OS" = "win64" ]
51then
52 # msys/mingw does not include shasum. :(
53 SHASUM="openssl dgst -sha1"
54else
55 SHASUM="shasum"
56fi
58$SHASUM bundle/${OS}.tar.gz > bundle/${OS}.sha
60# Remove the staging directory
61rm -rf build/
63popd > /dev/null