Build library packages as shared libs
[ghc-hetmet.git] / boot
1 #! /bin/sh
2 set -e
3
4 # Check that we have all boot packages.
5 for dir in `grep "^[^# ][^ ]*  *[^ ][^ ]*  *[^ ][^ ]*$" packages | sed "s/ .*//"`
6 do
7     if test ! -f $dir/LICENSE
8     then
9         echo "Error: $dir/LICENSE doesn't exist." >&2
10         echo "Maybe you haven't done './darcs-all get'?" >&2
11         exit 1
12     fi
13 done
14
15 # autoreconf everything that needs it.
16 for dir in . libraries/*
17 do
18     if test -f $dir/configure.ac
19     then
20         echo "Booting $dir"
21         ( cd $dir && autoreconf )
22     fi
23 done
24
25 # Alas, darcs doesn't handle file permissions, so fix a few of them.
26 for f in boot darcs-all push-all validate
27 do
28     if test -f $f
29     then
30         chmod +x $f
31     fi
32 done
33
34 for f in libraries/*; do
35    dir=`basename $f`
36    cabals=`echo $f/*.cabal`
37    if test -f $cabals; then
38        echo "Creating $f/ghc.mk"
39        rm -f $f/ghc.mk
40        pkg=`basename ${cabals%.cabal}`
41        echo "${f}_PACKAGE = ${pkg}" >> $f/ghc.mk
42        echo "\$(eval \$(call build-package,${f},dist-install,1))" >> $f/ghc.mk
43        rm -f $f/GNUmakefile
44        echo "Creating $f/GNUmakefile"
45        echo "dir = ${f}" >> $f/GNUmakefile
46        echo "TOP = ../.." >> $f/GNUmakefile
47        echo "include \$(TOP)/mk/sub-makefile.mk" >> $f/GNUmakefile
48    fi
49 done