File: rules

package info (click to toggle)
libgnatcoll-bindings 18-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 980 kB
  • sloc: ada: 6,581; ansic: 722; python: 687; makefile: 48; sh: 46
file content (76 lines) | stat: -rwxr-xr-x 2,462 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
#!/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.

libraries :=
$(foreach line,$(shell sed -n '\
  s/^ gnat, gnat-\([0-9.]\+\),$$/GNAT_VERSION:=\1/p; \
  s/^Package: \(libgnatcoll-gmp[0-9.]\+-dev\)$$/gmp_dev:=\1/p; \
  /^Package: libgnatcoll-\([a-z]\+\)\([0-9.]\+\)$$/ { \
    s~~libraries+=\1 \1_version:=\2~; \
    y/-/_/; \
    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
vars := ADAFLAGS CFLAGS CPPFLAGS LDFLAGS

BUILD := PROD
vars += BUILD

GNATCOLL_PYTHON_CFLAGS := `pkg-config --cflags python`
GNATCOLL_PYTHON_LIBS   := `pkg-config --libs python`
vars += GNATCOLL_PYTHON_CFLAGS GNATCOLL_PYTHON_LIBS

GNATCOLL_ICONV_OPT :=
vars += GNATCOLL_ICONV_OPT

%:
	dh $@ --with ada-library

.PHONY: override_dh_auto_build
override_dh_auto_build: $(libraries)

.PHONY: $(libraries)
$(libraries):
	gprbuild $@/gnatcoll_$@.gpr \
	  -XLIBRARY_TYPE=static \
	  -p $(BUILDER_OPTIONS) $(foreach v,$(vars),-X$(v)="$($(v))")
	gprbuild $@/gnatcoll_$@.gpr \
	  -XLIBRARY_TYPE=relocatable \
	  -XGNATCOLL_VERSION=$($@_version) \
	  -p $(BUILDER_OPTIONS) $(foreach v,$(vars),-X$(v)="$($(v))")

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	$(RM) -r $(foreach l,$(libraries),$(l)/lib $(l)/obj)

# An override avoids hardcoding the ALI version of libgnatcoll-gmp-dev.
.PHONY: override_dh_installexamples
override_dh_installexamples:
	dh_installexamples -p$(gmp_dev) gmp/examples/*
	dh_installexamples --remaining-packages

.PHONY: override_dh_ada_library
override_dh_ada_library:
	dh_ada_library $(foreach l,$(libraries), \
	  LIBRARY_TYPE=relocatable \
	  GNATCOLL_VERSION=$($(l)_version) \
	  $(foreach v,$(vars),$(v)="$($(v))") \
	  $(l)/gnatcoll_$(l).gpr)