File: rules

package info (click to toggle)
libgnatcoll-db 18-4
  • links: PTS
  • area: main
  • in suites: buster
  • size: 2,268 kB
  • sloc: ada: 23,786; python: 2,166; makefile: 486; sh: 34; ansic: 18
file content (102 lines) | stat: -rwxr-xr-x 3,484 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
#!/usr/bin/make -f
# Build script for GNATColl in Debian.
# Copyright (c) 2014-2018 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, gnat-\([0-9.]\+\),$$/GNAT_VERSION:=\1/p; \
  s/^Package: libgnatcoll-\([a-z]\+\)\([0-9.]\+\)$$/gnatcoll_\1_version:=\2/p; \
  ' debian/control),$(eval $(line)))

DEB_BUILD_MAINT_OPTIONS := hardening=+all
include /usr/share/dpkg/default.mk
include /usr/share/ada/debian_packaging-$(GNAT_VERSION).mk

# The scenario variables passed to gprbuild and dh_ada_library.
BUILD := PROD
GNATCOLL_SQLITE := external
vars := \
  gnatcoll_sql_version \
  gnatcoll_sqlite_version \
  gnatcoll_xref_version \
  ADAFLAGS CFLAGS CPPFLAGS LDFLAGS \
  BUILD \
  GNATCOLL_SQLITE \

gpr_opts := -p $(BUILDER_OPTIONS) $(foreach v,$(vars),-X$(v)="$($(v))")

%:
	dh $@ --with ada-library

# 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
override_dh_auto_build:

	gprbuild sql/gnatcoll_sql.gpr \
	  -XLIBRARY_TYPE=static $(gpr_opts)
	gprbuild sql/gnatcoll_sql.gpr \
	  -XLIBRARY_TYPE=relocatable $(gpr_opts)

	gprbuild sqlite/gnatcoll_sqlite.gpr \
	  -XLIBRARY_TYPE=static -aPsql $(gpr_opts)
	gprbuild sqlite/gnatcoll_sqlite.gpr \
	  -XLIBRARY_TYPE=relocatable -aPsql $(gpr_opts)

	gprbuild gnatcoll_db2ada/gnatcoll_sqlite2ada.gpr \
	  -XLIBRARY_TYPE=relocatable -aPsql -aPsqlite $(gpr_opts)

# TODO: ask upstream to provide initialdata.txt and this Makefile
# snippet. They have probably forgotten them during the libgnatcoll
# source package split.
	rm -fr xref/generated
	mkdir xref/generated
	LD_LIBRARY_PATH=sql/lib/relocatable:sqlite/lib/relocatable \
	  gnatcoll_db2ada/obj/gnatcoll_sqlite2ada \
	  -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"

	gprbuild xref/gnatcoll_xref.gpr \
	  -XLIBRARY_TYPE=static -aPsql -aPsqlite $(gpr_opts)
	gprbuild xref/gnatcoll_xref.gpr \
	  -XLIBRARY_TYPE=relocatable -aPsql -aPsqlite $(gpr_opts)

	gprbuild gnatinspect/gnatinspect.gpr \
	  -XLIBRARY_TYPE=relocatable -aPsql -aPsqlite -aPxref $(gpr_opts)

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	rm -fr xref/generated \
	  $(addsuffix /lib,sql sqlite xref) \
	  $(addsuffix /obj,sql sqlite xref gnatcoll_db2ada gnatinspect)

# dh_ada_library does not accept -aP arguments.
.PHONY: override_dh_ada_library
override_dh_ada_library:
	ADA_PROJECT_PATH=sql:sqlite:xref \
	dh_ada_library $(foreach l,sql sqlite xref, \
	  LIBRARY_TYPE=relocatable \
	  $(foreach v,$(vars),$(v)="$($(v))") \
	  $(l)/gnatcoll_$(l).gpr)