@@ -1,7 +1,8 @@
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.
14set -e
25
3−SCRIPTPATH=$( cd "$(dirname "$0")" ; pwd -P )
4−
56OS=$1
67
78if [ -z $OS ]
@@ -10,39 +11,51 @@ then
1011 exit 1
1112fi
1213
13−pushd ${SCRIPTPATH} > /dev/null
14+pushd $(stack path --project-root)
15+
16+LOCAL_INSTALL_ROOT=$(stack path --local-install-root)
17+
18+if [ "$OS" = "win64" ]
19+then
20+ BIN_EXT=".exe"
21+else
22+ BIN_EXT=""
23+fi
1424
1525# Make the staging directory
16−mkdir -p build/purescript/
17−
18−# Strip the binaries
19−strip ~/.local/bin/psc
20−strip ~/.local/bin/psci
21−strip ~/.local/bin/psc-docs
22−strip ~/.local/bin/psc-publish
23−strip ~/.local/bin/psc-bundle
24−strip ~/.local/bin/psc-ide-server
25−strip ~/.local/bin/psc-ide-client
26−
27−# Copy files to staging directory
28−cp ~/.local/bin/psc build/purescript/
29−cp ~/.local/bin/psci build/purescript/
30−cp ~/.local/bin/psc-docs build/purescript/
31−cp ~/.local/bin/psc-publish build/purescript/
32−cp ~/.local/bin/psc-bundle build/purescript/
33−cp ~/.local/bin/psc-ide-server build/purescript/
34−cp ~/.local/bin/psc-ide-client build/purescript/
35−cp README build/purescript/
36−cp ../LICENSE build/purescript/
37−cp ../INSTALL.md build/purescript/
26+mkdir -p bundle/build/purescript
27+
28+# Strip the binaries, and copy them to the staging directory
29+for BIN in psc psci psc-docs psc-publish psc-bundle psc-ide-server psc-ide-client
30+do
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
35+done
36+
37+# Copy extra files to the staging directory
38+cp bundle/README bundle/build/purescript/
39+cp LICENSE bundle/build/purescript/
40+cp INSTALL.md bundle/build/purescript/
41+
42+stack list-dependencies >bundle/build/purescript/dependencies.txt
3843
3944# Make the binary bundle
40−pushd build > /dev/null
41−tar -zcvf ../$OS.tar.gz purescript
45+pushd bundle/build > /dev/null
46+tar -zcvf ../${OS}.tar.gz purescript
4247popd > /dev/null
4348
4449# Calculate the SHA hash
45−shasum $OS.tar.gz > $OS.sha
50+if [ "$OS" = "win64" ]
51+then
52+ # msys/mingw does not include shasum. :(
53+ SHASUM="openssl dgst -sha1"
54+else
55+ SHASUM="shasum"
56+fi
57+
58+$SHASUM bundle/${OS}.tar.gz > bundle/${OS}.sha
4659
4760# Remove the staging directory
4861rm -rf build/