#!/usr/bin/make -f # debian/rules for libgtkada # Copyright (c) 2003-2012 Ludovic Brenta # Copyright (c) 2011-2020 Nicolas Boulenguez # # 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 $@ # Declaring these targets prevents dh calling upstream build system directly. .PHONY: $(addprefix override_dh_auto_, \ configure-arch configure-indep build-arch build-indep test-arch test-indep install) ###################################################################### $(foreach line,$(shell sed -n '\ s/^ gnat-\([0-9.]\+\),$$/ GNAT_VERSION:=\1 /p;\ s/^Package: libgtkada\([0-9.]\+\)$$/ soversion:=\1 /p;\ ' debian/control),$(eval $(line))) DPKG_EXPORT_BUILDFLAGS := 1 DEB_ADAFLAGS_MAINT_APPEND := -gnatVa -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 $(wildcard /usr/share/ada/debian_packaging-$(GNAT_VERSION).mk) # wildcard in case only Build-Depends-Indep are installed. # Note: despite what the help string says, --enable-shared does *not* # link tools dynamically when both libraries are built. We use # LIBRARY_KIND_FOR_TOOLS later to ensure dynamic linking. # OpenGL is disabled: it copies gtkgl2/gtk2 sources while gtk3 seems # to include more recent versions of the same files. override_dh_auto_configure-arch: # Requires pkg-config package. dh_auto_configure -- \ --with-GL=no \ --enable-shared \ --disable-static-pic \ --includedir=$${prefix}/share/ada/adainclude \ CC=gnatgcc \ PACKAGE_VERSION=$(soversion) dh_auto_build -- generate PYTHON=python3 override_dh_auto_build-arch: # Instead of running default target all: static relocatable tools tests, # - link tools dynamically # - run tests only if DEB_BUILD_OPTIONS does not contain nocheck. dh_auto_build -- static relocatable tools \ LIBRARY_TYPE_FOR_TOOLS=relocatable \ PROCESSORS=$(BUILDER_JOBS) \ GPRBUILD_OPTIONS='$(filter-out -j$(BUILDER_JOBS),$(BUILDER_OPTIONS))' override_dh_auto_test-arch: dh_auto_test -- \ LIBRARY_TYPE_FOR_TOOLS=relocatable \ PROCESSORS=$(BUILDER_JOBS) \ GPRBUILD_OPTIONS='$(filter-out -j$(BUILDER_JOBS),$(BUILDER_OPTIONS))' # Archive testgtk sources, so that the user does not need to # uncompress them separately. # Remove objects and executables. TESTGTK_TGZ := testgtk.tgz testgtk_exclude := obj/* test_rtree testgtk testgtk.gpr.orig testgtk_gpr := 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 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) override_dh_auto_build-indep: $(TESTGTK_TGZ) docs/gtkada_ug/_build/GtkAda.html endif docs/gtkada_ug/_build/GtkAda.html: dh_auto_build --sourcedir=docs/gtkada_ug -- latexpdf html # libgtkada-doc.docs cannot rename files. mv docs/gtkada_ug/_build/html docs/gtkada_ug/_build/GtkAda.html $(TESTGTK_TGZ): # Reimplement "make testgtk/opengl/view_gl.adb", without requiring # ./configure dependencies during -indep builds. gnatprep -DHAVE_GL=False -DWIN32=False testgtk/opengl/view_gl.gpb testgtk/opengl/view_gl.adb patch -b $(testgtk_gpr) debian/testgtk-no-opengl.diff tar --create \ $(reproducible_tar_options) \ $(addprefix --exclude=testgtk/,$(testgtk_exclude)) \ testgtk | gzip $(reproducible_gz_options) > $@ # Restore the project, so that the clean target works as expected. mv -f $(testgtk_gpr).orig $(testgtk_gpr)