boot 1.6 KB
Newer Older
sven.panne@aedion.de's avatar
sven.panne@aedion.de committed
1
#! /bin/sh
2
3
set -e

4
# Check that we have all boot packages.
5
for dir in `grep "^[^# ][^ ]*  *[^ ][^ ]*  *[^ ][^ ]*$" packages | sed "s/ .*//"`
Ian Lynagh's avatar
Ian Lynagh committed
6
do
Ian Lynagh's avatar
Ian Lynagh committed
7
    if test ! -f $dir/LICENSE
Ian Lynagh's avatar
Ian Lynagh committed
8
    then
Ian Lynagh's avatar
Ian Lynagh committed
9
        echo "Error: $dir/LICENSE doesn't exist." >&2
Ian Lynagh's avatar
Ian Lynagh committed
10
11
12
        echo "Maybe you haven't done './darcs-all get'?" >&2
        exit 1
    fi
13
done
14

Ian Lynagh's avatar
Ian Lynagh committed
15
16
17
18
19
20
21
22
# autoreconf everything that needs it.
for dir in . libraries/*
do
    if test -f $dir/configure.ac
    then
        echo "Booting $dir"
        ( cd $dir && autoreconf )
    fi
23
24
done

sven.panne@aedion.de's avatar
sven.panne@aedion.de committed
25
# Alas, darcs doesn't handle file permissions, so fix a few of them.
Ian Lynagh's avatar
Ian Lynagh committed
26
27
for f in boot darcs-all push-all validate
do
Ian Lynagh's avatar
Ian Lynagh committed
28
29
30
31
    if test -f $f
    then
        chmod +x $f
    fi
32
done
Ian Lynagh's avatar
Ian Lynagh committed
33

34
35
libraries=

Ian Lynagh's avatar
Ian Lynagh committed
36
for f in libraries/*; do
37
38
39
40
41
42
43
44
45
46
47
  pkgs=$f/ghc-packages
  if test -f $pkgs; then
    for p in `cat $pkgs`; do
      libraries="$libraries $f/$p"
    done
  else
    libraries="$libraries $f"
  fi
done

for f in $libraries; do
Ian Lynagh's avatar
Ian Lynagh committed
48
49
50
51
52
   dir=`basename $f`
   cabals=`echo $f/*.cabal`
   if test -f $cabals; then
       echo "Creating $f/ghc.mk"
       rm -f $f/ghc.mk
53
       pkg=`echo "$cabals" | sed -e 's#.*/##' -e 's#\.cabal$##'`
54
55
56
57
58
       if test -f $f/ghc-stage; then
           stage=`cat $f/ghc-stage`
       else
           stage=1
       fi
Ian Lynagh's avatar
Ian Lynagh committed
59
       top=`echo $f | sed 's#[^/]\+#..#g'`
Ian Lynagh's avatar
Ian Lynagh committed
60
       echo "${f}_PACKAGE = ${pkg}" >> $f/ghc.mk
61
       echo "\$(eval \$(call build-package,${f},dist-install,${stage}))" >> $f/ghc.mk
Ian Lynagh's avatar
Ian Lynagh committed
62
63
64
       rm -f $f/GNUmakefile
       echo "Creating $f/GNUmakefile"
       echo "dir = ${f}" >> $f/GNUmakefile
65
       echo "TOP = ${top}" >> $f/GNUmakefile
Ian Lynagh's avatar
Ian Lynagh committed
66
67
68
       echo "include \$(TOP)/mk/sub-makefile.mk" >> $f/GNUmakefile
   fi
done