at 18.09-beta 53 lines 1.8 kB view raw
1{ stdenv, buildPackages, fetchurl, bison, m4 2, fetchpatch, autoreconfHook, help2man 3}: 4 5stdenv.mkDerivation rec { 6 name = "flex-${version}"; 7 version = "2.6.4"; 8 9 src = fetchurl { 10 url = "https://github.com/westes/flex/releases/download/v${version}/flex-${version}.tar.gz"; 11 sha256 = "15g9bv236nzi665p9ggqjlfn4dwck5835vf0bbw2cz7h5c1swyp8"; 12 }; 13 14 # Also upstream, will be part of 2.6.5 15 # https://github.com/westes/flex/commit/24fd0551333e 16 patches = [(fetchpatch { 17 name = "glibc-2.26.patch"; 18 url = "https://raw.githubusercontent.com/lede-project/source/0fb14a2b1ab2f82c" 19 + "/tools/flex/patches/200-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch"; 20 sha256 = "1aarhcmz7mfrgh15pkj6f7ikxa2m0mllw1i1vscsf1kw5d05lw6f"; 21 })]; 22 23 postPatch = '' 24 patchShebangs tests 25 '' + stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' 26 substituteInPlace Makefile.in --replace "tests" " " 27 28 substituteInPlace doc/Makefile.am --replace 'flex.1: $(top_srcdir)/configure.ac' 'flex.1: ' 29 ''; 30 31 depsBuildBuild = [ buildPackages.stdenv.cc ]; 32 nativeBuildInputs = [ autoreconfHook help2man ]; 33 buildInputs = [ bison ]; 34 propagatedBuildInputs = [ m4 ]; 35 36 preConfigure = stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 37 "ac_cv_func_malloc_0_nonnull=yes" 38 "ac_cv_func_realloc_0_nonnull=yes" 39 ]; 40 41 postConfigure = stdenv.lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) '' 42 sed -i Makefile -e 's/-no-undefined//;' 43 ''; 44 45 dontDisableStatic = stdenv.buildPlatform != stdenv.hostPlatform; 46 47 meta = with stdenv.lib; { 48 homepage = https://github.com/westes/flex; 49 description = "A fast lexical analyser generator"; 50 license = licenses.bsd2; 51 platforms = platforms.unix; 52 }; 53}