Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2 # debian/rules for libgtkada
3 # Copyright (c) 2003-2012 Ludovic Brenta <[email protected]>
4 # Copyright (c) 2011-2022 Nicolas Boulenguez <[email protected]>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # The full text of the GNU General Public License is in the file
17 # /usr/share/common-licenses/GPL-3 on Debian systems.
18
19 %:
20 dh $@
21
22 include /usr/share/dpkg/architecture.mk
23
24 DPKG_EXPORT_BUILDFLAGS := 1
25
26 # -gnatVa triggers #998177.
27 DEB_ADAFLAGS_MAINT_APPEND := -gnatVcdefimnoprst -gnatafo
28
29 # #1068058 gtkada-canvas_view.adb: Assembler messages: branch out of range
30 ifeq ($(DEB_HOST_ARCH),armhf)
31 ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
32 DEB_ADAFLAGS_MAINT_APPEND += -O1
33 endif
34 endif
35
36 DEB_CFLAGS_MAINT_APPEND := -Wall -Wextra -fstack-check
37 # debian/lto-failure-log completes the description in #1015492.
38 DEB_BUILD_MAINT_OPTIONS := hardening=+all optimize=-lto
39 DEB_LDFLAGS_MAINT_APPEND := \
40 -Wl,--no-allow-shlib-undefined \
41 -Wl,--no-copy-dt-needed-entries \
42 -Wl,--no-undefined
43 include /usr/share/dpkg/buildflags.mk
44 include /usr/share/dpkg/buildopts.mk
45 include /usr/share/ada/packaging.mk
46
47 # TODO: why is AC_CONFIG_MACRO_DIR([m4]) not sufficient?
48 export ACLOCAL := aclocal -Im4
49
50 override_dh_auto_configure:
51 # Requires pkg-config package.
52 dh_auto_configure -- \
53 --enable-shared \
54 --disable-static-pic \
55 --includedir=$${prefix}/share/ada/adainclude \
56 CC=gcc-$(DEB_GNAT_VERSION) \
57 PACKAGE_VERSION=$(gtkada_SO_VERSION)
58
59 # Work around because gtk.gpr is not generated.
60 export GTK_PREFIX := /usr
61
62 override_dh_auto_build-arch:
63 # Instead of running default target all: static relocatable tools tests,
64 # - write generated Ada sources (removed by the clean target)
65 # - link tools dynamically
66 # - run tests only if DEB_BUILD_OPTIONS does not contain nocheck.
67
68 # We want one gprbuild main process, even if itself deals with
69 # parallelism. Hence, prefer MAKE to dh_auto_build (=make -jN).
70
71 # When changing this, check that the library is only built twice.
72 $(MAKE) generate src/gtkada-intl.adb PYTHON=python3
73 gprconfig --batch $(GPRCONFIGFLAGS)
74 gprbuild -m -p $(GPRBUILDFLAGS) src/gtkada.gpr -XLIBRARY_TYPE=static
75 gprbuild -m -p ${GPRBUILDFLAGS} src/tools/tools.gpr
76
77 override_dh_auto_test-arch:
78 gprbuild -m -p $(GPRBUILDFLAGS) testgtk/testgtk.gpr
79
80 override_dh_auto_install-arch:
81 gprinstall src/tools/tools.gpr $(standard_GPRINSTALLFLAGS)
82 # 20221214: gprinstall ignores the --no-project option.
83 # Work-around: install the (buggy) static project to the default
84 # location first, then overwrite it with the (desired) shared
85 # project (the locations match).
86 gprinstall src/gtkada.gpr $(static_GPRINSTALLFLAGS) \
87 -XLIBRARY_TYPE=static
88 gprinstall src/gtkada.gpr $(call shared_GPRINSTALLFLAGS,gtkada)
89
90 # Archive testgtk sources, so that the user does not need to
91 # uncompress them separately.
92 # Remove objects and executables.
93 testgtk_exclude := obj/* test_rtree testgtk testgtk.gpr \
94 task_project/task_project.gpr
95 reproducible_tar_options := --owner=0 --group=0 --numeric-owner \
96 --preserve-permissions
97 reproducible_gz_options := --no-name
98
99 # TODO: add the reference manual when gnat-gps/gnatdoc is available
100 override_dh_auto_build-indep:
101 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
102 # We want one sphinx main process, even if itself deals with parallelism.
103 # Hence, prefer MAKE to dh_auto_build (=make -jN).
104 $(MAKE) -Cdocs/gtkada_ug latexpdf html \
105 $(addprefix SPHINXOPTS=-j,$(DEB_BUILD_OPTION_PARALLEL))
106
107 # Exclude or transform options only affect following files.
108 tar --create \
109 $(reproducible_tar_options) \
110 $(addprefix --exclude=testgtk/,$(testgtk_exclude)) testgtk \
111 --transform=s_debian_testgtk_ debian/testgtk.gpr \
112 | gzip $(reproducible_gz_options) > testgtk.tgz
113 endif
114
115 override_dh_auto_test-indep:
116
117 override_dh_auto_install-indep:
118 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
119 # See debian/patches/gprinstall-no-indep-artifacts.diff.
120 mkdir -p debian/tmp/usr/share/doc/gtkada/gtkada_ug
121 cp --reflink=auto -aftdebian/tmp/usr/share/doc/gtkada/gtkada_ug \
122 docs/gtkada_ug/_build/html/* \
123 docs/gtkada_ug/_build/latex/GtkAda.pdf
124 endif