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
|
#!/usr/bin/make -f
# Build script for GNATColl database components in Debian.
# Copyright (c) 2014-2020 Nicolas Boulenguez <nicolas@debian.org>
# This build script is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# On Debian systems, the full text of the GPL is in the file
# /usr/share/common-licenses/GPL-3.
$(foreach line,$(shell sed -n '\
s/^ gnat-\([0-9.]\+\),$$/ GNAT_VERSION:=\1 /p; \
s/^Package: libgnatcoll-\([a-z]\+\)\([0-9.]\+\)$$/ gnatcoll_\1_version:=\2 /p; \
' debian/control),$(eval $(line)))
DPKG_EXPORT_BUILDFLAGS := 1
DEB_BUILD_MAINT_OPTIONS := hardening=+all
DEB_LDFLAGS_MAINT_APPEND := \
-Wl,--no-allow-shlib-undefined \
-Wl,--no-copy-dt-needed-entries \
-Wl,--no-undefined
# On mips64el gnatcoll-xref.adb generates long jump that do not fit in
# standard branch instructions. Use the mxgot option to workaround that.
# See bug #953069.
ifneq (,$(filter mips64el,$(DEB_HOST_ARCH)))
DEB_CFLAGS_MAINT_APPEND := -mxgot
endif
# Use -Os on mipsel to workaround further jump length issues
ifneq (,$(filter mipsel,$(DEB_HOST_ARCH)))
DEB_CFLAGS_MAINT_APPEND += -Os
endif
include /usr/share/dpkg/buildflags.mk
include $(wildcard /usr/share/ada/debian_packaging-$(GNAT_VERSION).mk)
# wildcard means: not during -indep builds.
LD_LIBRARY_PATH := \
sql/lib/relocatable:sqlite/lib/relocatable:postgres/lib/relocatable:xref/lib/relocatable
ADA_PROJECT_PATH := $(subst /lib/relocatable,,$(LD_LIBRARY_PATH))
libs := $(subst :, ,$(ADA_PROJECT_PATH))
# The scenario variables passed to gprbuild and dh_ada_library.
GNATCOLL_SQLITE := external
vars := \
$(foreach l,$(libs),gnatcoll_$(l)_version) \
GNATCOLL_SQLITE \
gprbuild := \
ADA_PROJECT_PATH=$(ADA_PROJECT_PATH) \
gprbuild -p $(BUILDER_OPTIONS) \
$(foreach v,$(vars),-X$(v)="$($(v))")
%:
dh $@
# Dependencies and parallelism are handled by gprbuild,
# avoid using Make for this (risky, without much gain).
# Anyway, there is only one possible build order.
# For the same reason, blindly regenerate xref/generated.
.PHONY: override_dh_auto_build-arch
override_dh_auto_build-arch:
rm -f xref/generated/*
# Build db2ada (and relocatable sql, postgres, sqlite).
$(gprbuild) gnatcoll_db2ada/gnatcoll_all2ada.gpr -XLIBRARY_TYPE=relocatable
cp gnatcoll_db2ada/obj/gnatcoll_all2ada gnatcoll_db2ada/obj/gnatcoll_db2ada
# TODO: ask upstream to provide initialdata.txt and this Makefile
# snippet. They have probably forgotten them during the libgnatcoll
# source package split.
LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
gnatcoll_db2ada/obj/gnatcoll_db2ada \
-dbtype=sqlite \
-dbname=:memory: \
-output xref/generated \
-dbmodel=gnatcoll_db2ada/dbschema.txt \
-createdb \
-adacreate \
-api GNATCOLL.Xref.Database \
-load=debian/initialdata.txt \
-enum "f2f_kind,id,name,F2F,Integer" \
-enum "e2e_kind,id,name,E2E,Integer"
# Build static xref (and sql, sqlite as dependencies).
$(gprbuild) gnatcoll_xref.gpr -XLIBRARY_TYPE=static
# Build static postgres (and sql).
$(gprbuild) gnatcoll_postgres.gpr -XLIBRARY_TYPE=static
# Build gnatinspect (and relocatable sql, sqlite, xref).
$(gprbuild) gnatinspect/gnatinspect.gpr -XLIBRARY_TYPE=relocatable
.PHONY: override_dh_auto_clean
override_dh_auto_clean:
dh_auto_clean --sourcedir=docs
rm -f xref/generated/*
rm -fr \
$(addsuffix /lib,$(libs)) \
$(addsuffix /obj,$(libs) gnatcoll_db2ada gnatinspect)
# dh_ada_library does not accept -aP arguments.
.PHONY: override_dh_ada_library
override_dh_ada_library:
ADA_PROJECT_PATH=$(ADA_PROJECT_PATH) \
dh_ada_library $(foreach l,$(libs), \
LIBRARY_TYPE=relocatable \
$(foreach v,$(vars),$(v)="$($(v))") \
$(l)/gnatcoll_$(l).gpr)
override_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
dh_auto_build --sourcedir=docs -- html latexpdf text
endif
# Avoid a warning about doc-main-package.
doc_pkg := libgnatcoll-db-doc
override_dh_installdocs:
dh_installdocs --package=$(doc_pkg) --doc-main-package=$(doc_pkg)
dh_installdocs --remaining-packages
override_dh_installexamples:
dh_installexamples --package=$(doc_pkg) --doc-main-package=$(doc_pkg)
dh_installexamples --remaining-packages
|