r8306: some more heimdal configure checks
[sfrench/samba-autobuild/.git] / source4 / heimdal_build / build_external.sh
1 #!/bin/sh
2 #####################
3 # build generated asn1, et and flex files in heimdal/ tree
4 # tridge@samba.org, June 2005
5
6 TOP=`pwd`
7 ASN1_COMPILE=$TOP/bin/asn1_compile
8 ET_COMPILE=$TOP/bin/compile_et
9
10 # we need to substitute these correctly based on configure output
11 FLEX=flex
12 BISON=bison
13 CC=gcc
14
15 build_asn1() {
16     f=$1
17     name=$2
18
19     dir=`dirname $f`
20     file=`basename $f`
21     echo Building $f
22     cd $dir && $ASN1_COMPILE $file $name || exit 1
23     for f in *.x; do
24         base=`basename $f .x`
25         rm -f $base.c && cp $base.x $base.c
26     done
27     cd $TOP || exit 1
28 }
29
30 build_et() {
31     f=$1
32     dir=`dirname $f`
33     file=`basename $f`
34     echo Building $f
35     cd $dir && $ET_COMPILE $file || exit 1
36     cd $TOP || exit 1
37 }
38
39 build_lex() {
40     f=$1
41     dir=`dirname $f`
42     file=`basename $f`
43     base=`basename $f .l`
44     echo Building $f
45     cd $dir && $FLEX $file
46     sed '/^#/ s|$base.yy\.c|$base.c|' $base.yy.c > $base.c
47     cd $TOP || exit 1
48 }
49
50 build_bison() {
51     f=$1
52     dir=`dirname $f`
53     file=`basename $f`
54     base=`basename $f .y`
55     echo Building $f
56     cd $dir && $BISON -y -d $file
57     sed -e "/^#/!b" -e "s|y\.tab\.h|$base.h|" y.tab.h > $base.h
58     sed '/^#/ s|y\.tab\.c|$base.c|' y.tab.c > $base.c
59     cd $TOP || exit 1
60 }
61
62 build_cp() {
63     f=$1
64     dir=`dirname $f`
65     file=`basename $f`
66     base=`basename $f in`
67     echo Building $f
68     echo cp $base"in" $base
69     cd $dir && cp $base"in" $base
70     cd $TOP || exit 1
71 }
72
73 build_cp heimdal/lib/roken/vis.hin
74 build_lex heimdal/lib/asn1/lex.l
75 build_lex heimdal/lib/com_err/lex.l
76 build_bison heimdal/lib/com_err/parse.y
77 build_bison heimdal/lib/asn1/parse.y
78
79 make bin/asn1_compile || exit 1
80 build_asn1 heimdal/lib/hdb/hdb.asn1 hdb_asn1
81 build_asn1 heimdal/lib/gssapi/spnego.asn1 spnego_asn1
82 build_asn1 heimdal/lib/asn1/k5.asn1 krb5_asn1
83
84 make bin/compile_et || exit 1
85 build_et heimdal/lib/hdb/hdb_err.et
86 build_et heimdal/lib/krb5/krb5_err.et
87 build_et heimdal/lib/krb5/heim_err.et
88 build_et heimdal/lib/krb5/k524_err.et
89 build_et heimdal/lib/asn1/asn1_err.et