1 | #!/bin/sh - |
---|
2 | # Id: s_win32,v 1.25 2002/05/20 19:18:14 bostic Exp |
---|
3 | # |
---|
4 | # Build Windows/32 include files. |
---|
5 | |
---|
6 | msgc="/* DO NOT EDIT: automatically built by dist/s_win32. */" |
---|
7 | msgw="; DO NOT EDIT: automatically built by dist/s_win32." |
---|
8 | |
---|
9 | . RELEASE |
---|
10 | |
---|
11 | s=/tmp/__db_a$$ |
---|
12 | t=/tmp/__db_b$$ |
---|
13 | rm -f $s $t |
---|
14 | |
---|
15 | trap 'rm -f $s $t ; exit 1' 1 2 3 13 15 |
---|
16 | |
---|
17 | # Build the Win32 automatically generated files. |
---|
18 | f=../build_win32/db.h |
---|
19 | cat <<ENDOFSEDTEXT > $s |
---|
20 | s/@u_int8_decl@/typedef unsigned char u_int8_t;/ |
---|
21 | s/@int16_decl@/typedef short int16_t;/ |
---|
22 | s/@u_int16_decl@/typedef unsigned short u_int16_t;/ |
---|
23 | s/@int32_decl@/typedef int int32_t;/ |
---|
24 | s/@u_int32_decl@/typedef unsigned int u_int32_t;/ |
---|
25 | /@u_char_decl@/{ |
---|
26 | i\\ |
---|
27 | #if !defined(_WINSOCKAPI_) |
---|
28 | s/@u_char_decl@/typedef unsigned char u_char;/ |
---|
29 | } |
---|
30 | s/@u_short_decl@/typedef unsigned short u_short;/ |
---|
31 | s/@u_int_decl@/typedef unsigned int u_int;/ |
---|
32 | /@u_long_decl@/{ |
---|
33 | s/@u_long_decl@/typedef unsigned long u_long;/ |
---|
34 | a\\ |
---|
35 | #endif |
---|
36 | } |
---|
37 | /@ssize_t_decl@/{ |
---|
38 | i\\ |
---|
39 | #if defined(_WIN64)\\ |
---|
40 | typedef __int64 ssize_t;\\ |
---|
41 | #else\\ |
---|
42 | typedef int ssize_t;\\ |
---|
43 | #endif |
---|
44 | d |
---|
45 | } |
---|
46 | s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/ |
---|
47 | s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/ |
---|
48 | s/@DB_VERSION_PATCH@/$DB_VERSION_PATCH/ |
---|
49 | s/@DB_VERSION_STRING@/"$DB_VERSION_STRING"/ |
---|
50 | s/@DB_VERSION_UNIQUE_NAME@// |
---|
51 | ENDOFSEDTEXT |
---|
52 | (echo "$msgc" && |
---|
53 | sed -f $s ../dbinc/db.in && |
---|
54 | cat ../dbinc_auto/rpc_defs.in && |
---|
55 | cat ../dbinc_auto/ext_prot.in) > $t |
---|
56 | cmp $t $f > /dev/null 2>&1 || |
---|
57 | (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) |
---|
58 | |
---|
59 | f=../build_win32/db_cxx.h |
---|
60 | cat <<ENDOFSEDTEXT > $s |
---|
61 | s/@cxx_have_stdheaders@/#define HAVE_CXX_STDHEADERS 1/ |
---|
62 | ENDOFSEDTEXT |
---|
63 | (echo "$msgc" && sed -f $s ../dbinc/db_cxx.in) > $t |
---|
64 | cmp $t $f > /dev/null 2>&1 || |
---|
65 | (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) |
---|
66 | |
---|
67 | f=../build_win32/db_int.h |
---|
68 | cat <<ENDOFSEDTEXT > $s |
---|
69 | s/\(PATH_SEPARATOR[^"]*"\)\/"/\1\\\\\\\\\\/:\"/ |
---|
70 | s/@db_align_t_decl@/typedef unsigned long db_align_t;/ |
---|
71 | s/@db_alignp_t_decl@/typedef unsigned long db_alignp_t;/ |
---|
72 | s/@db_int_def@// |
---|
73 | ENDOFSEDTEXT |
---|
74 | (echo "$msgc" && sed -f $s ../dbinc/db_int.in) > $t |
---|
75 | cmp $t $f > /dev/null 2>&1 || |
---|
76 | (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) |
---|
77 | |
---|
78 | f=../build_win32/db_config.h |
---|
79 | (echo "$msgc" && sed "s/__EDIT_DB_VERSION__/$DB_VERSION/" win_config.in) > $t |
---|
80 | cmp $t $f > /dev/null 2>&1 || |
---|
81 | (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) |
---|
82 | |
---|
83 | f=../build_win32/libdb.rc |
---|
84 | cat <<ENDOFSEDTEXT > $s |
---|
85 | s/%MAJOR%/$DB_VERSION_MAJOR/ |
---|
86 | s/%MINOR%/$DB_VERSION_MINOR/ |
---|
87 | s/%PATCH%/$DB_VERSION_PATCH/ |
---|
88 | ENDOFSEDTEXT |
---|
89 | sed -f $s ../build_win32/libdbrc.src > $t |
---|
90 | cmp $t $f > /dev/null 2>&1 || |
---|
91 | (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) |
---|
92 | |
---|
93 | f=../build_win32/libdb.def |
---|
94 | (echo $msgw && |
---|
95 | echo && |
---|
96 | echo \ |
---|
97 | "DESCRIPTION 'Berkeley DB $DB_VERSION_MAJOR.$DB_VERSION_MINOR Library'" && |
---|
98 | echo && |
---|
99 | echo EXPORTS; |
---|
100 | a=1 |
---|
101 | for i in `sed -e '/^$/d' -e '/^#/d' win_exports.in`; do |
---|
102 | echo " $i @$a" |
---|
103 | a=`expr $a + 1` |
---|
104 | done) > $t |
---|
105 | cmp $t $f > /dev/null 2>&1 || |
---|
106 | (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) |
---|
107 | |
---|
108 | rm -f $s $t |
---|