| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
# Uncomment this to turn on verbose mode. |
| 4 |
#export DH_VERBOSE=1 |
| 5 |
|
| 6 |
%: |
| 7 |
dh $@ |
| 8 |
|
| 9 |
FB_MAJOR:= $(shell awk '/FB_MAJOR_VER/ { v=$$3; gsub("\"", "", v); print v}' < src/jrd/build_no.h ) |
| 10 |
export FB_MAJOR |
| 11 |
FB_MINOR:= $(shell awk '/FB_MINOR_VER/ { v=$$3; gsub("\"", "", v); print v}' < src/jrd/build_no.h ) |
| 12 |
FB_REV := $(shell awk '/FB_REV_NO/ { v=$$3; gsub("\"", "", v); print v}' < src/jrd/build_no.h ) |
| 13 |
FB_VER := $(FB_MAJOR).$(FB_MINOR) |
| 14 |
export FB_VER |
| 15 |
FB_FULL_VER:= $(FB_VER).$(FB_REV) |
| 16 |
export FB_FULL_VER |
| 17 |
FB_VER_NO_DOTS := $(FB_MAJOR)$(FB_MINOR) |
| 18 |
export FB_VER_NO_DOTS |
| 19 |
|
| 20 |
FB3_MULTI_VER="3.0.12.ds7-7+exp~" |
| 21 |
|
| 22 |
include /usr/share/dpkg/pkg-info.mk |
| 23 |
SOURCE_DATE := $(shell date -d@$(SOURCE_DATE_EPOCH) -u +"%Y-%m-%d") |
| 24 |
|
| 25 |
CLIENT_SOVER := 2 |
| 26 |
export CLIENT_SOVER |
| 27 |
UTIL_SOVER := |
| 28 |
|
| 29 |
ifndef FB_MAJOR |
| 30 |
$(error FB_MAJOR not defined) |
| 31 |
else ifndef FB_MINOR |
| 32 |
$(error FB_MINOR not defined) |
| 33 |
else ifndef FB_REV |
| 34 |
$(error FB_REV not defined) |
| 35 |
else ifndef FB_VER |
| 36 |
$(error FB_VER not defined) |
| 37 |
else ifndef FB_FULL_VER |
| 38 |
$(error FB_FULL_VER not defined) |
| 39 |
else ifndef CLIENT_SOVER |
| 40 |
$(error CLIENT_SOVER not defined) |
| 41 |
endif |
| 42 |
|
| 43 |
-include /usr/share/dpkg/buildtools.mk |
| 44 |
PKG_CONFIG ?= pkg-config |
| 45 |
# Use the following lines to set the compiler if |
| 46 |
# the default Debian one can't be used (or you want to try |
| 47 |
# the bleeding edge) |
| 48 |
#export CC=gcc-5 |
| 49 |
#export CXX=g++-5 |
| 50 |
#export CPP=cpp-5 |
| 51 |
#export CXXPP=cpp-5 |
| 52 |
|
| 53 |
|
| 54 |
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| 55 |
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
| 56 |
export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
| 57 |
|
| 58 |
ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) |
| 59 |
NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) |
| 60 |
endif |
| 61 |
|
| 62 |
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
| 63 |
confflags += --build $(DEB_HOST_GNU_TYPE) |
| 64 |
else |
| 65 |
confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) |
| 66 |
endif |
| 67 |
|
| 68 |
ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH_OS), linux) |
| 69 |
confflags += --enable-raw-devices |
| 70 |
else |
| 71 |
confflags += --disable-raw-devices |
| 72 |
endif |
| 73 |
|
| 74 |
DOC := /usr/share/doc/firebird${FB_VER}-common-doc |
| 75 |
ULFB := /usr/lib/${DEB_HOST_MULTIARCH}/firebird/${FB_VER} |
| 76 |
USFB := /usr/share/firebird/${FB_VER} |
| 77 |
VAR := /var/lib/firebird/${FB_VER} |
| 78 |
RUN := /run/firebird${FB_VER} |
| 79 |
|
| 80 |
DEB_BUILD_MAINT_OPTIONS := hardening=+bindnow optimize=-lto |
| 81 |
DEB_CXXFLAGS_MAINT_STRIP := -O2 |
| 82 |
DEB_CXXFLAGS_MAINT_APPEND := -DUCHAR_TYPE=uint16_t -fno-lifetime-dse -fno-strict-aliasing -O3 |
| 83 |
DEB_CFLAGS_MAINT_STRIP := -O2 |
| 84 |
DEB_CFLAGS_MAINT_APPEND := -fno-strict-aliasing -O3 |
| 85 |
|
| 86 |
include /usr/share/dpkg/buildflags.mk |
| 87 |
|
| 88 |
confflags += --disable-rpath --with-gpre-cobol \ |
| 89 |
--enable-regen-codes \ |
| 90 |
--with-system-re2 \ |
| 91 |
--with-system-editline --prefix=${ULFB} --with-fbsbin=/usr/sbin \ |
| 92 |
--with-fblib=/usr/lib/${DEB_HOST_MULTIARCH} \ |
| 93 |
--with-fbconf=${ULFB} --with-fbdoc=${DOC} \ |
| 94 |
--with-fbudf=${ULFB}/UDF --with-fbsample=${DOC}/examples \ |
| 95 |
--with-fbsample-db=${DOC}/examples/empbuild \ |
| 96 |
--with-fbhelp=${VAR}/system --with-fbintl=${ULFB}/intl \ |
| 97 |
--with-fbmisc=${ULFB}/misc --with-fbsecure-db=${VAR}/system \ |
| 98 |
--with-fblog=/var/log/firebird --with-fbglock=${RUN} \ |
| 99 |
--with-fblogfilename=firebird$(FB_VER).log \ |
| 100 |
--with-fbplugins=${ULFB}/plugins \ |
| 101 |
--with-fbmsg=${ULFB} |
| 102 |
|
| 103 |
# see #575564 |
| 104 |
export FIREBIRD_LOCK := $(CURDIR)/debian/tmp-lock |
| 105 |
|
| 106 |
# Packaging is split into several packages: |
| 107 |
# * firebirdVV-server (incl libengineXX) |
| 108 |
# * libfbclient2 |
| 109 |
# * libib-util |
| 110 |
# * firebirdVV-utils |
| 111 |
# * firebirdVV-common (common parts to client and utils) |
| 112 |
# * firebirdVV-common-doc (big copyright and changelog in one place) |
| 113 |
# * firebirdVV-doc |
| 114 |
# * firebirdVV-examples |
| 115 |
# * firebird-dev |
| 116 |
|
| 117 |
override_dh_autoreconf: |
| 118 |
mkdir -p builds/make.new/config |
| 119 |
dh_autoreconf |
| 120 |
|
| 121 |
override_dh_auto_configure: |
| 122 |
dh_auto_configure -- $(confflags) |
| 123 |
|
| 124 |
ifneq (,$(filter nodoc,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) |
| 125 |
MANUALS_BASE_USR := |
| 126 |
MANUALS_BASE_SYS := |
| 127 |
else |
| 128 |
MANUALS_BASE_USR := isql-fb gbak gfix gpre gsec fbstat nbackup \ |
| 129 |
fbsvcmgr fbtracemgr fb_lock_print fb_config \ |
| 130 |
fb_wrapper |
| 131 |
MANUALS_BASE_SYS := fbguard firebird |
| 132 |
endif |
| 133 |
MANUALS := $(addprefix debian/man/,$(addsuffix .1.gz,$(MANUALS_BASE_USR))) \ |
| 134 |
$(addprefix debian/man/,$(addsuffix .8.gz,$(MANUALS_BASE_SYS))) |
| 135 |
|
| 136 |
%.1 : %.pod |
| 137 |
pod2man -c "Firebird documentation" --release "Firebird $(FB_VER)" $< > $@ |
| 138 |
%.8 : %.pod |
| 139 |
pod2man -c "Firebird documentation" --release "Firebird $(FB_VER)" --section 8 $< > $@ |
| 140 |
|
| 141 |
%.1.gz : %.1 |
| 142 |
gzip -n -9 < $< > $@ |
| 143 |
|
| 144 |
%.8.gz : %.8 |
| 145 |
gzip -n -9 < $< > $@ |
| 146 |
|
| 147 |
FB_IMG := debian/firebird-image |
| 148 |
|
| 149 |
ODS_VER=$(shell grep -E '^const \S+ ODS_CURRENT\b' src/jrd/ods.h | sed 's/.*ODS_CURRENT//; s/\;.*//') |
| 150 |
|
| 151 |
override_dh_auto_build: |
| 152 |
$(MAKE) -f debian/rules $(NJOBS) $(MANUALS) |
| 153 |
[ -d $(FIREBIRD_TMP) ] || mkdir $(FIREBIRD_TMP) |
| 154 |
rm -rf $(FB_IMG) |
| 155 |
dh_auto_build -- QUIET=1 |
| 156 |
|
| 157 |
#fakeroot $(MAKE) -C gen -f Makefile.install buildRoot |
| 158 |
#mv ./gen/buildroot ./debian/firebird-build |
| 159 |
cp -a ./gen/Release/firebird $(FB_IMG) |
| 160 |
cp -a src/include/gen $(FB_IMG)/include-gen |
| 161 |
|
| 162 |
sed -i -e's,-I$$fb_incdir,,' $(FB_IMG)/bin/fb_config |
| 163 |
sed -i -e's,-L$$fb_libdir ,,' $(FB_IMG)/bin/fb_config |
| 164 |
|
| 165 |
sh $(FB_IMG)/bin/fb_config --cflags |
| 166 |
sh $(FB_IMG)/bin/fb_config --libs |
| 167 |
|
| 168 |
# renamed utilities |
| 169 |
cp -a $(FB_IMG)/bin/gstat $(FB_IMG)/bin/fbstat |
| 170 |
cp -a $(FB_IMG)/bin/isql $(FB_IMG)/bin/isql-fb |
| 171 |
|
| 172 |
sed -i -e '/^#RemoteBindAddress/ a RemoteBindAddress = localhost' "$(FB_IMG)/firebird.conf" |
| 173 |
sed -i -e 's|^#SecurityDatabase.*|SecurityDatabase = /var/lib/firebird/$(FB_VER)/system/security$(FB_MAJOR).fdb|' "$(FB_IMG)/firebird.conf" |
| 174 |
sed -i -e 's|^#Providers.*|Providers = Remote,Engine$(ODS_VER),Loopback|' "$(FB_IMG)/firebird.conf" |
| 175 |
sed -i -e 's|^#UdfAccess.*|UdfAccess = None|' "$(FB_IMG)/firebird.conf" |
| 176 |
sed -i -e '/^#RemoteServicePort/ {' -e 'G' -e 'a # managed by debian package scripts' -e 'a include service-port.conf' -e '}' "$(FB_IMG)/firebird.conf" |
| 177 |
touch "$(FB_IMG)/service-port.conf" |
| 178 |
|
| 179 |
sed -i -e 's,$$(this),$$(root)/intl,' "$(FB_IMG)/intl/fbintl.conf" |
| 180 |
|
| 181 |
rm -r "$(FB_IMG)/examples/empbuild" |
| 182 |
debian/gen-employee-sql > "$(FB_IMG)/examples/employee.sql" |
| 183 |
|
| 184 |
cp debian/firebird$(FB_VER)-examples.README.Debian "$(FB_IMG)/examples/README.Debian" |
| 185 |
|
| 186 |
debian/gen-xbin-wrappers |
| 187 |
|
| 188 |
echo "Built image contents" |
| 189 |
cd $(FB_IMG) && ls -lR |
| 190 |
|
| 191 |
override_dh_auto_test: |
| 192 |
FIREBIRD=$(CURDIR)/debian/firebird-image debian/postbuild-tests |
| 193 |
|
| 194 |
override_dh_clean: |
| 195 |
dh_clean |
| 196 |
|
| 197 |
rm -f $(MANUALS) |
| 198 |
|
| 199 |
debconf-updatepo |
| 200 |
|
| 201 |
@echo FB_MAJOR = $(FB_MAJOR) |
| 202 |
@echo FB_MINOR = $(FB_MINOR) |
| 203 |
@echo FB_REV = $(FB_REV) |
| 204 |
@echo FB_VER = $(FB_VER) |
| 205 |
@echo FB_FULL_VER = $(FB_FULL_VER) |
| 206 |
@echo CLIENT_SOVER= $(CLIENT_SOVER) |
| 207 |
@echo UTIL_SOVER= $(UTIL_SOVER) |
| 208 |
|
| 209 |
override_dh_auto_install: |
| 210 |
true |
| 211 |
|
| 212 |
override_dh_install: |
| 213 |
dh_install --sourcedir=debian/firebird-image |
| 214 |
|
| 215 |
override_dh_installsystemd: |
| 216 |
sed -e "s/\$${FB_VER}/$(FB_VER)/g" < debian/systemd-services.sed.in > debian/systemd-services.sed |
| 217 |
sed -f debian/systemd-services.sed < gen/install/misc/firebird.service > debian/firebird$(FB_VER)-server.firebird$(FB_VER).service |
| 218 |
|
| 219 |
dh_installsystemd --name firebird$(FB_VER) |
| 220 |
|
| 221 |
override_dh_installtmpfiles: |
| 222 |
dh_installtmpfiles --name firebird$(FB_VER) |
| 223 |
|
| 224 |
ICU_VER := $(shell $(PKG_CONFIG) icu-i18n --modversion|sed 's/[^0-9]*\([0-9]\+\).*/\1/') |
| 225 |
ifeq ($(ICU_VER),) |
| 226 |
$(error Unable to determine ICU version) |
| 227 |
endif |
| 228 |
|
| 229 |
override_dh_installchangelogs: |
| 230 |
dh_installchangelogs CHANGELOG.md -p firebird$(FB_VER)-common-doc |
| 231 |
override_dh_installdocs-indep: |
| 232 |
dh_installdocs -p firebird$(FB_VER)-common-doc --doc-main-package=firebird$(FB_VER)-common-doc |
| 233 |
dh_installdocs -Xchangelog -Xcopyright -X license/IDPL.txt -p firebird$(FB_VER)-doc |
| 234 |
recode windows-1252..utf8 "debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-doc/doc/ods11-index-structure.html" |
| 235 |
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" |
| 236 |
override_dh_installdocs-arch: |
| 237 |
true |
| 238 |
override_dh_installexamples: |
| 239 |
dh_installexamples -p firebird$(FB_VER)-examples --sourcedir=$(FB_IMG) |
| 240 |
override_dh_installlogrotate: |
| 241 |
dh_installlogrotate --name firebird$(FB_VER) |
| 242 |
override_dh_installinit: |
| 243 |
dh_installinit -pfirebird$(FB_VER)-server --name=firebird$(FB_VER) |
| 244 |
override_dh_link-arch: |
| 245 |
dh_link -a -A |
| 246 |
override_dh_link-indep: |
| 247 |
mkdir -p debian/firebird$(FB_VER)-examples/usr/share/doc/firebird$(FB_VER)-common-doc |
| 248 |
mv debian/firebird$(FB_VER)-examples/usr/share/doc/firebird$(FB_VER)-examples/* \ |
| 249 |
debian/firebird$(FB_VER)-examples/usr/share/doc/firebird$(FB_VER)-common-doc/ |
| 250 |
rmdir debian/firebird$(FB_VER)-examples/usr/share/doc/firebird$(FB_VER)-examples |
| 251 |
|
| 252 |
mkdir -p debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-common-doc |
| 253 |
mv debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-doc/* \ |
| 254 |
debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-common-doc/ |
| 255 |
rmdir debian/firebird$(FB_VER)-doc/usr/share/doc/firebird$(FB_VER)-doc |
| 256 |
|
| 257 |
dh_link -i -A |
| 258 |
override_dh_makeshlibs: |
| 259 |
dh_makeshlibs -p libfbclient$(CLIENT_SOVER) -V'libfbclient$(CLIENT_SOVER) (>= $(FB_FULL_VER)~)' |
| 260 |
dh_makeshlibs -p libib-util$(UTIL_SOVER) -V'libib-util$(UTIL_SOVER) (>= $(FB_FULL_VER)~)' |
| 261 |
dpkg-gensymbols -plibfbclient$(CLIENT_SOVER) -Pdebian/libfbclient$(CLIENT_SOVER) |
| 262 |
dpkg-gensymbols -plibib-util$(UTIL_SOVER) -Pdebian/libib-util$(UTIL_SOVER) |
| 263 |
override_dh_gencontrol-arch: |
| 264 |
dh_gencontrol -a -- \ |
| 265 |
-V"icu:Depends=libicu$(ICU_VER)" \ |
| 266 |
-V"fb3:multi-ver=$(FB3_MULTI_VER)" |
| 267 |
override_dh_gencontrol-indep: |
| 268 |
dh_gencontrol -i -- \ |
| 269 |
-V"fb3:multi-ver=$(FB3_MULTI_VER)" |