diff --git a/recipes/perl/perl.yaml b/recipes/perl/perl.yaml index 6ae5b961..8c706c49 100644 --- a/recipes/perl/perl.yaml +++ b/recipes/perl/perl.yaml @@ -6,7 +6,7 @@ metaEnvironment: privateEnvironment: APPLY_UPDATE_CONFIG: "no" - PERL_CROSS_VERSION: "1.6.2" + PERL_CROSS_VERSION: "1.6.5" PERL_ARCH: "$(if-then-else,$(eq,${ARCH},arm64),aarch64-linux,${ARCH}-linux)" checkoutSCM: @@ -18,8 +18,9 @@ checkoutSCM: stripComponents: 1 - scm: url - url: "https://github.com/arsv/perl-cross/raw/releases/perl-cross-${PERL_CROSS_VERSION}.tar.gz" - digestSHA256: "131f7496152ee32067dbac2bc9b44b2f582fc778140e545701b3b2faee782f1d" + url: "https://github.com/arsv/perl-cross/releases/download/${PERL_CROSS_VERSION}/\ + perl-cross-${PERL_CROSS_VERSION}.tar.gz" + digestSHA256: "81130cd4b8c6d9eb2a1959f37d44391a46ad6a6794fc41fed5441f74e85e3dd0" extract: False dir: perl-cross fileName: perl-cross.tar.gz @@ -38,6 +39,12 @@ buildTools: [host-toolchain, target-toolchain] buildVars: [AUTOCONF_HOST, CROSS_COMPILE, TOOLCHAIN_SYSROOT, CPPFLAGS, CFLAGS, LDFLAGS] buildScript: | + # perl-cross symlinks the sources into the build directory only if there + # is no MANIFEST yet. Start over if configure did not complete before, + # e.g. because a previous run was interrupted while symlinking. + if [ -d build ] && [ ! -e build/.bob-configured ]; then + rm -rf build + fi mkdir -p build install cd build @@ -60,6 +67,8 @@ buildScript: | -Dperladmin=root \ -Duserelocatableinc \ + touch .bob-configured + makeParallel all make DESTDIR=$PWD/../install install.perl diff --git a/recipes/perl/perl/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch b/recipes/perl/perl/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch new file mode 100644 index 00000000..59d85f4c --- /dev/null +++ b/recipes/perl/perl/0001-configure-keep-_GNU_SOURCE-in-build-flags.patch @@ -0,0 +1,60 @@ +From 6bdfdff24f4a7d17d3b7d9d02bca3eac11c235a4 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 26 Aug 2026 19:34:39 +0200 +Subject: [PATCH] configure: keep _GNU_SOURCE in build flags + +The checkfunc() function probes available libc functions with _GNU_SOURCE +defined. The generated config.sh did not retain that define in ccflags, so +the actual cross build could use functions whose prototypes remain hidden by +feature-test macros. This breaks musl builds, where memrchr is declared only +with _GNU_SOURCE. + +To fix this, append _GNU_SOURCE to explicit -Dccflags values while parsing +configure arguments. Such values are locked before configure_tool.sh can +append flags. This keeps the function-availability checks and subsequent +compilation in the same feature set, including when flags are supplied +through CFLAGS. + +This fixes the regression introduced by b40c560f5d5e (configure_func.sh: Add +_GNU_SOURCE define and function signatures). + +It fixes the following build issue with musl: + + In file included from op.c:163: + op.c: In function 'Perl_newATTRSUB_x': + perl.h:2385:25: error: implicit declaration of function 'memrchr'; did + you mean 'memchr'? [-Wimplicit-function-declaration] + 2385 | # define my_memrchr memrchr + | ^~~~~~~ + +This issue is worked around in several build systems: + +- In OpenEmbedded: + https://github.com/openembedded/openembedded-core/commit/6422e62 + +- In NixOS: + https://github.com/NixOS/nixpkgs/pull/441527 + +Fixes: https://github.com/arsv/perl-cross/issues/158 +Signed-off-by: Thomas Petazzoni +--- + cnf/configure_args.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/cnf/configure_args.sh b/cnf/configure_args.sh +index 5bc4c6b..65ffc96 100644 +--- a/cnf/configure_args.sh ++++ b/cnf/configure_args.sh +@@ -225,6 +225,9 @@ while [ $i -le $# -o -n "$n" ]; do + host|target|build) ;; + # original Configure options + D) ++ if [ "$k" = 'ccflags' ]; then ++ v="$v -D_GNU_SOURCE" ++ fi + setordefine "$k" "$x" "$v" 'define' 'true' + ;; + U) +-- +2.55.0 + diff --git a/recipes/perl/perl/0001-configure_sigs.sh-Use-less-ambiguous-identifier.patch b/recipes/perl/perl/0001-configure_sigs.sh-Use-less-ambiguous-identifier.patch deleted file mode 100644 index 41da9ddd..00000000 --- a/recipes/perl/perl/0001-configure_sigs.sh-Use-less-ambiguous-identifier.patch +++ /dev/null @@ -1,40 +0,0 @@ -From eaabd91ea030d52932d2d53d3da17cd0bc03a118 Mon Sep 17 00:00:00 2001 -From: Adam Lackorzynski -Date: Fri, 31 Oct 2025 11:51:39 +0100 -Subject: [PATCH] configure_sigs.sh: Use less ambiguous identifier - -'number' might be used in the included header file(s) which then defeats -the grep for the number. Thus use the less ambiguous identifier to avoid -those type of clashes. - -Signed-off-by: Adam Lackorzynski ---- - cnf/configure_sigs.sh | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/cnf/configure_sigs.sh b/cnf/configure_sigs.sh -index d0d1b46..7c07846 100644 ---- a/cnf/configure_sigs.sh -+++ b/cnf/configure_sigs.sh -@@ -18,15 +18,15 @@ for sig in HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1\ - - # OH SHI-- - try_add "#if SIG$sig == 0" -- try_add "number 0" -+ try_add "perl_cross_configure_sig_number 0" - for num in `seq 1 100`; do - try_add "#elif SIG$sig == $num" -- try_add "number $num" -+ try_add "perl_cross_configure_sig_number $num" - done - try_add "#endif" - - if try_preproc; then -- num=`grep 'number ' try.out | sed -e 's/[^0-9]//g'` -+ num=`grep 'perl_cross_configure_sig_number ' try.out | sed -e 's/[^0-9]//g'` - if [ -n "$num" -a "$num" != 0 ]; then - msg " got SIG$sig = $num" >&2 - signals="$signals $sig" --- -2.51.0 - diff --git a/recipes/perl/perl/0002-configure-detect-musl-setlocale-LC_ALL-format.patch b/recipes/perl/perl/0002-configure-detect-musl-setlocale-LC_ALL-format.patch new file mode 100644 index 00000000..a20e8979 --- /dev/null +++ b/recipes/perl/perl/0002-configure-detect-musl-setlocale-LC_ALL-format.patch @@ -0,0 +1,65 @@ +From: Adam Lackorzynski +Subject: [PATCH] configure: detect musl's setlocale(LC_ALL) format + +perl-cross hardcodes the glibc format of the string that +setlocale(LC_ALL, NULL) returns for mixed locales, i.e. name=value pairs +like "LC_CTYPE=C.UTF-8;LC_NUMERIC=C;...". musl instead returns the +category names positionally, separated by ';', in the order of the LC_* +constants: "C.UTF-8;C;C;C;C;C". Perl's native Configure detects this by +running a probe, which is not possible when cross compiling. + +With the wrong setting, perl panics on musl as soon as the locale +categories differ, which is the default there (LC_CTYPE is C.UTF-8): + + locale.c: 1484: panic: 'C.UTF-8;C;C;C;C;C' needs an '=' to split name=value + ; errno=0 + Called by locale.c: 4101 + +musl has no identifying macro, so check at compile time for a libc that +is neither glibc nor uclibc and has musl's category layout, and configure +the positional format for it. + +--- + cnf/configure_misc.sh | 31 ++++++++++++++++++++++++++----- + 1 file changed, 26 insertions(+), 5 deletions(-) + +--- a/cnf/configure_misc.sh ++++ b/cnf/configure_misc.sh +@@ -240,11 +240,32 @@ + define stdio_stream_array + define d_lc_monetary_2008 'undef' + +-define d_perl_lc_all_uses_name_value_pairs 'define' +-define d_perl_lc_all_category_positions_init 'undef' +-define d_perl_lc_all_separator 'undef' +-define perl_lc_all_separator '' +-define perl_lc_all_category_positions_init '' ++# The format of setlocale(LC_ALL, NULL) for mixed locales cannot be probed ++# by running code when cross compiling. glibc returns name=value pairs, ++# musl the six category names positionally, separated by ';', in the order ++# of the LC_* constants. musl has no identifying macro, so check for a ++# non-glibc libc with musl's category layout. ++mstart "Checking setlocale(LC_ALL) format" ++try_start ++try_includes locale.h ++try_add '#if defined(__GLIBC__) || defined(__UCLIBC__) || LC_ALL != 6 || LC_MESSAGES != 5' ++try_add '#error not musl' ++try_add '#endif' ++if try_compile; then ++ result 'positional (musl)' ++ define d_perl_lc_all_uses_name_value_pairs 'undef' ++ define d_perl_lc_all_category_positions_init 'define' ++ define d_perl_lc_all_separator 'define' ++ define perl_lc_all_separator '";"' ++ define perl_lc_all_category_positions_init '{ 0, 1, 2, 3, 4, 5 }' ++else ++ result 'name=value pairs' ++ define d_perl_lc_all_uses_name_value_pairs 'define' ++ define d_perl_lc_all_category_positions_init 'undef' ++ define d_perl_lc_all_separator 'undef' ++ define perl_lc_all_separator '' ++ define perl_lc_all_category_positions_init '' ++fi + + define sharpbang '#!' + define startperl "$sharpbang$perlpath"