haskell-stack.sh (1236B)
1# 2# This helper is for templates built using Haskell stack. 3# 4# make_build_args="stack-build-flags" 5# stackage="lts-X.Y" # or include a stack.yaml in $FILESDIR 6# 7do_build() { 8 # use --skip-ghc-check to really force stack to use the ghc in the system 9 # --system-ghc still downloads if stackage ghc version does not match ours 10 # this fails on all platforms other than x86_64 glibc when we bump ghc 11 local _stack_args="--system-ghc --skip-ghc-check" 12 13 if [ -f "${FILESDIR}/stack.yaml" ]; then 14 msg_normal "Using stack config in stack.yaml.\n" 15 cp "${FILESDIR}/stack.yaml" . 16 elif [ -z "$stackage" -a -f "stack.yaml" ]; then 17 msg_normal "Using stack.yaml from downloaded source.\n" 18 else 19 if [ -z "$stackage" ]; then 20 msg_error "Stackage version not set in \$stackage.\n" 21 fi 22 msg_normal "Using stackage resolver ${stackage}.\n" 23 STACK_ROOT="$wrksrc/.stack" \ 24 stack init ${_stack_args} --force --resolver ${stackage} 25 fi 26 27 STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} ${makejobs} build \ 28 ${make_build_args} 29} 30 31do_install() { 32 local _stack_args="--system-ghc --skip-ghc-check" 33 34 vmkdir usr/bin 35 STACK_ROOT="$wrksrc/.stack" stack ${_stack_args} install \ 36 ${make_build_args} --local-bin-path=${DESTDIR}/usr/bin 37}