%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} Summary: A tool for generating scanners (text pattern recognizers) Name: flex Version: 2.6.4 Release: 10%{?dist} # parse.c and parse.h are under GPLv3+ with exception which allows relicensing. Since flex is shipped under BDS-style # license, let's assume that the relicensing was done. # gettext.h (copied from gnulib) is under LGPLv2+ License: BSD and LGPLv2+ URL: https://github.com/westes/flex Source: https://github.com/westes/flex/releases/download/v%{version}/flex-%{version}.tar.gz Patch0: flex-rh1389575.patch Patch1: flex-2.6.4-libobjdir.patch Requires: m4 BuildRequires: gettext gettext-devel bison m4 help2man gcc gcc-c++ automake libtool BuildRequires: make BuildRequires: git %description The flex program 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. # We keep the libraries in separate sub-package to allow for multilib # installations of flex. %define somajor 2 %package -n libfl%{somajor} Summary: Libraries for the flex scanner generator %description -n libfl%{somajor} flex is a tool for generating scanners. This package contains the shared library with default implementations of `main' and `yywrap' functions that binaries using flex can choose to link against instead of implementing on their own. %package -n libfl-devel Summary: Development files for the flex scanner generator Requires: libfl%{somajor} = %{version}-%{release} %description -n libfl-devel flex is a tool for generating scanners. This package contains files required to build programs that use flex libraries. %package -n libfl-static Summary: Static libraries for the flex scanner generator # We renamed flex-static to flex-devel in version 2.5.35-15: Obsoletes: flex-static < 2.5.35-15 Provides: flex-static # We renamed flex-devel to libfl-static in version 2.6.4-6. This clarifies the nature of the package and brings us in # line with naming used by SUSE and Debian: Obsoletes: flex-devel < 2.6.4-6 Provides: flex-devel %description -n libfl-static flex is a tool for generating scanners. This package contains the static library with default implementations of `main' and `yywrap' functions that binaries using flex can choose to statically link against instead of implementing their own. %package doc Summary: Documentation for the flex scanner generator %description doc This package contains documentation for the flex scanner generator in plain text and PDF formats. %prep %autosetup -S git %build autoreconf -i %configure --docdir=%{_pkgdocdir} CFLAGS="-fPIC $RPM_OPT_FLAGS" make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install rm -f $RPM_BUILD_ROOT/%{_infodir}/dir rm -f $RPM_BUILD_ROOT/%{_pkgdocdir}/{README.cvs,TODO} # Exclude libtool archives (.la) as per Fedora packaging guidelines find %{buildroot} -name '*.la' -delete ( cd ${RPM_BUILD_ROOT} ln -sf flex .%{_bindir}/lex ln -sf flex .%{_bindir}/flex++ ln -s flex.1 .%{_mandir}/man1/lex.1 ln -s flex.1 .%{_mandir}/man1/flex++.1 ln -s libfl.a .%{_libdir}/libl.a ) %find_lang flex %check echo ============TESTING=============== make check echo ============END TESTING=========== %files -f flex.lang %dir %{_pkgdocdir} %license COPYING %{_pkgdocdir}/NEWS %{_pkgdocdir}/README.md %{_bindir}/* %{_mandir}/man1/* %{_includedir}/FlexLexer.h %{_infodir}/flex.info* %files -n libfl%{somajor} %{_libdir}/libfl.so.%{somajor}* %files -n libfl-devel %{_includedir}/FlexLexer.h %{_libdir}/libfl.so %files -n libfl-static %dir %{_pkgdocdir} %license COPYING %{_libdir}/*.a %files doc %{_pkgdocdir}