4 # Build the BREW files.
6 msgc="/* DO NOT EDIT: automatically built by dist/s_brew. */"
13 trap 'rm -f $s $t ; exit 0' 0
14 trap 'rm -f $s $t ; exit 1' 1 2 3 13 15
16 # Build the BREW db.h.
17 cat <<ENDOFSEDTEXT > $s
20 s/@stddef_h_decl@/#include <stddef.h>/
23 s/@u_int8_decl@/typedef unsigned char u_int8_t;/
24 s/@int16_decl@/typedef short int16_t;/
25 s/@u_int16_decl@/typedef unsigned short u_int16_t;/
26 s/@int32_decl@/typedef int int32_t;/
27 s/@u_int32_decl@/typedef unsigned int u_int32_t;/
30 s/@u_char_decl@/typedef unsigned char u_char;/
31 s/@u_int_decl@/typedef unsigned int u_int;/
32 s/@u_long_decl@/typedef unsigned long u_long;/
33 s/@u_short_decl@/typedef unsigned short u_short;/
34 s/@uintmax_t_decl@/typedef unsigned long uintmax_t;/
35 s/@uintptr_t_decl@/typedef unsigned long uintptr_t;/
36 s/@FILE_t_decl@/typedef IFile FILE;/
37 s/@off_t_decl@/typedef u_int32_t off_t;/
38 s/@pid_t_decl@/typedef int pid_t;/
39 s/@size_t_decl@/typedef unsigned int size_t;/
40 s/@ssize_t_decl@/typedef int ssize_t;/
41 s/@time_t_decl@/typedef long time_t;/
42 s/@db_seq_decl@/typedef int32_t db_seq_t;/
43 s/@db_threadid_t_decl@/typedef uintmax_t db_threadid_t;/
44 s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/
45 s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/
46 s/@DB_VERSION_PATCH@/$DB_VERSION_PATCH/
47 s/@DB_VERSION_STRING@/"$DB_VERSION_STRING"/
48 s/@DB_VERSION_UNIQUE_NAME@//
50 s/@DB_PROTO1@/#undef __P/
51 s/@DB_PROTO2@/#define __P(protos) protos/
56 \ AEEApplet a; /* AEEApplet must be listed first. */\\
57 \ void *db_global_values;\\
59 int brew_bdb_begin __P((void));\\
60 void brew_bdb_end __P((void));
63 /^#ifndef.__NO_SYSTEM_INCLUDES/i\\
65 /^#ifndef.__NO_SYSTEM_INCLUDES/,/^#endif/d
68 sed -f $s ../dbinc/db.in &&
69 cat ../dbinc_auto/api_flags.in &&
70 cat ../dbinc_auto/ext_prot.in) > $t
71 test `egrep '@.*@' $t` && {
73 echo 'Unexpanded autoconf variables found in BREW db.h.'
77 cmp $t $f > /dev/null 2>&1 ||
78 (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
80 # Build the BREW db_int.h.
81 cat <<ENDOFSEDTEXT > $s
82 s/@PATH_SEPARATOR@/\\\\\\\\\/:/
84 /#endif.*HAVE_SYSTEM_INCLUDE_FILES/a\\
87 (echo "$msgc" && sed -f $s ../dbinc/db_int.in) > $t
88 test `egrep '@.*@' $t` && {
90 echo 'Unexpanded autoconf variables found in BREW db_int.h.'
93 f=../build_brew/db_int.h
94 cmp $t $f > /dev/null 2>&1 ||
95 (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
97 # Build the BREW db_config.h
98 # We don't fail, but we complain if the brew_config.in file isn't up-to-date.
101 egrep '^#undef' config.hin | awk '{print $2}' | sort > $s
102 (egrep '#undef' $1 | awk '{print $3}'
103 egrep '^#define' $1 | awk '{print $2}') | sort > $t
104 cmp $s $t > /dev/null || {
105 echo "config.hin and $1 differ"
106 echo "<<< config.hin >>> $1"
110 check_config brew/brew_config.in
111 f=../build_brew/db_config.h
113 sed "s/__EDIT_DB_VERSION__/$DB_VERSION/" brew/brew_config.in) > $t
114 cmp $t $f > /dev/null 2>&1 ||
115 (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
117 # Build BREW's brew_db.h
118 f=../build_brew/brew_db.h
120 cmp $i $f > /dev/null 2>&1 ||
121 (echo "Building $f" && rm -f $f && cp $i $f && chmod 444 $f)
123 # Build the BREW clib_port.h.
124 cat <<ENDOFSEDTEXT > $s
128 sed -f $s clib_port.in > $t
129 test `egrep '@.*@' $t` && {
131 echo 'Unexpanded autoconf variables found in BREW clib_port.h.'
134 f=../build_brew/clib_port.h
135 cmp $t $f > /dev/null 2>&1 ||
136 (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
139 f=../build_brew/errno.h
140 cmp errno.h $f > /dev/null 2>&1 ||
141 (echo "Building $f" && rm -f $f && cp errno.h $f && chmod 444 $f)