4 # Build the BREW files on a POSIX system.
9 trap 'rm -f $s $t ; exit 0' 0
10 trap 'rm -f $s $t ; exit 1' 1 2 3 13 15
12 # Temporary directory to build in.
13 test -d ../build_brew_x || mkdir ../build_brew_x
15 # Copy in db_config.h.
17 # We do have system include files in the POSIX build.
18 f=../build_brew_x/db_config.h
19 cat <<ENDOFSEDTEXT > $s
20 /HAVE_SYSTEM_INCLUDE_FILES/{
22 #define HAVE_SYSTEM_INCLUDE_FILES 1
25 sed -f $s < ../build_brew/db_config.h > $t
26 cmp $t $f > /dev/null 2>&1 ||
27 (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
30 f=../build_brew_x/db.h
31 sed -e '/typedef.*[ ]FILE;/s/.*/#define IFile FILE/' \
32 -e '/typedef.*[ ]off_t;/d' \
33 -e '/typedef.*[ ]time_t;/d' \
34 -e '/typedef.*[ ]uintptr_t;/d' \
35 -e '/#include.<AEEFile.h>/d' \
36 < ../build_brew/db.h > $t
38 cmp $t $f > /dev/null 2>&1 ||
39 (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
42 f=../build_brew_x/brew_db.h
43 cmp brew/brew_posix.h $f > /dev/null 2>&1 ||
44 (echo "Building $f" && rm -f $f && cp brew/brew_posix.h $f && chmod 444 $f)
48 # Delete all references to isalpha, isdigit, isprint, isspace.
49 f=../build_brew_x/clib_port.h
50 sed -e '/HAVE_ISALPHA/,/#endif/d' \
51 -e '/HAVE_ISDIGIT/,/#endif/d' \
52 -e '/HAVE_ISPRINT/,/#endif/d' \
53 -e '/HAVE_ISSPACE/,/#endif/d' < ../build_brew/clib_port.h > $t
54 cmp $t $f > /dev/null 2>&1 ||
55 (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
57 # Copy in remaining files.
58 for i in db_int.h errno.h; do
60 cmp ../build_brew/$i $f > /dev/null 2>&1 ||
61 (echo "Building $f" &&
62 rm -f $f && cp ../build_brew/$i $f && chmod 444 $f)
65 # Build a Makefile for testing on a POSIX system.
66 # $1 is srcfiles keyword
72 (cat brew/brew_make.in &&
74 echo '###################################################' &&
75 echo '# EVERYTHING BELOW THIS LINE IS GENERATED BY s_brew' &&
76 echo '##################################################' &&
78 grep -w $1 srcfiles.in |
88 grep -w $1 srcfiles.in |
95 -e 's/.*/&.o: ..\/&.c/' \
98 echo 'libdb.a: $(OBJS)' &&
99 echo ' ar cr $@ $(OBJS)') > $t
101 cmp $t $f > /dev/null 2>&1 ||
102 (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
105 build_make brew Makefile