on master help sign in
Merge pull request #3533 from jfdm/make-mkpkg-more-robust
4d574b9Jan de Muijnck-Hughes
mkpkg.sh+44−6
@@ -1,26 +1,64 @@
1#!/bin/sh
1#!/bin/sh
2
2
3−VERSION=$1
3+set -euo pipefail
4
4
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+
5−echo "Building version-$VERSION\n\n"
20+echo "==> Building version-$VERSION"
21+echo ""
6−echo "Have you: set the release flag, checked the demos and the tutorial?"
22+echo "Q: Have you: (a) set the release flag & (b) checked the demos and the tutorial?"
7−read $foo
23+read ${FOO:-}
8
24
9git tag v$VERSION -a
25git tag v$VERSION -a
10
26
27+echo "==> Building Source Distribution"
11cabal sdist
28cabal sdist
12
29
13# Generate Idris library docs and put them in lib_docs.tar.gz in the root
30# Generate Idris library docs and put them in lib_docs.tar.gz in the root
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.";
14−make lib_doc
36+ make lib_doc
37+else
38+ echo "==> Using custom location.";
39+ make -C libs IDRIS=$2 doc
40+fi
41+
15DOCDIR=`mktemp -d /tmp/docsXXXXX`
42DOCDIR=`mktemp -d /tmp/docsXXXXX`
43+
16cp -r libs/base/base_doc "$DOCDIR"
44cp -r libs/base/base_doc "$DOCDIR"
17cp -r libs/prelude/prelude_doc "$DOCDIR"
45cp -r libs/prelude/prelude_doc "$DOCDIR"
18cp -r libs/effects/effects_doc "$DOCDIR"
46cp -r libs/effects/effects_doc "$DOCDIR"
19cp -r libs/contrib/contrib_doc "$DOCDIR"
47cp -r libs/contrib/contrib_doc "$DOCDIR"
48+
20tar -czvf lib_docs.tar.gz -C "$DOCDIR" prelude_doc base_doc effects_doc contrib_doc
49tar -czvf lib_docs.tar.gz -C "$DOCDIR" prelude_doc base_doc effects_doc contrib_doc
21
50
51+echo "==> Building Binaries"
22cabal configure --prefix=/usr/local
52cabal configure --prefix=/usr/local
53+
23cabal build
54cabal build
55+
56+echo "==> Creating Package"
57+mkdir -p /tmp/idris-pkg/
58+
24cabal copy --destdir=/tmp/idris-pkg/
59cabal copy --destdir=/tmp/idris-pkg/
25−pkgbuild --id org.idris-lang --root /tmp/idris-pkg/ idris-$VERSION.pkg
26
60
61+pkgbuild --identifier org.idris-lang \
62+ --version "v$VERSION" \
63+ --root /tmp/idris-pkg/ \
64+ idris-$VERSION.pkg