File: rules

package info (click to toggle)
libncursesada 6.2.20200212-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,468 kB
  • sloc: ada: 9,967; sh: 3,260; makefile: 831; ansic: 662; awk: 68
file content (108 lines) | stat: -rwxr-xr-x 4,483 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
#!/usr/bin/make -f

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

DEB_BUILD_MAINT_OPTIONS := hardening=+all
# Set C ald LD flags here, so that they also affect the upstream build
# system when it compiles the source generator.
# For now, all other compilations are driven by the project.
DEB_CFLAGS_MAINT_APPEND := -Wall -Wextra
DEB_LDFLAGS_MAINT_APPEND := \
  -Wl,--no-allow-shlib-undefined \
  -Wl,--no-copy-dt-needed-entries \
  -Wl,--no-undefined
DPKG_EXPORT_BUILDFLAGS := 1
include /usr/share/dpkg/buildflags.mk
include $(wildcard /usr/share/ada/debian_packaging-$(GNAT_VERSION).mk)
# wildcard means: not during -indep builds.

%:
	dh $@

.PHONY: override_dh_autoreconf-arch override_dh_autoreconf-indep
override_dh_autoreconf-arch:
# Do not run autoreconf during -indep builds.
# The ncurses maintainer maintains his own fork of autoconf, which
# refuses the -f option (checked on 2020/04).
	rm -f configure
	dh_autoreconf autoconf-dickey

# In Debian, it is convenient to consistently drive the static build,
# the dynamic build and the installation by dh-ada-library with a
# single GNAT project.
# Until gnat-8, gnatmake was able to use such a project, and upstream
# was able to drive gnatmake (this may help to understand historical
# bits in aclocal.m4 and Makefile.in, like cf_ada_compiler below).
# With gnat >= 9, gnatmake has stopped supporting projects, but
# upstream does not mix projects and shared libraries yet.
# That's why we ignore large parts of upstream build system.
.PHONY: $(addprefix override_dh_auto_, \
  configure-arch configure-indep build-arch build-indep install)
# The clean target is OK.

override_dh_auto_configure-arch:
 # tests: samples/* will be installed into the -doc package, and used
 # by autopkgtest, but there is no point in compiling them now.
	CC=gnatgcc \
	dh_auto_configure -- \
	  --without-tests
# --with-ada-sharedlib --with-ada-libname=libncursesada.so.$(SOVERSION)
#   would not help much, see paragraph above.
 # with-ada-compiler="gprbuild $(BUILDER_OPTIONS)" actually has no effect.

NCURSES_MODULES := form menu panel ncurses
NCURSES_CFLAGS  := `pkg-config --cflags $(NCURSES_MODULES)`
LDLIBS          := `pkg-config --libs $(NCURSES_MODULES)`
PROJECT := debian/ncursesada.gpr

override_dh_auto_build-arch:
	dh_auto_build -- -C include ncurses_def.h
	dh_auto_build -- -C gen
 # The src/ build system ignores CFLAGS when building two versions of
 # the library. We only call it to generate a needed file.
 # TODO: the NEWS changelog seems to tell that this has been fixed.
 # Is it possible to pass ADAFLAGS?
	dh_auto_build -- -C src terminal_interface-curses-trace.adb

	gprbuild $(PROJECT) $(BUILDER_OPTIONS) -p \
	  -XSOVERSION= -XNCURSES_CFLAGS="$(NCURSES_CFLAGS)"
	gprbuild $(PROJECT) $(BUILDER_OPTIONS) -p \
	  -XSOVERSION=$(SOVERSION) -XLDLIBS="$(LDLIBS)" -XNCURSES_CFLAGS="$(NCURSES_CFLAGS)"

# Upstream allows installation of explain.txt into any directory, and
# consequently reformats the generated source in the 80-columns limit.
# During -indep builds, avoid running ./configure just for that.
override_dh_auto_build-indep: debian/build/sample-explanation.adb
debian/build/sample-explanation.adb: samples/sample-explanation.adb_p
	mkdir -p $(dir $@)
	sed 's|\$$THIS_DATADIR|"./"|' $< > $@

######################################################################

.PHONY: override_dh_ada_library-arch
override_dh_ada_library-arch:
	dh_ada_library \
	  SOVERSION=not-empty LDLIBS="$(LDLIBS)" $(PROJECT)

# doc/ provides a -config script giving build flags for
# reverse dependencies. We ignore it as per Debian Ada Policy
# we prefer project files. It also contains HTML pages
# generated from the sources (make -C gen html). We do not
# regenerate them either because we do not want to install
# arch-dependant files into the -doc package. The
# arch-specific parts are identified in the comments anyway.

######################################################################

.PHONY: override_dh_installchangelogs
override_dh_installchangelogs:
	dh_installchangelogs --all NEWS

# Avoid a warning about autodetection of doc-main-package.
.PHONY: override_dh_installdocs override_dh_installexamples
override_dh_installdocs override_dh_installexamples: override_%:
	$* --package=libncursesada-doc --doc-main-package=libncursesada-doc
	$* --remaining-packages