public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-devel/flex/, sys-devel/flex/files/
@ 2017-03-23 12:20 Lars Wendler
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Wendler @ 2017-03-23 12:20 UTC (permalink / raw
  To: gentoo-commits

commit:     b4f455b89cd6fd4b72ee4ec1626ed7a20bd5f28a
Author:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 23 12:19:46 2017 +0000
Commit:     Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Thu Mar 23 12:20:06 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b4f455b8

sys-devel/flex: Added upstream reentrant patch to fix wine breakage.

See https://bugs.winehq.org/show_bug.cgi?id=42132

Package-Manager: Portage-2.3.5, Repoman-2.3.2

 sys-devel/flex/files/flex-2.6.3-reentrant.patch | 82 ++++++++++++++++++++++++
 sys-devel/flex/flex-2.6.3-r1.ebuild             | 84 +++++++++++++++++++++++++
 2 files changed, 166 insertions(+)

diff --git a/sys-devel/flex/files/flex-2.6.3-reentrant.patch b/sys-devel/flex/files/flex-2.6.3-reentrant.patch
new file mode 100644
index 00000000000..f2f5eb8374b
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.6.3-reentrant.patch
@@ -0,0 +1,82 @@
+From 078b46c69d063aef1715b11348a2871d6036f253 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Sun, 22 Jan 2017 18:34:30 +0100
+Subject: [PATCH] Add more defines in the non-reentrant part.
+
+Fix the reentrant part; don't "#define yyfoo yyfoo" because it breaks
+code that does #ifndef yywrap ..
+---
+ src/flex.skl | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/src/flex.skl b/src/flex.skl
+index 190700f..6a7cde4 100644
+--- a/src/flex.skl
++++ b/src/flex.skl
+@@ -61,11 +61,17 @@ m4_changequote([[, ]])
+ m4_ifelse(M4_YY_PREFIX,yy,,
+ #define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]
+ #define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]
+-#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]
++#define yy_scan_buffer M4_YY_PREFIX[[_scan_buffer]]
++#define yy_scan_string M4_YY_PREFIX[[_scan_string]]
++#define yy_scan_bytes M4_YY_PREFIX[[_scan_bytes]]
+ #define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]
+ #define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]
+ #define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]
+ #define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]
++#define yypush_buffer_state M4_YY_PREFIX[[push_buffer_state]]
++#define yypop_buffer_state M4_YY_PREFIX[[pop_buffer_state]]
++#define yyensure_buffer_stack M4_YY_PREFIX[[ensure_buffer_stack]]
++#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]
+ #define yyin M4_YY_PREFIX[[in]]
+ #define yyleng M4_YY_PREFIX[[leng]]
+ #define yylex M4_YY_PREFIX[[lex]]
+@@ -107,7 +113,7 @@ m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
+ 
+ m4preproc_define(`M4_GEN_PREFIX',
+     ``[[#define yy$1 ]]M4_YY_PREFIX[[$1]]
+-m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
++%# m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
+ 
+ %if-c++-only
+     /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+@@ -120,6 +126,7 @@ m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
+ %endif
+ 
+ %if-c-only
++m4_ifelse(M4_YY_PREFIX,yy,,
+     M4_GEN_PREFIX(`_create_buffer')
+     M4_GEN_PREFIX(`_delete_buffer')
+     M4_GEN_PREFIX(`_scan_buffer')
+@@ -155,6 +162,7 @@ m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
+         M4_GEN_PREFIX(`set_column')
+     ]])
+     M4_GEN_PREFIX(`wrap')
++)
+ %endif
+ 
+ m4_ifdef( [[M4_YY_BISON_LVAL]],
+@@ -170,11 +178,14 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]],
+ ]])
+ 
+ 
++m4_ifelse(M4_YY_PREFIX,yy,,
+     M4_GEN_PREFIX(`alloc')
+     M4_GEN_PREFIX(`realloc')
+     M4_GEN_PREFIX(`free')
++)
+ 
+ %if-c-only
++m4_ifelse(M4_YY_PREFIX,yy,,
+ m4_ifdef( [[M4_YY_NOT_REENTRANT]],
+ [[
+     M4_GEN_PREFIX(`text')
+@@ -184,6 +195,7 @@ m4_ifdef( [[M4_YY_NOT_REENTRANT]],
+     M4_GEN_PREFIX(`_flex_debug')
+     M4_GEN_PREFIX(`lineno')
+ ]])
++)
+ %endif
+ 
+ 

diff --git a/sys-devel/flex/flex-2.6.3-r1.ebuild b/sys-devel/flex/flex-2.6.3-r1.ebuild
new file mode 100644
index 00000000000..2cd53fc6b2f
--- /dev/null
+++ b/sys-devel/flex/flex-2.6.3-r1.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit eutils flag-o-matic libtool multilib-minimal
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="https://flex.sourceforge.net/ https://github.com/westes/flex"
+SRC_URI="https://github.com/westes/${PN}/releases/download/v${PV}/${P}.tar.gz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="nls static test"
+
+# We want bison explicitly and not yacc in general #381273
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+	app-arch/xz-utils
+	nls? ( sys-devel/gettext )
+	test? ( sys-devel/bison )"
+
+PATCHES=(
+	"${FILESDIR}/${P}-reentrant.patch"
+)
+
+src_prepare() {
+	epatch "${PATCHES[@]}"
+
+	# Disable running in the tests/ subdir as it has a bunch of built sources
+	# that cannot be made conditional (automake limitation). #568842
+	if ! use test ; then
+		sed -i \
+			-e '/^SUBDIRS =/,/^$/{/tests/d}' \
+			Makefile.in || die
+	fi
+	elibtoolize # Prefix always needs this
+}
+
+src_configure() {
+	use static && append-ldflags -static
+
+	multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+	# Do not install shared libs #503522
+	ECONF_SOURCE=${S} \
+	econf \
+		--disable-shared \
+		$(use_enable nls) \
+		--docdir='$(datarootdir)/doc/'${PF}
+}
+
+multilib_src_compile() {
+	if multilib_is_native_abi; then
+		default
+	else
+		cd src || die
+		emake -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
+		cd src || die
+		emake DESTDIR="${D}" install-libLTLIBRARIES install-includeHEADERS
+	fi
+}
+
+multilib_src_install_all() {
+	einstalldocs
+	dodoc ONEWS
+	prune_libtool_files --all
+	rm "${ED}"/usr/share/doc/${PF}/COPYING || die
+	dosym flex /usr/bin/lex
+}


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/flex/, sys-devel/flex/files/
@ 2017-10-13 20:19 Thomas Deutschmann
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Deutschmann @ 2017-10-13 20:19 UTC (permalink / raw
  To: gentoo-commits

commit:     aa6c077d00c3a21b75ae646421aefadcad527f80
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 13 20:16:10 2017 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Oct 13 20:19:23 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa6c077d

sys-devel/flex: Rev bump to fix multiple problems

Closes: https://bugs.gentoo.org/628744
Closes: https://bugs.gentoo.org/625508
See: https://bugs.gentoo.org/632523
Package-Manager: Portage-2.3.10, Repoman-2.3.3

 .../flex-2.6.4-fix-build-with-glibc2.6+.patch      | 767 +++++++++++++++++++++
 sys-devel/flex/files/flex-2.6.4-libobjdir.patch    |  26 +
 sys-devel/flex/flex-2.6.4-r1.ebuild                |  85 +++
 3 files changed, 878 insertions(+)

diff --git a/sys-devel/flex/files/flex-2.6.4-fix-build-with-glibc2.6+.patch b/sys-devel/flex/files/flex-2.6.4-fix-build-with-glibc2.6+.patch
new file mode 100644
index 00000000000..328b5752456
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.6.4-fix-build-with-glibc2.6+.patch
@@ -0,0 +1,767 @@
+Backport of https://github.com/westes/flex/commit/24fd0551333e7eded87b64dd36062da3df2f6380
+
+Bug: https://bugs.gentoo.org/628744
+
+--- a/configure
++++ b/configure
+@@ -3605,13 +3605,142 @@ test -z "$SED" && SED=sed
+ Xsed="$SED -e 1s/^X//"
+ 
+ 
++ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
++$as_echo_n "checking how to run the C preprocessor... " >&6; }
++# On Suns, sometimes $CPP names a directory.
++if test -n "$CPP" && test -d "$CPP"; then
++  CPP=
++fi
++if test -z "$CPP"; then
++  if ${ac_cv_prog_CPP+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++      # Double quotes because CPP needs to be expanded
++    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
++    do
++      ac_preproc_ok=false
++for ac_c_preproc_warn_flag in '' yes
++do
++  # Use a header file that comes with gcc, so configuring glibc
++  # with a fresh cross-compiler works.
++  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
++  # <limits.h> exists even on freestanding compilers.
++  # On the NeXT, cc -E runs the code through the compiler's parser,
++  # not just through cpp. "Syntax error" is here to catch this case.
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#ifdef __STDC__
++# include <limits.h>
++#else
++# include <assert.h>
++#endif
++		     Syntax error
++_ACEOF
++if ac_fn_c_try_cpp "$LINENO"; then :
++
++else
++  # Broken: fails on valid input.
++continue
++fi
++rm -f conftest.err conftest.i conftest.$ac_ext
++
++  # OK, works on sane cases.  Now check whether nonexistent headers
++  # can be detected and how.
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <ac_nonexistent.h>
++_ACEOF
++if ac_fn_c_try_cpp "$LINENO"; then :
++  # Broken: success on invalid input.
++continue
++else
++  # Passes both tests.
++ac_preproc_ok=:
++break
++fi
++rm -f conftest.err conftest.i conftest.$ac_ext
++
++done
++# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
++rm -f conftest.i conftest.err conftest.$ac_ext
++if $ac_preproc_ok; then :
++  break
++fi
+ 
++    done
++    ac_cv_prog_CPP=$CPP
+ 
++fi
++  CPP=$ac_cv_prog_CPP
++else
++  ac_cv_prog_CPP=$CPP
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
++$as_echo "$CPP" >&6; }
++ac_preproc_ok=false
++for ac_c_preproc_warn_flag in '' yes
++do
++  # Use a header file that comes with gcc, so configuring glibc
++  # with a fresh cross-compiler works.
++  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
++  # <limits.h> exists even on freestanding compilers.
++  # On the NeXT, cc -E runs the code through the compiler's parser,
++  # not just through cpp. "Syntax error" is here to catch this case.
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#ifdef __STDC__
++# include <limits.h>
++#else
++# include <assert.h>
++#endif
++		     Syntax error
++_ACEOF
++if ac_fn_c_try_cpp "$LINENO"; then :
+ 
++else
++  # Broken: fails on valid input.
++continue
++fi
++rm -f conftest.err conftest.i conftest.$ac_ext
+ 
++  # OK, works on sane cases.  Now check whether nonexistent headers
++  # can be detected and how.
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <ac_nonexistent.h>
++_ACEOF
++if ac_fn_c_try_cpp "$LINENO"; then :
++  # Broken: success on invalid input.
++continue
++else
++  # Passes both tests.
++ac_preproc_ok=:
++break
++fi
++rm -f conftest.err conftest.i conftest.$ac_ext
+ 
++done
++# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
++rm -f conftest.i conftest.err conftest.$ac_ext
++if $ac_preproc_ok; then :
+ 
++else
++  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
++See \`config.log' for more details" "$LINENO" 5; }
++fi
+ 
++ac_ext=c
++ac_cpp='$CPP $CPPFLAGS'
++ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
++ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
++ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ 
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+@@ -3744,91 +3873,208 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
+  EGREP="$ac_cv_path_EGREP"
+ 
+ 
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+-$as_echo_n "checking for fgrep... " >&6; }
+-if ${ac_cv_path_FGREP+:} false; then :
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
++$as_echo_n "checking for ANSI C header files... " >&6; }
++if ${ac_cv_header_stdc+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+-  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+-   then ac_cv_path_FGREP="$GREP -F"
+-   else
+-     if test -z "$FGREP"; then
+-  ac_path_FGREP_found=false
+-  # Loop through the user's path and test for each of PROGNAME-LIST
+-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+-do
+-  IFS=$as_save_IFS
+-  test -z "$as_dir" && as_dir=.
+-    for ac_prog in fgrep; do
+-    for ac_exec_ext in '' $ac_executable_extensions; do
+-      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+-      as_fn_executable_p "$ac_path_FGREP" || continue
+-# Check for GNU ac_path_FGREP and select it if it is found.
+-  # Check for GNU $ac_path_FGREP
+-case `"$ac_path_FGREP" --version 2>&1` in
+-*GNU*)
+-  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+-*)
+-  ac_count=0
+-  $as_echo_n 0123456789 >"conftest.in"
+-  while :
+-  do
+-    cat "conftest.in" "conftest.in" >"conftest.tmp"
+-    mv "conftest.tmp" "conftest.in"
+-    cp "conftest.in" "conftest.nl"
+-    $as_echo 'FGREP' >> "conftest.nl"
+-    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+-    as_fn_arith $ac_count + 1 && ac_count=$as_val
+-    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+-      # Best one so far, save it but keep looking for a better one
+-      ac_cv_path_FGREP="$ac_path_FGREP"
+-      ac_path_FGREP_max=$ac_count
+-    fi
+-    # 10*(2^10) chars as input seems more than enough
+-    test $ac_count -gt 10 && break
+-  done
+-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+-esac
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <stdlib.h>
++#include <stdarg.h>
++#include <string.h>
++#include <float.h>
+ 
+-      $ac_path_FGREP_found && break 3
+-    done
+-  done
+-  done
+-IFS=$as_save_IFS
+-  if test -z "$ac_cv_path_FGREP"; then
+-    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+-  fi
+-else
+-  ac_cv_path_FGREP=$FGREP
+-fi
++int
++main ()
++{
+ 
+-   fi
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  ac_cv_header_stdc=yes
++else
++  ac_cv_header_stdc=no
+ fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+-$as_echo "$ac_cv_path_FGREP" >&6; }
+- FGREP="$ac_cv_path_FGREP"
+-
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ 
+-test -z "$GREP" && GREP=grep
++if test $ac_cv_header_stdc = yes; then
++  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <string.h>
+ 
++_ACEOF
++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
++  $EGREP "memchr" >/dev/null 2>&1; then :
+ 
++else
++  ac_cv_header_stdc=no
++fi
++rm -f conftest*
+ 
++fi
+ 
++if test $ac_cv_header_stdc = yes; then
++  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <stdlib.h>
+ 
++_ACEOF
++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
++  $EGREP "free" >/dev/null 2>&1; then :
+ 
++else
++  ac_cv_header_stdc=no
++fi
++rm -f conftest*
+ 
++fi
+ 
++if test $ac_cv_header_stdc = yes; then
++  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
++  if test "$cross_compiling" = yes; then :
++  :
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++#include <ctype.h>
++#include <stdlib.h>
++#if ((' ' & 0x0FF) == 0x020)
++# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
++# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
++#else
++# define ISLOWER(c) \
++		   (('a' <= (c) && (c) <= 'i') \
++		     || ('j' <= (c) && (c) <= 'r') \
++		     || ('s' <= (c) && (c) <= 'z'))
++# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
++#endif
+ 
++#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
++int
++main ()
++{
++  int i;
++  for (i = 0; i < 256; i++)
++    if (XOR (islower (i), ISLOWER (i))
++	|| toupper (i) != TOUPPER (i))
++      return 2;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_run "$LINENO"; then :
+ 
++else
++  ac_cv_header_stdc=no
++fi
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
++fi
+ 
++fi
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
++$as_echo "$ac_cv_header_stdc" >&6; }
++if test $ac_cv_header_stdc = yes; then
+ 
++$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+ 
++fi
+ 
++# On IRIX 5.3, sys/types and inttypes.h are conflicting.
++for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
++		  inttypes.h stdint.h unistd.h
++do :
++  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
++ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
++"
++if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
++  cat >>confdefs.h <<_ACEOF
++#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
++_ACEOF
++
++fi
++
++done
++
++
++
++  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
++if test "x$ac_cv_header_minix_config_h" = xyes; then :
++  MINIX=yes
++else
++  MINIX=
++fi
++
++
++  if test "$MINIX" = yes; then
+ 
++$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
+ 
+ 
++$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
++
++
++$as_echo "#define _MINIX 1" >>confdefs.h
++
++  fi
++
++
++  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
++$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
++if ${ac_cv_safe_to_define___extensions__+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++#         define __EXTENSIONS__ 1
++          $ac_includes_default
++int
++main ()
++{
++
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_compile "$LINENO"; then :
++  ac_cv_safe_to_define___extensions__=yes
++else
++  ac_cv_safe_to_define___extensions__=no
++fi
++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
++$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
++  test $ac_cv_safe_to_define___extensions__ = yes &&
++    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
++
++  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
++
++  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
++
++  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
++
++  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
++
++
++for ac_header in dlfcn.h
++do :
++  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
++"
++if test "x$ac_cv_header_dlfcn_h" = xyes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_DLFCN_H 1
++_ACEOF
++
++fi
++
++done
+ 
+ 
+ # Check whether --with-gnu-ld was given.
+@@ -6898,288 +7144,6 @@ func_munge_path_list ()
+     esac
+ }
+ 
+-ac_ext=c
+-ac_cpp='$CPP $CPPFLAGS'
+-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+-$as_echo_n "checking how to run the C preprocessor... " >&6; }
+-# On Suns, sometimes $CPP names a directory.
+-if test -n "$CPP" && test -d "$CPP"; then
+-  CPP=
+-fi
+-if test -z "$CPP"; then
+-  if ${ac_cv_prog_CPP+:} false; then :
+-  $as_echo_n "(cached) " >&6
+-else
+-      # Double quotes because CPP needs to be expanded
+-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+-    do
+-      ac_preproc_ok=false
+-for ac_c_preproc_warn_flag in '' yes
+-do
+-  # Use a header file that comes with gcc, so configuring glibc
+-  # with a fresh cross-compiler works.
+-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+-  # <limits.h> exists even on freestanding compilers.
+-  # On the NeXT, cc -E runs the code through the compiler's parser,
+-  # not just through cpp. "Syntax error" is here to catch this case.
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#ifdef __STDC__
+-# include <limits.h>
+-#else
+-# include <assert.h>
+-#endif
+-		     Syntax error
+-_ACEOF
+-if ac_fn_c_try_cpp "$LINENO"; then :
+-
+-else
+-  # Broken: fails on valid input.
+-continue
+-fi
+-rm -f conftest.err conftest.i conftest.$ac_ext
+-
+-  # OK, works on sane cases.  Now check whether nonexistent headers
+-  # can be detected and how.
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#include <ac_nonexistent.h>
+-_ACEOF
+-if ac_fn_c_try_cpp "$LINENO"; then :
+-  # Broken: success on invalid input.
+-continue
+-else
+-  # Passes both tests.
+-ac_preproc_ok=:
+-break
+-fi
+-rm -f conftest.err conftest.i conftest.$ac_ext
+-
+-done
+-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+-rm -f conftest.i conftest.err conftest.$ac_ext
+-if $ac_preproc_ok; then :
+-  break
+-fi
+-
+-    done
+-    ac_cv_prog_CPP=$CPP
+-
+-fi
+-  CPP=$ac_cv_prog_CPP
+-else
+-  ac_cv_prog_CPP=$CPP
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+-$as_echo "$CPP" >&6; }
+-ac_preproc_ok=false
+-for ac_c_preproc_warn_flag in '' yes
+-do
+-  # Use a header file that comes with gcc, so configuring glibc
+-  # with a fresh cross-compiler works.
+-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+-  # <limits.h> exists even on freestanding compilers.
+-  # On the NeXT, cc -E runs the code through the compiler's parser,
+-  # not just through cpp. "Syntax error" is here to catch this case.
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#ifdef __STDC__
+-# include <limits.h>
+-#else
+-# include <assert.h>
+-#endif
+-		     Syntax error
+-_ACEOF
+-if ac_fn_c_try_cpp "$LINENO"; then :
+-
+-else
+-  # Broken: fails on valid input.
+-continue
+-fi
+-rm -f conftest.err conftest.i conftest.$ac_ext
+-
+-  # OK, works on sane cases.  Now check whether nonexistent headers
+-  # can be detected and how.
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#include <ac_nonexistent.h>
+-_ACEOF
+-if ac_fn_c_try_cpp "$LINENO"; then :
+-  # Broken: success on invalid input.
+-continue
+-else
+-  # Passes both tests.
+-ac_preproc_ok=:
+-break
+-fi
+-rm -f conftest.err conftest.i conftest.$ac_ext
+-
+-done
+-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+-rm -f conftest.i conftest.err conftest.$ac_ext
+-if $ac_preproc_ok; then :
+-
+-else
+-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+-See \`config.log' for more details" "$LINENO" 5; }
+-fi
+-
+-ac_ext=c
+-ac_cpp='$CPP $CPPFLAGS'
+-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+-
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+-$as_echo_n "checking for ANSI C header files... " >&6; }
+-if ${ac_cv_header_stdc+:} false; then :
+-  $as_echo_n "(cached) " >&6
+-else
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#include <stdlib.h>
+-#include <stdarg.h>
+-#include <string.h>
+-#include <float.h>
+-
+-int
+-main ()
+-{
+-
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+-  ac_cv_header_stdc=yes
+-else
+-  ac_cv_header_stdc=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-
+-if test $ac_cv_header_stdc = yes; then
+-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#include <string.h>
+-
+-_ACEOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+-  $EGREP "memchr" >/dev/null 2>&1; then :
+-
+-else
+-  ac_cv_header_stdc=no
+-fi
+-rm -f conftest*
+-
+-fi
+-
+-if test $ac_cv_header_stdc = yes; then
+-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#include <stdlib.h>
+-
+-_ACEOF
+-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+-  $EGREP "free" >/dev/null 2>&1; then :
+-
+-else
+-  ac_cv_header_stdc=no
+-fi
+-rm -f conftest*
+-
+-fi
+-
+-if test $ac_cv_header_stdc = yes; then
+-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+-  if test "$cross_compiling" = yes; then :
+-  :
+-else
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-#include <ctype.h>
+-#include <stdlib.h>
+-#if ((' ' & 0x0FF) == 0x020)
+-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+-#else
+-# define ISLOWER(c) \
+-		   (('a' <= (c) && (c) <= 'i') \
+-		     || ('j' <= (c) && (c) <= 'r') \
+-		     || ('s' <= (c) && (c) <= 'z'))
+-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+-#endif
+-
+-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+-int
+-main ()
+-{
+-  int i;
+-  for (i = 0; i < 256; i++)
+-    if (XOR (islower (i), ISLOWER (i))
+-	|| toupper (i) != TOUPPER (i))
+-      return 2;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_run "$LINENO"; then :
+-
+-else
+-  ac_cv_header_stdc=no
+-fi
+-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+-fi
+-
+-fi
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+-$as_echo "$ac_cv_header_stdc" >&6; }
+-if test $ac_cv_header_stdc = yes; then
+-
+-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+-
+-fi
+-
+-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+-		  inttypes.h stdint.h unistd.h
+-do :
+-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+-"
+-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+-  cat >>confdefs.h <<_ACEOF
+-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+-_ACEOF
+-
+-fi
+-
+-done
+-
+-
+-for ac_header in dlfcn.h
+-do :
+-  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+-"
+-if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+-  cat >>confdefs.h <<_ACEOF
+-#define HAVE_DLFCN_H 1
+-_ACEOF
+-
+-fi
+-
+-done
+-
+-
+-
+ 
+ 
+ # Set options
+--- a/src/config.h.in
++++ b/src/config.h.in
+@@ -207,6 +207,9 @@
+ /* Define to the m4 executable name. */
+ #undef M4
+ 
++/* Define to 1 if your C compiler doesn't accept -c and -o together. */
++#undef NO_MINUS_C_MINUS_O
++
+ /* Name of package */
+ #undef PACKAGE
+ 
+@@ -239,6 +242,28 @@
+ /* Define to 1 if you have the ANSI C header files. */
+ #undef STDC_HEADERS
+ 
++/* Enable extensions on AIX 3, Interix.  */
++#ifndef _ALL_SOURCE
++# undef _ALL_SOURCE
++#endif
++/* Enable GNU extensions on systems that have them.  */
++#ifndef _GNU_SOURCE
++# undef _GNU_SOURCE
++#endif
++/* Enable threading extensions on Solaris.  */
++#ifndef _POSIX_PTHREAD_SEMANTICS
++# undef _POSIX_PTHREAD_SEMANTICS
++#endif
++/* Enable extensions on HP NonStop.  */
++#ifndef _TANDEM_SOURCE
++# undef _TANDEM_SOURCE
++#endif
++/* Enable general extensions on Solaris.  */
++#ifndef __EXTENSIONS__
++# undef __EXTENSIONS__
++#endif
++
++
+ /* Version number of package */
+ #undef VERSION
+ 
+@@ -246,6 +271,16 @@
+    `char[]'. */
+ #undef YYTEXT_POINTER
+ 
++/* Define to 1 if on MINIX. */
++#undef _MINIX
++
++/* Define to 2 if the system does not provide POSIX.1 features except with
++   this defined. */
++#undef _POSIX_1_SOURCE
++
++/* Define to 1 if you need to in order for `stat' and other things to work. */
++#undef _POSIX_SOURCE
++
+ /* Define to empty if `const' does not conform to ANSI C. */
+ #undef const
+ 

diff --git a/sys-devel/flex/files/flex-2.6.4-libobjdir.patch b/sys-devel/flex/files/flex-2.6.4-libobjdir.patch
new file mode 100644
index 00000000000..a652b9236b1
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.6.4-libobjdir.patch
@@ -0,0 +1,26 @@
+https://github.com/westes/flex/commit/24e73c4446841eda8d4ea01298e887059e8c1472
+
+Bug: https://bugs.gentoo.org/625508
+
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -79,6 +79,8 @@ COMMON_SOURCES = \
+ 
+ LDADD = $(LIBOBJS) @LIBINTL@
+ 
++$(LIBOBJS): $(LIBOBJDIR)$(am__dirstamp)
++
+ include_HEADERS = \
+ 	FlexLexer.h
+ 
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -1688,6 +1688,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ @CROSS_TRUE@$(stage1flex_OBJECTS): CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
+ @CROSS_TRUE@$(stage1flex_OBJECTS): LDFLAGS=$(LDFLAGS_FOR_BUILD)
+ 
++$(LIBOBJS): $(LIBOBJDIR)$(am__dirstamp)
++
+ skel.c: flex.skl mkskel.sh flexint.h tables_shared.h tables_shared.c
+ 	$(SHELL) $(srcdir)/mkskel.sh $(srcdir) $(m4) $(VERSION) > $@.tmp
+ 	mv $@.tmp $@

diff --git a/sys-devel/flex/flex-2.6.4-r1.ebuild b/sys-devel/flex/flex-2.6.4-r1.ebuild
new file mode 100644
index 00000000000..b221d35914b
--- /dev/null
+++ b/sys-devel/flex/flex-2.6.4-r1.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit eutils flag-o-matic libtool multilib-minimal
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="https://flex.sourceforge.net/ https://github.com/westes/flex"
+SRC_URI="https://github.com/westes/${PN}/releases/download/v${PV}/${P}.tar.gz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="nls static test"
+
+# We want bison explicitly and not yacc in general #381273
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+	app-arch/xz-utils
+	nls? ( sys-devel/gettext )
+	test? ( sys-devel/bison )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.6.4-libobjdir.patch
+	"${FILESDIR}"/${PN}-2.6.4-fix-build-with-glibc2.6+.patch
+)
+
+src_prepare() {
+	default
+
+	# Disable running in the tests/ subdir as it has a bunch of built sources
+	# that cannot be made conditional (automake limitation). #568842
+	if ! use test ; then
+		sed -i \
+			-e '/^SUBDIRS =/,/^$/{/tests/d}' \
+			Makefile.in || die
+	fi
+	elibtoolize # Prefix always needs this
+}
+
+src_configure() {
+	use static && append-ldflags -static
+
+	multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+	# Do not install shared libs #503522
+	ECONF_SOURCE=${S} \
+	econf \
+		--disable-shared \
+		$(use_enable nls) \
+		--docdir='$(datarootdir)/doc/'${PF}
+}
+
+multilib_src_compile() {
+	if multilib_is_native_abi; then
+		default
+	else
+		cd src || die
+		emake -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
+		cd src || die
+		emake DESTDIR="${D}" install-libLTLIBRARIES install-includeHEADERS
+	fi
+}
+
+multilib_src_install_all() {
+	einstalldocs
+	dodoc ONEWS
+	prune_libtool_files --all
+	rm "${ED}"/usr/share/doc/${PF}/COPYING || die
+	dosym flex /usr/bin/lex
+}


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/flex/, sys-devel/flex/files/
@ 2021-04-30 19:03 Andreas Sturmlechner
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Sturmlechner @ 2021-04-30 19:03 UTC (permalink / raw
  To: gentoo-commits

commit:     0438e6d3b20ae30dfc2339cca81f53c1f8b2a1d8
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 18 22:46:30 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Fri Apr 30 19:02:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0438e6d3

sys-devel/flex: Drop 2.6.1, 2.6.3, 2.6.3-r1 and 2.6.4 (r0)

Bug: https://bugs.gentoo.org/777906
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 sys-devel/flex/Manifest                         |  2 -
 sys-devel/flex/files/flex-2.6.3-reentrant.patch | 82 ------------------------
 sys-devel/flex/flex-2.6.1.ebuild                | 78 -----------------------
 sys-devel/flex/flex-2.6.3-r1.ebuild             | 85 -------------------------
 sys-devel/flex/flex-2.6.3.ebuild                | 79 -----------------------
 sys-devel/flex/flex-2.6.4.ebuild                | 82 ------------------------
 6 files changed, 408 deletions(-)

diff --git a/sys-devel/flex/Manifest b/sys-devel/flex/Manifest
index 14e6b2bca98..327f0405ede 100644
--- a/sys-devel/flex/Manifest
+++ b/sys-devel/flex/Manifest
@@ -1,3 +1 @@
-DIST flex-2.6.1.tar.xz 835048 BLAKE2B 5b0b67774d1ba2d4b2ad8a8cba1f0b8fed9aecdae387e54e6cb8fd1c0c9ef78559bc1a6fe6b97f984f16b438d350de4dccda7e3427d71fead9073ab6616b0ecc SHA512 1e35d0447f59139b98ede085d1a603d4f61cf8bc11cf2e291a3f492a05c60ee61535481b878585cd6843cd9b3c7952c834adfa78a6a71c64802e7b3069dec9d1
-DIST flex-2.6.3.tar.gz 1405560 BLAKE2B 2aa9ca18f2ab124db9567e2d2ee512881a71755342bdcbd05ef536653396d1e4ed47dafc1227531bf9e9a610d9c5aa2d924bf864b18c5a618b2ccb61db7fef4e SHA512 f14b1af7ddd148660737991787fcf13d86cc0bef3859ed6c2135963373e76524d70382795c845cb6491b0435f8c40ba81e17f15267592b8d1656cfd4c3430b00
 DIST flex-2.6.4.tar.gz 1419096 BLAKE2B c003d4f764f7f4d41e33af7ee28c2af272a9f0aee6ba7c2494ba96722d8d0b18f7a3f745217e9a2cecb43b6863328267a810280670c04464156b3eb3d7ee9d62 SHA512 e9785f3d620a204b7d20222888917dc065c2036cae28667065bf7862dfa1b25235095a12fd04efdbd09bfd17d3452e6b9ef953a8c1137862ff671c97132a082e

diff --git a/sys-devel/flex/files/flex-2.6.3-reentrant.patch b/sys-devel/flex/files/flex-2.6.3-reentrant.patch
deleted file mode 100644
index f2f5eb8374b..00000000000
--- a/sys-devel/flex/files/flex-2.6.3-reentrant.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From 078b46c69d063aef1715b11348a2871d6036f253 Mon Sep 17 00:00:00 2001
-From: Christos Zoulas <christos@zoulas.com>
-Date: Sun, 22 Jan 2017 18:34:30 +0100
-Subject: [PATCH] Add more defines in the non-reentrant part.
-
-Fix the reentrant part; don't "#define yyfoo yyfoo" because it breaks
-code that does #ifndef yywrap ..
----
- src/flex.skl | 16 ++++++++++++++--
- 1 file changed, 14 insertions(+), 2 deletions(-)
-
-diff --git a/src/flex.skl b/src/flex.skl
-index 190700f..6a7cde4 100644
---- a/src/flex.skl
-+++ b/src/flex.skl
-@@ -61,11 +61,17 @@ m4_changequote([[, ]])
- m4_ifelse(M4_YY_PREFIX,yy,,
- #define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]
- #define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]
--#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]
-+#define yy_scan_buffer M4_YY_PREFIX[[_scan_buffer]]
-+#define yy_scan_string M4_YY_PREFIX[[_scan_string]]
-+#define yy_scan_bytes M4_YY_PREFIX[[_scan_bytes]]
- #define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]
- #define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]
- #define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]
- #define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]
-+#define yypush_buffer_state M4_YY_PREFIX[[push_buffer_state]]
-+#define yypop_buffer_state M4_YY_PREFIX[[pop_buffer_state]]
-+#define yyensure_buffer_stack M4_YY_PREFIX[[ensure_buffer_stack]]
-+#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]
- #define yyin M4_YY_PREFIX[[in]]
- #define yyleng M4_YY_PREFIX[[leng]]
- #define yylex M4_YY_PREFIX[[lex]]
-@@ -107,7 +113,7 @@ m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
- 
- m4preproc_define(`M4_GEN_PREFIX',
-     ``[[#define yy$1 ]]M4_YY_PREFIX[[$1]]
--m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
-+%# m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
- 
- %if-c++-only
-     /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
-@@ -120,6 +126,7 @@ m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
- %endif
- 
- %if-c-only
-+m4_ifelse(M4_YY_PREFIX,yy,,
-     M4_GEN_PREFIX(`_create_buffer')
-     M4_GEN_PREFIX(`_delete_buffer')
-     M4_GEN_PREFIX(`_scan_buffer')
-@@ -155,6 +162,7 @@ m4_define([[yy$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
-         M4_GEN_PREFIX(`set_column')
-     ]])
-     M4_GEN_PREFIX(`wrap')
-+)
- %endif
- 
- m4_ifdef( [[M4_YY_BISON_LVAL]],
-@@ -170,11 +178,14 @@ m4_ifdef( [[<M4_YY_BISON_LLOC>]],
- ]])
- 
- 
-+m4_ifelse(M4_YY_PREFIX,yy,,
-     M4_GEN_PREFIX(`alloc')
-     M4_GEN_PREFIX(`realloc')
-     M4_GEN_PREFIX(`free')
-+)
- 
- %if-c-only
-+m4_ifelse(M4_YY_PREFIX,yy,,
- m4_ifdef( [[M4_YY_NOT_REENTRANT]],
- [[
-     M4_GEN_PREFIX(`text')
-@@ -184,6 +195,7 @@ m4_ifdef( [[M4_YY_NOT_REENTRANT]],
-     M4_GEN_PREFIX(`_flex_debug')
-     M4_GEN_PREFIX(`lineno')
- ]])
-+)
- %endif
- 
- 

diff --git a/sys-devel/flex/flex-2.6.1.ebuild b/sys-devel/flex/flex-2.6.1.ebuild
deleted file mode 100644
index d732bb861ff..00000000000
--- a/sys-devel/flex/flex-2.6.1.ebuild
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit eutils flag-o-matic ltprune multilib-minimal
-
-DESCRIPTION="The Fast Lexical Analyzer"
-HOMEPAGE="https://flex.sourceforge.net/ https://github.com/westes/flex"
-SRC_URI="https://github.com/westes/flex/releases/download/v${PV}/${P}.tar.xz"
-
-LICENSE="FLEX"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="nls static test"
-RESTRICT="!test? ( test )"
-
-# We want bison explicitly and not yacc in general #381273
-RDEPEND="sys-devel/m4"
-DEPEND="${RDEPEND}
-	app-arch/xz-utils
-	nls? ( sys-devel/gettext )
-	test? ( sys-devel/bison )"
-
-src_prepare() {
-	# Disable running in the tests/ subdir as it has a bunch of built sources
-	# that cannot be made conditional (automake limitation). #568842
-	if ! use test ; then
-		sed -i \
-			-e '/^SUBDIRS =/,/^$/{/tests/d}' \
-			Makefile.in || die
-	fi
-}
-
-src_configure() {
-	use static && append-ldflags -static
-
-	multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
-	# Do not install shared libs #503522
-	ECONF_SOURCE=${S} \
-	econf \
-		--disable-shared \
-		$(use_enable nls) \
-		--docdir='$(datarootdir)/doc/'${PF}
-}
-
-multilib_src_compile() {
-	if multilib_is_native_abi; then
-		default
-	else
-		cd src || die
-		emake -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
-		cd src || die
-		emake DESTDIR="${D}" install-libLTLIBRARIES install-includeHEADERS
-	fi
-}
-
-multilib_src_install_all() {
-	einstalldocs
-	dodoc ONEWS
-	prune_libtool_files --all
-	rm "${ED}"/usr/share/doc/${PF}/COPYING || die
-	dosym flex /usr/bin/lex
-}

diff --git a/sys-devel/flex/flex-2.6.3-r1.ebuild b/sys-devel/flex/flex-2.6.3-r1.ebuild
deleted file mode 100644
index 86c8beada8b..00000000000
--- a/sys-devel/flex/flex-2.6.3-r1.ebuild
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit eutils flag-o-matic libtool ltprune multilib-minimal
-
-DESCRIPTION="The Fast Lexical Analyzer"
-HOMEPAGE="https://flex.sourceforge.net/ https://github.com/westes/flex"
-SRC_URI="https://github.com/westes/${PN}/releases/download/v${PV}/${P}.tar.gz"
-
-LICENSE="FLEX"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~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 )"
-
-# We want bison explicitly and not yacc in general #381273
-RDEPEND="sys-devel/m4"
-DEPEND="${RDEPEND}
-	app-arch/xz-utils
-	nls? ( sys-devel/gettext )
-	test? ( sys-devel/bison )"
-
-PATCHES=(
-	"${FILESDIR}/${P}-reentrant.patch"
-)
-
-src_prepare() {
-	epatch "${PATCHES[@]}"
-
-	# Disable running in the tests/ subdir as it has a bunch of built sources
-	# that cannot be made conditional (automake limitation). #568842
-	if ! use test ; then
-		sed -i \
-			-e '/^SUBDIRS =/,/^$/{/tests/d}' \
-			Makefile.in || die
-	fi
-	elibtoolize # Prefix always needs this
-}
-
-src_configure() {
-	use static && append-ldflags -static
-
-	multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
-	# Do not install shared libs #503522
-	ECONF_SOURCE=${S} \
-	econf \
-		--disable-shared \
-		$(use_enable nls) \
-		--docdir='$(datarootdir)/doc/'${PF}
-}
-
-multilib_src_compile() {
-	if multilib_is_native_abi; then
-		default
-	else
-		cd src || die
-		emake -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
-		cd src || die
-		emake DESTDIR="${D}" install-libLTLIBRARIES install-includeHEADERS
-	fi
-}
-
-multilib_src_install_all() {
-	einstalldocs
-	dodoc ONEWS
-	prune_libtool_files --all
-	rm "${ED}"/usr/share/doc/${PF}/COPYING || die
-	dosym flex /usr/bin/lex
-}

diff --git a/sys-devel/flex/flex-2.6.3.ebuild b/sys-devel/flex/flex-2.6.3.ebuild
deleted file mode 100644
index 92259329371..00000000000
--- a/sys-devel/flex/flex-2.6.3.ebuild
+++ /dev/null
@@ -1,79 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit eutils flag-o-matic libtool ltprune multilib-minimal
-
-DESCRIPTION="The Fast Lexical Analyzer"
-HOMEPAGE="https://flex.sourceforge.net/ https://github.com/westes/flex"
-SRC_URI="https://github.com/westes/${PN}/releases/download/v${PV}/${P}.tar.gz"
-
-LICENSE="FLEX"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~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 )"
-
-# We want bison explicitly and not yacc in general #381273
-RDEPEND="sys-devel/m4"
-DEPEND="${RDEPEND}
-	app-arch/xz-utils
-	nls? ( sys-devel/gettext )
-	test? ( sys-devel/bison )"
-
-src_prepare() {
-	# Disable running in the tests/ subdir as it has a bunch of built sources
-	# that cannot be made conditional (automake limitation). #568842
-	if ! use test ; then
-		sed -i \
-			-e '/^SUBDIRS =/,/^$/{/tests/d}' \
-			Makefile.in || die
-	fi
-	elibtoolize # Prefix always needs this
-}
-
-src_configure() {
-	use static && append-ldflags -static
-
-	multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
-	# Do not install shared libs #503522
-	ECONF_SOURCE=${S} \
-	econf \
-		--disable-shared \
-		$(use_enable nls) \
-		--docdir='$(datarootdir)/doc/'${PF}
-}
-
-multilib_src_compile() {
-	if multilib_is_native_abi; then
-		default
-	else
-		cd src || die
-		emake -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
-		cd src || die
-		emake DESTDIR="${D}" install-libLTLIBRARIES install-includeHEADERS
-	fi
-}
-
-multilib_src_install_all() {
-	einstalldocs
-	dodoc ONEWS
-	prune_libtool_files --all
-	rm "${ED}"/usr/share/doc/${PF}/COPYING || die
-	dosym flex /usr/bin/lex
-}

diff --git a/sys-devel/flex/flex-2.6.4.ebuild b/sys-devel/flex/flex-2.6.4.ebuild
deleted file mode 100644
index 623bc261d89..00000000000
--- a/sys-devel/flex/flex-2.6.4.ebuild
+++ /dev/null
@@ -1,82 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="5"
-
-inherit eutils flag-o-matic libtool ltprune multilib-minimal
-
-DESCRIPTION="The Fast Lexical Analyzer"
-HOMEPAGE="https://flex.sourceforge.net/ https://github.com/westes/flex"
-SRC_URI="https://github.com/westes/${PN}/releases/download/v${PV}/${P}.tar.gz"
-
-LICENSE="FLEX"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~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 )"
-
-# We want bison explicitly and not yacc in general #381273
-RDEPEND="sys-devel/m4"
-DEPEND="${RDEPEND}
-	app-arch/xz-utils
-	nls? ( sys-devel/gettext )
-	test? ( sys-devel/bison )"
-
-src_prepare() {
-	#epatch "${PATCHES[@]}"
-	epatch_user
-
-	# Disable running in the tests/ subdir as it has a bunch of built sources
-	# that cannot be made conditional (automake limitation). #568842
-	if ! use test ; then
-		sed -i \
-			-e '/^SUBDIRS =/,/^$/{/tests/d}' \
-			Makefile.in || die
-	fi
-	elibtoolize # Prefix always needs this
-}
-
-src_configure() {
-	use static && append-ldflags -static
-
-	multilib-minimal_src_configure
-}
-
-multilib_src_configure() {
-	# Do not install shared libs #503522
-	ECONF_SOURCE=${S} \
-	econf \
-		--disable-shared \
-		$(use_enable nls) \
-		--docdir='$(datarootdir)/doc/'${PF}
-}
-
-multilib_src_compile() {
-	if multilib_is_native_abi; then
-		default
-	else
-		cd src || die
-		emake -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
-		cd src || die
-		emake DESTDIR="${D}" install-libLTLIBRARIES install-includeHEADERS
-	fi
-}
-
-multilib_src_install_all() {
-	einstalldocs
-	dodoc ONEWS
-	prune_libtool_files --all
-	rm "${ED}"/usr/share/doc/${PF}/COPYING || die
-	dosym flex /usr/bin/lex
-}


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/flex/, sys-devel/flex/files/
@ 2022-10-25 11:42 Sam James
  0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2022-10-25 11:42 UTC (permalink / raw
  To: gentoo-commits

commit:     bec6a7be57fc3493dccef497b5d4b513c315f5f1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 25 11:41:32 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 25 11:42:25 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bec6a7be

sys-devel/flex: backport "config.h" fix too

We already have the patch to config.h/configure.ac backported
but we don't have the fix to actually *use* config.h everywhere,
and clearly from bug #705800 it wasn't sufficient to just backport
it (for reasons covered in the bug & upstream bug).

Bug: https://bugs.gentoo.org/628744
Bug: https://bugs.gentoo.org/705800
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../flex/files/flex-2.6.4-implicit-func-decl.patch | 50 ++++++++++++
 sys-devel/flex/flex-2.6.4-r3.ebuild                | 95 ++++++++++++++++++++++
 2 files changed, 145 insertions(+)

diff --git a/sys-devel/flex/files/flex-2.6.4-implicit-func-decl.patch b/sys-devel/flex/files/flex-2.6.4-implicit-func-decl.patch
new file mode 100644
index 000000000000..1900ae0529b9
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.6.4-implicit-func-decl.patch
@@ -0,0 +1,50 @@
+https://github.com/westes/flex/commit/4b5111d9772b5c160340ca96f08d30d7f6db5cda
+https://github.com/westes/flex/issues/436
+https://bugs.gentoo.org/705800
+https://developers.redhat.com/blog/2019/04/22/implicit-function-declarations-flexs-use-of-reallocarray
+
+From 4b5111d9772b5c160340ca96f08d30d7f6db5cda Mon Sep 17 00:00:00 2001
+From: Explorer09 <explorer09@gmail.com>
+Date: Mon, 4 Sep 2017 08:28:53 +0800
+Subject: [PATCH] scanner: Include flexdef.h at %top block of scan.l
+
+config.h may define macros that alter the API of the standard library
+funtions, and so it should be included before any other standard
+header, even before the skeleton's standard header inclusion.
+
+For example: config.h may #define _GNU_SOURCE that would expose the
+reallocarray() prototype from <stdlib.h> on glibc 2.26+ systems. If we
+include <stdlib.h> before config.h, reallocarray() would not be
+available for use in lex file since the second include doesn't help
+due to header guard.
+
+For now our config.h might `#define malloc rpl_malloc` -- this
+substitution must work before including stdlib.h, or else the compiler
+will complain about missing prototypes, and may result in incorrect
+code in scan.l (gcc warning: return makes pointer from integer without
+a cast [-Wint-conversion]).
+
+Fixes #247.
+--- a/src/scan.l
++++ b/src/scan.l
+@@ -1,5 +1,11 @@
+ /* scan.l - scanner for flex input -*-C-*- */
+ 
++%top{
++/* flexdef.h includes config.h, which may contain macros that alter the API */
++/* of libc functions. Must include first before any libc header. */
++#include "flexdef.h"
++}
++
+ %{
+ /*  Copyright (c) 1990 The Regents of the University of California. */
+ /*  All rights reserved. */
+@@ -32,7 +38,6 @@
+ /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+ /*  PURPOSE. */
+ 
+-#include "flexdef.h"
+ #include "parse.h"
+ extern bool tablesverify, tablesext;
+ extern int trlcontxt; /* Set in  parse.y for each rule. */
+

diff --git a/sys-devel/flex/flex-2.6.4-r3.ebuild b/sys-devel/flex/flex-2.6.4-r3.ebuild
new file mode 100644
index 000000000000..1f1ebfe61893
--- /dev/null
+++ b/sys-devel/flex/flex-2.6.4-r3.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2022 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"
+
+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 )"
+
+# We want bison explicitly and not yacc in general, bug #381273
+RDEPEND="sys-devel/m4"
+BDEPEND="${RDEPEND}
+	nls? ( sys-devel/gettext )
+	test? ( sys-devel/bison )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.6.4-libobjdir.patch
+	"${FILESDIR}"/${PN}-2.6.4-fix-build-with-glibc2.6+.patch
+	"${FILESDIR}"/${P}-implicit-func-decl.patch
+)
+
+src_prepare() {
+	default
+
+	# 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() {
+	if tc-is-cross-compiler ; then
+		# Similar to workaround for procps:
+		# - bug #705800
+		# - https://sourceforge.net/p/psmisc/bugs/71/
+		# - https://lists.gnu.org/archive/html/autoconf/2011-04/msg00019.html
+		export ac_cv_func_malloc_0_nonnull=yes \
+			ac_cv_func_realloc_0_nonnull=yes
+	fi
+
+	# 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
+
+	dosym flex /usr/bin/lex
+}


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/flex/, sys-devel/flex/files/
@ 2022-10-27 23:46 Sam James
  0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2022-10-27 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     0ca92815271c88de49c6f061e9ac81e7ed2b6108
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 27 23:45:27 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 27 23:45:34 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ca92815

sys-devel/flex: fix build w/o flex

We touch a file which has a generated derivative, so regenerate that.

Closes: https://bugs.gentoo.org/878339
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/flex/Manifest                            |  1 +
 .../flex/files/flex-2.6.4-implicit-func-decl.patch | 50 ----------------------
 sys-devel/flex/flex-2.6.4-r3.ebuild                |  3 +-
 3 files changed, 3 insertions(+), 51 deletions(-)

diff --git a/sys-devel/flex/Manifest b/sys-devel/flex/Manifest
index 327f0405ede2..0e5c2985d561 100644
--- a/sys-devel/flex/Manifest
+++ b/sys-devel/flex/Manifest
@@ -1 +1,2 @@
+DIST flex-2.6.4-implicit-func-decl.patch.xz 6572 BLAKE2B 7b2eb1d240e46470c4899b667fc6fbb1d0f91d784d67bb47f351c35683bda4d3c5d59479a8a26f1d9250fd9f6ce9e8b77ee7c53183c09735e898b48cd74bcb88 SHA512 cf7e5ac35b617b40ac3ca3dcf5c5ec5e81a1a48b99348c646aa68f61f3a83cbda3c9a6e820ad275f994220a6290518c4f56bdba9c0ed303cf27e60a75f4eb88c
 DIST flex-2.6.4.tar.gz 1419096 BLAKE2B c003d4f764f7f4d41e33af7ee28c2af272a9f0aee6ba7c2494ba96722d8d0b18f7a3f745217e9a2cecb43b6863328267a810280670c04464156b3eb3d7ee9d62 SHA512 e9785f3d620a204b7d20222888917dc065c2036cae28667065bf7862dfa1b25235095a12fd04efdbd09bfd17d3452e6b9ef953a8c1137862ff671c97132a082e

diff --git a/sys-devel/flex/files/flex-2.6.4-implicit-func-decl.patch b/sys-devel/flex/files/flex-2.6.4-implicit-func-decl.patch
deleted file mode 100644
index 1900ae0529b9..000000000000
--- a/sys-devel/flex/files/flex-2.6.4-implicit-func-decl.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-https://github.com/westes/flex/commit/4b5111d9772b5c160340ca96f08d30d7f6db5cda
-https://github.com/westes/flex/issues/436
-https://bugs.gentoo.org/705800
-https://developers.redhat.com/blog/2019/04/22/implicit-function-declarations-flexs-use-of-reallocarray
-
-From 4b5111d9772b5c160340ca96f08d30d7f6db5cda Mon Sep 17 00:00:00 2001
-From: Explorer09 <explorer09@gmail.com>
-Date: Mon, 4 Sep 2017 08:28:53 +0800
-Subject: [PATCH] scanner: Include flexdef.h at %top block of scan.l
-
-config.h may define macros that alter the API of the standard library
-funtions, and so it should be included before any other standard
-header, even before the skeleton's standard header inclusion.
-
-For example: config.h may #define _GNU_SOURCE that would expose the
-reallocarray() prototype from <stdlib.h> on glibc 2.26+ systems. If we
-include <stdlib.h> before config.h, reallocarray() would not be
-available for use in lex file since the second include doesn't help
-due to header guard.
-
-For now our config.h might `#define malloc rpl_malloc` -- this
-substitution must work before including stdlib.h, or else the compiler
-will complain about missing prototypes, and may result in incorrect
-code in scan.l (gcc warning: return makes pointer from integer without
-a cast [-Wint-conversion]).
-
-Fixes #247.
---- a/src/scan.l
-+++ b/src/scan.l
-@@ -1,5 +1,11 @@
- /* scan.l - scanner for flex input -*-C-*- */
- 
-+%top{
-+/* flexdef.h includes config.h, which may contain macros that alter the API */
-+/* of libc functions. Must include first before any libc header. */
-+#include "flexdef.h"
-+}
-+
- %{
- /*  Copyright (c) 1990 The Regents of the University of California. */
- /*  All rights reserved. */
-@@ -32,7 +38,6 @@
- /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
- /*  PURPOSE. */
- 
--#include "flexdef.h"
- #include "parse.h"
- extern bool tablesverify, tablesext;
- extern int trlcontxt; /* Set in  parse.y for each rule. */
-

diff --git a/sys-devel/flex/flex-2.6.4-r3.ebuild b/sys-devel/flex/flex-2.6.4-r3.ebuild
index 1f1ebfe61893..1fe2eb9549ec 100644
--- a/sys-devel/flex/flex-2.6.4-r3.ebuild
+++ b/sys-devel/flex/flex-2.6.4-r3.ebuild
@@ -8,6 +8,7 @@ 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}-implicit-func-decl.patch.xz"
 
 LICENSE="FLEX"
 SLOT="0"
@@ -24,7 +25,7 @@ BDEPEND="${RDEPEND}
 PATCHES=(
 	"${FILESDIR}"/${PN}-2.6.4-libobjdir.patch
 	"${FILESDIR}"/${PN}-2.6.4-fix-build-with-glibc2.6+.patch
-	"${FILESDIR}"/${P}-implicit-func-decl.patch
+	"${WORKDIR}"/${P}-implicit-func-decl.patch
 )
 
 src_prepare() {


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/flex/, sys-devel/flex/files/
@ 2022-10-28  1:54 Sam James
  0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2022-10-28  1:54 UTC (permalink / raw
  To: gentoo-commits

commit:     af4a94a1b5b778c0d983fbe6370b5ded4e6b54e1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 28 00:35:41 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 28 01:54:19 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af4a94a1

sys-devel/flex: backport further macro fixes

The gist is that the original glibc-2.26 patch was incomplete
and didn't help with cross-compilation or non-glibc environments
fully.

There were a succession of further upstream commits
now backported here. Noticed when doing some more Clang 16 work.

This complements bec6a7be57fc3493dccef497b5d4b513c315f5f1 in that
more effort is taken to ensure all necessary macros are defined
so needed functions are available.

Bug: https://bugs.gentoo.org/628744
Bug: https://bugs.gentoo.org/705800
See: bec6a7be57fc3493dccef497b5d4b513c315f5f1
See: 4d77781e2db7bb8bef7f390c43efc04ba58ff7bb
See: aa6c077d00c3a21b75ae646421aefadcad527f80
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/flex/Manifest                            |   2 +-
 .../flex-2.6.4-fix-build-with-glibc2.26.patch      | 219 +++++++++++++++++++++
 .../{flex-2.6.4-r3.ebuild => flex-2.6.4-r4.ebuild} |  20 +-
 3 files changed, 233 insertions(+), 8 deletions(-)

diff --git a/sys-devel/flex/Manifest b/sys-devel/flex/Manifest
index 0e5c2985d561..34ccf066269d 100644
--- a/sys-devel/flex/Manifest
+++ b/sys-devel/flex/Manifest
@@ -1,2 +1,2 @@
-DIST flex-2.6.4-implicit-func-decl.patch.xz 6572 BLAKE2B 7b2eb1d240e46470c4899b667fc6fbb1d0f91d784d67bb47f351c35683bda4d3c5d59479a8a26f1d9250fd9f6ce9e8b77ee7c53183c09735e898b48cd74bcb88 SHA512 cf7e5ac35b617b40ac3ca3dcf5c5ec5e81a1a48b99348c646aa68f61f3a83cbda3c9a6e820ad275f994220a6290518c4f56bdba9c0ed303cf27e60a75f4eb88c
+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

diff --git a/sys-devel/flex/files/flex-2.6.4-fix-build-with-glibc2.26.patch b/sys-devel/flex/files/flex-2.6.4-fix-build-with-glibc2.26.patch
new file mode 100644
index 000000000000..9a9de8746b89
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.6.4-fix-build-with-glibc2.26.patch
@@ -0,0 +1,219 @@
+https://github.com/westes/flex/issues/436
+https://bugs.gentoo.org/705800
+https://developers.redhat.com/blog/2019/04/22/implicit-function-declarations-flexs-use-of-reallocarray
+https://github.com/westes/flex/commit/4b5111d9772b5c160340ca96f08d30d7f6db5cda
+https://github.com/westes/flex/commit/24fd0551333e7eded87b64dd36062da3df2f6380
+https://github.com/westes/flex/commit/0db9f8903a446e7026874be519b8dc55a471f014
+https://github.com/westes/flex/commit/a17d79e9c722a6735b6d2a8f152287404f27df32
+https://github.com/westes/flex/commit/4081efa0831b15d7e4e4255401c225ad8262426d
+https://github.com/westes/flex/commit/1985bb3c7abed940e91ad816504ef08a18c3b7c1
+
+From 4b5111d9772b5c160340ca96f08d30d7f6db5cda Mon Sep 17 00:00:00 2001
+From: Explorer09 <explorer09@gmail.com>
+Date: Mon, 4 Sep 2017 08:28:53 +0800
+Subject: [PATCH] scanner: Include flexdef.h at %top block of scan.l
+
+config.h may define macros that alter the API of the standard library
+funtions, and so it should be included before any other standard
+header, even before the skeleton's standard header inclusion.
+
+For example: config.h may #define _GNU_SOURCE that would expose the
+reallocarray() prototype from <stdlib.h> on glibc 2.26+ systems. If we
+include <stdlib.h> before config.h, reallocarray() would not be
+available for use in lex file since the second include doesn't help
+due to header guard.
+
+For now our config.h might `#define malloc rpl_malloc` -- this
+substitution must work before including stdlib.h, or else the compiler
+will complain about missing prototypes, and may result in incorrect
+code in scan.l (gcc warning: return makes pointer from integer without
+a cast [-Wint-conversion]).
+
+Fixes #247.
+--- a/src/scan.l
++++ b/src/scan.l
+@@ -1,5 +1,11 @@
+ /* scan.l - scanner for flex input -*-C-*- */
+ 
++%top{
++/* flexdef.h includes config.h, which may contain macros that alter the API */
++/* of libc functions. Must include first before any libc header. */
++#include "flexdef.h"
++}
++
+ %{
+ /*  Copyright (c) 1990 The Regents of the University of California. */
+ /*  All rights reserved. */
+@@ -32,7 +38,6 @@
+ /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
+ /*  PURPOSE. */
+ 
+-#include "flexdef.h"
+ #include "parse.h"
+ extern bool tablesverify, tablesext;
+ extern int trlcontxt; /* Set in  parse.y for each rule. */
+
+From 24fd0551333e7eded87b64dd36062da3df2f6380 Mon Sep 17 00:00:00 2001
+From: Explorer09 <explorer09@gmail.com>
+Date: Mon, 4 Sep 2017 10:47:33 +0800
+Subject: [PATCH] build: AC_USE_SYSTEM_EXTENSIONS in configure.ac.
+
+This would, e.g. define _GNU_SOURCE in config.h, enabling the
+reallocarray() prototype in glibc 2.26+ on Linux systems with that
+version of glibc.
+
+Fixes #241.
+--- a/configure.ac
++++ b/configure.ac
+@@ -25,8 +25,10 @@
+ # autoconf requirements and initialization
+ 
+ AC_INIT([the fast lexical analyser generator],[2.6.4],[flex-help@lists.sourceforge.net],[flex])
++AC_PREREQ([2.60])
+ AC_CONFIG_SRCDIR([src/scan.l])
+ AC_CONFIG_AUX_DIR([build-aux])
++AC_USE_SYSTEM_EXTENSIONS
+ LT_INIT
+ AM_INIT_AUTOMAKE([1.15 -Wno-portability foreign std-options dist-lzip parallel-tests subdir-objects])
+ AC_CONFIG_HEADER([src/config.h])
+
+
+From 0db9f8903a446e7026874be519b8dc55a471f014 Mon Sep 17 00:00:00 2001
+From: Lukasz Baj <l.baj@radytek.com>
+Date: Fri, 22 Sep 2017 10:24:46 +0200
+Subject: [PATCH] build: Remove custom reallocarray() declaration.
+
+Use one from <stdlib.h> instead because that is more portable.
+--- a/src/flexdef.h
++++ b/src/flexdef.h
+@@ -631,10 +631,6 @@ extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
+ extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
+ extern int num_backing_up, bol_needed;
+ 
+-#ifndef HAVE_REALLOCARRAY
+-void *reallocarray(void *, size_t, size_t);
+-#endif
+-
+ void   *allocate_array(int, size_t);
+ void   *reallocate_array(void *, int, size_t);
+ 
+
+From a17d79e9c722a6735b6d2a8f152287404f27df32 Mon Sep 17 00:00:00 2001
+From: Explorer09 <explorer09@gmail.com>
+Date: Sat, 14 Oct 2017 00:36:54 +0800
+Subject: [PATCH] scanner: Define _POSIX_C_SOURCE when needed in skeleton.
+
+The function fileno() is defined by POSIX. When flex would otherwise not provide that feature macro, we define it.
+
+Fixes #263
+--- a/src/flex.skl
++++ b/src/flex.skl
+@@ -218,6 +218,14 @@ m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
+ 
+ /* begin standard C headers. */
+ %if-c-only
++m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], ,
++[[m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]], ,
++[[#ifndef _POSIX_C_SOURCE
++#define _POSIX_C_SOURCE 1 /* for fileno() */
++#ifndef _POSIX_SOURCE
++#define _POSIX_SOURCE 1
++#endif
++#endif]])]])
+ #include <stdio.h>
+ #include <string.h>
+ #include <errno.h>
+
+From 4081efa0831b15d7e4e4255401c225ad8262426d Mon Sep 17 00:00:00 2001
+From: Explorer09 <explorer09@gmail.com>
+Date: Thu, 8 Mar 2018 10:04:36 +0800
+Subject: [PATCH] scanner: Fix glibc features.h dependency in skeleton.
+
+Commit a17d79e9c722a6735b6d2a8f152287404f27df32 defines _POSIX_C_SOURCE
+to the minimum of 1 if it's not defined in the user's scanner code or
+the compiling environment. However in glibc the macros are not yet set
+up until one of the libc headers is included. This unfortunately have
+made us overwrite the default _POSIX_C_SOURCE value that would be
+defined by glibc (200809L at the time of writing), causing regressions
+in user code.
+
+Now in this patch:
+1. Ensure feature test macros have been set up in glibc before checking
+or defining any of them in our skeleton code.
+2. Have a more conservative logic when determining the need to define
+_POSIX_C_SOURCE (required for fileno()).
+
+Fixes: #313
+
+Note:
+It could be tricky for application code to ensure feature test macros
+have been set up in glibc, since <features.h> is no portable header and
+not meant to be included directly by applications. The way to do it is
+to include a libc header which in turn includes <features.h>. However,
+many of the glibc headers check __USE_POSIX (a glibc internal macro
+defined if _POSIX_C_SOURCE is defined) and determine which interfaces
+to expose already, making the headers inappropriate for our goal.
+Those which don't depend on _POSIX_C_SOURCE, and are also available
+since ANSI C89, are only <assert.h>, <errno.h> and <math.h>.
+
+<assert.h> is finally favored due to other considerations:
+- <math.h> check for __USE_XOPEN in glibc, making a dependency on
+_XOPEN_SOURCE, besides it exposes much more interfaces than we need.
+- In djgpp, <errno.h> depends on _POSIX_SOURCE to hide definitions of
+some errno values when it's defined.
+- <assert.h> exposes the fewest interfaces among the 3 headers and, at
+the time of writing, checks for only C99 (for __func__), C11 (for
+_Static_assert), and _GNU_SOURCE when needed.
+
+Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
+--- a/src/flex.skl
++++ b/src/flex.skl
+@@ -220,11 +220,21 @@ m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
+ %if-c-only
+ m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]], ,
+ [[m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]], ,
+-[[#ifndef _POSIX_C_SOURCE
+-#define _POSIX_C_SOURCE 1 /* for fileno() */
+-#ifndef _POSIX_SOURCE
+-#define _POSIX_SOURCE 1
++[[/* Feature test macros. Flex uses functions that require a minimum set of
++ * macros defined. As defining some macros may hide function declarations that
++ * user code might use, be conservative and respect user's definitions as much
++ * as possible. In glibc, feature test macros may not be all set up until one
++ * of the libc header (that includes <features.h>) is included. This creates
++ * a circular dependency when we check the macros. <assert.h> is the safest
++ * header we can include and does not declare too many functions we don't need.
++ */
++#if !defined(__GNU_LIBRARY__) && defined(__STDC__)
++#include <assert.h>
+ #endif
++#if !(defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
++    defined(_POSIX_SOURCE))
++# define _POSIX_C_SOURCE 1 /* Required for fileno() */
++# define _POSIX_SOURCE 1
+ #endif]])]])
+ #include <stdio.h>
+ #include <string.h>
+
+From 1985bb3c7abed940e91ad816504ef08a18c3b7c1 Mon Sep 17 00:00:00 2001
+From: Explorer09 <explorer09@gmail.com>
+Date: Thu, 8 Mar 2018 09:53:24 +0800
+Subject: [PATCH] scanner: correct comments about __STDC_LIMIT_MACROS.
+
+No code changes.
+
+Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
+--- a/src/flexint.h
++++ b/src/flexint.h
+@@ -7,8 +7,8 @@
+ 
+ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ 
+-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+- * if you want the limit (max/min) macros for int types. 
++/* C++ systems might need __STDC_LIMIT_MACROS defined before including
++ * <stdint.h>, if you want the limit (max/min) macros for int types.
+  */
+ #ifndef __STDC_LIMIT_MACROS
+ #define __STDC_LIMIT_MACROS 1
+

diff --git a/sys-devel/flex/flex-2.6.4-r3.ebuild b/sys-devel/flex/flex-2.6.4-r4.ebuild
similarity index 85%
rename from sys-devel/flex/flex-2.6.4-r3.ebuild
rename to sys-devel/flex/flex-2.6.4-r4.ebuild
index 1fe2eb9549ec..0fb0e60d9372 100644
--- a/sys-devel/flex/flex-2.6.4-r3.ebuild
+++ b/sys-devel/flex/flex-2.6.4-r4.ebuild
@@ -8,7 +8,7 @@ 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}-implicit-func-decl.patch.xz"
+SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-autotools-regenerate.patch.xz"
 
 LICENSE="FLEX"
 SLOT="0"
@@ -16,21 +16,27 @@ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~
 IUSE="nls static test"
 RESTRICT="!test? ( test )"
 
-# We want bison explicitly and not yacc in general, bug #381273
 RDEPEND="sys-devel/m4"
-BDEPEND="${RDEPEND}
+# We want bison explicitly and not yacc in general, bug #381273
+BDEPEND="
+	${RDEPEND}
 	nls? ( sys-devel/gettext )
-	test? ( sys-devel/bison )"
+	test? ( sys-devel/bison )
+"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-2.6.4-libobjdir.patch
-	"${FILESDIR}"/${PN}-2.6.4-fix-build-with-glibc2.6+.patch
-	"${WORKDIR}"/${P}-implicit-func-decl.patch
+	"${FILESDIR}"/${P}-libobjdir.patch
+	"${FILESDIR}"/${P}-fix-build-with-glibc2.26.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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-devel/flex/, sys-devel/flex/files/
@ 2023-02-20 13:48 Sam James
  0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2023-02-20 13:48 UTC (permalink / raw
  To: gentoo-commits

commit:     3ab5b78c47ee2dcfdb2de0ae84f43c96d2e9c210
Author:     Yifeng Li <tomli <AT> tomli <DOT> me>
AuthorDate: Mon Feb 20 10:35:16 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 20 13:48:16 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ab5b78c

sys-devel/flex: fix crash on Apple M1 due to undefined behavior.

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 *).

Since the existence of the bug doesn't always prevent a Gentoo
Prefix bootstrapping, it can lurk inside the system and remain
undetected, furthermore, it's technically a C programming bug,
other platforms could've been affected as well in theory. Thus,
we also bump the package version.

Closes: https://bugs.gentoo.org/871324
Signed-off-by: Yifeng Li <tomli <AT> tomli.me>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...x-apple-m1-crash-by-explicit-pointer-cast.patch |  48 ++++++++++
 sys-devel/flex/flex-2.6.4-r6.ebuild                | 101 +++++++++++++++++++++
 2 files changed, 149 insertions(+)

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..6da72c3dfe33
--- /dev/null
+++ b/sys-devel/flex/flex-2.6.4-r6.ebuild
@@ -0,0 +1,101 @@
+# Copyright 1999-2022 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
+}


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-20 13:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-27 23:46 [gentoo-commits] repo/gentoo:master commit in: sys-devel/flex/, sys-devel/flex/files/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2023-02-20 13:48 Sam James
2022-10-28  1:54 Sam James
2022-10-25 11:42 Sam James
2021-04-30 19:03 Andreas Sturmlechner
2017-10-13 20:19 Thomas Deutschmann
2017-03-23 12:20 Lars Wendler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox