File: rules

package info (click to toggle)
libgtkada 23.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 41,624 kB
  • sloc: ada: 207,980; xml: 8,602; python: 4,513; perl: 3,838; sh: 3,219; ansic: 1,986; makefile: 344; objc: 163; javascript: 100
file content (114 lines) | stat: -rwxr-xr-x 4,396 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
#!/usr/bin/make -f
# debian/rules for libgtkada
# Copyright (c) 2003-2012 Ludovic Brenta <lbrenta@debian.org>
# Copyright (c) 2011-2022 Nicolas Boulenguez <nicolas@debian.org>
#
# This program 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.
#
# The full text of the GNU General Public License is in the file
# /usr/share/common-licenses/GPL-3 on Debian systems.

%:
	dh $@

DPKG_EXPORT_BUILDFLAGS := 1
# -gnatVa triggers #998177.
DEB_ADAFLAGS_MAINT_APPEND := -gnatVcdefimnoprst -gnatafo
DEB_CFLAGS_MAINT_APPEND := -Wall -Wextra -fstack-check
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/buildflags.mk
include /usr/share/dpkg/buildopts.mk
include /usr/share/ada/packaging.mk

# TODO: why is AC_CONFIG_MACRO_DIR([m4]) not sufficient?
export ACLOCAL := aclocal -Im4

override_dh_auto_configure:
 # Requires pkg-config package.
	dh_auto_configure -- \
	  --enable-shared \
	  --disable-static-pic \
	  --includedir=$${prefix}/share/ada/adainclude \
	  CC=gcc-$(DEB_GNAT_VERSION) \
	  PACKAGE_VERSION=$(gtkada_SO_VERSION)

# Work around because gtk.gpr is not generated.
export GTK_PREFIX := /usr

override_dh_auto_build-arch:
 # Instead of running default target all: static relocatable tools tests,
 # - write generated Ada sources (removed by the clean target)
 # - link tools dynamically
 # - run tests only if DEB_BUILD_OPTIONS does not contain nocheck.

 # We want one gprbuild main process, even if itself deals with
 # parallelism.  Hence, prefer MAKE to dh_auto_build (=make -jN).

 # When changing this, check that the library is only built twice.
	$(MAKE) generate src/gtkada-intl.adb PYTHON=python3
	gprconfig --batch $(GPRCONFIGFLAGS)
	gprbuild -m -p $(GPRBUILDFLAGS) src/gtkada.gpr -XLIBRARY_TYPE=static
	gprbuild -m -p ${GPRBUILDFLAGS} src/tools/tools.gpr

override_dh_auto_test-arch:
	gprbuild -m -p $(GPRBUILDFLAGS) testgtk/testgtk.gpr

override_dh_auto_install-arch:
	gprinstall src/tools/tools.gpr $(standard_GPRINSTALLFLAGS)
  # 20221214: gprinstall ignores the --no-project option.
  #   Work-around: install the (buggy) static project to the default
  #   location first, then overwrite it with the (desired) shared
  #   project (the locations match).
	gprinstall src/gtkada.gpr $(static_GPRINSTALLFLAGS) \
	  -XLIBRARY_TYPE=static
	gprinstall src/gtkada.gpr $(call shared_GPRINSTALLFLAGS,gtkada)

# Archive testgtk sources, so that the user does not need to
# uncompress them separately.
# Remove objects and executables.
testgtk_exclude := obj/* test_rtree testgtk testgtk.gpr
reproducible_tar_options := --owner=0 --group=0 --numeric-owner
reproducible_gz_options  := --no-name

# TODO: add the reference manual when gnat-gps/gnatdoc is available
override_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
  # We want one sphinx main process, even if itself deals with parallelism.
  # Hence, prefer MAKE to dh_auto_build (=make -jN).
	$(MAKE) -Cdocs/gtkada_ug latexpdf html \
	  $(addprefix SPHINXOPTS=-j,$(DEB_BUILD_OPTION_PARALLEL))

  # Exclude or transform options only affect following files.
  # testgtk/testgtk.gpr is overwritten (or more accurately, appended twice).
	tar --create \
	  $(reproducible_tar_options) \
	  $(addprefix --exclude=testgtk/,$(testgtk_exclude)) testgtk \
	  --transform=s_debian_testgtk_ debian/testgtk.gpr \
	  | gzip $(reproducible_gz_options) > testgtk.tgz
endif

override_dh_auto_test-indep:

override_dh_auto_install-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
# See debian/patches/gprinstall-no-indep-artifacts.diff.
	mkdir -p debian/tmp/usr/share/gps/plug-ins
	cp --reflink=auto -aftdebian/tmp/usr/share/gps/plug-ins \
	  xml/gtkada.xml
	mkdir -p debian/tmp/usr/share/doc/gtkada/gtkada_ug
	cp --reflink=auto -aftdebian/tmp/usr/share/doc/gtkada/gtkada_ug \
	  docs/gtkada_ug/_build/html/* \
	  docs/gtkada_ug/_build/latex/GtkAda.pdf
endif