2017-10-15 18:03:00 +02:00
|
|
|
{ stdenv, buildPackages, fetchurl, bison, m4
|
2017-11-06 19:20:21 +01:00
|
|
|
, fetchpatch, autoreconfHook, help2man
|
|
|
|
}:
|
2008-03-20 10:50:15 +01:00
|
|
|
|
2015-11-19 02:49:54 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "flex";
|
2017-07-29 19:14:47 +02:00
|
|
|
version = "2.6.4";
|
2014-01-07 14:24:59 +01:00
|
|
|
|
2008-03-20 10:50:15 +01:00
|
|
|
src = fetchurl {
|
2016-12-30 20:36:03 +01:00
|
|
|
url = "https://github.com/westes/flex/releases/download/v${version}/flex-${version}.tar.gz";
|
2017-07-29 19:14:47 +02:00
|
|
|
sha256 = "15g9bv236nzi665p9ggqjlfn4dwck5835vf0bbw2cz7h5c1swyp8";
|
2008-03-20 10:50:15 +01:00
|
|
|
};
|
2014-01-07 14:24:59 +01:00
|
|
|
|
2017-11-06 19:25:14 +01:00
|
|
|
# Also upstream, will be part of 2.6.5
|
|
|
|
# https://github.com/westes/flex/commit/24fd0551333e
|
2017-11-06 19:20:21 +01:00
|
|
|
patches = [(fetchpatch {
|
|
|
|
name = "glibc-2.26.patch";
|
|
|
|
url = "https://raw.githubusercontent.com/lede-project/source/0fb14a2b1ab2f82c"
|
|
|
|
+ "/tools/flex/patches/200-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch";
|
|
|
|
sha256 = "1aarhcmz7mfrgh15pkj6f7ikxa2m0mllw1i1vscsf1kw5d05lw6f";
|
|
|
|
})];
|
2018-08-08 23:16:13 +02:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs tests
|
|
|
|
'' + stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
|
2018-01-23 01:44:42 +01:00
|
|
|
substituteInPlace Makefile.in --replace "tests" " "
|
2017-11-06 19:20:21 +01:00
|
|
|
|
2018-01-23 01:44:42 +01:00
|
|
|
substituteInPlace doc/Makefile.am --replace 'flex.1: $(top_srcdir)/configure.ac' 'flex.1: '
|
|
|
|
'';
|
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
nativeBuildInputs = [ autoreconfHook help2man ];
|
2014-01-07 14:24:59 +01:00
|
|
|
buildInputs = [ bison ];
|
2018-01-23 01:44:42 +01:00
|
|
|
propagatedBuildInputs = [ m4 ];
|
|
|
|
|
2018-07-23 23:35:23 +02:00
|
|
|
preConfigure = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
|
|
"ac_cv_func_malloc_0_nonnull=yes"
|
|
|
|
"ac_cv_func_realloc_0_nonnull=yes"
|
|
|
|
];
|
2008-03-20 10:50:15 +01:00
|
|
|
|
2015-06-04 19:26:30 +02:00
|
|
|
postConfigure = stdenv.lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) ''
|
2014-04-15 12:04:27 +02:00
|
|
|
sed -i Makefile -e 's/-no-undefined//;'
|
|
|
|
'';
|
|
|
|
|
2018-01-23 01:44:42 +01:00
|
|
|
dontDisableStatic = stdenv.buildPlatform != stdenv.hostPlatform;
|
2011-11-04 22:31:07 +01:00
|
|
|
|
2018-08-16 21:51:07 +02:00
|
|
|
meta = with stdenv.lib; {
|
2016-09-24 03:42:08 +02:00
|
|
|
homepage = https://github.com/westes/flex;
|
2008-03-20 10:50:15 +01:00
|
|
|
description = "A fast lexical analyser generator";
|
2018-08-16 21:51:07 +02:00
|
|
|
license = licenses.bsd2;
|
|
|
|
platforms = platforms.unix;
|
2008-03-20 10:50:15 +01:00
|
|
|
};
|
|
|
|
}
|