File: rules

package info (click to toggle)
libgnatcoll-db 23.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,544 kB
  • sloc: ansic: 128,019; ada: 28,171; sql: 15,778; python: 2,263; makefile: 625; sh: 45
file content (134 lines) | stat: -rwxr-xr-x 4,596 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
#!/usr/bin/make -f
# Build script for GNATColl database components in Debian.
# Copyright (c) 2014-2022 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.

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

include /usr/share/dpkg/architecture.mk

# 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.
ifeq ($(DEB_HOST_ARCH),mips64el)
  DEB_ADAFLAGS_MAINT_APPEND := -mxgot
  DEB_CFLAGS_MAINT_APPEND := -mxgot
endif

# Use -Os on mipsel to workaround further jump length issues
# See bug #971018.
ifeq ($(DEB_HOST_ARCH),mipsel)
  DEB_ADAFLAGS_MAINT_APPEND := -Os
  DEB_CFLAGS_MAINT_APPEND := -Os
endif

include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/buildopts.mk
include $(wildcard /usr/share/ada/packaging.mk)
# wildcard means: not during -indep builds.

# The order matters for dh_ada_library.
libs := sql sqlite postgres xref

gpr_vars := \
  -XGNATCOLL_SQLITE=external \
  $(libs:%=-aP%) \
  -XGNATCOLL_SQL_VERSION=$(gnatcoll_sql_SO_VERSION) \
  -XGNATCOLL_SQLITE_VERSION=$(gnatcoll_sqlite_SO_VERSION) \
  -XGNATCOLL_POSTGRES_VERSION=$(gnatcoll_postgres_SO_VERSION) \
  -XGNATCOLL_XREF_VERSION=$(gnatcoll_xref_SO_VERSION) \
  # EOL

gprbuild := \
  gprbuild -p $(GPRBUILDFLAGS) \
  $(gpr_vars)

%:
	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:

  # Ensure the same major version for Ada and C compilers.
	gprconfig --batch $(GPRCONFIGFLAGS)

	rm -f xref/generated/*

  # Build db2ada (and relocatable sql, postgres, sqlite).
	$(gprbuild) gnatcoll_db2ada/gnatcoll_all2ada.gpr -XLIBRARY_TYPE=relocatable

# 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=$(subst $() ,:,$(libs:=/lib/relocatable)) \
	  gnatcoll_db2ada/obj/gnatcoll_all2ada \
	  -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

override_dh_auto_install-arch: $(libs:%=install-%)
	gprinstall gnatinspect/gnatinspect.gpr $(gpr_vars) \
	  -XLIBRARY_TYPE=relocatable $(standard_GPRINSTALLFLAGS)
	gprinstall gnatcoll_db2ada/gnatcoll_all2ada.gpr $(gpr_vars) \
	  -XLIBRARY_TYPE=relocatable $(standard_GPRINSTALLFLAGS)
	mv debian/tmp/usr/bin/gnatcoll_all2ada \
	   debian/tmp/usr/bin/gnatcoll_db2ada
install-%:
	gprinstall $(gpr_vars) \
	  gnatcoll_$*.gpr -XLIBRARY_TYPE=static \
	  $(static_GPRINSTALLFLAGS)
	gprinstall $(gpr_vars) \
	  gnatcoll_$*.gpr -XLIBRARY_TYPE=relocatable \
	  $(call shared_GPRINSTALLFLAGS,gnatcoll_$*)

override_dh_auto_build-indep:
  ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	$(MAKE) -Cdocs html latexpdf text $(DEB_BUILD_OPTION_PARALLEL:%=-j%)
  endif

# Avoid a warning about doc-main-package.
# Exclude generated sources from examples.
doc_pkg := libgnatcoll-db-doc
execute_before_dh_installdocs:
	dh_installdocs --package=$(doc_pkg) --doc-main-package=$(doc_pkg)
execute_before_dh_installexamples:
	dh_installexamples --package=$(doc_pkg) --doc-main-package=$(doc_pkg) \
	  -Xgenerated