#!/usr/bin/make -f # Build script for GNATColl in Debian. # Copyright (c) 2014-2023 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. libraries := gmp iconv lzma omp python3 readline syslog zlib 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/packaging.mk project = -P$*/gnatcoll_$(*:3=).gpr static := -XLIBRARY_TYPE=static shared = -XLIBRARY_TYPE=relocatable \ -XGNATCOLL_VERSION=$(gnatcoll_$*_SO_VERSION) vars := -XBUILD=PROD build-python3 install-python3: vars += \ -XGNATCOLL_PYTHON_CFLAGS=`pkg-config --cflags python3-embed` \ -XGNATCOLL_PYTHON_LIBS=`pkg-config --libs python3-embed` build-iconv install-iconv: vars += -XGNATCOLL_ICONV_OPT= %: dh $@ override_dh_auto_build: $(libraries:%=build-%) build-%: default.cgpr gprbuild $(project) $(static) -p $(GPRBUILDFLAGS) $(vars) gprbuild $(project) $(shared) -p $(GPRBUILDFLAGS) $(vars) default.cgpr: gprconfig --batch $(GPRCONFIGFLAGS) override_dh_auto_install: $(libraries:%=install-%) # The concrete project with all information available must be named # after the library name for dh-ada-library. sed s/GnatColl_Python/GnatColl_Python3/ \ debian/tmp/$(DEB_GNAT_PROJECT_DIR)/gnatcoll_python.gpr \ > debian/tmp/$(DEB_GNAT_PROJECT_DIR)/gnatcoll_python3.gpr rm debian/tmp/$(DEB_GNAT_PROJECT_DIR)/gnatcoll_python.gpr install-%: gprinstall $(project) $(vars) $(static) $(static_GPRINSTALLFLAGS) gprinstall $(project) $(vars) $(shared) \ $(call shared_GPRINSTALLFLAGS,gnatcoll_$*) execute_before_dh_install: # Install a wrapper project so that 'with "gnatcoll_python.gpr";' works.. dh_install -plibgnatcoll-python3-dev debian/gnatcoll_python.gpr \ $(DEB_GNAT_PROJECT_DIR) override_dh_gencontrol: dh_gencontrol -- -Vpython-version=$(shell \ python3 -V | sed 's/^Python \(3\.[0-9]\+\)\.[0-9]\+$$/\1/')