#!/usr/bin/make -f # Build script for GNATColl in Debian. # Copyright (c) 2014-2020 Nicolas Boulenguez # This build script 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. # On Debian systems, the full text of the GPL is in the file # /usr/share/common-licenses/GPL-3. # The debian/control file contains either the python binding or the # other bindings, depending on the current VCS branch. libraries := $(foreach line,$(shell sed -En '\ s/^ gnat-([0-9.]+),$$/ GNAT_VERSION:=\1 /p;\ s/^Package: (libgnatcoll-([a-z]+)[0-9.]+-dev)$$/libraries+=\2 \2_dev:=\1/p;\ s/^Package: libgnatcoll-([a-z]+)([0-9.]+)$$/ \1_version:=\2 /p;\ ' debian/control),$(eval $(line))) DPKG_EXPORT_BUILDFLAGS := 1 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/ada/debian_packaging-$(GNAT_VERSION).mk BUILD := PROD vars += BUILD ifneq (,$(filter python,$(libraries))) GNATCOLL_PYTHON_CFLAGS := `pkg-config --cflags python2` GNATCOLL_PYTHON_LIBS := `pkg-config --libs python2` vars += GNATCOLL_PYTHON_CFLAGS GNATCOLL_PYTHON_LIBS endif ifneq (,$(filter iconv,$(libraries))) GNATCOLL_ICONV_OPT := vars += GNATCOLL_ICONV_OPT endif %: dh $@ .PHONY: override_dh_auto_build override_dh_auto_build: $(libraries) .PHONY: $(libraries) $(libraries): gprbuild $@/gnatcoll_$@.gpr \ -XLIBRARY_TYPE=static \ -p $(BUILDER_OPTIONS) $(foreach v,$(vars),-X$(v)="$($(v))") gprbuild $@/gnatcoll_$@.gpr \ -XLIBRARY_TYPE=relocatable \ -XGNATCOLL_VERSION=$($@_version) \ -p $(BUILDER_OPTIONS) $(foreach v,$(vars),-X$(v)="$($(v))") .PHONY: override_dh_installdocs override_dh_installdocs: ifneq (,$(filter gmp,$(libraries))) dh_installdocs -p$(gmp_dev) gmp/README.md dh_installdocs -p$(iconv_dev) iconv/README.md iconv/docs/index.rst dh_installdocs -p$(omp_dev) omp/README.md dh_installdocs -p$(readline_dev) readline/README.md readline/docs/index.rst dh_installdocs -p$(syslog_dev) syslog/README.md syslog/docs/index.rst endif ifneq (,$(filter python,$(libraries))) dh_installdocs -p$(python_dev) python/README.md python/docs/index.rst endif dh_installdocs --remaining-packages .PHONY: override_dh_auto_clean override_dh_auto_clean: $(RM) -r $(foreach l,$(libraries),$(l)/lib $(l)/obj) ifneq (,$(filter gmp,$(libraries))) .PHONY: override_dh_installexamples override_dh_installexamples: dh_installexamples -p$(gmp_dev) gmp/examples/* dh_installexamples --remaining-packages endif .PHONY: override_dh_ada_library override_dh_ada_library: dh_ada_library $(foreach l,$(libraries), \ LIBRARY_TYPE=relocatable \ GNATCOLL_VERSION=$($(l)_version) \ $(foreach v,$(vars),$(v)="$($(v))") \ $(l)/gnatcoll_$(l).gpr)