#!/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