summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-04 18:16:57 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-11-04 18:16:57 -0800
commit0960e23e38178233fc295c3d87760f6f8fac58bf (patch)
tree5c65b4816581732cc8db33152aad1eb0546d7efa
parentc29d6e204b4dfe99a2f08c258652823e4c26c324 (diff)
downloadflex-0960e23e38178233fc295c3d87760f6f8fac58bf.tar.gz
flex-0960e23e38178233fc295c3d87760f6f8fac58bf.tar.bz2
flex-0960e23e38178233fc295c3d87760f6f8fac58bf.zip
add packaging
-rw-r--r--packaging/baselibs.conf1
-rw-r--r--packaging/flex-2.5.33-yylineno.patch36
-rw-r--r--packaging/flex-2.5.34-asneeded.patch15
-rw-r--r--packaging/flex-2.5.34-doc-fix.diff96
-rw-r--r--packaging/flex-2.5.34-fPIC.patch34
-rw-r--r--packaging/flex-2.5.34-g++44.diff12
-rw-r--r--packaging/flex.spec62
7 files changed, 256 insertions, 0 deletions
diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf
new file mode 100644
index 0000000..b03c40c
--- /dev/null
+++ b/packaging/baselibs.conf
@@ -0,0 +1 @@
+flex
diff --git a/packaging/flex-2.5.33-yylineno.patch b/packaging/flex-2.5.33-yylineno.patch
new file mode 100644
index 0000000..495efeb
--- /dev/null
+++ b/packaging/flex-2.5.33-yylineno.patch
@@ -0,0 +1,36 @@
+--- main.c
++++ main.c
+@@ -1633,9 +1633,11 @@
+
+ if (!C_plus_plus && !reentrant) {
+ outn ("extern int yylineno;");
+- OUT_BEGIN_CODE ();
+- outn ("int yylineno = 1;");
+- OUT_END_CODE ();
++ if (do_yylineno) {
++ OUT_BEGIN_CODE ();
++ outn ("int yylineno = 1;");
++ OUT_END_CODE ();
++ }
+ }
+
+ if (C_plus_plus) {
+--- flex.skl
++++ flex.skl
+@@ -80,6 +80,16 @@
+ m4preproc_define(`M4_GEN_PREFIX',
+ ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
+
++%# don't use yylineno in non-reentrant scanners when %option yylineno not given
++m4_ifdef( [[M4_YY_REENTRANT]],,
++ [[m4_ifdef( [[M4_YY_USE_LINENO]],,
++ [[
++ m4_define( [[M4_YY_NO_GET_LINENO]], [[]])
++ m4_define( [[M4_YY_NO_SET_LINENO]], [[]])
++ ]])
++ ]]
++)
++
+ %if-c++-only
+ /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
+ * following macro. This is required in order to pass the c++-multiple-scanners
diff --git a/packaging/flex-2.5.34-asneeded.patch b/packaging/flex-2.5.34-asneeded.patch
new file mode 100644
index 0000000..e3386a2
--- /dev/null
+++ b/packaging/flex-2.5.34-asneeded.patch
@@ -0,0 +1,15 @@
+libraries need to be last
+
+Index: tests/test-pthread/Makefile.am
+===================================================================
+--- tests/test-pthread/Makefile.am.orig
++++ tests/test-pthread/Makefile.am
+@@ -37,7 +37,7 @@ scanner.c: $(srcdir)/scanner.l
+ $(FLEX) $(LFLAGS) $<
+
+ $(testname)$(EXEEXT): $(OBJS)
+- $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
++ $(CC) -o $@ $(OBJS) $(LOADLIBES) $(LDFLAGS)
+
+ test: $(testname)$(EXEEXT)
+ ./$(testname) $(srcdir)/test-*.input
diff --git a/packaging/flex-2.5.34-doc-fix.diff b/packaging/flex-2.5.34-doc-fix.diff
new file mode 100644
index 0000000..1209314
--- /dev/null
+++ b/packaging/flex-2.5.34-doc-fix.diff
@@ -0,0 +1,96 @@
+The documentation has the td_hilen and td_lolen fields in the wrong
+order (comapre with tables_shared.h).
+
+Andreas Gruenbacher <agruen@suse.de>
+
+---
+ doc/flex.info-1 | 16 ++++++++--------
+ doc/flex.texi | 14 +++++++-------
+ 2 files changed, 15 insertions(+), 15 deletions(-)
+
+--- doc/flex.info-1.orig
++++ doc/flex.info-1
+@@ -4171,8 +4171,8 @@ indexed by name, as described below. The
+ +-------------------------------+
+ Table 1 | uint16 td_id; |
+ | uint16 td_flags; |
+- | uint32 td_lolen; |
+ | uint32 td_hilen; |
++ | uint32 td_lolen; |
+ | void td_data[]; |
+ | uint8 td_pad64[]; |
+ +-------------------------------+
+@@ -4303,12 +4303,6 @@ Fields of a table:
+ elements or between structs. The type of each member is
+ determined by the `YYTD_DATA*' bits.
+
+-`td_lolen'
+- Specifies the number of elements in the lowest dimension array. If
+- this is a one-dimensional array, then it is simply the number of
+- elements in this array. The element size is determined by the
+- `td_flags' field.
+-
+ `td_hilen'
+ If `td_hilen' is non-zero, then the data is a two-dimensional
+ array. Otherwise, the data is a one-dimensional array. `td_hilen'
+@@ -4324,11 +4318,17 @@ Fields of a table:
+ simply skipped. Flex does not currently generate tables of zero
+ length.
+
++`td_lolen'
++ Specifies the number of elements in the lowest dimension array. If
++ this is a one-dimensional array, then it is simply the number of
++ elements in this array. The element size is determined by the
++ `td_flags' field.
++
+ `td_data[]'
+ The table data. This array may be a one- or two-dimensional array,
+ of type `int8', `int16', `int32', `struct yy_trans_info', or
+ `struct yy_trans_info*', depending upon the values in the
+- `td_flags', `td_lolen', and `td_hilen' fields.
++ `td_flags', `td_hilen', and `td_lolen' fields.
+
+ `td_pad64[]'
+ Zero or more NULL bytes, padding the entire table to the next
+--- doc/flex.texi.orig
++++ doc/flex.texi
+@@ -5083,8 +5083,8 @@ indexed by name, as described below. The
+ +-------------------------------+
+ Table 1 | uint16 td_id; |
+ | uint16 td_flags; |
+- | uint32 td_lolen; |
+ | uint32 td_hilen; |
++ | uint32 td_lolen; |
+ | void td_data[]; |
+ | uint8 td_pad64[]; |
+ +-------------------------------+
+@@ -5203,11 +5203,6 @@ two integers. There is no padding betwee
+ The type of each member is determined by the @code{YYTD_DATA*} bits.
+ @end table
+
+-@item td_lolen
+-Specifies the number of elements in the lowest dimension array. If this is
+-a one-dimensional array, then it is simply the number of elements in this array.
+-The element size is determined by the @code{td_flags} field.
+-
+ @item td_hilen
+ If @code{td_hilen} is non-zero, then the data is a two-dimensional array.
+ Otherwise, the data is a one-dimensional array. @code{td_hilen} contains the
+@@ -5221,11 +5216,16 @@ by the @code{td_flags} field. It is pos
+ array, and no data is loaded, i.e., this table is simply skipped. Flex does not
+ currently generate tables of zero length.
+
++@item td_lolen
++Specifies the number of elements in the lowest dimension array. If this is
++a one-dimensional array, then it is simply the number of elements in this array.
++The element size is determined by the @code{td_flags} field.
++
+ @item td_data[]
+ The table data. This array may be a one- or two-dimensional array, of type
+ @code{int8}, @code{int16}, @code{int32}, @code{struct yy_trans_info}, or
+ @code{struct yy_trans_info*}, depending upon the values in the
+-@code{td_flags}, @code{td_lolen}, and @code{td_hilen} fields.
++@code{td_flags}, @code{td_hilen}, and @code{td_lolen} fields.
+
+ @item td_pad64[]
+ Zero or more NULL bytes, padding the entire table to the next 64-bit boundary as
diff --git a/packaging/flex-2.5.34-fPIC.patch b/packaging/flex-2.5.34-fPIC.patch
new file mode 100644
index 0000000..3517a1c
--- /dev/null
+++ b/packaging/flex-2.5.34-fPIC.patch
@@ -0,0 +1,34 @@
+We've been packaging an -fPIC enabled libfl.a since some time, switching to
+the new scheme is not worth it, package a libfl_pic.a -> libfl.a symlink
+instead.
+---
+ Makefile.am | 11 ++---------
+ 1 file changed, 2 insertions(+), 9 deletions(-)
+
+--- Makefile.am.orig
++++ Makefile.am
+@@ -40,8 +40,7 @@ indent = @INDENT@
+
+ bin_PROGRAMS = flex
+ lib_LIBRARIES = \
+- libfl.a \
+- libfl_pic.a
++ libfl.a
+
+ flex_SOURCES = \
+ ccl.c \
+@@ -70,13 +69,7 @@ libfl_a_SOURCES = \
+ libmain.c \
+ libyywrap.c
+
+-libfl_pic_a_SOURCES = \
+- libmain.c \
+- libyywrap.c
+-
+-libfl_pic_a_CFLAGS = \
+- -fPIC \
+- $(AM_CFLAGS)
++libfl_a_CFLAGS = -fPIC $(AM_CFLAGS)
+
+ noinst_HEADERS = \
+ flexdef.h \
diff --git a/packaging/flex-2.5.34-g++44.diff b/packaging/flex-2.5.34-g++44.diff
new file mode 100644
index 0000000..6ca879a
--- /dev/null
+++ b/packaging/flex-2.5.34-g++44.diff
@@ -0,0 +1,12 @@
+Index: skel.c
+===================================================================
+--- skel.c 2008-02-26 22:34:19.000000000 +0100
++++ skel.c 2009-01-12 11:29:26.000000000 +0100
+@@ -286,6 +286,7 @@ const char *skel[] = {
+ "#include <errno.h>",
+ "#include <cstdlib>",
+ "#include <cstring>",
++ "#include <cstdio>",
+ "/* end standard C++ headers. */",
+ "%endif",
+ "",
diff --git a/packaging/flex.spec b/packaging/flex.spec
new file mode 100644
index 0000000..cbe6263
--- /dev/null
+++ b/packaging/flex.spec
@@ -0,0 +1,62 @@
+Name: flex
+Version: 2.5.35
+Release: 0
+License: BSD-3-Clause
+Summary: Fast Lexical Analyzer Generator
+Url: http://flex.sourceforge.net/
+Group: Development/Languages/C and C++
+Source: %{name}-%{version}.tar.bz2
+Source1: lex-wrapper.sh
+Source3: baselibs.conf
+Patch1: flex-2.5.34-fPIC.patch
+Patch2: flex-2.5.33-yylineno.patch
+Patch3: flex-2.5.34-doc-fix.diff
+Patch4: flex-2.5.34-g++44.diff
+Patch5: flex-2.5.34-asneeded.patch
+BuildRequires: automake
+BuildRequires: bison
+BuildRequires: gcc-c++
+BuildRequires: gettext-tools
+Requires: m4
+
+%description
+FLEX is a tool for generating scanners: programs that recognize lexical
+patterns in text.
+
+%prep
+%setup -q
+%patch1
+# Patch2 disabled for now, as the testsuite explicitly tests for yylineno in
+# all scanners. Let's see if the failing packages got fixed in the meantime.
+#patch2
+%patch3
+%patch4
+%patch5
+
+%build
+autoreconf -fi
+%configure --disable-nls
+make %{?_smp_mflags}
+
+%check
+%if !0%{?qemu_user_space_build:1}
+make check
+%endif
+
+%install
+%make_install
+install %{SOURCE1} %{buildroot}/%{_bindir}/lex
+ln -s flex %{buildroot}/%{_bindir}/flex++
+ln -s flex.1.gz %{buildroot}/%{_mandir}/man1/lex.1.gz
+
+%files
+%defattr(-,root,root)
+/usr/bin/flex
+/usr/bin/flex++
+/usr/bin/lex
+/usr/include/FlexLexer.h
+%{_libdir}/libfl.a
+%{_mandir}/man1/flex.1.gz
+%{_mandir}/man1/lex.1.gz
+%{_infodir}/flex*
+