s_win32 3.75 KB
Newer Older
1
#!/bin/sh -
jimw@mysql.com's avatar
jimw@mysql.com committed
2
#	$Id: s_win32,v 12.10 2005/11/03 17:46:13 bostic Exp $
3 4 5 6
#
# Build Windows/32 include files.

msgc="/* DO NOT EDIT: automatically built by dist/s_win32. */"
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
7
msgw="; DO NOT EDIT: automatically built by dist/s_win32."
8

jimw@mysql.com's avatar
jimw@mysql.com committed
9
. RELEASE
10

ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
11 12 13
s=/tmp/__db_a$$
t=/tmp/__db_b$$
rm -f $s $t
14

ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
15
trap 'rm -f $s $t ; exit 1' 1 2 3 13 15
16

ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
17 18
# Build the Win32 automatically generated files.
cat <<ENDOFSEDTEXT > $s
jimw@mysql.com's avatar
jimw@mysql.com committed
19 20 21
/@inttypes_h_decl@/d
/@stdint_h_decl@/d
s/@stddef_h_decl@/#include <stddef.h>/
jimw@mysql.com's avatar
jimw@mysql.com committed
22 23
/@unistd_h_decl@/d
/@thread_h_decl@/d
24 25 26 27 28
s/@u_int8_decl@/typedef unsigned char u_int8_t;/
s/@int16_decl@/typedef short int16_t;/
s/@u_int16_decl@/typedef unsigned short u_int16_t;/
s/@int32_decl@/typedef int int32_t;/
s/@u_int32_decl@/typedef unsigned int u_int32_t;/
jimw@mysql.com's avatar
jimw@mysql.com committed
29 30 31
s/@int64_decl@/typedef __int64 int64_t;/
s/@u_int64_decl@/typedef unsigned __int64 u_int64_t;/
s/@db_seq_decl@/typedef int64_t db_seq_t;/
jimw@mysql.com's avatar
jimw@mysql.com committed
32 33
s/@pid_t_decl@/typedef int pid_t;/
s/@db_threadid_t_decl@/typedef u_int32_t db_threadid_t;/
34 35
/@u_char_decl@/{
	i\\
jimw@mysql.com's avatar
jimw@mysql.com committed
36
#ifndef _WINSOCKAPI_
37 38 39 40 41 42 43
	s/@u_char_decl@/typedef unsigned char u_char;/
}
s/@u_short_decl@/typedef unsigned short u_short;/
s/@u_int_decl@/typedef unsigned int u_int;/
/@u_long_decl@/{
	s/@u_long_decl@/typedef unsigned long u_long;/
	a\\
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
44 45 46 47
#endif
}
/@ssize_t_decl@/{
	i\\
jimw@mysql.com's avatar
jimw@mysql.com committed
48 49 50 51 52 53 54 55 56 57 58 59
#ifdef _WIN64\\
typedef int64_t ssize_t;\\
#else\\
typedef int32_t ssize_t;\\
#endif
	d
}
s/@uintmax_t_decl@/typedef u_int64_t uintmax_t;/
/@uintptr_t_decl@/{
	i\\
#ifdef _WIN64\\
typedef u_int64_t uintptr_t;\\
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
60
#else\\
jimw@mysql.com's avatar
jimw@mysql.com committed
61
typedef u_int32_t uintptr_t;\\
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
62 63
#endif
	d
64 65 66 67 68
}
s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/
s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/
s/@DB_VERSION_PATCH@/$DB_VERSION_PATCH/
s/@DB_VERSION_STRING@/"$DB_VERSION_STRING"/
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
69
s/@DB_VERSION_UNIQUE_NAME@//
jimw@mysql.com's avatar
jimw@mysql.com committed
70 71 72
s/@DB_CONST@//
s/@DB_PROTO1@/#undef __P/
s/@DB_PROTO2@/#define	__P(protos)	protos/
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
73 74 75 76
ENDOFSEDTEXT
(echo "$msgc" &&
    sed -f $s ../dbinc/db.in &&
    cat ../dbinc_auto/ext_prot.in) > $t
jimw@mysql.com's avatar
jimw@mysql.com committed
77 78
test `egrep '@.*@' $t` && {
	egrep '@.*@' $t
jimw@mysql.com's avatar
jimw@mysql.com committed
79 80 81 82
	echo 'Unexpanded autoconf variables found in Windows db.h.'
	exit 1
}
f=../build_win32/db.h
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
83 84 85 86 87
cmp $t $f > /dev/null 2>&1 ||
    (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)

cat <<ENDOFSEDTEXT > $s
s/@cxx_have_stdheaders@/#define	HAVE_CXX_STDHEADERS 1/
88
ENDOFSEDTEXT
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
89
(echo "$msgc" && sed -f $s ../dbinc/db_cxx.in) > $t
jimw@mysql.com's avatar
jimw@mysql.com committed
90 91
test `egrep '@.*@' $t` && {
	egrep '@.*@' $t
jimw@mysql.com's avatar
jimw@mysql.com committed
92 93 94 95
	echo 'Unexpanded autoconf variables found in Windows db_cxx.h.'
	exit 1
}
f=../build_win32/db_cxx.h
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
96 97
cmp $t $f > /dev/null 2>&1 ||
    (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
98

ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
99
cat <<ENDOFSEDTEXT > $s
jimw@mysql.com's avatar
jimw@mysql.com committed
100 101
s/@INT64_FMT@//
s/@UINT64_FMT@//
jimw@mysql.com's avatar
jimw@mysql.com committed
102
s/@PATH_SEPARATOR@/\\\\\\\\\/:/
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
103
s/@db_int_def@//
104
ENDOFSEDTEXT
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
105
(echo "$msgc" && sed -f $s ../dbinc/db_int.in) > $t
jimw@mysql.com's avatar
jimw@mysql.com committed
106 107
test `egrep '@.*@' $t` && {
	egrep '@.*@' $t
jimw@mysql.com's avatar
jimw@mysql.com committed
108 109 110 111
	echo 'Unexpanded autoconf variables found in Windows db_int.h.'
	exit 1
}
f=../build_win32/db_int.h
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
112 113 114 115 116 117 118
cmp $t $f > /dev/null 2>&1 ||
    (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)

f=../build_win32/db_config.h
(echo "$msgc" && sed "s/__EDIT_DB_VERSION__/$DB_VERSION/" win_config.in) > $t
cmp $t $f > /dev/null 2>&1 ||
    (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
119 120

f=../build_win32/libdb.rc
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
121
cat <<ENDOFSEDTEXT > $s
122 123 124 125
s/%MAJOR%/$DB_VERSION_MAJOR/
s/%MINOR%/$DB_VERSION_MINOR/
s/%PATCH%/$DB_VERSION_PATCH/
ENDOFSEDTEXT
ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
sed -f $s ../build_win32/libdbrc.src > $t
cmp $t $f > /dev/null 2>&1 ||
    (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)

f=../build_win32/libdb.def
(echo $msgw &&
 echo &&
 echo EXPORTS;
a=1
for i in `sed -e '/^$/d' -e '/^#/d' win_exports.in`; do
	echo "	$i	@$a"
	a=`expr $a + 1`
done) > $t
cmp $t $f > /dev/null 2>&1 ||
    (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f)
141

jimw@mysql.com's avatar
jimw@mysql.com committed
142 143 144 145 146
f=../build_win32/win_db.h
i=win_db.in
cmp $i $f > /dev/null 2>&1 ||
    (echo "Building $f" && rm -f $f && cp $i $f && chmod 444 $f)

ram@mysql.r18.ru's avatar
ram@mysql.r18.ru committed
147
rm -f $s $t