flex: upgraded package to upstream

Upgraded sys-devel/flex to version 2.5.39-r1 for all

BUG=chromium:417051
TEST=`cbuildbot chromiumos-sdk` passes (builds sdk and 3 boards)

Change-Id: Icdb555732c1d314b3b2383ba7e68c84bec4b360b
Reviewed-on: https://chromium-review.googlesource.com/222081
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sys-devel/flex/Manifest b/sys-devel/flex/Manifest
index 66a97f0..b627eb5 100644
--- a/sys-devel/flex/Manifest
+++ b/sys-devel/flex/Manifest
@@ -1 +1 @@
-DIST flex-2.5.37.tar.bz2 1303313 SHA256 17aa7b4ebf19a13bc2dff4115b416365c95f090061539a932a68092349ac052a SHA512 1f34285953a7f058e6a2dddc305fc82cfcaaa451d6d7777da17bf9cccbe4a08e480c8c28951fa5d2920e7c7adc40ccd0e51191b363c9a3c4137db5ded1cbbc2a WHIRLPOOL ee5a4dde9b373c57248df261a53ea951e12ccb3e6f2e6344c56c2d8393511389560b4843660edf2a0929e2ed6fc46ab8d832e36a8ee5fe4317ce85ccea14d6ca
+DIST flex-2.5.39.tar.xz 1347436 SHA256 c988bb3ab340aaba16df5a54ab98bb4760599975375c8ac9388a078b7f27e9e8 SHA512 488bfd40043851d6f069333090081cc09c8754cd098dd24655ea705dd381efc4e88080fe8060fe6c790f450695f1b209f7115b154723c203f43b00f4ccfa5bec WHIRLPOOL 6f46ed30ca3a3ac6449170171205031ab821a0d78aaed36c7faf59c12724f8787092ba1a3ea846e359791476da7f9bb007155caac60e696326445c75c5d70dd5
diff --git a/sys-devel/flex/files/flex-2.5.37-proto.patch b/sys-devel/flex/files/flex-2.5.37-proto.patch
deleted file mode 100644
index 5d3c30f..0000000
--- a/sys-devel/flex/files/flex-2.5.37-proto.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-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
deleted file mode 100644
index 56d441a..0000000
--- a/sys-devel/flex/files/flex-2.5.37-tests.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-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.37.ebuild b/sys-devel/flex/flex-2.5.37.ebuild
deleted file mode 100644
index 98ce819..0000000
--- a/sys-devel/flex/flex-2.5.37.ebuild
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/flex/flex-2.5.37.ebuild,v 1.14 2013/04/27 10:14:35 vapier Exp $
-
-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="*"
-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.39-r1.ebuild b/sys-devel/flex/flex-2.5.39-r1.ebuild
new file mode 100644
index 0000000..97af69d
--- /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
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/flex/flex-2.5.39-r1.ebuild,v 1.10 2014/09/15 08:23:54 ago Exp $
+
+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="*"
+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
+}