#!/bin/bash
cd $LFS/usr/src/flex-*/ ||exit

#already now needed for binutils_devel

#flex-2.5.31 does not work with xc!!!, (modutils?), (wine?) without
#the following patch, 2.5.27 does without it:

#fixes a ton of things, stuff that Debian thought to be broken, makes flex not suck anymore:
patch -p 1 <../flex-2.5.31-debian_fixes-4.patch
#fix flex bug:
patch -p 1 <../flex-2.5.31-yytext_ptr-1.patch

#dont regenerate doc after previous patch, because we do not have help2man:
touch doc/flex.1



./configure --prefix=/prelfs &&
make &&
#make bigcheck
make install &&
#2do: is the rest still needed?
#gcc -shared libmain.o libyywrap.o -o libfl.so &&
gcc -shared libyywrap.o -o libfl.so &&
cp libfl.so /prelfs/lib &&
ln -sf libfl.a /prelfs/lib/libl.a
