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 <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2025-03-15 14:17:04 -07:00
parent 6be4067178
commit 32eb262643
No known key found for this signature in database
GPG Key ID: BB053355919D3314
3 changed files with 73 additions and 33 deletions

View File

@ -0,0 +1,68 @@
From: Helmut Grohne <helmut@subdivi.de>
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 <raj.khem@gmail.com>
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 <stdlib.h>
#include <stdio.h>
-
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else /* HAVE_STRING_H */
-# ifdef HAVE_STRINGS_H
-# include <strings.h>
-# endif /* HAVE_STRINGS_H */
-#endif /* HAVE_STRING_H */
-
-#ifdef HAVE_MEMORY_H
-# include <memory.h>
-#endif /* HAVE_MEMORY_H */
-
+#include <string.h>
#include <unistd.h>
#include <ctype.h>

View File

@ -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

View File

@ -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"