File: rules

package info (click to toggle)
asis 2019-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,848 kB
  • sloc: ada: 156,772; makefile: 296; sh: 81; xml: 48; csh: 10
file content (107 lines) | stat: -rwxr-xr-x 4,230 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
#! /usr/bin/make -rf
# Debian build script for asis
# Copyright (c) 2003-2014 Ludovic Brenta <lbrenta@debian.org>
# Copyright (c) 2013-2020 Nicolas Boulenguez <nicolas@debian.org>

# This build script is free software; you can redistribute it and/or
# modify it under terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3, or (at your
# option) any later version. This build script 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. You
# should have received a copy of the GNU General Public License
# distributed with this build script; see file
# /usr/share/common-licenses/GPL. If not, see <http://www.gnu.org/licenses/>.

$(foreach line,$(shell sed -n '\
  s/^ gnat, gnat-\([0-9.]\+\),$$/ \
    GNAT_VERSION:=\1 \
  /p;\
  s/^Package: libasis\([0-9.]\+\)$$/ \
    soversion:=\1 \
  /p;\
  ' debian/control),$(eval $(line)))

DPKG_EXPORT_BUILDFLAGS := 1
DEB_BUILD_MAINT_OPTIONS := hardening=+all
DEB_ADAFLAGS_MAINT_APPEND := -gnatfno -gnatwa -gnatVa
DEB_LDFLAGS_MAINT_APPEND := -Wl,--no-undefined \
  -Wl,--no-copy-dt-needed-entries -Wl,--no-allow-shlib-undefined
include /usr/share/dpkg/buildflags.mk
include /usr/share/ada/debian_packaging-$(GNAT_VERSION).mk

BUILDER_OPTIONS := $(subst -j,-XPROCESSORS=,$(BUILDER_OPTIONS))

######################################################################
%:
	dh $@

# Ignore upstream Makefile/configure.
.PHONY: $(addprefix override_dh_auto_,configure build-arch build-indep test install clean)

######################################################################
# Build the dynamic library and tools.
# Upstream Makefile does not allow to select tool, skip a static assistant,
# or select gnat2xml mains.
# The aggregate project increases performance, as gprbuild only parses
# all projects once.
tools_gpr := debian/tools.gpr

override_dh_auto_build-arch:
	gprbuild $(tools_gpr) -p $(BUILDER_OPTIONS) -Xsoversion=$(soversion)
override_dh_auto_clean::
	gprclean $(tools_gpr) -Xsoversion=$(soversion)

######################################################################
# The factory generated sources are required for both -arch (for
# gnat2xml gnatpp) and -indep (for the schemas via gnat2xsd).
# The static ASIS library is built here as a dependency.
factory_dir := tools/tool_utils
factory_gpr := $(factory_dir)/generate_factory.gpr
factory_exe := $(factory_dir)/ada_trees-generate_factory
factory_out := ada_trees-factory

override_dh_auto_configure:
	gprbuild $(factory_gpr) -p $(BUILDER_OPTIONS)
	$(factory_exe)
	mv -f $(factory_out).nb $(factory_dir)/$(factory_out).adb
	mv -f $(factory_out).ns $(factory_dir)/$(factory_out).ads
override_dh_auto_clean::
	gprclean asis.gpr
	gprclean $(factory_gpr)
	rm -f $(factory_dir)/$(factory_out).ad[bs] $(factory_out).n[bs]

######################################################################
xsd_dir  := tools/gnat2xml
xsd_gpr  := $(xsd_dir)/gnat2xml.gpr
xsd_main := gnat2xml-gnat2xsd
xsd_exe  := LD_LIBRARY_PATH=lib-dynamic $(xsd_dir)/gnat2xsd

ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
override_dh_auto_build-indep:
	gprbuild $(xsd_gpr) $(xsd_main) -p $(BUILDER_OPTIONS)
	$(xsd_exe)           > $(xsd_dir)/ada-schema.xsd
	$(xsd_exe) --compact > $(xsd_dir)/ada-schema.compact.xsd
endif
override_dh_auto_clean::
	gprclean $(xsd_gpr)
	rm -f $(xsd_dir)/ada-schema.xsd $(xsd_dir)/ada-schema.compact.xsd

######################################################################
examples := debian/asis-doc/usr/share/doc/asis-doc/examples

.PHONY: override_dh_installexamples
override_dh_installexamples:
	dh_installexamples --package=asis-doc --doc-main-package=asis-programs
  # Replace duplicate files with relative symlinks, except during -arch builds.
	if test -d $(examples); then \
	  rdfind -makeresultsfile false -makesymlinks true $(examples) && \
	  symlinks -r -s -c $(examples); \
	fi
	dh_installexamples --remaining-packages

.PHONY: override_dh_installdocs
override_dh_installdocs:
	dh_installdocs --package=asis-doc --doc-main-package=asis-programs
	dh_installdocs --remaining-packages