| 1 |
#!/usr/bin/make -f |
| 2 |
# Build script for GNATColl in Debian. |
| 3 |
# Copyright (c) 2014-2023 Nicolas Boulenguez <[email protected]> |
| 4 |
|
| 5 |
# This build script is free software; you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU General Public License as |
| 7 |
# published by the Free Software Foundation; either version 3 of the |
| 8 |
# License, or (at your option) any later version. |
| 9 |
|
| 10 |
# This program is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
# General Public License for more details. |
| 14 |
|
| 15 |
# On Debian systems, the full text of the GPL is in the file |
| 16 |
# /usr/share/common-licenses/GPL-3. |
| 17 |
|
| 18 |
libraries := cpp gmp iconv lzma omp python3 readline syslog zlib |
| 19 |
|
| 20 |
DPKG_EXPORT_BUILDFLAGS := 1 |
| 21 |
DEB_BUILD_MAINT_OPTIONS := hardening=+all |
| 22 |
DEB_LDFLAGS_MAINT_APPEND := \ |
| 23 |
-Wl,--no-allow-shlib-undefined \ |
| 24 |
-Wl,--no-copy-dt-needed-entries \ |
| 25 |
-Wl,--no-undefined |
| 26 |
include /usr/share/dpkg/buildflags.mk |
| 27 |
include /usr/share/ada/packaging.mk |
| 28 |
|
| 29 |
project = -P$*/gnatcoll_$(*:3=).gpr |
| 30 |
static := -XLIBRARY_TYPE=static |
| 31 |
shared = -XLIBRARY_TYPE=relocatable \ |
| 32 |
-XGNATCOLL_VERSION=$(gnatcoll_$*_SO_VERSION) |
| 33 |
vars := -XBUILD=PROD |
| 34 |
|
| 35 |
build-python3 install-python3: vars += \ |
| 36 |
-XGNATCOLL_PYTHON_CFLAGS=`pkg-config --cflags python3-embed` \ |
| 37 |
-XGNATCOLL_PYTHON_LIBS=`pkg-config --libs python3-embed` |
| 38 |
|
| 39 |
build-iconv install-iconv: vars += -XGNATCOLL_ICONV_OPT= |
| 40 |
|
| 41 |
%: |
| 42 |
dh $@ |
| 43 |
|
| 44 |
override_dh_auto_build: $(libraries:%=build-%) |
| 45 |
|
| 46 |
build-%: default.cgpr |
| 47 |
gprbuild $(project) $(static) -p $(GPRBUILDFLAGS) $(vars) |
| 48 |
gprbuild $(project) $(shared) -p $(GPRBUILDFLAGS) $(vars) |
| 49 |
|
| 50 |
default.cgpr: |
| 51 |
gprconfig --batch $(GPRCONFIGFLAGS) |
| 52 |
|
| 53 |
override_dh_auto_install: $(libraries:%=install-%) |
| 54 |
# The concrete project with all information available must be named |
| 55 |
# after the library name for dh-ada-library. |
| 56 |
sed s/GnatColl_Python/GnatColl_Python3/ \ |
| 57 |
debian/tmp/$(DEB_GNAT_PROJECT_DIR)/gnatcoll_python.gpr \ |
| 58 |
> debian/tmp/$(DEB_GNAT_PROJECT_DIR)/gnatcoll_python3.gpr |
| 59 |
rm debian/tmp/$(DEB_GNAT_PROJECT_DIR)/gnatcoll_python.gpr |
| 60 |
|
| 61 |
install-%: |
| 62 |
gprinstall $(project) $(vars) $(static) $(static_GPRINSTALLFLAGS) |
| 63 |
gprinstall $(project) $(vars) $(shared) \ |
| 64 |
$(call shared_GPRINSTALLFLAGS,gnatcoll_$*) |
| 65 |
|
| 66 |
execute_before_dh_install: |
| 67 |
# Install a wrapper project so that 'with "gnatcoll_python.gpr";' works.. |
| 68 |
dh_install -plibgnatcoll-python3-dev debian/gnatcoll_python.gpr \ |
| 69 |
$(DEB_GNAT_PROJECT_DIR) |
| 70 |
|
| 71 |
override_dh_gencontrol: |
| 72 |
dh_gencontrol -- -Vpython-version=$(shell \ |
| 73 |
python3 -V | sed 's/^Python \(3\.[0-9]\+\)\.[0-9]\+$$/\1/') |