%define _libdir64 %{_prefix}/lib64 Summary: A tool for creating scanners (text pattern recognizers) Name: flex Version: 2.5.37 Release: 1 License: BSD Group: Development/Tools URL: http://flex.sourceforge.net/ Source0: %{name}-%{version}.tar.bz2 Patch0: %{name}-%{version}-aix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gettext m4 Requires: /sbin/install-info, info, gettext, make %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. %prep %setup -q %patch0 find . -exec touch {} \; mkdir ../32bit mv * ../32bit mv ../32bit . mkdir 64bit cd 32bit && tar cf - . | (cd ../64bit ; tar xpf -) %build export PATH=/opt/freeware/bin:$PATH export CC=xlc_r # first build the 64-bit version export OBJECT_MODE=64 export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000" cd 64bit ./configure \ --prefix=%{_prefix} \ --libdir=%{_libdir64} \ --mandir=%{_mandir} \ --infodir=%{_infodir} make %{?_smp_mflags} cd ../32bit # now build the 32-bit version export OBJECT_MODE=32 export LDFLAGS="-L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000" ./configure \ --prefix=%{_prefix} \ --mandir=%{_mandir} \ --infodir=%{_infodir} make %{?_smp_mflags} %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT cd 64bit export OBJECT_MODE=64 gmake DESTDIR=${RPM_BUILD_ROOT} install ( cd ${RPM_BUILD_ROOT}%{_bindir} for f in * ; do mv -f ${f} ${f}_64 done ) cd ../32bit export OBJECT_MODE=32 gmake DESTDIR=${RPM_BUILD_ROOT} install /usr/bin/strip -X32_64 ${RPM_BUILD_ROOT}%{_bindir}/* || : gzip --best ${RPM_BUILD_ROOT}%{_infodir}/%{name}.info* rm -f ${RPM_BUILD_ROOT}%{_infodir}/dir ( 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 for dir in usr/bin usr/lib usr/lib64 usr/include usr/linux/bin usr/linux/lib usr/linux/lib64 do mkdir -p ${dir} done cd usr/linux/bin ln -sf ../../..%{_bindir}/flex lex ln -sf ../../..%{_bindir}/flex_64 flex_64 cd ../lib ln -sf ../../..%{_libdir}/libfl.a libl.a cd ../lib64 ln -sf ../../..%{_libdir64}/libfl.a libl.a cd ../../bin ln -sf ../..%{_bindir}/flex . ln -sf ../..%{_bindir}/flex_64 . ln -sf ../..%{_bindir}/flex++ . ln -sf ../..%{_bindir}/flex++_64 . cd ../include ln -sf ../..%{_includedir}/* . cd ../lib ln -sf ../..%{_libdir}/libfl.a . cd ../lib64 ln -sf ../..%{_libdir64}/libfl.a . ) %post /sbin/install-info %{_infodir}/%{name}.info.gz --dir-file=%{_infodir}/dir ||: %preun if [ $1 = 0 ]; then /sbin/install-info --delete %{_infodir}/%{name}.info.gz %{_infodir}/dir ||: fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,system) %doc 32bit/COPYING 32bit/NEWS 32bit/README %{_bindir}/* %{_mandir}/man1/* %{_libdir}/* %{_libdir64}/* %{_includedir}/* %{_infodir}/* %{_datadir}/locale/*/*/* /usr/bin/* /usr/lib/* /usr/lib64/* /usr/include/* /usr/linux/bin/* /usr/linux/lib/* /usr/linux/lib64/* %changelog * Mon Mar 23 2015 Michael Perzl - 2.5.37-1 - updated to version 2.5.37 * Tue Jul 24 2012 Michael Perzl - 2.5.36-1 - updated to version 2.5.36 * Sun Aug 21 2011 Michael Perzl - 2.5.35-2 - added 64-bit libraries * Thu Mar 27 2008 Michael Perzl - 2.5.35-1 - first version for AIX V5.1 and higher