summaryrefslogtreecommitdiff
path: root/sys-devel/flex
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-02-20 20:21:39 +0000
committerV3n3RiX <venerix@koprulu.sector>2023-02-20 20:21:39 +0000
commitdd03974882f85ca04e35cfbc97f7ff756f5d5c20 (patch)
tree4fabcc91c51083e19657dd0a557043e74468106e /sys-devel/flex
parentd542bd2ef95af892c7ef62be1489b0288b1df9e3 (diff)
gentoo auto-resync : 20:02:2023 - 20:21:39
Diffstat (limited to 'sys-devel/flex')
-rw-r--r--sys-devel/flex/Manifest2
-rw-r--r--sys-devel/flex/files/flex-2.6.4-fix-apple-m1-crash-by-explicit-pointer-cast.patch48
-rw-r--r--sys-devel/flex/flex-2.6.4-r6.ebuild101
3 files changed, 151 insertions, 0 deletions
diff --git a/sys-devel/flex/Manifest b/sys-devel/flex/Manifest
index f770c807c82c..b90089b49d03 100644
--- a/sys-devel/flex/Manifest
+++ b/sys-devel/flex/Manifest
@@ -1,6 +1,8 @@
+AUX flex-2.6.4-fix-apple-m1-crash-by-explicit-pointer-cast.patch 1654 BLAKE2B 7d3855e96c9a09b3797da8d19e3f1d9c7882fe06836c476a3bbb1eadc5e078e3b174711b56a661fc15ef162b9428d264efadfbf51fef1bc11cdda8e2d8773e77 SHA512 0beefd98e37bd0eff8a419f6b078faccd98854d0846af7e7d5104bd91b5fa94e3c0ff298590a834446b651ac6e6e2848e5e334fc8184c51fb3975e8935df9e49
AUX flex-2.6.4-fix-build-with-glibc2.26.patch 8623 BLAKE2B 59433c6a35a05633a9e960c3d6a0248e9bf5606ca7b1376df1594b7f42e23f2e06eb04850b4f9f84f88dc820c6a6e8d88e23aee09451392ed494a71e0a147a37 SHA512 7d13f056181b4859c7bd0f3b494f8e684eb46f499004f3e9f8121382adbf59c7bdd0f26b9105e90fdeb3ee09184743859074993012f6144feb2299343ea95f54
AUX flex-2.6.4-libobjdir.patch 770 BLAKE2B 0771af247117123e3efed3e2a0c8a71573c81dc1e8d2e364a887aa49d3bf3a5198042396d1df1e2c0ae196df098241eba0e2b35e953f9a5be3d43d2408a97536 SHA512 76e3a3e19fe9c9b6b3e0fcfea98feb0eaf03fdc683e3695045b3246b57538a52842b455a9aebed87548d2b8ee3e7d34dca5ff355f06648911866b3b621b40f86
DIST flex-2.6.4-autotools-regenerate.patch.xz 282588 BLAKE2B 3995b8b5e354a43b1a4ff72fae76027c904ddb24eb8e5d55fc6fbe81299f48fa70ac3c4a98b9ed39aca8a98190d6db5005cacb96ec1016d413860d84a434dcc0 SHA512 9efd3197fdf7f8435dfbf4dafbe6b99c1fafede0ec364dbeb9cca81711763d693bc5d30fc3b2af038a44f8848577d19dd737e3afe0cd3b08ab79daea64fcdefa
DIST flex-2.6.4.tar.gz 1419096 BLAKE2B c003d4f764f7f4d41e33af7ee28c2af272a9f0aee6ba7c2494ba96722d8d0b18f7a3f745217e9a2cecb43b6863328267a810280670c04464156b3eb3d7ee9d62 SHA512 e9785f3d620a204b7d20222888917dc065c2036cae28667065bf7862dfa1b25235095a12fd04efdbd09bfd17d3452e6b9ef953a8c1137862ff671c97132a082e
EBUILD flex-2.6.4-r5.ebuild 2517 BLAKE2B 25ea227113a5e1eb8d09d68613d4124e5e5bb773cea8eaa201e8f7b04f64606bc1cd27147123e05c62e2179d353e5017ca4f18fd0ff299a5391d1592e1a9c00f SHA512 22597131284228569e9b82dc72b255779fcc926b6d8c83195f960141cd1c84306b9e1d9b12acfa066b21af2d0b59f7dc7e5cc8d173c1f0d25bc59e7c84e1db6c
+EBUILD flex-2.6.4-r6.ebuild 2595 BLAKE2B b7da401dcd10071806589295dc3022afd443a913b6be14bf17f7d7e72b059d611be8b02b2419c8b390df576a38975d12439f01f0a3f6ca4708f3368901b17aca SHA512 403cd179bc6f6f2e1ed2cb68f49992df718c0bc4fe5e0f9ffbbf1bcf012ddb1ffefbb103e0ec44551d93326563e94e1a71140467b172a0753d1c0e12b1458f34
MISC metadata.xml 444 BLAKE2B 28bd0cd35c6ab4386dffdf221e6b43927e47971bea62a0f0395e3cd6725567114675055dc1267ce5ffbd42fe4731a806b4e5666ea6b83ad4bcf4d35b5529ce85 SHA512 53f91d714d7f4401f7d986d743c08a817d794147f9b277d829a4e8065ce91ce00123cd5b42957af60ef9051568a214b7ce791aa8a4baf82a5179859971357d56
diff --git a/sys-devel/flex/files/flex-2.6.4-fix-apple-m1-crash-by-explicit-pointer-cast.patch b/sys-devel/flex/files/flex-2.6.4-fix-apple-m1-crash-by-explicit-pointer-cast.patch
new file mode 100644
index 000000000000..c594262d2cb0
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.6.4-fix-apple-m1-crash-by-explicit-pointer-cast.patch
@@ -0,0 +1,48 @@
+https://github.com/westes/flex/issues/539
+https://github.com/westes/flex/pull/554
+https://bugs.gentoo.org/871324
+
+This is a backported version for applying to v2.6.4
+instead of git.
+
+From cce2df853386d5b5b60445b1204dcca08e9f259e Mon Sep 17 00:00:00 2001
+From: Yifeng Li <tomli@tomli.me>
+Date: Mon, 20 Feb 2023 11:23:52 +0000
+Subject: [PATCH] Fix #539 crash on Apple M1 by casting 0 to (char *)
+ explicitly
+
+Currently, when the NULL-terminated variadic function
+filter_create_ext() is invoked, the value "0" is passed as
+the last argument to act as a terminator. However, this is
+an integer value, which is incompatible with the pointer
+data type expected by filter_create_ext().
+
+This is undefined behavior in C, correct operation is not
+guaranteed. In fact, it causes flex to crash on Apple M1
+when GCC is used - the loop is not terminated when it should,
+instead, it keeps running, corrupting the argument list for
+invoking m4. As a result, it creates the following error:
+
+> flex: fatal internal error, exec of gm4 failed
+
+This commit fixes the problem by explicitly casting the value 0 to
+the correct pointer type (char *).
+
+Signed-off-by: Yifeng Li <tomli@tomli.me>
+---
+ src/main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/main.c b/src/main.c
+index e5eac44fe..5c9086183 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -380,7 +380,7 @@ void check_options (void)
+ }
+ }
+ }
+- filter_create_ext(output_chain, m4, "-P", 0);
++ filter_create_ext(output_chain, m4, "-P", (char *) 0);
+ filter_create_int(output_chain, filter_fix_linedirs, NULL);
+
+ /* For debugging, only run the requested number of filters. */
diff --git a/sys-devel/flex/flex-2.6.4-r6.ebuild b/sys-devel/flex/flex-2.6.4-r6.ebuild
new file mode 100644
index 000000000000..b4d76b9e0b1a
--- /dev/null
+++ b/sys-devel/flex/flex-2.6.4-r6.ebuild
@@ -0,0 +1,101 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic libtool multilib-minimal toolchain-funcs
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="https://github.com/westes/flex"
+SRC_URI="https://github.com/westes/${PN}/releases/download/v${PV}/${P}.tar.gz"
+SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-autotools-regenerate.patch.xz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="nls static test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="sys-devel/m4"
+# We want bison explicitly and not yacc in general, bug #381273
+BDEPEND="
+ ${RDEPEND}
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )
+"
+PDEPEND="app-alternatives/lex"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-libobjdir.patch
+ "${FILESDIR}"/${P}-fix-build-with-glibc2.26.patch
+ "${FILESDIR}"/${P}-fix-apple-m1-crash-by-explicit-pointer-cast.patch
+
+ "${WORKDIR}"/${P}-autotools-regenerate.patch
+)
+
+src_prepare() {
+ default
+
+ # Drop on next release when we can remove ${P}-autotools-regenerate.patch
+ touch configure.ac aclocal.m4 Makefile.in configure src/config.h.in || die
+
+ # Disable running in the tests/ subdir as it has a bunch of built sources
+ # that cannot be made conditional (automake limitation). bug #568842
+ if ! use test ; then
+ sed -i \
+ -e '/^SUBDIRS =/,/^$/{/tests/d}' \
+ Makefile.in || die
+ fi
+
+ # Prefix always needs this
+ elibtoolize
+}
+
+src_configure() {
+ use static && append-ldflags -static
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ # Do not install shared libs, #503522
+ ECONF_SOURCE="${S}" econf \
+ CC_FOR_BUILD="$(tc-getBUILD_CC)" \
+ --disable-shared \
+ $(use_enable nls)
+}
+
+multilib_src_compile() {
+ if multilib_is_native_abi; then
+ default
+ else
+ emake -C src -f Makefile -f - lib <<< 'lib: $(lib_LTLIBRARIES)'
+ fi
+}
+
+multilib_src_test() {
+ multilib_is_native_abi && emake check
+}
+
+multilib_src_install() {
+ if multilib_is_native_abi; then
+ default
+ else
+ emake -C src DESTDIR="${D}" install-libLTLIBRARIES install-includeHEADERS
+ fi
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ dodoc ONEWS
+ find "${ED}" -name '*.la' -type f -delete || die
+ rm "${ED}"/usr/share/doc/${PF}/COPYING || die
+}
+
+pkg_postinst() {
+ # ensure to preserve the symlink before app-alternatives/lex
+ # is installed
+ if [[ ! -h ${EROOT}/usr/bin/lex ]]; then
+ ln -s flex "${EROOT}/usr/bin/lex" || die
+ fi
+}