From 886d8b19d2326faedcf471e3e986589793190d74 Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Tue, 25 Jul 2023 20:57:37 +0300 Subject: [PATCH 1/5] debian: rules.in: export all necessary variables and pass path to src dir After these changes, the dh_auto_XX commands will receive all the necessary variables and parameters and pass the applicable variables\parameters to the dh_XX commands. All dh commands will be run in the src directory if they are not overridden. That is, we need to write the override like this: override_dh_auto_build-arch: dh_auto_build -- build-software NOT so: override_dh_auto_build-arch: dh_build -- build-software --- debian/rules.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/rules.in b/debian/rules.in index 73b71edd087..2c5a97fded1 100644 --- a/debian/rules.in +++ b/debian/rules.in @@ -13,7 +13,9 @@ # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 -include /usr/share/dpkg/pkg-info.mk +# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/default.mk # Support more robust code and makes code modifications more difficult # Compare https://wiki.debian.org/Hardening @@ -31,11 +33,12 @@ export TIME=$(shell LANG=C date --date='@$(TIMESTAMP)' '+%T') kernel_version = @KERNEL_VERSION@ configure_realtime_arg = @CONFIGURE_REALTIME_ARG@ enable_build_documentation = @ENABLE_BUILD_DOCUMENTATION@ +SRCDIR = $(CURDIR)/src DESTDIR=$(CURDIR)/debian/tmp DEV_PACKAGE_NAME=@MAIN_PACKAGE_NAME@-dev %: - dh $@ + dh $@ -D$(SRCDIR) override_dh_auto_configure: cd src && ./autogen.sh From 51d649112ca89c44bc71beda5b6a247c8b3d9e37 Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Thu, 27 Jul 2023 15:33:45 +0300 Subject: [PATCH 2/5] override_dh_auto_clean: Perform cleaning only if required The src/Makefile file has a check of variables at the very beginning and exits by mistake if they are not initialized. That is, if there is no src/Makefile.inc file, then the project configuration was not performed and any other goals were not fulfilled. It is not possible to complete any goal before the initial configuration. This check ensures that the source code is clean and there is no need to clean it. --- debian/rules.in | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/debian/rules.in b/debian/rules.in index 2c5a97fded1..cde3fe84d57 100644 --- a/debian/rules.in +++ b/debian/rules.in @@ -60,14 +60,10 @@ ifneq "$(enable_build_documentation)" "" endif override_dh_auto_clean: - dh_auto_clean - py3clean . - if [ -r src/Makefile.inc -a -r src/config.status ]; then $(MAKE) -C src clean -s; fi - rm -f Makefile.inc - rm -f src/config.log src/config.status - rm -f $(for i in $(find . -name "*.in"); do basename $i .in; done) - dh_clean - + if [ -r src/Makefile.inc -a -r src/config.status ]; then \ + dh_auto_clean; \ + py3clean .; \ + fi override_dh_auto_install-arch: # Install all architecture-dependent libraries and executables From 01d017f24704076f156a8dc6afa48069277fb4c5 Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:26:59 +0300 Subject: [PATCH 3/5] PYTHON: Export a variable explicitly to access it If the variable is not explicitly exported or passed to the configuration command, then it will be initialized by the configure script as: PYTHON=/usr/bin/python3.11 on bookworm PYTHON=/usr/bin/python3.10 on jammi --- debian/rules.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/rules.in b/debian/rules.in index cde3fe84d57..31a7ba66c79 100644 --- a/debian/rules.in +++ b/debian/rules.in @@ -37,12 +37,14 @@ SRCDIR = $(CURDIR)/src DESTDIR=$(CURDIR)/debian/tmp DEV_PACKAGE_NAME=@MAIN_PACKAGE_NAME@-dev +export PYTHON=/usr/bin/python3 + %: dh $@ -D$(SRCDIR) override_dh_auto_configure: cd src && ./autogen.sh - cd src && PYTHON=/usr/bin/python3 ./configure \ + dh_auto_configure -- \ --prefix=/usr --sysconfdir=/etc \ --mandir=/usr/share/man \ $(configure_realtime_arg) \ From b65fec5694002a91f3092fbbe1044961ac34328b Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Thu, 27 Jul 2023 16:39:05 +0300 Subject: [PATCH 4/5] dh_auto_build: Provide the possibility of automatic operation --- debian/rules.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/rules.in b/debian/rules.in index 31a7ba66c79..a1f00dee977 100644 --- a/debian/rules.in +++ b/debian/rules.in @@ -52,13 +52,13 @@ override_dh_auto_configure: --disable-check-runtime-deps override_dh_auto_build-arch: - $(MAKE) PYTHON=/usr/bin/python3 -C src build-software + dh_auto_build -- build-software override_dh_auto_build-indep: ifneq "$(enable_build_documentation)" "" - $(MAKE) PYTHON=/usr/bin/python3 -C src manpages - $(MAKE) PYTHON=/usr/bin/python3 -C src translateddocs - $(MAKE) PYTHON=/usr/bin/python3 -C src docs + dh_auto_build -- manpages + dh_auto_build -- translateddocs + dh_auto_build -- docs endif override_dh_auto_clean: From 908afcf6b637a89d6f03cade0273819a0e23b9f5 Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Fri, 28 Jul 2023 09:35:10 +0300 Subject: [PATCH 5/5] debian: rules.in: Specify explicitly the path to libdir Reverse this commit if the path to the library is needed as architecture-dependent. --libdir=\${prefix}/lib/${DEB_HOST_MULTIARCH} As: --libdir=\${prefix}/lib/x86_64-linux-gnu --libdir=\${prefix}/lib/aarch64-linux-gnu --- debian/rules.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/rules.in b/debian/rules.in index a1f00dee977..8ff183ed295 100644 --- a/debian/rules.in +++ b/debian/rules.in @@ -46,6 +46,8 @@ override_dh_auto_configure: cd src && ./autogen.sh dh_auto_configure -- \ --prefix=/usr --sysconfdir=/etc \ + --libdir=/usr/lib \ + --disable-multiarch \ --mandir=/usr/share/man \ $(configure_realtime_arg) \ $(enable_build_documentation) \