blob: 93b9b29fef3431d3bb4f4a4b3214b6fbb83a81d8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#-------------------------------------------------------------------------
## Setup file detection function.
#-------------------------------------------------------------------------
function detect_setup_file() {
if [ -r Setup.hs ] ; then
echo Setup.hs
elif [ -r Setup.lhs ] ; then
echo Setup.lhs
else
message "${PROBLEM_COLOR}Cannot detect setup file!${DEFAULT_COLOR}"
return 1
fi
}
#-------------------------------------------------------------------------
## Section-default build script.
#-------------------------------------------------------------------------
function default_build_haskell() {
local setup_file &&
setup_file=$(detect_setup_file) &&
runhaskell $setup_file configure -O2 --enable-shared --enable-executable-dynamic \
--disable-library-vanilla --prefix=${INSTALL_ROOT}/usr \
--docdir=${INSTALL_ROOT}/usr/share/doc/$SPELL --global $OPTS &&
runhaskell $setup_file build -j${MAKE_NJOBS} ||
runhaskell $setup_file build &&
runhaskell $setup_file register --gen-script &&
runhaskell $setup_file unregister --gen-script &&
if [[ -f register.sh ]]; then
sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
fi &&
if [[ -f unregister.sh ]]; then
sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
fi
}
#-------------------------------------------------------------------------
## Section-default install script.
#-------------------------------------------------------------------------
function default_install_haskell() {
local setup_file &&
local cabal_file &&
local share_dir &&
setup_file=$(detect_setup_file) &&
if [[ -f register.sh ]]; then
install -D -m744 register.sh "$INSTALL_ROOT/usr/share/haskell/register/${SPELL}.sh" &&
install -D -m744 unregister.sh "$INSTALL_ROOT/usr/share/haskell/unregister/${SPELL}.sh"
fi
runhaskell $setup_file install &&
cabal_file=$(ls *.cabal) &&
share_dir=${INSTALL_ROOT}/usr/share/${SPELL} &&
mkdir -vp $share_dir &&
cp -v $cabal_file $share_dir
}
function default_build() {
default_build_haskell
}
function default_install() {
default_install_haskell
}
|