@@ -1,26 +1,64 @@
11#!/bin/sh
22
3−VERSION=$1
3+set -euo pipefail
44
5−echo "Building version-$VERSION\n\n"
6−echo "Have you: set the release flag, checked the demos and the tutorial?"
7−read $foo
5+if [ "$#" -lt 1 ]; then
6+ echo "Usage $0 [version number] ?[idris bin location]"
7+ echo ""
8+ echo "The first argument is the version number"
9+ echo ""
10+ echo "The second argument is optional, and used to point to a"
11+ echo "custom location in which idris was recently built i.e."
12+ echo "withing .stack-work or .cabal-sandbox. The location must"
13+ echo "be given relative to the project root of a package in the "
14+ echo "libs/ directory."
15+ exit 1
16+fi
17+
18+VERSION=${1:-}
19+
20+echo "==> Building version-$VERSION"
21+echo ""
22+echo "Q: Have you: (a) set the release flag & (b) checked the demos and the tutorial?"
23+read ${FOO:-}
824
925git tag v$VERSION -a
1026
27+echo "==> Building Source Distribution"
1128cabal sdist
1229
1330# Generate Idris library docs and put them in lib_docs.tar.gz in the root
14−make lib_doc
31+echo "==> Generating API Documentation."
32+echo "==> Determining version of Idris to use."
33+if [ -z ${2+x} ];
34+then
35+ echo "==> Using default location.";
36+ make lib_doc
37+else
38+ echo "==> Using custom location.";
39+ make -C libs IDRIS=$2 doc
40+fi
41+
1542DOCDIR=`mktemp -d /tmp/docsXXXXX`
43+
1644cp -r libs/base/base_doc "$DOCDIR"
1745cp -r libs/prelude/prelude_doc "$DOCDIR"
1846cp -r libs/effects/effects_doc "$DOCDIR"
1947cp -r libs/contrib/contrib_doc "$DOCDIR"
48+
2049tar -czvf lib_docs.tar.gz -C "$DOCDIR" prelude_doc base_doc effects_doc contrib_doc
2150
51+echo "==> Building Binaries"
2252cabal configure --prefix=/usr/local
53+
2354cabal build
55+
56+echo "==> Creating Package"
57+mkdir -p /tmp/idris-pkg/
58+
2459cabal copy --destdir=/tmp/idris-pkg/
25−pkgbuild --id org.idris-lang --root /tmp/idris-pkg/ idris-$VERSION.pkg
2660
61+pkgbuild --identifier org.idris-lang \
62+ --version "v$VERSION" \
63+ --root /tmp/idris-pkg/ \
64+ idris-$VERSION.pkg