@@ -0,0 +1,37 @@
1+{ stdenv, fetchurl, bison, m4 }:
2+
3+stdenv.mkDerivation rec {
4+ name = "flex-2.6.1";
5+
6+ src = fetchurl {
7+ url = "https://github.com/westes/flex/releases/download/v2.6.1/flex-2.6.1.tar.gz";
8+ sha256 = "0fy14c35yz2m1n1m4f02by3501fn0cca37zn7jp8lpp4b3kgjhrw";
9+ };
10+
11+ buildInputs = [ bison ];
12+
13+ propagatedNativeBuildInputs = [ m4 ];
14+
15+ postConfigure = stdenv.lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) ''
16+ sed -i Makefile -e 's/-no-undefined//;'
17+ '';
18+
19+ crossAttrs = {
20+
21+ # disable tests which can't run on build machine
22+ postPatch = ''
23+ substituteInPlace Makefile.in --replace "tests" " ";
24+ '';
25+
26+ preConfigure = ''
27+ export ac_cv_func_malloc_0_nonnull=yes
28+ export ac_cv_func_realloc_0_nonnull=yes
29+ '';
30+ };
31+
32+ meta = {
33+ homepage = https://github.com/westes/flex;
34+ description = "A fast lexical analyser generator";
35+ platforms = stdenv.lib.platforms.unix;
36+ };
37+}