summaryrefslogtreecommitdiff
path: root/dist/s_sig
blob: 545451fd3892af2b1f86826b8988dbbcb95413fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh -
#	$Id$
#
# Build structure signature code.

a=/tmp/__db_a.$$
b=/tmp/__db_b.$$
trap 'rm -f $a $b; exit 0' 0 1 2 3 13 15

cat ../dbinc/db.in ../dbinc/db_int.in ../dbinc/*.h | 
sed -e '/__addrinfo/d' \
    -e '/__aes_cipher/d' \
    -e '/__cipher/d' \
    -e '/__queued_output/d' \
    -e '/__repmgr_connection/d' \
    -e '/__repmgr_message/d' \
    -e '/__repmgr_retry/d' \
    -e '/__repmgr_runnable/d' \
    -e '/__repmgr_site/d' \
    -e '/struct.*mutex.*{/i\
#ifdef	HAVE_MUTEX_SUPPORT' \
    -e '/struct.*mutex.*{/a\
#endif' \
    -e 's/.*[	 ]*struct[	 ]*\(__[a-z_]*\)[	 ]*{.*/	__ADD(\1);/p' \
    -e d > $a

cnt=`sed -e '$=' -e d $a`

cat << END_OF_TEXT > $b
/*-
 * DO NOT EDIT: automatically built by dist/s_sig.
 *
 * \$Id$
 */

#include "db_config.h"

#define	__INCLUDE_NETWORKING	1
#define __INCLUDE_SELECT_H      1
#include "db_int.h"

#include "dbinc/db_page.h"
#include "dbinc/btree.h"
#include "dbinc/crypto.h"
#include "dbinc/db_join.h"
#include "dbinc/db_verify.h"
#include "dbinc/hash.h"
#include "dbinc/lock.h"
#include "dbinc/log.h"
#include "dbinc/mp.h"
#include "dbinc/partition.h"
#include "dbinc/qam.h"
#include "dbinc/txn.h"

END_OF_TEXT

echo "#define	__STRUCTURE_COUNT	$cnt" >> $b

cat << END_OF_TEXT >> $b

/*
 * __env_struct_sig --
 *	Compute signature of structures.
 *
 * PUBLIC: u_int32_t __env_struct_sig __P((void));
 */
u_int32_t
__env_struct_sig()
{
	u_short t[__STRUCTURE_COUNT + 5];
	u_int i;

	i = 0;
#define	__ADD(s)	(t[i++] = sizeof(struct s))

END_OF_TEXT

cat $a >> $b

cat << END_OF_TEXT >> $b

	return (__ham_func5(NULL, t, i * sizeof(t[0])));
}
END_OF_TEXT

f=../env/env_sig.c
cmp $b $f > /dev/null 2>&1 ||
    (echo "Building $f" && rm -f $f && cp $b $f && chmod 444 $f)