nixpkgs/pkgs/development/tools/parsing/flex/default.nix

54 lines
1.7 KiB
Nix
Raw Normal View History

{ stdenv, buildPackages, fetchurl, bison, m4
, fetchpatch, autoreconfHook, help2man
}:
2015-11-19 01:49:54 +00:00
stdenv.mkDerivation rec {
pname = "flex";
2017-07-29 18:14:47 +01:00
version = "2.6.4";
2014-01-07 13:24:59 +00:00
src = fetchurl {
url = "https://github.com/westes/flex/releases/download/v${version}/flex-${version}.tar.gz";
2017-07-29 18:14:47 +01:00
sha256 = "15g9bv236nzi665p9ggqjlfn4dwck5835vf0bbw2cz7h5c1swyp8";
};
2014-01-07 13:24:59 +00:00
# Also upstream, will be part of 2.6.5
# https://github.com/westes/flex/commit/24fd0551333e
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 22:16:13 +01:00
postPatch = ''
patchShebangs tests
'' + stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
substituteInPlace Makefile.in --replace "tests" " "
substituteInPlace doc/Makefile.am --replace 'flex.1: $(top_srcdir)/configure.ac' 'flex.1: '
'';
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ autoreconfHook help2man ];
2014-01-07 13:24:59 +00:00
buildInputs = [ bison ];
propagatedBuildInputs = [ m4 ];
2018-07-23 22:35:23 +01:00
preConfigure = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"ac_cv_func_malloc_0_nonnull=yes"
"ac_cv_func_realloc_0_nonnull=yes"
];
2015-06-04 18:26:30 +01:00
postConfigure = stdenv.lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) ''
sed -i Makefile -e 's/-no-undefined//;'
'';
dontDisableStatic = stdenv.buildPlatform != stdenv.hostPlatform;
2018-08-16 20:51:07 +01:00
meta = with stdenv.lib; {
homepage = "https://github.com/westes/flex";
description = "A fast lexical analyser generator";
2018-08-16 20:51:07 +01:00
license = licenses.bsd2;
platforms = platforms.unix;
};
}