From: Dan McGregor <[email protected]>

The distributed configure script removes the existing CFLAGS if it
finds python3. Correct this, so that our prefix mapping flags and
other OpenEmbedded flags get applied.

This patch was acquired from the comments in
https://bugs.launchpad.net/hplip/+bug/1879445

Signed-off-by: Dan McGregor <[email protected]>
---
 meta-oe/conf/include/non-repro-meta-oe.inc    |  2 -
 .../0001-Fix-upstream-CFLAGS-override.patch   | 68 +++++++++++++++++++
 .../recipes-extended/hplip/hplip_3.22.10.bb   | 15 ++--
 3 files changed, 73 insertions(+), 12 deletions(-)
 create mode 100644 
meta-oe/recipes-extended/hplip/hplip/0001-Fix-upstream-CFLAGS-override.patch

diff --git a/meta-oe/conf/include/non-repro-meta-oe.inc 
b/meta-oe/conf/include/non-repro-meta-oe.inc
index 7961d851f92..3441cb119a8 100755
--- a/meta-oe/conf/include/non-repro-meta-oe.inc
+++ b/meta-oe/conf/include/non-repro-meta-oe.inc
@@ -33,8 +33,6 @@ KNOWN_NON_REPRO_META_OE = " \
     hdf5-dbg \
     hdf5-src \
     hdf5-staticdev \
-    hplip \
-    hplip-dbg \
     jpnevulator-doc \
     jsonrpc-dev \
     kpatch-build \
diff --git 
a/meta-oe/recipes-extended/hplip/hplip/0001-Fix-upstream-CFLAGS-override.patch 
b/meta-oe/recipes-extended/hplip/hplip/0001-Fix-upstream-CFLAGS-override.patch
new file mode 100644
index 00000000000..c8c892c5e12
--- /dev/null
+++ 
b/meta-oe/recipes-extended/hplip/hplip/0001-Fix-upstream-CFLAGS-override.patch
@@ -0,0 +1,68 @@
+From 297e517d302469fa27dd96c091021b53f9ac2254 Mon Sep 17 00:00:00 2001
+From: Zdenek Dohnal <[email protected]>
+Date: Fri, 26 Apr 2024 14:17:54 -0600
+Subject: [PATCH] Fix upstream CFLAGS override
+
+Upstream check for python clears OS build system CFLAGS
+
+Upstream-Status: Submitted [https://bugs.launchpad.net/hplip/+bug/1879445]
+---
+ configure.in | 36 +++++++++++++++++++++++-------------
+ 1 file changed, 23 insertions(+), 13 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index ebea052..80c4618 100644
+--- a/configure.in
++++ b/configure.in
+@@ -628,20 +628,31 @@ if test "$class_driver" = "no" && test 
"$hpijs_only_build" = "no" && test "$hpcu
+    fi
+ fi
+ 
+-SAVE_CPPFLAGS="$CPPFLAGS"
+-CFLAGS=`python-config --includes`
+-if [ $? -eq 0 ] 
+-then
+-   echo $FLAGS
+-else
+-CFLAGS=`python3-config --includes`
+-   if [ $? -eq 0 ]
+-   then
+-   echo $FLAGS
+-   fi
++AC_PATH_PROG(python3_config_path, python3-config, 
[AC_MSG_ERROR([python3-config not installed], 6)])
++
++PYTHON_INCLUDES=`$python3_config_path --includes`
++if test "X$PYTHON_INCLUDES" == "X" ; then
++  AC_MSG_ERROR([Cannot get Python includes via python3-config], 6)
++fi
++
++PYTHON_LIBS=`$python3_config_path --libs`
++if test "X$PYTHON_LIBS" == "X" ; then
++  AC_MSG_ERROR([Cannot get Python libs via python3-config], 6)
++fi
++
++SAVE_CFLAGS=$CFLAGS
++SAVE_LIBS=$LIBS
++
++CFLAGS="$CFLAGS $PYTHON_INCLUDES"
++LIBS="$LIBS $PYTHON_LIBS"
++
++AC_TRY_LINK(,[ ], AC_MSG_RESULT(yes); python_includes="ok", AC_MSG_ERROR([no: 
PYTHON DISABLED], 6))
++
++if test "X$python_includes" != "Xok" ; then
++  CFLAGS="$SAVE_CFLAGS"
++  LIBS="$SAVE_LIBS"
+ fi
+ 
+-#CFLAGS=`(python-config --includes)`
+ if test "$class_driver" = "no" && test "$hpijs_only_build" = "no" && test 
"$lite_build" = "no" && test "$hpcups_only_build" = "no"; then
+    AC_ARG_VAR([PYTHON], [Python interpreter/compiler command])
+    AC_CHECK_PROGS(PYTHON,[python python3 python2])
+@@ -664,7 +675,6 @@ if test "$class_driver" = "no" && test "$hpijs_only_build" 
= "no" && test "$lite
+    AS_IF([test "x$FOUND_HEADER" != "xyes"],
+           [AC_MSG_ERROR([cannot find python-devel support], 6)])
+ fi
+-CFLAGS="$save_CFLAGS"
+ 
+ if test "$hpijs_only_build" = "no" && test "$scan_build" = "yes" && test 
"$hpcups_only_build" = "no"; then
+    AC_CHECK_LIB([sane], [sane_open], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot 
find sane-backends-devel support (or --disable-scan-build)], 12)])
diff --git a/meta-oe/recipes-extended/hplip/hplip_3.22.10.bb 
b/meta-oe/recipes-extended/hplip/hplip_3.22.10.bb
index c54b2e0d88f..4ee333de33a 100644
--- a/meta-oe/recipes-extended/hplip/hplip_3.22.10.bb
+++ b/meta-oe/recipes-extended/hplip/hplip_3.22.10.bb
@@ -16,7 +16,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.gz \
            file://0005-hp_ipp.c-Add-printf-format-to-snprintf-calls.patch \
            
file://0006-Workaround-patch-for-missing-Python3-transition-of-t.patch \
            file://0001-Fix-installing-ipp-usb-quirk.patch \
-           file://0001-Drop-using-register-storage-classifier.patch"
+           file://0001-Drop-using-register-storage-classifier.patch \
+           file://0001-Fix-upstream-CFLAGS-override.patch"
 SRC_URI[sha256sum] = 
"533c3f2f6b53e4163ded4fd81d1f11ae6162a0f6451bd5e62a8382d0c1366624"
 
 UPSTREAM_CHECK_URI = "https://sourceforge.net/p/hplip/activity";
@@ -25,11 +26,6 @@ DEPENDS += "cups python3 libusb1 python3-setuptools-native"
 
 inherit autotools-brokensep python3-dir python3native python3targetconfig 
pkgconfig systemd
 
-export STAGING_INCDIR
-export STAGING_LIBDIR
-
-CFLAGS += "-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}"
-
 EXTRA_OECONF += "\
         --enable-cups-drv-install \
         --enable-cups-ppd-install \
@@ -51,7 +47,7 @@ EXTRA_OECONF += "\
         --with-cupsfilterdir=${libexecdir}/cups/filter \
 "
 
-EXTRA_OEMAKE = "CPPFLAGS='${CFLAGS}' rulessystemdir=${systemd_unitdir}/system/"
+EXTRA_OEMAKE = "rulessystemdir=${systemd_unitdir}/system/"
 
 do_install:append() {
     rm -rf ${D}${datadir}/hplip/upgrade.py
@@ -76,7 +72,8 @@ RDEPENDS:${PN} += " \
 "
 RDEPENDS:${PN}-filter += "perl ghostscript"
 
-FILES:${PN} += "${datadir}/ipp-usb/quirks/HPLIP.conf"
+FILES:${PN} += "${datadir}/ipp-usb/quirks/HPLIP.conf \
+        ${systemd_system_unitdir}/[email protected]"
 FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la"
 FILES:${PN}-ppd = "${datadir}/ppd"
 FILES:${PN}-cups = "${datadir}/cups"
@@ -86,6 +83,4 @@ FILES:${PN}-hal = "${datadir}/hal"
 
 FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}/*.so"
 
-SYSTEMD_SERVICE:${PN} = "[email protected]"
-
 CLEANBROKEN = "1"
-- 
2.47.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#113914): 
https://lists.openembedded.org/g/openembedded-devel/message/113914
Mute This Topic: https://lists.openembedded.org/mt/109672223/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to