Blob Blame History Raw
Summary: Legacy version of flex, a tool for creating scanners
Name: compat-flex
Version: 2.5.4a
Release: 1%{?dist}
License: BSD
Group: Development/Tools
URL: http://www.gnu.org/software/flex/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source: ftp://ftp.gnu.org/non-gnu/flex/flex-2.5.4a.tar.gz
Source2: README.fedora
Patch0: flex-2.5.4a-skel.patch
Patch1: flex-2.5.4-glibc22.patch
Patch2: flex-2.5.4a-gcc3.patch
Patch3: flex-2.5.4a-gcc31.patch
Patch4: flex-2.5.4a2.patch
Patch5: flex-pic.patch
Patch6: flex-2.5.4a2-std.patch
Patch7: flex-2.5.4a2-warn.patch
Patch8: flex-2.5.4a2-shapwarn.patch
Patch9: flex-2.5.4a2-iniscan.patch
Patch10: flex-2.5.4a-Makefile.in.patch
BuildRequires: autoconf byacc texinfo info

%description

This is legacy version of flex, a program that generates scanners.
Scanners are programs which can recognize lexical patterns in text.
Flex takes pairs of regular expressions and C code as input and
generates a C source file as output.  The output file is compiled and
linked with a library to produce an executable.  The executable
searches through its input for occurrences of the regular expressions.
When a match is found, it executes the corresponding C code.  Flex was
designed to work with both Yacc and Bison, and is used by many
programs as part of their build process.

You should install flex if you are going to use your system for
application development.

%prep
%setup -q -n flex-2.5.4
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
cp %{SOURCE2} .

%build
autoconf
%configure
sed -i '/^START-INFO-DIR-ENTRY/,/^END-INFO-DIR-ENTRY/s/[Ff]lex/&-%{version}/g' ./MISC/texinfo/flex.texi
make FLEX=flex-%{version}
makeinfo MISC/texinfo/flex.texi -o MISC/texinfo/flex-%{version}.info

%install
rm -rf $RPM_BUILD_ROOT
%{makeinstall} FLEX=flex-%{version} libdir=$RPM_BUILD_ROOT/%{_libdir}/flex-%{version} mandir=$RPM_BUILD_ROOT/%{_mandir}/man1
./mkinstalldirs $RPM_BUILD_ROOT/%{_infodir} $RPM_BUILD_ROOT/%{_includedir}/flex-%{version}
install -m 644 MISC/texinfo/flex-%{version}.info $RPM_BUILD_ROOT/%{_infodir}/flex-%{version}.info
mv ${RPM_BUILD_ROOT}/%{_includedir}/FlexLexer.h ${RPM_BUILD_ROOT}/%{_includedir}/flex-%{version}/FlexLexer.h
ln -s flex-%{version}.1 ${RPM_BUILD_ROOT}/%{_mandir}/man1/flex-%{version}++.1

%check
echo ============TESTING===============
make FLEX=flex-%{version} bigcheck
echo ============END TESTING===========

%post
/sbin/install-info %{_infodir}/flex-%{version}.info --dir-file=%{_infodir}/dir ||:

%preun
if [ $1 = 0 ]; then
	/sbin/install-info --delete %{_infodir}/flex-%{version}.info %{_infodir}/dir ||:
fi

%clean
rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-,root,root)
%doc COPYING NEWS README README.fedora
%{_bindir}/*
%{_mandir}/man1/*
%{_libdir}/flex-%{version}
%{_includedir}/flex-%{version}
%{_infodir}/flex-%{version}.info*

%changelog
* Wed Jan 18 2006 Petr Machata <pmachata@redhat.com> - 2.5.4a-1
- Initial build.