[DSE-Dev] Bug#1022964: libselinux FTCBFS: python and ruby extensions

Helmut Grohne helmut at subdivi.de
Fri Oct 28 10:16:10 BST 2022


Source: libselinux
Version: 3.4-1
Tags: patch
User: debian-cross at lists.debian.org
Usertags: cross-satisfiability ftcbfs

libselinux is long part of architecture cross bootstrap, but a full
cross build of libselinux without build profiles still doesn't work yet.
Given the recent work on ruby by Antonio Terceiro (thanks!), it is now
possible to fix that. I'm attaching a patch that solves all of the
involved problems and makes libselinux cross buildable.

1. Multiarchify python build depends.
2. (optional cleanup) Use declarative debhelper addons.
3. export _PYTHON_SYSCONFIGDATA_NAME
4. export RUBYLIB

Helmut
-------------- next part --------------
diff --minimal -Nru libselinux-3.4/debian/changelog libselinux-3.4/debian/changelog
--- libselinux-3.4/debian/changelog	2022-06-04 12:41:40.000000000 +0200
+++ libselinux-3.4/debian/changelog	2022-10-28 10:33:35.000000000 +0200
@@ -1,3 +1,11 @@
+libselinux (3.4-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Support cross building python and ruby extensions.
+    (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Fri, 28 Oct 2022 10:33:35 +0200
+
 libselinux (3.4-1) unstable; urgency=medium
 
   [ Laurent Bigonville ]
diff --minimal -Nru libselinux-3.4/debian/control libselinux-3.4/debian/control
--- libselinux-3.4/debian/control	2022-06-04 12:41:40.000000000 +0200
+++ libselinux-3.4/debian/control	2022-10-28 10:33:35.000000000 +0200
@@ -8,13 +8,14 @@
            Russell Coker <russell at coker.com.au>
 Standards-Version: 4.6.0
 Build-Depends: debhelper-compat (= 13),
-               dh-python <!nopython>,
+               dh-sequence-python3 <!nopython>,
+               dh-sequence-ruby <!noruby>,
                file,
-               gem2deb <!noruby>,
                libsepol-dev (>= 3.4),
                libpcre2-dev,
+               libpython3-all-dev <!nopython>,
                pkg-config,
-               python3-all-dev <!nopython>,
+               python3-all-dev:any <!nopython>,
                swig <!nopython> <!noruby>
 XS-Ruby-Versions: all
 Homepage: https://selinuxproject.org
diff --minimal -Nru libselinux-3.4/debian/rules libselinux-3.4/debian/rules
--- libselinux-3.4/debian/rules	2022-06-04 12:41:40.000000000 +0200
+++ libselinux-3.4/debian/rules	2022-10-28 10:33:35.000000000 +0200
@@ -10,6 +10,13 @@
 ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
 export CC := $(DEB_HOST_GNU_TYPE)-gcc
 export PKG_CONFIG := $(DEB_HOST_GNU_TYPE)-pkg-config
+export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__$(DEB_HOST_MULTIARCH)
+define ruby_env
+  RUBYLIB=/usr/lib/$(DEB_HOST_MULTIARCH)/ruby-crossbuild/$$($(1) -e "puts RbConfig::CONFIG['ruby_version']")
+endef
+else
+define ruby_env
+endef
 endif
 
 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -27,18 +34,15 @@
 ## missing (hardening) flags. Also enable Wall and Wextra to spot basic irregularities.
 export DEB_CFLAGS_MAINT_APPEND += $(shell dpkg-buildflags --get CPPFLAGS) -Wall -Wextra
 
-DH_ADDONS =
 ifneq ($(filter python3-selinux,$(DOPACKAGES)),)
 PY3VERSIONS = $(shell py3versions -rv)
-DH_ADDONS += --with=python3
 endif
 ifneq ($(filter ruby-selinux,$(DOPACKAGES)),)
 RUBY_VERSIONS := $(shell dh_ruby --print-supported)
-DH_ADDONS += --with=ruby
 endif
 
 %:
-	@dh $@ $(DH_ADDONS)
+	@dh $@
 
 ## Set up some variables to be passed to the upstream Makefile
 extra_make_args = ARCH=$(patsubst i%86,i386,$(DEB_HOST_GNU_CPU))
@@ -52,6 +56,7 @@
 endif
 ifneq ($(filter ruby-selinux,$(DOPACKAGES)),)
 	set -e; for version in $(RUBY_VERSIONS); do      \
+	  $(call ruby_env,$$version) \
 	  $(MAKE) rubywrap $(extra_make_args) RUBY=$$version; \
 	done;
 endif
@@ -67,6 +72,7 @@
 endif
 ifneq ($(filter ruby-selinux,$(DOPACKAGES)),)
 	set -e; for version in $(RUBY_VERSIONS); do \
+	  $(call ruby_env,$$version) \
 	  $(MAKE) install-rubywrap $(extra_make_args) RUBY=$$version DESTDIR="${CURDIR}/debian/tmp"; \
 	done;
 endif


More information about the SELinux-devel mailing list