2015-09-14 14:13:13 +00:00
|
|
|
#
|
|
|
|
# This helper is for templates built using Haskell stack.
|
|
|
|
#
|
|
|
|
# make_build_args="stack-build-flags"
|
|
|
|
# stackage="lts-X.Y" # or include a stack.yaml in $FILESDIR
|
|
|
|
#
|
|
|
|
do_build() {
|
2019-08-01 20:20:14 +00:00
|
|
|
# use --skip-ghc-check to really force stack to use the ghc in the system
|
|
|
|
# --system-ghc still downloads if stackage ghc version does not match ours
|
|
|
|
# this fails on all platforms other than x86_64 glibc when we bump ghc
|
|
|
|
local _stack_args="--system-ghc --skip-ghc-check"
|
|
|
|
|
2015-09-14 14:13:13 +00:00
|
|
|
if [ -f "${FILESDIR}/stack.yaml" ]; then
|
|
|
|
msg_normal "Using stack config in stack.yaml.\n"
|
|
|
|
cp "${FILESDIR}/stack.yaml" .
|
2017-05-18 19:35:38 +00:00
|
|
|
elif [ -z "$stackage" -a -f "stack.yaml" ]; then
|
|
|
|
msg_normal "Using stack.yaml from downloaded source.\n"
|
2015-09-14 14:13:13 +00:00
|
|
|
else
|
|
|
|
if [ -z "$stackage" ]; then
|
|
|
|
msg_error "Stackage version not set in \$stackage.\n"
|
|
|
|
fi
|
|
|
|
msg_normal "Using stackage resolver ${stackage}.\n"
|
|
|
|
STACK_ROOT=$wrksrc/.stack \
|
2019-08-01 20:20:14 +00:00
|
|
|
stack init ${_stack_args} --force --resolver ${stackage}
|
2015-09-14 14:13:13 +00:00
|
|
|
fi
|
|
|
|
|
2019-08-01 20:20:14 +00:00
|
|
|
STACK_ROOT=$wrksrc/.stack stack ${_stack_args} ${makejobs} build \
|
2017-04-12 13:33:46 +00:00
|
|
|
${make_build_args}
|
2015-09-14 14:13:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
do_install() {
|
2019-08-01 20:20:14 +00:00
|
|
|
local _stack_args="--system-ghc --skip-ghc-check"
|
|
|
|
|
2015-09-14 14:13:13 +00:00
|
|
|
vmkdir usr/bin
|
2019-08-01 20:20:14 +00:00
|
|
|
STACK_ROOT=$wrksrc/.stack stack ${_stack_args} install \
|
2017-04-12 13:33:46 +00:00
|
|
|
${make_build_args} --local-bin-path=${DESTDIR}/usr/bin
|
2015-09-14 14:13:13 +00:00
|
|
|
}
|