From c5b97d4d967fde1e090b90b547500abaa40cc925 Mon Sep 17 00:00:00 2001
From: Esaaprilia Salsabila <esaapriliasalsabila@gmail.com>
Date: Tue, 18 Jun 2024 07:43:33 +0800
Subject: [PATCH] perl: update version 5.40.0

https://metacpan.org/release/HAARG/perl-5.40.0

remove bytes_heavy.pl
Perl/perl5#22047

perl update version 5.40.0

Signed-off-by: Esaaprilia Salsabila <esaapriliasalsabila@gmail.com>
---
 lang/perl/Makefile                            |   6 +-
 lang/perl/files/base.config                   |   3 +
 lang/perl/files/version.config                |   6 +-
 lang/perl/patches/010-musl-compat.patch       |   2 +-
 .../patches/120-remove-build-timestamp.patch  |   2 +-
 lang/perl/patches/900-use-rm-force.patch      |  46 +-
 .../patches/910-miniperl-needs-inc-dot.patch  |   6 +-
 ...06-adjust-dependency-paths-on-instal.patch |   2 +-
 ...ixup-regex-engine-build-under-Uusedl.patch | 541 ------------------
 lang/perl/perlbase.mk                         |   2 +-
 lang/perl/perlver.mk                          |   2 +-
 11 files changed, 40 insertions(+), 578 deletions(-)
 delete mode 100644 lang/perl/patches/999-fixup-regex-engine-build-under-Uusedl.patch

diff --git a/lang/perl/Makefile b/lang/perl/Makefile
index 6ca116161c..2d1bcc24c1 100644
--- a/lang/perl/Makefile
+++ b/lang/perl/Makefile
@@ -11,11 +11,11 @@ include perlver.mk
 
 PKG_NAME:=perl
 PKG_VERSION:=$(PERL_VERSION)
-PKG_RELEASE:=3
+PKG_RELEASE:=1
 
 PKG_SOURCE_URL:=https://www.cpan.org/src/5.0
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_HASH:=d91115e90b896520e83d4de6b52f8254ef2b70a8d545ffab33200ea9f1cf29e8
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_HASH:=c740348f357396327a9795d3e8323bafd0fe8a5c7835fc1cbaba0cc8dfe7161f
 
 PKG_LICENSE:=GPL-1.0-or-later Artistic-1.0-Perl
 PKG_LICENSE_FILES:=Copying Artistic README
diff --git a/lang/perl/files/base.config b/lang/perl/files/base.config
index 67232b6d83..5a9294477f 100644
--- a/lang/perl/files/base.config
+++ b/lang/perl/files/base.config
@@ -378,6 +378,9 @@ d_open3='define'
 d_openat='define'
 d_pathconf='define'
 d_pause='define'
+d_perl_lc_all_category_positions_init='undef'
+d_perl_lc_all_separator='undef'
+d_perl_lc_all_uses_name_value_pairs='define'
 d_perl_otherlibdirs='undef'
 d_phostname='undef'
 d_pipe='define'
diff --git a/lang/perl/files/version.config b/lang/perl/files/version.config
index 1c0e7718cd..04b324bc10 100644
--- a/lang/perl/files/version.config
+++ b/lang/perl/files/version.config
@@ -1,11 +1,11 @@
 # Set the version here
 PERL_REVISION=5
-PERL_VERSION=38
-PERL_SUBVERSION=2
+PERL_VERSION=40
+PERL_SUBVERSION=0
 
 # (api_revison, api_version, api_subversion) = (revision, version, 0) usually
 PERL_API_REVISION=5
-PERL_API_VERSION=38
+PERL_API_VERSION=40
 PERL_API_SUBVERSION=0
 
 dynamic_ext='attributes B Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd Data/Dumper DB_File Devel/Peek Devel/PPPort Digest/MD5 Digest/SHA Encode Fcntl File/DosGlob File/Glob Filter/Util/Call GDBM_File Hash/Util Hash/Util/FieldHash I18N/Langinfo IO IPC/SysV List/Util Math/BigInt/FastCalc MIME/Base64 mro Opcode PerlIO/encoding PerlIO/mmap PerlIO/scalar PerlIO/via POSIX re SDBM_File Socket Storable Sys/Hostname Sys/Syslog threads threads/shared Time/HiRes Time/Piece Unicode/Collate Unicode/Normalize XS/APItest XS/Typemap'
diff --git a/lang/perl/patches/010-musl-compat.patch b/lang/perl/patches/010-musl-compat.patch
index e38a05be8d..435bf8c447 100644
--- a/lang/perl/patches/010-musl-compat.patch
+++ b/lang/perl/patches/010-musl-compat.patch
@@ -1,6 +1,6 @@
 --- a/perl.c
 +++ b/perl.c
-@@ -317,7 +317,7 @@ perl_construct(pTHXx)
+@@ -318,7 +318,7 @@ perl_construct(pTHXx)
      PL_localpatches = local_patches;	/* For possible -v */
  #endif
  
diff --git a/lang/perl/patches/120-remove-build-timestamp.patch b/lang/perl/patches/120-remove-build-timestamp.patch
index ae044c8f16..fabb56cc65 100644
--- a/lang/perl/patches/120-remove-build-timestamp.patch
+++ b/lang/perl/patches/120-remove-build-timestamp.patch
@@ -1,6 +1,6 @@
 --- a/perl.c
 +++ b/perl.c
-@@ -2098,16 +2098,6 @@ S_Internals_V(pTHX_ CV *cv)
+@@ -2092,16 +2092,6 @@ S_Internals_V(pTHX_ CV *cv)
      PUSHs(Perl_newSVpvn_flags(aTHX_ non_bincompat_options,
                                sizeof(non_bincompat_options) - 1, SVs_TEMP));
  
diff --git a/lang/perl/patches/900-use-rm-force.patch b/lang/perl/patches/900-use-rm-force.patch
index 09967bebd6..9e44f5402f 100644
--- a/lang/perl/patches/900-use-rm-force.patch
+++ b/lang/perl/patches/900-use-rm-force.patch
@@ -8,7 +8,7 @@
  ranlib = $ranlib
  ECHO = $echo
  
-@@ -786,7 +787,7 @@ bitcount.h: generate_uudmap$(HOST_EXE_EX
+@@ -791,7 +792,7 @@ bitcount.h: generate_uudmap$(HOST_EXE_EX
  	./generate_uudmap$(HOST_EXE_EXT) $(generated_headers)
  
  generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT)
@@ -17,7 +17,7 @@
  	$(LNS) $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT)
  
  !NO!SUBS!
-@@ -891,26 +892,26 @@ mydtrace.h: $(DTRACE_H)
+@@ -896,26 +897,26 @@ mydtrace.h: $(DTRACE_H)
  	define)
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  $(DTRACE_MINI_O): perldtrace.d $(miniperl_objs_nodt)
@@ -48,7 +48,7 @@
  
  !NO!SUBS!
  		;;
-@@ -921,13 +922,13 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOAD
+@@ -926,13 +927,13 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOAD
  	case "$useshrplib" in
  	true)
  		$spitshell >>$Makefile <<'!NO!SUBS!'
@@ -64,7 +64,7 @@
  	mv $@ libperl$(OBJ_EXT)
  	$(AR) qv $(LIBPERL) libperl$(OBJ_EXT)
  !NO!SUBS!
-@@ -936,7 +937,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOAD
+@@ -941,7 +942,7 @@ $(LIBPERL): $& $(perllib_dep) $(DYNALOAD
  		;;
  	*)
  		$spitshell >>$Makefile <<'!NO!SUBS!'
@@ -73,7 +73,7 @@
  	$(AR) rc $(LIBPERL) $(perllib_objs) $(DYNALOADER)
  	@$(ranlib) $(LIBPERL)
  !NO!SUBS!
-@@ -970,7 +971,7 @@ $(MINIPERL_EXE): lib/buildcustomize.pl
+@@ -975,7 +976,7 @@ $(MINIPERL_EXE): lib/buildcustomize.pl
  	amigaos*)
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
@@ -82,7 +82,7 @@
  	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
  	    $(miniperl_objs) $(libs)
  #	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
-@@ -992,7 +993,7 @@ NAMESPACEFLAGS = -force_flat_namespace
+@@ -997,7 +998,7 @@ NAMESPACEFLAGS = -force_flat_namespace
  		esac
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
@@ -91,7 +91,7 @@
  	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
  	    $(miniperl_objs) $(libs)
  	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
-@@ -1003,8 +1004,8 @@ lib/buildcustomize.pl: $& $(miniperl_obj
+@@ -1008,8 +1009,8 @@ lib/buildcustomize.pl: $& $(miniperl_obj
  		if test "X$hostperl" != X; then
  			$spitshell >>$Makefile <<!GROK!THIS!
  lib/buildcustomize.pl: \$& \$(miniperl_dep) write_buildcustomize.pl
@@ -102,7 +102,7 @@
  	\$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE)
  	\$(LDLIBPTH) ./miniperl\$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
  	\$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname"
-@@ -1012,7 +1013,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_d
+@@ -1017,7 +1018,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_d
  		else
  			$spitshell >>$Makefile <<'!NO!SUBS!'
  lib/buildcustomize.pl: $& $(miniperl_dep) write_buildcustomize.pl
@@ -111,7 +111,7 @@
  	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
  	    $(miniperl_objs) $(libs)
  	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
-@@ -1025,7 +1026,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep
+@@ -1030,7 +1031,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep
  	$spitshell >>$Makefile <<'!NO!SUBS!'
  
  $(PERL_EXE): $& $(perlmain_dep) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl
@@ -120,8 +120,8 @@
  !NO!SUBS!
  
          case "$osname" in
-@@ -1133,8 +1134,8 @@ pod/perl5382delta.pod: pod/perldelta.pod
- 	$(LNS) perldelta.pod pod/perl5382delta.pod
+@@ -1130,8 +1131,8 @@ pod/perl5400delta.pod: pod/perldelta.pod
+ 	$(LNS) perldelta.pod pod/perl5400delta.pod
  
  extra.pods: $(MINIPERL_EXE)
 -	-@test ! -f extra.pods || rm -f `cat extra.pods`
@@ -131,7 +131,7 @@
  	-@for x in `grep -l '^=[a-z]' README.* | grep -v README.vms` ; do \
  	    nx=`echo $$x | sed -e "s/README\.//"`; \
  	    $(LNS) ../$$x "pod/perl"$$nx".pod" ; \
-@@ -1334,11 +1335,11 @@ realclean:	_realcleaner _mopup
+@@ -1330,11 +1331,11 @@ realclean:	_realcleaner _mopup
  	@echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh"
  
  _clobber:
@@ -148,7 +148,7 @@
  
  clobber:	_realcleaner _mopup _clobber
  
-@@ -1346,24 +1347,24 @@ distclean:	clobber
+@@ -1342,24 +1343,24 @@ distclean:	clobber
  
  # Like distclean but also removes emacs backups and *.orig.
  veryclean:	_verycleaner _mopup _clobber
@@ -167,7 +167,7 @@
 -	-rm -f perl.export perl.dll perl.libexp perl.map perl.def
 -	-rm -f *perl.xok
 -	-rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
--	-rm -f $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.* microperl
+-	-rm -f $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.*
 -	-rm -f config.arch config.over $(DTRACE_H)
 +	-@test -f extra.pods && $(RMS) `cat extra.pods`
 +	-@test -f vms/README_vms.pod && $(RMS) vms/README_vms.pod
@@ -175,7 +175,7 @@
 +	$(RMS) perl.export perl.dll perl.libexp perl.map perl.def
 +	$(RMS) *perl.xok
 +	$(RMS) cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
-+	$(RMS) $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.* microperl
++	$(RMS) $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.*
 +	$(RMS) config.arch config.over $(DTRACE_H)
  
  _cleaner1:
@@ -184,7 +184,7 @@
  	-cd pod; $(LDLIBPTH) $(MAKE) $(CLEAN)
  	-cd utils; $(LDLIBPTH) $(MAKE) $(CLEAN)
  	-@if test -f $(MINIPERL_EXE) ; then \
-@@ -1373,8 +1374,8 @@ _cleaner1:
+@@ -1369,8 +1370,8 @@ _cleaner1:
  	else \
  	sh $(CLEAN).sh ; \
  	fi
@@ -195,7 +195,7 @@
  
  # Dear POSIX, thanks for making the default to xargs to be
  # run once if nothing is passed in. It is such a great help.
-@@ -1389,24 +1390,24 @@ _cleaner1:
+@@ -1385,24 +1386,24 @@ _cleaner1:
  # Add new rules before that line - the next line (rm -f so_locations ...) is
  # used as a placeholder by a regen script.
  _cleaner2:
@@ -237,7 +237,7 @@
  	-rmdir lib/version lib/threads lib/inc/ExtUtils lib/inc lib/encoding
  	-rmdir lib/autodie/exception lib/autodie/Scope lib/autodie lib/XS
  	-rmdir lib/Win32API lib/VMS lib/Unicode/Collate/Locale
-@@ -1457,11 +1458,11 @@ _realcleaner:
+@@ -1459,11 +1460,11 @@ _realcleaner:
  _verycleaner:
  	@$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=veryclean
  	@$(LDLIBPTH) $(MAKE) _cleaner2
@@ -251,7 +251,7 @@
  	lint $(lintflags) -DPERL_CORE -D_REENTRANT -DDEBUGGING -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(c)
  
  cscopeflags = -Rb  # Recursive, build-only.
-@@ -1522,7 +1523,7 @@ case "$targethost" in
+@@ -1524,7 +1525,7 @@ case "$targethost" in
  '') $spitshell >>$Makefile <<'!NO!SUBS!'
  test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \
  	$(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods) common_build
@@ -260,7 +260,7 @@
  
  !NO!SUBS!
  ;;
-@@ -1572,7 +1573,7 @@ test_prep test-prep: test_prep_pre \$(MI
+@@ -1574,7 +1575,7 @@ test_prep test-prep: test_prep_pre \$(MI
  	$to config.sh
  # --- For lib/diagnostics.t with -Duseshrplib
  	$to \$(PERL_EXE)
@@ -269,16 +269,16 @@
  	$to t/\$(PERL_EXE)
  
  !GROK!THIS!
-@@ -1582,7 +1583,7 @@ esac
+@@ -1592,7 +1593,7 @@ else
  $spitshell >>$Makefile <<'!NO!SUBS!'
  test_prep_reonly: $(MINIPERL_EXE) $(PERL_EXE) $(dynamic_ext_re) $(TEST_PERL_DLL)
  	$(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic
 -	cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
 +	cd t && ($(RMS) $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
  !NO!SUBS!
+ fi
  
- case "$targethost" in
-@@ -1637,7 +1638,7 @@ minitest_prep: $(MINIPERL_EXE)
+@@ -1648,7 +1649,7 @@ minitest_prep: $(MINIPERL_EXE)
  	@echo "You may see some irrelevant test failures if you have been unable"
  	@echo "to build lib/Config.pm, or the Unicode data files."
  	@echo " "
diff --git a/lang/perl/patches/910-miniperl-needs-inc-dot.patch b/lang/perl/patches/910-miniperl-needs-inc-dot.patch
index 6589926bc5..6997f04d57 100644
--- a/lang/perl/patches/910-miniperl-needs-inc-dot.patch
+++ b/lang/perl/patches/910-miniperl-needs-inc-dot.patch
@@ -9,7 +9,7 @@
  
  # Macros to invoke sort the MANIFEST during build
  MANIFEST_SRT = MANIFEST.srt
-@@ -996,7 +996,7 @@ lib/buildcustomize.pl: $& $(miniperl_obj
+@@ -1001,7 +1001,7 @@ lib/buildcustomize.pl: $& $(miniperl_obj
  	@$(RMS) miniperl.xok
  	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
  	    $(miniperl_objs) $(libs)
@@ -18,7 +18,7 @@
  	$(MINIPERL) -f write_buildcustomize.pl
  !NO!SUBS!
  		;;
-@@ -1007,7 +1007,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_d
+@@ -1012,7 +1012,7 @@ lib/buildcustomize.pl: \$& \$(miniperl_d
  	@\$(RMS) miniperl.xok
  	@\$(RMS) \$(MINIPERL_EXE)
  	\$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE)
@@ -27,7 +27,7 @@
  	\$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname"
  !GROK!THIS!
  		else
-@@ -1016,7 +1016,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep
+@@ -1021,7 +1021,7 @@ lib/buildcustomize.pl: $& $(miniperl_dep
  	@$(RMS) miniperl.xok
  	$(CC) $(CLDFLAGS) -o $(MINIPERL_EXE) \
  	    $(miniperl_objs) $(libs)
diff --git a/lang/perl/patches/920-Revert-perl-127606-adjust-dependency-paths-on-instal.patch b/lang/perl/patches/920-Revert-perl-127606-adjust-dependency-paths-on-instal.patch
index cff268c3c0..e9e5688e47 100644
--- a/lang/perl/patches/920-Revert-perl-127606-adjust-dependency-paths-on-instal.patch
+++ b/lang/perl/patches/920-Revert-perl-127606-adjust-dependency-paths-on-instal.patch
@@ -45,7 +45,7 @@ Signed-off-by: Georgi Valkov <gvalkov@gmail.com>
  $spitshell >>$Makefile <<!GROK!THIS!
  # Macros to invoke a copy of our fully operational perl during the build.
  PERL_EXE = perl\$(EXE_EXT)
-@@ -1040,20 +1024,6 @@ $(PERL_EXE): $& $(perlmain_dep) $(LIBPER
+@@ -1045,20 +1029,6 @@ $(PERL_EXE): $& $(perlmain_dep) $(LIBPER
  	$(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) $(perlmain_objs) $(LLIBPERL) $(static_ext) `cat ext.libs` $(libs)
  !NO!SUBS!
          ;;
diff --git a/lang/perl/patches/999-fixup-regex-engine-build-under-Uusedl.patch b/lang/perl/patches/999-fixup-regex-engine-build-under-Uusedl.patch
deleted file mode 100644
index 99cc13b9a2..0000000000
--- a/lang/perl/patches/999-fixup-regex-engine-build-under-Uusedl.patch
+++ /dev/null
@@ -1,541 +0,0 @@
-From ba6e2c38aafc23cf114f3ba0d0ff3baead34328b Mon Sep 17 00:00:00 2001
-From: Yves Orton <demerphq@gmail.com>
-Date: Tue, 1 Aug 2023 23:12:46 +0200
-Subject: [PATCH] regcomp*.c, regexec.c - fixup regex engine build under
- -Uusedl
-
-The regex engine is built a bit different from most of the perl
-codebase. It is compiled as part of the main libperl.so and it is
-also compiled (with DEBUGGING enabled) as part of the re extension.
-When perl itself is compiled with DEBUGGING enabled then the code
-in the re.so extension and the code in libperl.so is the same.
-
-This all works fine and dandy until you have a static build where the
-re.so is linked into libperl.so, which results in duplicate symbols
-being defined. These symbols come in two flaviours: "auxiliary" and
-"debugging" related symbols.
-
-We have basically three cases:
-
-1. USE_DYNAMIC_LOADING is defined. In this case we are doing a dynamic
-   build and re.so will be separate from libperl.so, so it even if this
-   is a DEBUGGING enabled build debug and auxiliary functions can be
-   compiled into *both* re.so and libperl.so. This is basically the
-   "standard build".
-
-2. USE_DYNAMIC_LOADING is not defined, and DEBUGGING is not defined
-   either. In this case auxiliary functions should only be compiled in
-   libperl.so, and the debug functions should only be compiled into
-   re.so
-
-3. USE_DYNAMIC_LOADING is not defined, and DEBUGGING *is* defined. In
-   this case auxiliary functions AND debug functions should only be
-   compiled into libperl.so
-
-It is possible to detect the different build options by looking at the
-defines 'USE_DYNAMIC_LOADING', 'PERL_EXT_RE_DEBUG' and
-'DEBUGGING_RE_ONLY'. 'USE_DYNAMIC_LOADING' is NOT defined when we are
-building a static perl. 'PERL_EXT_RE_DEBUG' is defined only when we are
-building re.so, and 'DEBUGGING_RE_ONLY' is defined only when we are
-building re.so in a perl that is not itself already a DEBUGGING enabled
-perl. The file ext/re/re_top.h responsible for setting up
-DEBUGGING_RE_ONLY.
-
-This patch uses 'PERL_EXT_RE_DEBUG', 'DEBUGGING_RE_ONLY' and
-'USE_DYNAMIC_LOADING' to define in regcomp.h two further define flags
-'PERL_RE_BUILD_DEBUG' and 'PERL_RE_BUILD_AUX'.
-
-The 'PERL_RE_BUILD_DEBUG' flag determines if the debugging functions
-should be compiled into libperl.so or re.so or both. The
-'PERL_RE_BUILD_AUX' flag determines if the auxiliary functions should be
-compiled into just libperl.so or into it and re.so. We then use these
-flags to guard the different types of functions so that we can build in
-all three modes without duplicate symbols.
----
- regcomp.c         |  13 +-
- regcomp.h         |  14 ++-
- regcomp_debug.c   | 308 +++++++++++++++++++++++-----------------------
- regcomp_invlist.c |   3 +-
- regexec.c         |   3 +-
- 5 files changed, 181 insertions(+), 160 deletions(-)
-
---- a/regcomp.c
-+++ b/regcomp.c
-@@ -290,6 +290,7 @@ S_edit_distance(const UV* src,
- /* END of edit_distance() stuff
-  * ========================================================= */
- 
-+#ifdef PERL_RE_BUILD_AUX
- /* add a data member to the struct reg_data attached to this regex, it should
-  * always return a non-zero return. the 's' argument is the type of the items
-  * being added and the n is the number of items. The length of 's' should match
-@@ -340,6 +341,7 @@ Perl_reg_add_data(RExC_state_t* const pR
-     assert(count>0);
-     return count;
- }
-+#endif /* PERL_RE_BUILD_AUX */
- 
- /*XXX: todo make this not included in a non debugging perl, but appears to be
-  * used anyway there, in 'use re' */
-@@ -7443,6 +7445,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_stat
- }
- 
- 
-+#ifdef PERL_RE_BUILD_AUX
- void
- Perl_populate_anyof_bitmap_from_invlist(pTHX_ regnode *node, SV** invlist_ptr)
- {
-@@ -7502,6 +7505,7 @@ Perl_populate_anyof_bitmap_from_invlist(
-         }
-     }
- }
-+#endif /* PERL_RE_BUILD_AUX */
- 
- /* Parse POSIX character classes: [[:foo:]], [[=foo=]], [[.foo.]].
-    Character classes ([:foo:]) can also be negated ([:^foo:]).
-@@ -9095,6 +9099,7 @@ S_dump_regex_sets_structures(pTHX_ RExC_
- #undef IS_OPERATOR
- #undef IS_OPERAND
- 
-+#ifdef PERL_RE_BUILD_AUX
- void
- Perl_add_above_Latin1_folds(pTHX_ RExC_state_t *pRExC_state, const U8 cp, SV** invlist)
- {
-@@ -9182,6 +9187,8 @@ Perl_add_above_Latin1_folds(pTHX_ RExC_s
-          }
-     }
- }
-+#endif /* PERL_RE_BUILD_AUX */
-+
- 
- STATIC void
- S_output_posix_warnings(pTHX_ RExC_state_t *pRExC_state, AV* posix_warnings)
-@@ -12105,6 +12112,7 @@ S_optimize_regclass(pTHX_
- 
- #undef HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION
- 
-+#ifdef PERL_RE_BUILD_AUX
- void
- Perl_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state,
-                 regnode* const node,
-@@ -12261,6 +12269,7 @@ Perl_set_ANYOF_arg(pTHX_ RExC_state_t* c
-     RExC_rxi->data->data[n] = (void*)rv;
-     ARG1u_SET(node, n);
- }
-+#endif /* PERL_RE_BUILD_AUX */
- 
- SV *
- 
-@@ -12999,6 +13008,8 @@ S_regtail_study(pTHX_ RExC_state_t *pREx
- }
- #endif
- 
-+
-+#ifdef PERL_RE_BUILD_AUX
- SV*
- Perl_get_ANYOFM_contents(pTHX_ const regnode * n) {
- 
-@@ -13047,7 +13058,7 @@ Perl_get_ANYOFHbbm_contents(pTHX_ const
-                                       UTF_CONTINUATION_MARK | 0));
-     return cp_list;
- }
--
-+#endif /* PERL_RE_BUILD_AUX */
- 
- 
- SV *
---- a/regcomp.h
-+++ b/regcomp.h
-@@ -1554,7 +1554,19 @@ typedef enum {
- #define EVAL_OPTIMISTIC_FLAG    128
- #define EVAL_FLAGS_MASK         (EVAL_OPTIMISTIC_FLAG-1)
- 
--
-+/* We define PERL_RE_BUILD_DEBUG if we are NOT compiling the re extension and
-+ * we are under DEBUGGING, or if we are ARE compiling the re extension
-+ * and this is not a DEBUGGING enabled build (identified by
-+ * DEBUGGING_RE_ONLY being defined)
-+ */
-+#if ( defined(USE_DYNAMIC_LOADING) && defined(DEBUGGING)) || \
-+    ( defined(PERL_EXT_RE_BUILD) && defined(DEBUGGING_RE_ONLY)) || \
-+    (!defined(PERL_EXT_RE_BUILD) && defined(DEBUGGING))
-+#define PERL_RE_BUILD_DEBUG
-+#endif
-+#if ( defined(USE_DYNAMIC_LOADING) || !defined(PERL_EXT_RE_BUILD) )
-+#define PERL_RE_BUILD_AUX
-+#endif
- 
- #endif /* PERL_REGCOMP_H_ */
- 
---- a/regcomp_debug.c
-+++ b/regcomp_debug.c
-@@ -18,8 +18,7 @@
- #include "unicode_constants.h"
- #include "regcomp_internal.h"
- 
--#ifdef DEBUGGING
--
-+#ifdef PERL_RE_BUILD_DEBUG
- int
- Perl_re_printf(pTHX_ const char *fmt, ...)
- {
-@@ -159,13 +158,160 @@ Perl_debug_peep(pTHX_ const char *str, c
-    });
- }
- 
--#endif /* DEBUGGING */
-+const regnode *
-+Perl_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
-+            const regnode *last, const regnode *plast,
-+            SV* sv, I32 indent, U32 depth)
-+{
-+    const regnode *next;
-+    const regnode *optstart= NULL;
-+
-+    RXi_GET_DECL(r, ri);
-+    DECLARE_AND_GET_RE_DEBUG_FLAGS;
-+
-+    PERL_ARGS_ASSERT_DUMPUNTIL;
-+
-+#ifdef DEBUG_DUMPUNTIL
-+    Perl_re_printf( aTHX_  "--- %d : %d - %d - %d\n", indent, node-start,
-+        last ? last-start : 0, plast ? plast-start : 0);
-+#endif
-+
-+    if (plast && plast < last)
-+        last= plast;
-+
-+    while (node && (!last || node < last)) {
-+        const U8 op = OP(node);
-+
-+        if (op == CLOSE || op == SRCLOSE || op == WHILEM)
-+            indent--;
-+        next = regnext((regnode *)node);
-+        const regnode *after = regnode_after((regnode *)node,0);
-+
-+        /* Where, what. */
-+        if (op == OPTIMIZED) {
-+            if (!optstart && RE_DEBUG_FLAG(RE_DEBUG_COMPILE_OPTIMISE))
-+                optstart = node;
-+            else
-+                goto after_print;
-+        } else
-+            CLEAR_OPTSTART;
-+
-+        regprop(r, sv, node, NULL, NULL);
-+        Perl_re_printf( aTHX_  "%4" IVdf ":%*s%s", (IV)(node - start),
-+                      (int)(2*indent + 1), "", SvPVX_const(sv));
-+
-+        if (op != OPTIMIZED) {
-+            if (next == NULL)           /* Next ptr. */
-+                Perl_re_printf( aTHX_  " (0)");
-+            else if (REGNODE_TYPE(op) == BRANCH
-+                     && REGNODE_TYPE(OP(next)) != BRANCH )
-+                Perl_re_printf( aTHX_  " (FAIL)");
-+            else
-+                Perl_re_printf( aTHX_  " (%" IVdf ")", (IV)(next - start));
-+            Perl_re_printf( aTHX_ "\n");
-+        }
-+
-+      after_print:
-+        if (REGNODE_TYPE(op) == BRANCHJ) {
-+            assert(next);
-+            const regnode *nnode = (OP(next) == LONGJMP
-+                                   ? regnext((regnode *)next)
-+                                   : next);
-+            if (last && nnode > last)
-+                nnode = last;
-+            DUMPUNTIL(after, nnode);
-+        }
-+        else if (REGNODE_TYPE(op) == BRANCH) {
-+            assert(next);
-+            DUMPUNTIL(after, next);
-+        }
-+        else if ( REGNODE_TYPE(op)  == TRIE ) {
-+            const regnode *this_trie = node;
-+            const U32 n = ARG1u(node);
-+            const reg_ac_data * const ac = op>=AHOCORASICK ?
-+               (reg_ac_data *)ri->data->data[n] :
-+               NULL;
-+            const reg_trie_data * const trie =
-+                (reg_trie_data*)ri->data->data[op<AHOCORASICK ? n : ac->trie];
-+#ifdef DEBUGGING
-+            AV *const trie_words
-+                           = MUTABLE_AV(ri->data->data[n + TRIE_WORDS_OFFSET]);
-+#endif
-+            const regnode *nextbranch= NULL;
-+            I32 word_idx;
-+            SvPVCLEAR(sv);
-+            for (word_idx= 0; word_idx < (I32)trie->wordcount; word_idx++) {
-+                SV ** const elem_ptr = av_fetch_simple(trie_words, word_idx, 0);
-+
-+                Perl_re_indentf( aTHX_  "%s ",
-+                    indent+3,
-+                    elem_ptr
-+                    ? pv_pretty(sv, SvPV_nolen_const(*elem_ptr),
-+                                SvCUR(*elem_ptr), PL_dump_re_max_len,
-+                                PL_colors[0], PL_colors[1],
-+                                (SvUTF8(*elem_ptr)
-+                                 ? PERL_PV_ESCAPE_UNI
-+                                 : 0)
-+                                | PERL_PV_PRETTY_ELLIPSES
-+                                | PERL_PV_PRETTY_LTGT
-+                            )
-+                    : "???"
-+                );
-+                if (trie->jump) {
-+                    U16 dist= trie->jump[word_idx+1];
-+                    Perl_re_printf( aTHX_  "(%" UVuf ")\n",
-+                               (UV)((dist ? this_trie + dist : next) - start));
-+                    if (dist) {
-+                        if (!nextbranch)
-+                            nextbranch= this_trie + trie->jump[0];
-+                        DUMPUNTIL(this_trie + dist, nextbranch);
-+                    }
-+                    if (nextbranch && REGNODE_TYPE(OP(nextbranch))==BRANCH)
-+                        nextbranch= regnext((regnode *)nextbranch);
-+                } else {
-+                    Perl_re_printf( aTHX_  "\n");
-+                }
-+            }
-+            if (last && next > last)
-+                node= last;
-+            else
-+                node= next;
-+        }
-+        else if ( op == CURLY ) {   /* "next" might be very big: optimizer */
-+            DUMPUNTIL(after, after + 1); /* +1 is NOT a REGNODE_AFTER */
-+        }
-+        else if (REGNODE_TYPE(op) == CURLY && op != CURLYX) {
-+            assert(next);
-+            DUMPUNTIL(after, next);
-+        }
-+        else if ( op == PLUS || op == STAR) {
-+            DUMPUNTIL(after, after + 1); /* +1 NOT a REGNODE_AFTER */
-+        }
-+        else if (REGNODE_TYPE(op) == EXACT || op == ANYOFHs) {
-+            /* Literal string, where present. */
-+            node = (const regnode *)REGNODE_AFTER_varies(node);
-+        }
-+        else {
-+            node = REGNODE_AFTER_opcode(node,op);
-+        }
-+        if (op == CURLYX || op == OPEN || op == SROPEN)
-+            indent++;
-+        if (REGNODE_TYPE(op) == END)
-+            break;
-+    }
-+    CLEAR_OPTSTART;
-+#ifdef DEBUG_DUMPUNTIL
-+    Perl_re_printf( aTHX_  "--- %d\n", (int)indent);
-+#endif
-+    return node;
-+}
-+
-+#endif  /* PERL_RE_BUILD_DEBUG */
- 
- /*
-  - regdump - dump a regexp onto Perl_debug_log in vaguely comprehensible form
-  */
- #ifdef DEBUGGING
--
- static void
- S_regdump_intflags(pTHX_ const char *lead, const U32 flags)
- {
-@@ -907,8 +1053,8 @@ Perl_regprop(pTHX_ const regexp *prog, S
- #endif  /* DEBUGGING */
- }
- 
--#ifdef DEBUGGING
- 
-+#ifdef DEBUGGING
- STATIC void
- S_put_code_point(pTHX_ SV *sv, UV c)
- {
-@@ -1517,154 +1663,4 @@ S_put_charclass_bitmap_innards(pTHX_ SV
- 
-     return did_output_something;
- }
--
--
--const regnode *
--Perl_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
--            const regnode *last, const regnode *plast,
--            SV* sv, I32 indent, U32 depth)
--{
--    const regnode *next;
--    const regnode *optstart= NULL;
--
--    RXi_GET_DECL(r, ri);
--    DECLARE_AND_GET_RE_DEBUG_FLAGS;
--
--    PERL_ARGS_ASSERT_DUMPUNTIL;
--
--#ifdef DEBUG_DUMPUNTIL
--    Perl_re_printf( aTHX_  "--- %d : %d - %d - %d\n", indent, node-start,
--        last ? last-start : 0, plast ? plast-start : 0);
--#endif
--
--    if (plast && plast < last)
--        last= plast;
--
--    while (node && (!last || node < last)) {
--        const U8 op = OP(node);
--
--        if (op == CLOSE || op == SRCLOSE || op == WHILEM)
--            indent--;
--        next = regnext((regnode *)node);
--        const regnode *after = regnode_after((regnode *)node,0);
--
--        /* Where, what. */
--        if (op == OPTIMIZED) {
--            if (!optstart && RE_DEBUG_FLAG(RE_DEBUG_COMPILE_OPTIMISE))
--                optstart = node;
--            else
--                goto after_print;
--        } else
--            CLEAR_OPTSTART;
--
--        regprop(r, sv, node, NULL, NULL);
--        Perl_re_printf( aTHX_  "%4" IVdf ":%*s%s", (IV)(node - start),
--                      (int)(2*indent + 1), "", SvPVX_const(sv));
--
--        if (op != OPTIMIZED) {
--            if (next == NULL)           /* Next ptr. */
--                Perl_re_printf( aTHX_  " (0)");
--            else if (REGNODE_TYPE(op) == BRANCH
--                     && REGNODE_TYPE(OP(next)) != BRANCH )
--                Perl_re_printf( aTHX_  " (FAIL)");
--            else
--                Perl_re_printf( aTHX_  " (%" IVdf ")", (IV)(next - start));
--            Perl_re_printf( aTHX_ "\n");
--        }
--
--      after_print:
--        if (REGNODE_TYPE(op) == BRANCHJ) {
--            assert(next);
--            const regnode *nnode = (OP(next) == LONGJMP
--                                   ? regnext((regnode *)next)
--                                   : next);
--            if (last && nnode > last)
--                nnode = last;
--            DUMPUNTIL(after, nnode);
--        }
--        else if (REGNODE_TYPE(op) == BRANCH) {
--            assert(next);
--            DUMPUNTIL(after, next);
--        }
--        else if ( REGNODE_TYPE(op)  == TRIE ) {
--            const regnode *this_trie = node;
--            const U32 n = ARG1u(node);
--            const reg_ac_data * const ac = op>=AHOCORASICK ?
--               (reg_ac_data *)ri->data->data[n] :
--               NULL;
--            const reg_trie_data * const trie =
--                (reg_trie_data*)ri->data->data[op<AHOCORASICK ? n : ac->trie];
--#ifdef DEBUGGING
--            AV *const trie_words
--                           = MUTABLE_AV(ri->data->data[n + TRIE_WORDS_OFFSET]);
--#endif
--            const regnode *nextbranch= NULL;
--            I32 word_idx;
--            SvPVCLEAR(sv);
--            for (word_idx= 0; word_idx < (I32)trie->wordcount; word_idx++) {
--                SV ** const elem_ptr = av_fetch_simple(trie_words, word_idx, 0);
--
--                Perl_re_indentf( aTHX_  "%s ",
--                    indent+3,
--                    elem_ptr
--                    ? pv_pretty(sv, SvPV_nolen_const(*elem_ptr),
--                                SvCUR(*elem_ptr), PL_dump_re_max_len,
--                                PL_colors[0], PL_colors[1],
--                                (SvUTF8(*elem_ptr)
--                                 ? PERL_PV_ESCAPE_UNI
--                                 : 0)
--                                | PERL_PV_PRETTY_ELLIPSES
--                                | PERL_PV_PRETTY_LTGT
--                            )
--                    : "???"
--                );
--                if (trie->jump) {
--                    U16 dist= trie->jump[word_idx+1];
--                    Perl_re_printf( aTHX_  "(%" UVuf ")\n",
--                               (UV)((dist ? this_trie + dist : next) - start));
--                    if (dist) {
--                        if (!nextbranch)
--                            nextbranch= this_trie + trie->jump[0];
--                        DUMPUNTIL(this_trie + dist, nextbranch);
--                    }
--                    if (nextbranch && REGNODE_TYPE(OP(nextbranch))==BRANCH)
--                        nextbranch= regnext((regnode *)nextbranch);
--                } else {
--                    Perl_re_printf( aTHX_  "\n");
--                }
--            }
--            if (last && next > last)
--                node= last;
--            else
--                node= next;
--        }
--        else if ( op == CURLY ) {   /* "next" might be very big: optimizer */
--            DUMPUNTIL(after, after + 1); /* +1 is NOT a REGNODE_AFTER */
--        }
--        else if (REGNODE_TYPE(op) == CURLY && op != CURLYX) {
--            assert(next);
--            DUMPUNTIL(after, next);
--        }
--        else if ( op == PLUS || op == STAR) {
--            DUMPUNTIL(after, after + 1); /* +1 NOT a REGNODE_AFTER */
--        }
--        else if (REGNODE_TYPE(op) == EXACT || op == ANYOFHs) {
--            /* Literal string, where present. */
--            node = (const regnode *)REGNODE_AFTER_varies(node);
--        }
--        else {
--            node = REGNODE_AFTER_opcode(node,op);
--        }
--        if (op == CURLYX || op == OPEN || op == SROPEN)
--            indent++;
--        if (REGNODE_TYPE(op) == END)
--            break;
--    }
--    CLEAR_OPTSTART;
--#ifdef DEBUG_DUMPUNTIL
--    Perl_re_printf( aTHX_  "--- %d\n", (int)indent);
--#endif
--    return node;
--}
--
--#endif  /* DEBUGGING */
-+#endif /* DEBUGGING */
---- a/regcomp_invlist.c
-+++ b/regcomp_invlist.c
-@@ -18,7 +18,7 @@
- #include "unicode_constants.h"
- #include "regcomp_internal.h"
- 
--
-+#ifdef PERL_RE_BUILD_AUX
- void
- Perl_populate_bitmap_from_invlist(pTHX_ SV * invlist, const UV offset, const U8 * bitmap, const Size_t len)
- {
-@@ -70,6 +70,7 @@ Perl_populate_invlist_from_bitmap(pTHX_
-         }
-     }
- }
-+#endif /* PERL_RE_BUILD_AUX */
- 
- /* This section of code defines the inversion list object and its methods.  The
-  * interfaces are highly subject to change, so as much as possible is static to
---- a/regexec.c
-+++ b/regexec.c
-@@ -4421,7 +4421,8 @@ S_regtry(pTHX_ regmatch_info *reginfo, c
- */
- #define REPORT_CODE_OFF 29
- #define INDENT_CHARS(depth) ((int)(depth) % 20)
--#ifdef DEBUGGING
-+
-+#ifdef PERL_RE_BUILD_DEBUG
- int
- Perl_re_exec_indentf(pTHX_ const char *fmt, U32 depth, ...)
- {
diff --git a/lang/perl/perlbase.mk b/lang/perl/perlbase.mk
index c50fda1b1f..5844bdb74b 100644
--- a/lang/perl/perlbase.mk
+++ b/lang/perl/perlbase.mk
@@ -221,7 +221,7 @@ TITLE:=bytes perl module
 endef
 
 define Package/perlbase-bytes/install
-$(call perlmod/Install,$(1),bytes.pm bytes_heavy.pl,)
+$(call perlmod/Install,$(1),bytes.pm,)
 $(call perlmod/InstallBaseTests,$(1),lib/bytes.t)
 endef
 
diff --git a/lang/perl/perlver.mk b/lang/perl/perlver.mk
index b0acc5d9e1..fd396f7257 100644
--- a/lang/perl/perlver.mk
+++ b/lang/perl/perlver.mk
@@ -1,4 +1,4 @@
-PERL_VERSION:=5.38.2
+PERL_VERSION:=5.40.0
 
 PERL_EXPLODE:=$(subst ., ,$(PERL_VERSION))
 
-- 
2.30.2