From 32eb26264323888e77154c2aeadc9994a4a54d5d Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 15 Mar 2025 14:17:04 -0700 Subject: [PATCH] enca: Fix cross builds Some portions are built using host CC, which is important when doing cross compile to pass correct flags otherwise it fails when using newer host compiler e.g. gcc-14 Signed-off-by: Khem Raj --- meta-oe/recipes-support/enca/enca/cross.patch | 68 +++++++++++++++++++ .../enca/enca/makefile-remove-tools.patch | 14 ---- meta-oe/recipes-support/enca/enca_1.19.bb | 24 ++----- 3 files changed, 73 insertions(+), 33 deletions(-) create mode 100644 meta-oe/recipes-support/enca/enca/cross.patch delete mode 100644 meta-oe/recipes-support/enca/enca/makefile-remove-tools.patch diff --git a/meta-oe/recipes-support/enca/enca/cross.patch b/meta-oe/recipes-support/enca/enca/cross.patch new file mode 100644 index 0000000000..7749dee088 --- /dev/null +++ b/meta-oe/recipes-support/enca/enca/cross.patch @@ -0,0 +1,68 @@ +From: Helmut Grohne +Subject: build make_hash with the build arch compiler + +Also note that we cannot include config.h in make_hash.c, because it is +specific to the host architecture. + +Sourced from debian - https://salsa.debian.org/debian/enca/-/blob/master/debian/patches/cross.patch?ref_type=heads + +Upstream-Status: Pending +Signed-off-by: Khem Raj + +Index: enca-1.19/configure.ac +=================================================================== +--- enca-1.19.orig/configure.ac ++++ enca-1.19/configure.ac +@@ -35,6 +35,7 @@ + dnl Checks for programs. + AC_PROG_AWK + AC_PROG_CC ++AX_PROG_CC_FOR_BUILD + AC_GNU_SOURCE + AC_AIX + AC_ISC_POSIX +Index: enca-1.19/tools/Makefile.am +=================================================================== +--- enca-1.19.orig/tools/Makefile.am ++++ enca-1.19/tools/Makefile.am +@@ -2,7 +2,8 @@ + noinst_HEADERS = encodings.h + noinst_SCRIPTS = expand_table.pl + +-make_hash_SOURCES = make_hash.c ++make_hash$(EXEEXT): make_hash.c ++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -o $@ $< + + BUILT_SOURCES = $(noinst_HEADERS) + +Index: enca-1.19/tools/make_hash.c +=================================================================== +--- enca-1.19.orig/tools/make_hash.c ++++ enca-1.19/tools/make_hash.c +@@ -17,25 +17,9 @@ + with this program; if not, write to the Free Software Foundation, Inc., + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +-#ifdef HAVE_CONFIG_H +-# include "config.h" +-#endif /* HAVE_CONFIG_H */ +- + #include + #include +- +-#ifdef HAVE_STRING_H +-# include +-#else /* HAVE_STRING_H */ +-# ifdef HAVE_STRINGS_H +-# include +-# endif /* HAVE_STRINGS_H */ +-#endif /* HAVE_STRING_H */ +- +-#ifdef HAVE_MEMORY_H +-# include +-#endif /* HAVE_MEMORY_H */ +- ++#include + #include + #include + diff --git a/meta-oe/recipes-support/enca/enca/makefile-remove-tools.patch b/meta-oe/recipes-support/enca/enca/makefile-remove-tools.patch deleted file mode 100644 index 756745d839..0000000000 --- a/meta-oe/recipes-support/enca/enca/makefile-remove-tools.patch +++ /dev/null @@ -1,14 +0,0 @@ -Upstream-Status: Pending - ---- enca-1.19/Makefile.am.orig 2006-06-29 15:34:55.000000000 +0100 -+++ enca-1.19/Makefile.am 2006-06-29 15:35:20.000000000 +0100 -@@ -1,7 +1,7 @@ - if MAINTAINER_MODE --SUBDIRS = tools data script lib src devel-docs test -+SUBDIRS = data script lib src devel-docs test - else --SUBDIRS = tools script lib src devel-docs -+SUBDIRS = script lib src devel-docs - endif - man_MANS = man/enca.1 - diff --git a/meta-oe/recipes-support/enca/enca_1.19.bb b/meta-oe/recipes-support/enca/enca_1.19.bb index 774f05f7c4..61da50ba52 100644 --- a/meta-oe/recipes-support/enca/enca_1.19.bb +++ b/meta-oe/recipes-support/enca/enca_1.19.bb @@ -2,33 +2,19 @@ SUMMARY = "Enca is an Extremely Naive Charset Analyser" SECTION = "libs" HOMEPAGE = "https://cihar.com/software/enca/" -DEPENDS += "gettext-native" +DEPENDS += "gettext-native autoconf-archive-native" LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=24b9569831c46d4818450b55282476b4" SRC_URI = "https://dl.cihar.com/enca/enca-${PV}.tar.gz \ + file://cross.patch \ file://dont-run-tests.patch \ - file://makefile-remove-tools.patch \ file://libenca-003-iconv.patch \ - file://0001-Do-not-use-MKTEMP_PROG-in-cross-build.patch" + file://0001-Do-not-use-MKTEMP_PROG-in-cross-build.patch \ + " SRC_URI[sha256sum] = "4c305cc59f3e57f2cfc150a6ac511690f43633595760e1cb266bf23362d72f8a" inherit autotools -do_configure:prepend() { - # remove failing test which checks for something that isn't even used - sed -i -e '/ye_FUNC_SCANF_MODIF_SIZE_T/d' ${S}/configure.ac -} - -do_configure:append() { - sed -i s:-I/usr/include::g ${B}/Makefile - sed -i s:-I/usr/include::g ${B}/*/Makefile -} - -do_compile() { - cd ${S}/tools && ${BUILD_CC} -o make_hash make_hash.c - cd ${B} - oe_runmake -} - +EXTRA_OECONF += "MKTEMP_PROG=mktemp"