allow phases to be omitted by setting OMIT_PHASE_[123]=YES
[ghc.git] / boot-pkgs
1 #! /bin/sh
2 set -e
3
4 libraries=
5
6 for f in libraries/*; do
7   pkgs=$f/ghc-packages
8   if test -f $pkgs; then
9     for p in `cat $pkgs`; do
10       libraries="$libraries $f/$p"
11     done
12   else
13     libraries="$libraries $f"
14   fi
15 done
16
17 for f in $libraries; do
18    dir=`basename $f`
19    cabals=`echo $f/*.cabal`
20    if test -f $cabals; then
21        echo "Creating $f/ghc.mk"
22        rm -f $f/ghc.mk
23        pkg=`echo "$cabals" | sed -e 's#.*/##' -e 's#\.cabal$##'`
24        if test -f $f/ghc-stage; then
25            stage=`cat $f/ghc-stage`
26        else
27            stage=1
28        fi
29        top=`echo $f | sed 's#[^/]\+#..#g'`
30        echo "${f}_PACKAGE = ${pkg}" >> $f/ghc.mk
31        echo "${f}_dist-install_GROUP = libraries" >> $f/ghc.mk
32        echo "\$(eval \$(call build-package,${f},dist-install,${stage}))" >> $f/ghc.mk
33        rm -f $f/GNUmakefile
34        echo "Creating $f/GNUmakefile"
35        echo "dir = ${f}" >> $f/GNUmakefile
36        echo "TOP = ${top}" >> $f/GNUmakefile
37        echo "include \$(TOP)/mk/sub-makefile.mk" >> $f/GNUmakefile
38    fi
39 done