summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/flex')
-rw-r--r--sys-devel/flex/Manifest5
-rw-r--r--sys-devel/flex/files/flex-2.5.33-pic.patch12
-rw-r--r--sys-devel/flex/files/flex-2.5.34-isatty.patch53
-rw-r--r--sys-devel/flex/files/flex-2.5.35-gcc44.patch13
-rw-r--r--sys-devel/flex/files/flex-2.5.35-saneautotools.patch77
-rw-r--r--sys-devel/flex/files/flex-2.5.37-proto.patch27
-rw-r--r--sys-devel/flex/files/flex-2.5.37-tests.patch113
-rw-r--r--sys-devel/flex/flex-2.5.35.ebuild43
-rw-r--r--sys-devel/flex/flex-2.5.35_p10.ebuild50
-rw-r--r--sys-devel/flex/flex-2.5.37.ebuild51
-rw-r--r--sys-devel/flex/flex-2.5.38-r1.ebuild40
-rw-r--r--sys-devel/flex/flex-2.5.39-r1.ebuild66
-rw-r--r--sys-devel/flex/flex-2.5.39.ebuild40
-rw-r--r--sys-devel/flex/metadata.xml8
14 files changed, 598 insertions, 0 deletions
diff --git a/sys-devel/flex/Manifest b/sys-devel/flex/Manifest
new file mode 100644
index 000000000000..2acb71534bb8
--- /dev/null
+++ b/sys-devel/flex/Manifest
@@ -0,0 +1,5 @@
+DIST flex-2.5.35.tar.bz2 1256501 SHA256 0becbd4b2b36b99c67f8c22ab98f7f80c9860aec70f0350a0018f29a88704e7b SHA512 aa5aebbc7ccaa4697d7f0cfa3ba899dd3b327bc8551ba341c26bece7f9044951d0532e3ebf6ec63760204b4ff805f9f957d064e9a213ef8aac428e565de31343 WHIRLPOOL 5cb46a2cec84b1c6d25e22a1e4a6ac1a5100fcf32a488918f8bfe9236339ff2aac7f2dc35a590417fe1609d89511ab47de4ba4f7db17251b7408ea0f18e6894d
+DIST flex-2.5.37.tar.bz2 1303313 SHA256 17aa7b4ebf19a13bc2dff4115b416365c95f090061539a932a68092349ac052a SHA512 1f34285953a7f058e6a2dddc305fc82cfcaaa451d6d7777da17bf9cccbe4a08e480c8c28951fa5d2920e7c7adc40ccd0e51191b363c9a3c4137db5ded1cbbc2a WHIRLPOOL ee5a4dde9b373c57248df261a53ea951e12ccb3e6f2e6344c56c2d8393511389560b4843660edf2a0929e2ed6fc46ab8d832e36a8ee5fe4317ce85ccea14d6ca
+DIST flex-2.5.38.tar.xz 1349536 SHA256 3621e0217f6c2088411e5b6fd9f2d83f2fbf014dcdf24e80680f66e6dd93729c SHA512 98d4a722dcb23c0ebca997ef28ae40cebbe65e24adf8700ac9127404d1bcd0e30638d296d639afb092b65b4767f35f5ee0b0bf229ac040ef8029a04694d6d4c2 WHIRLPOOL 56e282bc56ef825a953d1211602de1a243164d09b9b794debffbd7c56830572d24910b20b44b8749173c9bc008bae99406320a5042a4054290b69320a1df3aed
+DIST flex-2.5.39.tar.xz 1347436 SHA256 c988bb3ab340aaba16df5a54ab98bb4760599975375c8ac9388a078b7f27e9e8 SHA512 488bfd40043851d6f069333090081cc09c8754cd098dd24655ea705dd381efc4e88080fe8060fe6c790f450695f1b209f7115b154723c203f43b00f4ccfa5bec WHIRLPOOL 6f46ed30ca3a3ac6449170171205031ab821a0d78aaed36c7faf59c12724f8787092ba1a3ea846e359791476da7f9bb007155caac60e696326445c75c5d70dd5
+DIST flex_2.5.35-10.diff.gz 41011 SHA256 1d57a2a73ae7b7d4bd95a7c3f5801ab39c0b2b55b5d838782da8d3801cc1a3b9 SHA512 ecb64cb5d27da0c82c99958640ee5f09afff4096a93817f68f3333f86a838ab4f21daf959bfc650b89e0d52a827c55265cb4c4a4f9efab050a8f91dd82258820 WHIRLPOOL 4fa27c32d81c766e657645816e4a24e46b126e5eb38ad38fc66a7d3d3e3100b76ec694898dcbcc486687f4ec9d89d517a670f7ca20de22586d2f0b56a7fe50cd
diff --git a/sys-devel/flex/files/flex-2.5.33-pic.patch b/sys-devel/flex/files/flex-2.5.33-pic.patch
new file mode 100644
index 000000000000..88ac8b3ce98a
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.33-pic.patch
@@ -0,0 +1,12 @@
+--- Makefile.in 2007-02-06 12:27:32.000000000 +0100
++++ Makefile.in.new 2007-02-06 12:29:50.000000000 +0100
+@@ -993,7 +993,9 @@
+ ecs.o: ecs.c flexdef.h flexint.h
+ gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
+ libmain.o: libmain.c
++ $(COMPILE) -fPIC -DPIC -o libmain.o -c libmain.c
+ libyywrap.o: libyywrap.c
++ $(COMPILE) -fPIC -DPIC -o libyywrap.o -c libyywrap.c
+ main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
+ tables.h tables_shared.h
+ misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
diff --git a/sys-devel/flex/files/flex-2.5.34-isatty.patch b/sys-devel/flex/files/flex-2.5.34-isatty.patch
new file mode 100644
index 000000000000..b397433c5c57
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.34-isatty.patch
@@ -0,0 +1,53 @@
+Declare the isatty prototype all the time ... otherwise packages like
+doxygen and ttmkfdir fail to build.
+
+http://bugs.gentoo.org/119598
+
+--- flex/scan.c
++++ flex/scan.c
+@@ -4179,9 +4179,19 @@
+ yyfree((void *) b );
+ }
+
++#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */
+-#ifndef __cplusplus
++#ifdef __cplusplus
++extern "C" {
++#endif
++#ifdef __THROW /* this is a gnuism */
++extern int isatty (int ) __THROW;
++#else
+ extern int isatty (int );
++#endif
+-#endif /* __cplusplus */
++#ifdef __cplusplus
++}
++#endif
++#endif
+
+ /* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+--- flex/skel.c
++++ flex/skel.c
+@@ -2183,9 +2183,19 @@
+ "[[",
+ " m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,",
+ " [[",
++ "#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */",
+- "#ifndef __cplusplus",
++ "#ifdef __cplusplus",
++ "extern \"C\" {",
++ "#endif",
++ "#ifdef __THROW /* this is a gnuism */",
++ "extern int isatty M4_YY_PARAMS( int ) __THROW;",
++ "#else",
+ "extern int isatty M4_YY_PARAMS( int );",
++ "#endif",
+- "#endif /* __cplusplus */",
++ "#ifdef __cplusplus",
++ "}",
++ "#endif",
++ "#endif",
+ " ]])",
+ "]])",
+ "%endif",
diff --git a/sys-devel/flex/files/flex-2.5.35-gcc44.patch b/sys-devel/flex/files/flex-2.5.35-gcc44.patch
new file mode 100644
index 000000000000..69045bee9151
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.35-gcc44.patch
@@ -0,0 +1,13 @@
+https://sourceforge.net/tracker/?func=detail&aid=2178663&group_id=97492&atid=618177
+
+diff -Naurp flex-2.5.35-orig/skel.c flex-2.5.35/skel.c
+--- flex-2.5.35-orig/skel.c 2009-03-25 22:21:16.000000000 -0600
++++ flex-2.5.35/skel.c 2009-03-25 22:22:22.000000000 -0600
+@@ -286,6 +286,7 @@ const char *skel[] = {
+ "#include <errno.h>",
+ "#include <cstdlib>",
+ "#include <cstring>",
++ "#include <cstdio>",
+ "/* end standard C++ headers. */",
+ "%endif",
+ "",
diff --git a/sys-devel/flex/files/flex-2.5.35-saneautotools.patch b/sys-devel/flex/files/flex-2.5.35-saneautotools.patch
new file mode 100644
index 000000000000..fd8487a71e83
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.35-saneautotools.patch
@@ -0,0 +1,77 @@
+Index: flex-2.5.35/configure.in
+===================================================================
+--- flex-2.5.35.orig/configure.in
++++ flex-2.5.35/configure.in
+@@ -39,6 +39,7 @@ AM_GNU_GETTEXT_VERSION(0.12)
+ AC_PROG_YACC
+ AM_PROG_LEX
+ AC_PROG_CC
++AM_PROG_CC_C_O
+ AC_PROG_CXX
+ AC_PROG_LN_S
+ AC_PROG_RANLIB
+@@ -103,13 +104,6 @@ AC_HEADER_STDBOOL
+ AC_C_CONST
+ AC_TYPE_SIZE_T
+
+-# Checks for library functions.
+-
+-AC_FUNC_FORK
+-AC_FUNC_MALLOC
+-AC_FUNC_REALLOC
+-AC_CHECK_FUNCS([dup2 isascii memset pow regcomp setlocale strchr strtol])
+-
+ AC_CONFIG_FILES(
+ Makefile
+ doc/Makefile
+Index: flex-2.5.35/Makefile.am
+===================================================================
+--- flex-2.5.35.orig/Makefile.am
++++ flex-2.5.35/Makefile.am
+@@ -127,33 +127,6 @@ LIBS = @LIBINTL@ @LIBS@
+ skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
+ sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | $(m4) -P -DFLEX_MAJOR_VERSION=`echo $(VERSION)|cut -f 1 -d .` -DFLEX_MINOR_VERSION=`echo $(VERSION)|cut -f 2 -d .` -DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` | sed 's/m4postproc_/m4_/g' | $(SHELL) $(srcdir)/mkskel.sh >skel.c
+
+-# Explicitly describe dependencies.
+-# You can recreate this with `gcc -I. -MM *.c'
+-buf.o: buf.c flexdef.h flexint.h
+-ccl.o: ccl.c flexdef.h flexint.h
+-dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h
+-ecs.o: ecs.c flexdef.h flexint.h
+-scanflags.o: scanflags.c flexdef.h flexint.h
+-gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
+-libmain.o: libmain.c
+-libyywrap.o: libyywrap.c
+-main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
+- tables.h tables_shared.h
+-misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
+-nfa.o: nfa.c flexdef.h flexint.h
+-options.o: options.c options.h scanopt.h flexdef.h flexint.h
+-parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h
+-scan.o: scan.c flexdef.h flexint.h parse.h
+-scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h
+-skel.o: skel.c flexdef.h flexint.h
+-sym.o: sym.c flexdef.h flexint.h
+-tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h
+-tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \
+- tables_shared.h
+-tblcmp.o: tblcmp.c flexdef.h flexint.h
+-yylex.o: yylex.c flexdef.h flexint.h parse.h
+-filter.o: filter.c flexdef.h flexint.h
+-
+ # Create the ChangeLog, but only if we're inside a cvs working directory
+
+ ChangeLog: $(srcdir)/tools/cvsauthors $(srcdir)/tools/cvs2cl.pl
+Index: flex-2.5.35/tests/test-pthread/Makefile.am
+===================================================================
+--- flex-2.5.35.orig/tests/test-pthread/Makefile.am
++++ flex-2.5.35/tests/test-pthread/Makefile.am
+@@ -27,7 +27,7 @@ CLEANFILES = scanner.c scanner.h parser.
+ OBJS = scanner.o # parser.o
+
+ AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
+-LDFLAGS = -lpthread
++LOADLIBES = -lpthread
+ #LFLAGS = --header="scanner.h"
+ #YFLAGS = --defines --output=parser.c
+
diff --git a/sys-devel/flex/files/flex-2.5.37-proto.patch b/sys-devel/flex/files/flex-2.5.37-proto.patch
new file mode 100644
index 000000000000..5d3c30ff18d2
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.37-proto.patch
@@ -0,0 +1,27 @@
+From 0f9eb0b8455f843daebf0f3dababeee7f3cde48b Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sat, 4 Aug 2012 15:46:38 -0400
+Subject: [PATCH] add prototype for lerrsf_fatal
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ flexdef.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/flexdef.h b/flexdef.h
+index 0e81410..046dd9a 100644
+--- a/flexdef.h
++++ b/flexdef.h
+@@ -908,6 +908,9 @@ extern void lerrif PROTO ((const char *, int));
+ /* Report an error message formatted with one string argument. */
+ extern void lerrsf PROTO ((const char *, const char *));
+
++/* Like lerrsf, but also exit after displaying message. */
++extern void lerrsf_fatal PROTO ((const char *, const char *));
++
+ /* Spit out a "#line" statement. */
+ extern void line_directive_out PROTO ((FILE *, int));
+
+--
+1.7.9.7
+
diff --git a/sys-devel/flex/files/flex-2.5.37-tests.patch b/sys-devel/flex/files/flex-2.5.37-tests.patch
new file mode 100644
index 000000000000..56d441a351e6
--- /dev/null
+++ b/sys-devel/flex/files/flex-2.5.37-tests.patch
@@ -0,0 +1,113 @@
+From 095b0bf0a730d46d301c0e2fb2e7af40caeb2c9b Mon Sep 17 00:00:00 2001
+From: Elias Pipping <pipping@users.sourceforge.net>
+Date: Mon, 6 Aug 2012 15:13:23 -0400
+Subject: [PATCH] Fix two tests to pass under bison 2.6
+
+Given that bison is moving forward with the %parse-param instead of
+YYPARSE_PARAM syntax, it makes sense to switch over to using the new style
+declaration. In particular, this means that flex scanners that use bison
+features will now require bison 2.6 or higher.
+
+Signed-off-by: Will Estes <westes575@gmail.com>
+---
+ tests/test-bison-yylloc/main.c | 2 --
+ tests/test-bison-yylloc/parser.y | 6 +++---
+ tests/test-bison-yylval/main.c | 2 --
+ tests/test-bison-yylval/parser.y | 6 ++----
+ 4 files changed, 5 insertions(+), 11 deletions(-)
+
+diff --git a/tests/test-bison-yylloc/main.c b/tests/test-bison-yylloc/main.c
+index 082c88c..24568a9 100644
+--- a/tests/test-bison-yylloc/main.c
++++ b/tests/test-bison-yylloc/main.c
+@@ -24,8 +24,6 @@
+ #include "parser.h"
+ #include "scanner.h"
+
+-extern int testparse(yyscan_t);
+-
+ int main ( int argc, char** argv )
+ {
+ yyscan_t scanner;
+diff --git a/tests/test-bison-yylloc/parser.y b/tests/test-bison-yylloc/parser.y
+index aaee976..e8f4e56 100644
+--- a/tests/test-bison-yylloc/parser.y
++++ b/tests/test-bison-yylloc/parser.y
+@@ -21,6 +21,8 @@
+ * PURPOSE.
+ */
+
++%parse-param { void* scanner }
++
+ /*
+ How to compile:
+ bison --defines --output-file="parser.c" --name-prefix="test" parser.y
+@@ -32,10 +34,8 @@
+ #include "config.h"
+
+ #define YYERROR_VERBOSE 1
+-#define YYPARSE_PARAM scanner
+ #define YYLEX_PARAM scanner
+
+-int yyerror(char* msg);
+ extern int testget_lineno(void*);
+
+
+@@ -89,7 +89,7 @@ line:
+
+ %%
+
+-int yyerror(char* msg) {
++int yyerror(void* scanner, char* msg) {
+ fprintf(stderr,"%s\n",msg);
+ return 0;
+ }
+diff --git a/tests/test-bison-yylval/main.c b/tests/test-bison-yylval/main.c
+index 165e672..30c4314 100644
+--- a/tests/test-bison-yylval/main.c
++++ b/tests/test-bison-yylval/main.c
+@@ -24,8 +24,6 @@
+ #include "parser.h"
+ #include "scanner.h"
+
+-extern int testparse(yyscan_t);
+-
+ int main ( int argc, char** argv )
+ {
+ yyscan_t scanner;
+diff --git a/tests/test-bison-yylval/parser.y b/tests/test-bison-yylval/parser.y
+index 77bac87..0ffdb89 100644
+--- a/tests/test-bison-yylval/parser.y
++++ b/tests/test-bison-yylval/parser.y
+@@ -25,6 +25,7 @@
+ How to compile:
+ bison --defines --output-file="parser.c" --name-prefix="test" parser.y
+ */
++%parse-param { void* scanner }
+ %{
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -32,11 +33,8 @@
+ #include "config.h"
+
+ #define YYERROR_VERBOSE 1
+-#define YYPARSE_PARAM scanner
+ #define YYLEX_PARAM scanner
+
+-int yyerror(char* msg);
+-
+
+ /* A dummy function. A check against seg-faults in yylval->str. */
+ int process_text(char* s) {
+@@ -76,7 +74,7 @@ starttag: LT TAGNAME GT { process_text($2); free($2);} ;
+ endtag: LTSLASH TAGNAME GT { process_text($2);free($2);} ;
+ %%
+
+-int yyerror(char* msg) {
++int yyerror(void* scanner, char* msg) {
+ fprintf(stderr,"%s\n",msg);
+ return 0;
+ }
+--
+1.7.9.7
+
diff --git a/sys-devel/flex/flex-2.5.35.ebuild b/sys-devel/flex/flex-2.5.35.ebuild
new file mode 100644
index 000000000000..8477cb9e20be
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.35.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic
+
+#DEB_VER=36
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${P}.tar.bz2"
+# mirror://debian/pool/main/f/flex/${PN}_${PV}-${DEB_VER}.diff.gz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
+IUSE="nls static test"
+
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ [[ -n ${DEB_VER} ]] && epatch "${WORKDIR}"/${PN}_${PV}-${DEB_VER}.diff
+ epatch "${FILESDIR}"/${PN}-2.5.34-isatty.patch #119598
+ epatch "${FILESDIR}"/${PN}-2.5.33-pic.patch
+ epatch "${FILESDIR}"/${PN}-2.5.35-gcc44.patch
+ sed -i 's:^LDFLAGS:LOADLIBES:' tests/test-pthread/Makefile.in #262989
+}
+
+src_compile() {
+ use static && append-ldflags -static
+ econf $(use_enable nls) || die
+ emake || die
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die "make install failed"
+ dodoc AUTHORS ChangeLog NEWS ONEWS README* THANKS TODO
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.35_p10.ebuild b/sys-devel/flex/flex-2.5.35_p10.ebuild
new file mode 100644
index 000000000000..2b58515fc0bc
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.35_p10.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic autotools
+
+if [[ ${PV} == *_p* ]]; then
+ DEB_DIFF=${PN}_${PV/_p/-}
+fi
+
+MY_P=${P%_p*}
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${MY_P}.tar.bz2
+ ${DEB_DIFF:+mirror://debian/pool/main/f/flex/${DEB_DIFF}.diff.gz}"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE="nls static test"
+
+# We want bison explicitly and not yacc in general #381273
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ [[ -n ${DEB_DIFF} ]] && epatch "${WORKDIR}"/${DEB_DIFF}.diff
+ epatch "${FILESDIR}"/${PN}-2.5.35-gcc44.patch
+ epatch "${FILESDIR}"/${PN}-2.5.35-saneautotools.patch
+
+ eautoreconf
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ econf $(use_enable nls)
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die "make install failed"
+ dodoc AUTHORS ChangeLog NEWS ONEWS README* THANKS TODO || die
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.37.ebuild b/sys-devel/flex/flex-2.5.37.ebuild
new file mode 100644
index 000000000000..dc37f634f0c2
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.37.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+if [[ ${PV} == *_p* ]] ; then
+ DEB_DIFF=${PN}_${PV/_p/-}
+fi
+MY_P=${P%_p*}
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${MY_P}.tar.bz2
+ ${DEB_DIFF:+mirror://debian/pool/main/f/flex/${DEB_DIFF}.diff.gz}"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
+IUSE="nls static test"
+
+# We want bison explicitly and not yacc in general #381273
+RDEPEND="sys-devel/m4"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )
+ test? ( sys-devel/bison )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ [[ -n ${DEB_DIFF} ]] && epatch "${WORKDIR}"/${DEB_DIFF}.diff
+ epatch "${FILESDIR}"/${P}-proto.patch
+ epatch "${FILESDIR}"/${P}-tests.patch #429954
+ sed -i "/^AR =/s:=.*:= $(tc-getAR):" Makefile.in || die #444086
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ econf \
+ $(use_enable nls) \
+ --docdir="${EPREFIX}"/usr/share/doc/${PF}
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die
+ rm "${ED}"/usr/share/doc/${PF}/{COPYING,flex.pdf} || die
+ dodoc AUTHORS ChangeLog NEWS ONEWS README* THANKS TODO
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.38-r1.ebuild b/sys-devel/flex/flex-2.5.38-r1.ebuild
new file mode 100644
index 000000000000..7faf4211d8ba
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.38-r1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${P}.tar.xz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-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 )"
+
+src_configure() {
+ use static && append-ldflags -static
+ # Do not install shared libs #503522
+ econf \
+ --disable-shared \
+ $(use_enable nls) \
+ --docdir='$(datarootdir)/doc/'${PF}
+}
+
+src_install() {
+ default
+ dodoc ONEWS
+ find "${ED}" -name '*.la' -delete
+ rm "${ED}"/usr/share/doc/${PF}/{COPYING,flex.pdf} || die
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.39-r1.ebuild b/sys-devel/flex/flex-2.5.39-r1.ebuild
new file mode 100644
index 000000000000..ae1708c435ca
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.39-r1.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils flag-o-matic multilib-minimal
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${P}.tar.xz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-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 )"
+
+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
+ 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
+ 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,flex.pdf} || die
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/flex-2.5.39.ebuild b/sys-devel/flex/flex-2.5.39.ebuild
new file mode 100644
index 000000000000..7faf4211d8ba
--- /dev/null
+++ b/sys-devel/flex/flex-2.5.39.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit flag-o-matic
+
+DESCRIPTION="The Fast Lexical Analyzer"
+HOMEPAGE="http://flex.sourceforge.net/"
+SRC_URI="mirror://sourceforge/flex/${P}.tar.xz"
+
+LICENSE="FLEX"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-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 )"
+
+src_configure() {
+ use static && append-ldflags -static
+ # Do not install shared libs #503522
+ econf \
+ --disable-shared \
+ $(use_enable nls) \
+ --docdir='$(datarootdir)/doc/'${PF}
+}
+
+src_install() {
+ default
+ dodoc ONEWS
+ find "${ED}" -name '*.la' -delete
+ rm "${ED}"/usr/share/doc/${PF}/{COPYING,flex.pdf} || die
+ dosym flex /usr/bin/lex
+}
diff --git a/sys-devel/flex/metadata.xml b/sys-devel/flex/metadata.xml
new file mode 100644
index 000000000000..00f4c58c1f89
--- /dev/null
+++ b/sys-devel/flex/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>base-system</herd>
+ <upstream>
+ <remote-id type="sourceforge">flex</remote-id>
+ </upstream>
+</pkgmetadata>