File: rules

package info (click to toggle)
firebird4.0 4.0.5.3140.ds6-17
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 41,892 kB
  • sloc: ansic: 393,247; cpp: 355,953; sql: 14,917; yacc: 8,712; fortran: 5,645; sh: 5,184; pascal: 3,276; makefile: 1,342; asm: 271; perl: 194; xml: 55; csh: 15; awk: 1
file content (268 lines) | stat: -rwxr-xr-x 9,423 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
257
258
259
260
261
262
263
264
265
266
267
268
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@

FB_MAJOR:= $(shell awk '/FB_MAJOR_VER/ { v=$$3; gsub("\"", "", v); print v}' < src/jrd/build_no.h )
export FB_MAJOR
FB_MINOR:= $(shell awk '/FB_MINOR_VER/ { v=$$3; gsub("\"", "", v); print v}' < src/jrd/build_no.h )
FB_REV	:= $(shell awk '/FB_REV_NO/    { v=$$3; gsub("\"", "", v); print v}' < src/jrd/build_no.h )
FB_VER	:= $(FB_MAJOR).$(FB_MINOR)
export FB_VER
FB_FULL_VER:= $(FB_VER).$(FB_REV)
export FB_FULL_VER
FB_VER_NO_DOTS := $(FB_MAJOR)$(FB_MINOR)
export FB_VER_NO_DOTS

FB3_MULTI_VER="3.0.12.ds7-7+exp~"

include /usr/share/dpkg/pkg-info.mk
SOURCE_DATE := $(shell date -d@$(SOURCE_DATE_EPOCH) -u +"%Y-%m-%d")

CLIENT_SOVER := 2
export CLIENT_SOVER
UTIL_SOVER :=

ifndef FB_MAJOR
$(error FB_MAJOR not defined)
else ifndef FB_MINOR
$(error FB_MINOR not defined)
else ifndef FB_REV
$(error FB_REV not defined)
else ifndef FB_VER
$(error FB_VER not defined)
else ifndef FB_FULL_VER
$(error FB_FULL_VER not defined)
else ifndef CLIENT_SOVER
$(error CLIENT_SOVER not defined)
endif

-include /usr/share/dpkg/buildtools.mk
PKG_CONFIG ?= pkg-config
# Use the following lines to set the compiler if
# the default Debian one can't be used (or you want to try
# the bleeding edge)
#export CC=gcc-5
#export CXX=g++-5
#export CPP=cpp-5
#export CXXPP=cpp-5


export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
   NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
endif

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
	confflags += --build $(DEB_HOST_GNU_TYPE)
else
	confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH_OS), linux)
	confflags += --enable-raw-devices
else
	confflags += --disable-raw-devices
endif

DOC := /usr/share/doc/firebird${FB_VER}-common-doc
ULFB := /usr/lib/${DEB_HOST_MULTIARCH}/firebird/${FB_VER}
USFB := /usr/share/firebird/${FB_VER}
VAR := /var/lib/firebird/${FB_VER}
RUN := /run/firebird${FB_VER}

DEB_BUILD_MAINT_OPTIONS := hardening=+bindnow optimize=-lto
DEB_CXXFLAGS_MAINT_STRIP := -O2
DEB_CXXFLAGS_MAINT_APPEND := -DUCHAR_TYPE=uint16_t -fno-lifetime-dse -fno-strict-aliasing -O3
DEB_CFLAGS_MAINT_STRIP := -O2
DEB_CFLAGS_MAINT_APPEND := -fno-strict-aliasing -O3

include /usr/share/dpkg/buildflags.mk

confflags += --disable-rpath --with-gpre-cobol \
	     --enable-regen-codes \
	     --with-system-re2 \
	     --with-system-editline --prefix=${ULFB} --with-fbsbin=/usr/sbin \
	     --with-fblib=/usr/lib/${DEB_HOST_MULTIARCH} \
	     --with-fbconf=${ULFB} --with-fbdoc=${DOC} \
	     --with-fbudf=${ULFB}/UDF --with-fbsample=${DOC}/examples \
	     --with-fbsample-db=${DOC}/examples/empbuild \
	     --with-fbhelp=${VAR}/system --with-fbintl=${ULFB}/intl \
	     --with-fbmisc=${ULFB}/misc --with-fbsecure-db=${VAR}/system \
	     --with-fblog=/var/log/firebird --with-fbglock=${RUN} \
	     --with-fblogfilename=firebird$(FB_VER).log \
	     --with-fbplugins=${ULFB}/plugins \
	     --with-fbmsg=${ULFB}

# see #575564
export FIREBIRD_LOCK := $(CURDIR)/debian/tmp-lock

# Packaging is split into several packages:
# * firebirdVV-server (incl libengineXX)
# * libfbclient2
# * libib-util
# * firebirdVV-utils
# * firebirdVV-common (common parts to client and utils)
# * firebirdVV-common-doc (big copyright and changelog in one place)
# * firebirdVV-doc
# * firebirdVV-examples
# * firebird-dev

override_dh_autoreconf:
	mkdir -p builds/make.new/config
	dh_autoreconf

override_dh_auto_configure:
	dh_auto_configure -- $(confflags)

ifneq (,$(filter nodoc,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
    MANUALS_BASE_USR :=
    MANUALS_BASE_SYS :=
else
    MANUALS_BASE_USR := isql-fb gbak gfix gpre gsec fbstat nbackup \
                        fbsvcmgr fbtracemgr fb_lock_print fb_config \
			fb_wrapper
    MANUALS_BASE_SYS := fbguard firebird
endif
MANUALS := $(addprefix debian/man/,$(addsuffix .1.gz,$(MANUALS_BASE_USR))) \
           $(addprefix debian/man/,$(addsuffix .8.gz,$(MANUALS_BASE_SYS)))

%.1 : %.pod
	pod2man -c "Firebird documentation" --release "Firebird $(FB_VER)"  $< > $@
%.8 : %.pod
	pod2man -c "Firebird documentation" --release "Firebird $(FB_VER)"  --section 8 $< > $@

%.1.gz : %.1
	gzip -n -9 < $< > $@

%.8.gz : %.8
	gzip -n -9 < $< > $@

FB_IMG := debian/firebird-image

ODS_VER=$(shell grep -E '^const \S+ ODS_CURRENT\b' src/jrd/ods.h | sed 's/.*ODS_CURRENT//; s/\;.*//')

override_dh_auto_build:
	$(MAKE) -f debian/rules $(NJOBS) $(MANUALS)
	[ -d $(FIREBIRD_TMP) ] || mkdir $(FIREBIRD_TMP)
	rm -rf $(FB_IMG)
	dh_auto_build -- QUIET=1

	#fakeroot $(MAKE) -C gen -f Makefile.install buildRoot
	#mv ./gen/buildroot ./debian/firebird-build
	cp -a ./gen/Release/firebird $(FB_IMG)
	cp -a src/include/gen $(FB_IMG)/include-gen

	sed -i -e's,-I$$fb_incdir,,'  $(FB_IMG)/bin/fb_config
	sed -i -e's,-L$$fb_libdir ,,' $(FB_IMG)/bin/fb_config

	sh $(FB_IMG)/bin/fb_config --cflags
	sh $(FB_IMG)/bin/fb_config --libs

	# renamed utilities
	cp -a $(FB_IMG)/bin/gstat $(FB_IMG)/bin/fbstat
	cp -a $(FB_IMG)/bin/isql  $(FB_IMG)/bin/isql-fb

	sed -i -e '/^#RemoteBindAddress/ a RemoteBindAddress = localhost' "$(FB_IMG)/firebird.conf"
	sed -i -e 's|^#SecurityDatabase.*|SecurityDatabase = /var/lib/firebird/$(FB_VER)/system/security$(FB_MAJOR).fdb|' "$(FB_IMG)/firebird.conf"
	sed -i -e 's|^#Providers.*|Providers = Remote,Engine$(ODS_VER),Loopback|' "$(FB_IMG)/firebird.conf"
	sed -i -e '/^#RemoteServicePort/ {' -e 'G' -e 'a # managed by debian package scripts' -e 'a include service-port.conf' -e '}' "$(FB_IMG)/firebird.conf"
	touch "$(FB_IMG)/service-port.conf"

	sed -i -e 's,$$(this),$$(root)/intl,' "$(FB_IMG)/intl/fbintl.conf"

	rm -r "$(FB_IMG)/examples/empbuild"
	debian/gen-employee-sql > "$(FB_IMG)/examples/employee.sql"

	cp debian/firebird4.0-examples.README.Debian "$(FB_IMG)/examples/README.Debian"

	debian/gen-xbin-wrappers

	echo "Built image contents"
	cd $(FB_IMG) && ls -lR

override_dh_auto_test:
	FIREBIRD=$(CURDIR)/debian/firebird-image debian/postbuild-tests

override_dh_clean:
	dh_clean
	
	rm -f $(MANUALS)
	
	debconf-updatepo
	
	@echo FB_MAJOR = $(FB_MAJOR)
	@echo FB_MINOR = $(FB_MINOR)
	@echo FB_REV   = $(FB_REV)
	@echo FB_VER   = $(FB_VER)
	@echo FB_FULL_VER = $(FB_FULL_VER)
	@echo CLIENT_SOVER= $(CLIENT_SOVER)
	@echo UTIL_SOVER= $(UTIL_SOVER)

override_dh_auto_install:
	true

override_dh_install:
	dh_install --sourcedir=debian/firebird-image

override_dh_installsystemd:
	sed -e "s/\$${FB_VER}/$(FB_VER)/g" < debian/systemd-services.sed.in > debian/systemd-services.sed
	sed -f debian/systemd-services.sed < gen/install/misc/firebird.service > debian/firebird$(FB_VER)-server.firebird$(FB_VER).service

	dh_installsystemd --name firebird$(FB_VER)

override_dh_installtmpfiles:
	dh_installtmpfiles --name firebird$(FB_VER)

ICU_VER := $(shell $(PKG_CONFIG) icu-i18n --modversion|sed 's/[^0-9]*\([0-9]\+\).*/\1/')
ifeq ($(ICU_VER),)
    $(error Unable to determine ICU version)
endif

override_dh_installchangelogs:
	dh_installchangelogs CHANGELOG.md -p firebird$(FB_VER)-common-doc
override_dh_installdocs-indep:
	dh_installdocs -p firebird$(FB_VER)-common-doc --doc-main-package=firebird$(FB_VER)-common-doc
	dh_installdocs -Xchangelog -Xcopyright -X license/IDPL.txt -p firebird$(FB_VER)-doc
	recode windows-1252..utf8 "debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-doc/doc/ods11-index-structure.html"
	sed -i -e 's/windows-1252/UTF-8/' "debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-doc/doc/ods11-index-structure.html"
override_dh_installdocs-arch:
	true
override_dh_installexamples:
	dh_installexamples -p firebird$(FB_VER)-examples --sourcedir=$(FB_IMG)
override_dh_installlogrotate:
	dh_installlogrotate --name firebird$(FB_VER)
override_dh_installinit:
	dh_installinit -pfirebird$(FB_VER)-server --name=firebird$(FB_VER)
override_dh_link-arch:
	dh_link -a -A
override_dh_link-indep:
	mkdir -p debian/firebird$(FB_VER)-examples/usr/share/doc/firebird$(FB_VER)-common-doc
	mv debian/firebird$(FB_VER)-examples/usr/share/doc/firebird$(FB_VER)-examples/* \
	   debian/firebird$(FB_VER)-examples/usr/share/doc/firebird$(FB_VER)-common-doc/
	rmdir debian/firebird$(FB_VER)-examples/usr/share/doc/firebird$(FB_VER)-examples

	mkdir -p debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-common-doc
	mv debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-doc/* \
	   debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-common-doc/
	rmdir debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-doc

	dh_link -i -A
override_dh_makeshlibs:
	dh_makeshlibs -p libfbclient$(CLIENT_SOVER) -V'libfbclient$(CLIENT_SOVER) (>= $(FB_FULL_VER)~)'
	dh_makeshlibs -p libib-util$(UTIL_SOVER) -V'libib-util$(UTIL_SOVER) (>= $(FB_FULL_VER)~)'
	dpkg-gensymbols -plibfbclient$(CLIENT_SOVER) -Pdebian/libfbclient$(CLIENT_SOVER)
	dpkg-gensymbols -plibib-util$(UTIL_SOVER) -Pdebian/libib-util$(UTIL_SOVER)
override_dh_gencontrol-arch:
	dh_gencontrol -a -- \
	    -V"icu:Depends=libicu$(ICU_VER)" \
	    -V"fb3:multi-ver=$(FB3_MULTI_VER)"
override_dh_gencontrol-indep:
	dh_gencontrol -i -- \
	    -V"fb3:multi-ver=$(FB3_MULTI_VER)"