Source: libsemanage
Version: 3.4-1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: cross-satisfiability ftcbfs

libsemanage is long part of architecture cross bootstrap, but a full
cross build of libsemanage 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 libmanage cross buildable.

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

Helmut
diff --minimal -Nru libsemanage-3.4/debian/changelog 
libsemanage-3.4/debian/changelog
--- libsemanage-3.4/debian/changelog    2022-06-04 19:10:35.000000000 +0200
+++ libsemanage-3.4/debian/changelog    2022-10-28 11:37:29.000000000 +0200
@@ -1,3 +1,11 @@
+libsemanage (3.4-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Support cross building python and ruby extensions.
+    (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Fri, 28 Oct 2022 11:37:29 +0200
+
 libsemanage (3.4-1) unstable; urgency=medium
 
   * New upstream release
diff --minimal -Nru libsemanage-3.4/debian/control 
libsemanage-3.4/debian/control
--- libsemanage-3.4/debian/control      2022-06-04 19:10:35.000000000 +0200
+++ libsemanage-3.4/debian/control      2022-10-28 11:37:29.000000000 +0200
@@ -9,17 +9,19 @@
 Standards-Version: 4.6.0
 Build-Depends: bison,
                debhelper-compat (= 13),
-               dh-python <!nopython>,
+               dh-sequence-python3 <!nopython>,
+               dh-sequence-ruby <!noruby>,
                file,
                flex,
                gem2deb (>= 0.5.0~) <!noruby>,
                libaudit-dev,
                libbz2-dev,
                libcunit1-dev <!nocheck>,
+               libpython3-all-dev <!nopython>,
                libselinux1-dev (>= 3.4),
                libsepol-dev (>= 3.4),
                pkg-config,
-               python3-all-dev <!nopython>,
+               python3-all-dev:any <!nopython>,
                secilc (>= 3.4) <!nocheck>,
                swig <!nopython> <!noruby>
 Homepage: https://selinuxproject.org
diff --minimal -Nru libsemanage-3.4/debian/rules libsemanage-3.4/debian/rules
--- libsemanage-3.4/debian/rules        2022-06-04 19:10:35.000000000 +0200
+++ libsemanage-3.4/debian/rules        2022-10-28 11:37:27.000000000 +0200
@@ -8,6 +8,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)))
@@ -17,14 +24,11 @@
 
 DOPACKAGES = $(shell dh_listpackages)
 
-DH_ADDONS=
 ifneq ($(filter python3-semanage,$(DOPACKAGES)),)
 PY3VERSIONS = $(shell py3versions -rv)
-DH_ADDONS += --with=python3
 endif
 ifneq ($(filter ruby-semanage,$(DOPACKAGES)),)
 RUBY_VERSIONS := $(shell dh_ruby --print-supported)
-DH_ADDONS += --with=ruby
 endif
 
 # Upstream recommends using this flag
@@ -34,7 +38,7 @@
 export DEB_CFLAGS_MAINT_APPEND += $(shell dpkg-buildflags --get CPPFLAGS) 
-Wall -Wextra
 
 %:
-       dh $@ $(DH_ADDONS)
+       dh $@
 
 override_dh_auto_build:
        $(MAKE) all
@@ -46,6 +50,7 @@
 endif
 ifneq ($(filter ruby-semanage,$(DOPACKAGES)),)
        set -e; for version in $(RUBY_VERSIONS); do      \
+         $(call ruby_env,$$version) \
          $(MAKE) -C src rubywrap RUBY=$$version; \
        done;
 endif
@@ -62,6 +67,7 @@
 endif
 ifneq ($(filter ruby-semanage,$(DOPACKAGES)),)
        set -e; for version in $(RUBY_VERSIONS); do      \
+         $(call ruby_env,$$version) \
          $(MAKE) -C src install-rubywrap RUBY=$$version 
DESTDIR="${CURDIR}/debian/tmp"; \
        done;
 endif

Reply via email to