Idris-dev/mkpkg.sh

68 lines
1.8 KiB
Bash
Raw Normal View History

#!/usr/bin/env sh
2014-02-04 01:36:11 +04:00
set -euo pipefail
2014-02-04 20:07:00 +04:00
if [ "$#" -lt 1 ]; then
echo "Usage $0 [version number] ?[idris bin location]"
echo ""
echo "The first argument is the version number"
echo ""
echo "The second argument is optional, and used to point to a"
echo "custom location in which idris was recently built i.e."
echo "withing .stack-work or .cabal-sandbox. The location must"
echo "be given relative to the project root of a package in the "
echo "libs/ directory."
exit 1
fi
VERSION=${1:-}
echo "==> Building version-$VERSION"
echo ""
echo "Q: Have you: (a) set the release flag & (b) checked the demos and the tutorial?"
read ${FOO:-}
2014-02-04 01:36:11 +04:00
2014-02-04 20:07:00 +04:00
git tag v$VERSION -a
2014-02-04 01:36:11 +04:00
echo "==> Building Source Distribution"
2014-02-04 01:36:11 +04:00
cabal sdist
# Generate Idris library docs and put them in lib_docs.tar.gz in the root
echo "==> Generating API Documentation."
echo "==> Determining version of Idris to use."
if [ -z ${2+x} ];
then
echo "==> Using default location.";
make lib_doc
else
echo "==> Using custom location.";
make -C libs IDRIS=$2 doc
fi
DOCDIR=`mktemp -d /tmp/docsXXXXX`
cp -r libs/base/base_doc "$DOCDIR"
cp -r libs/prelude/prelude_doc "$DOCDIR"
cp -r libs/effects/effects_doc "$DOCDIR"
cp -r libs/contrib/contrib_doc "$DOCDIR"
tar -czvf lib_docs.tar.gz -C "$DOCDIR" prelude_doc base_doc effects_doc contrib_doc
echo "==> Building Binaries"
2014-02-04 01:36:11 +04:00
cabal configure --prefix=/usr/local
2014-02-04 01:36:11 +04:00
cabal build
echo "==> Creating Package"
mkdir -p /tmp/idris-pkg/
2014-02-04 01:36:11 +04:00
cabal copy --destdir=/tmp/idris-pkg/
pkgbuild --identifier org.idris-lang \
--version "v$VERSION" \
--root /tmp/idris-pkg/ \
idris-$VERSION.pkg
2017-03-08 13:59:30 +03:00
echo "==> Creating SHA256 hash (don't forget to update web site!)"
shasum -a 256 idris-$VERSION.pkg > idris-$VERSION.pkg.sha256