File: rules

package info (click to toggle)
db5.3 5.3.28+dfsg1-0.2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 158,352 kB
  • sloc: ansic: 448,411; java: 111,824; tcl: 80,544; sh: 44,326; cs: 33,697; cpp: 21,604; perl: 14,557; xml: 10,799; makefile: 4,090; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (256 lines) | stat: -rwxr-xr-x 7,573 bytes parent folder | download
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules for Berkeley DB defaults
# Copyright (C) 2011 Ondřej Surý
# Published under the GNU GPL license
# Partially based on previous work by Clint Adams
#
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

export DH_ALWAYS_EXCLUDE=.arch-ids

include /usr/share/dpkg/architecture.mk

# Don't try to build this file if missing
/usr/share/javahelper/java-vars.mk:
	:

-include /usr/share/javahelper/java-vars.mk

JAVA_BROKEN_ARCHS =

ENABLE_JAVA=no

ifeq (,$(filter $(DEB_HOST_ARCH), $(JAVA_BROKEN_ARCHS)))
  ENABLE_JAVA=yes
endif

ifeq ($(DEB_STAGE),stage1)
  ENABLE_JAVA=no
  ENABLE_TCL=no
else
  ENABLE_TCL=yes
endif

CONFIGURE_SWITCHES =    --prefix=/usr \
			--mandir=\$${prefix}/share/man \
			--localstatedir=/var \
			--sysconfdir=/etc \
			--libexecdir=/usr/lib \
			--enable-cxx \
			--enable-compat185 \
			--enable-sql \
			--enable-stl \
			--enable-dbm

ifeq ($(ENABLE_TCL),yes)
  ENABLE_TESTS=yes
  CONFIGURE_SWITCHES += --enable-tcl
ifneq (,$(wildcard /usr/lib/$(DEB_HOST_MULTIARCH)/tcl*))
  CONFIGURE_SWITCHES += --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)
else
  CONFIGURE_SWITCHES += --with-tcl=/usr/lib
endif
else
  ENABLE_TESTS=no
  CONFIGURE_SWITCHES += --disable-tcl
  DH_OPTIONS += -Nlibdb5.1-tcl
endif

ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
  ENABLE_TESTS=no
endif

ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
  ENABLE_TESTS=no
endif

ifeq ($(ENABLE_TESTS),yes)
  CONFIGURE_SWITCHES += --enable-test
else
  CONFIGURE_SWITCHES += --disable-test
endif

ifeq (zx86_64-linux-gnuz,z$(DEB_HOST_GNU_TYPE)z)
CONFIGURE_SWITCHES += --with-mutex=POSIX/pthreads/library
endif
ifeq (zavr32-linux-gnuz,z$(DEB_HOST_GNU_TYPE)z)
CONFIGURE_SWITCHES += --enable-posixmutexes
endif

ifeq (yes,$(ENABLE_JAVA))
JAVACFLAGS=-source 1.7 -target 1.7
JAVA_HOME ?= /usr/lib/jvm/default-java
CFLAGS += -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
CONFIGURE_SWITCHES += --enable-java
DH_PLUGINS += --with=javahelper
else
CONFIGURE_SWITCHES += --disable-java
DH_OPTIONS += -Nlibdb5.3-java -Nlibdb5.3-java-dev -Nlibdb5.3-java-jni
endif

ifeq (no,$(ENABLE_SQL))
DH_OPTIONS += -Nlibdb5.1-sql
  CONFIGURE_SWITCHES += --disable-sql
endif


BROKEN_CPUS = zs390z
VERY_BROKEN_CPUS = zhppaz
BROKEN_SYSTEMS = zgnuz
VERY_BROKEN_SYSTEMS =

TCLSH=/usr/bin/tclsh

export DH_OPTIONS

package=db5.3
bdbversion=5.3

version=$(shell expr `pwd` : '.*-\([0-9.]*\)')
version_major=$(shell expr `pwd` : '.*-\([0-9]*\).[0-9.]*')

LIBTOOL_AUX_FILES=config.guess config.sub install-sh ltmain.sh
LIBTOOL_MACROS_FILES=libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4

RECONF_FILES=dist/config.hin \
             dist/configure \
             $(patsubst %,dist/%,$(LIBTOOL_AUX_FILES)) \
             $(patsubst %,dist/aclocal/%,$(LIBTOOL_MACROS_FILES)) \
             lang/sql/sqlite/aclocal.m4 \
             lang/sql/sqlite/configure \
             $(patsubst %,lang/sql/sqlite/%,$(LIBTOOL_AUX_FILES))

%:
	dh $@ --with=autotools-dev $(DH_PLUGINS)

override_dh_auto_configure:
	if [ ! -d $(CURDIR)/debian/s_config ]; then \
	  mkdir -p $(CURDIR)/debian/s_config/dist/aclocal/ \
	           $(CURDIR)/debian/s_config/lang/sql/sqlite/; \
	fi
	for f in $(RECONF_FILES); do \
	  if [ ! -f $(CURDIR)/debian/s_config/$$f ]; then \
	    mv $(CURDIR)/$$f $(CURDIR)/debian/s_config/`dirname $$f`; \
	  fi; \
	done
	cd dist && libtoolize -cfi
	cd lang/sql/sqlite && libtoolize -cfi
	cd dist && ./s_config
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	JAVACFLAGS="$(JAVACFLAGS)" dh_auto_configure -Ddist -Bbuild-test -- $(CONFIGURE_SWITCHES) --enable-test
endif
	JAVACFLAGS="$(JAVACFLAGS)" dh_auto_configure -Ddist -Bbuild-production -- $(CONFIGURE_SWITCHES) --disable-test

override_dh_auto_clean:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	dh_auto_clean -Ddist -Bbuild-test
endif
	dh_auto_clean -Ddist -Bbuild-production
	rm -f $(CURDIR)/debian/build_signature.txt
	for f in $(RECONF_FILES); do \
	  if [ -f $(CURDIR)/debian/s_config/$$f ]; then \
	    mv $(CURDIR)/debian/s_config/$$f $(CURDIR)/`dirname $$f`; \
	  fi; \
	done
	if [ -d $(CURDIR)/debian/s_config/ ]; then \
	  rmdir $(CURDIR)/debian/s_config/dist/aclocal/ \
	        $(CURDIR)/debian/s_config/dist/ \
	        $(CURDIR)/debian/s_config/lang/sql/sqlite/ \
	        $(CURDIR)/debian/s_config/lang/sql/ \
	        $(CURDIR)/debian/s_config/lang/ \
	        $(CURDIR)/debian/s_config/; \
	fi

override_dh_auto_test:
ifeq (,$(findstring z$(DEB_BUILD_GNU_CPU)z,$(VERY_BROKEN_CPUS))$(findstring z$(DEB_BUILD_GNU_SYSTEM)z,$(VERY_BROKEN_SYSTEMS)))
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	cd build-test && make cutest && ./cutest
	echo 'source ../test/tcl/test.tcl; run_std;' | tclsh

ifeq (,$(findstring z$(DEB_BUILD_GNU_CPU)z,$(BROKEN_CPUS))$(findstring z$(DEB_BUILD_GNU_SYSTEM)z,$(BROKEN_SYSTEMS)))
	! grep ^FAIL build-test/ALL.OUT
else
# Testsuite failures are marked as non-fatal on $(DEB_BUILD_GNU_SYSTEM)-$(DEB_BUILD_GNU_CPU)
	grep ^FAIL build-test/ALL.OUT || true
endif
else
# Testsuite has been disabled by DEB_BUILD_OPTIONS=$(DEB_BUILD_OPTIONS)
endif
else
# Testsuite has been disabled on $(DEB_BUILD_GNU_SYSTEM)-$(DEB_BUILD_GNU_CPU)
endif

override_dh_auto_install:
	dh_auto_install -Ddist -Bbuild-production

# Remove .la files
	rm -f $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/*.la

# Remove libdb*-5.so from all packages, we don't provide generic libdb5 packages
	rm -f $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libdb*5.so

# Reduce duplication in duplicate .a files by symlinking
	for v in "" _cxx _sql _stl _tcl; do \
	  rm -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libdb$$v.a; \
	  ln -s libdb$$v-$(bdbversion).a $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libdb$$v.a; \
	done

# only works for the native build
ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
# Compare built-in signature and fail build if it is different
	cc -o$(CURDIR)/debian/db_signature \
	   -I$(CURDIR)/debian/tmp/usr/include \
	     $(CURDIR)/debian/db_signature.c \
	     $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libdb.a

	$(CURDIR)/debian/db_signature > $(CURDIR)/debian/build_signature_$(DEB_HOST_ARCH).txt

	echo -n "Berkeley DB signature is:"; $(CURDIR)/debian/db_signature

ifneq ($(DEB_STAGE),stage1)
	if [ -f $(CURDIR)/debian/saved_signature_$(DEB_HOST_ARCH).txt ]; then \
	    cmp $(CURDIR)/debian/saved_signature_$(DEB_HOST_ARCH).txt         \
	        $(CURDIR)/debian/build_signature_$(DEB_HOST_ARCH).txt         \
	    || ( echo "Region environment signatures differ."; exit 1; );     \
	fi
endif
endif

	mv $(CURDIR)/debian/tmp/usr/bin/dbsql $(CURDIR)/debian/tmp/usr/bin/db_sql
	rm -f $(CURDIR)/debian/tmp/usr/bin/sqlite3

	for i in $(CURDIR)/debian/tmp/usr/bin/db_*; do \
	  mv $$i $$(echo $$i | sed -e 's{usr/bin/db_{usr/bin/$(package)_{'); \
	done

override_dh_install:
	dh_install -a -Xusr/doc --list-missing
ifeq ($(ENABLE_TCL),yes)
	tcltk-depends
endif

override_dh_installdocs-indep:
	dh_installdocs -pdb5.3-doc -plibdb5.3-java

override_dh_installdocs-arch:
	dh_installdocs --link-doc=libdb5.3
ifeq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
	# Install build_signature_$(DEB_HOST_ARCH).txt to docs
	mkdir -p $(CURDIR)/debian/libdb5.3/usr/share/doc/libdb5.3/
	install -m 644 debian/build_signature_$(DEB_HOST_ARCH).txt $(CURDIR)/debian/libdb5.3/usr/share/doc/libdb5.3/
endif

override_dh_strip:
	dh_strip -s --dbg-package=libdb5.3-dbg

override_dh_clean:
	rm -rf build
	rm -f $(CURDIR)/debian/db_signature
	DH_OPTIONS="" dh_clean

override_jh_installlibs:
ifeq (yes,$(ENABLE_JAVA))
	jh_installlibs
endif