lol
at 18.03-beta 49 lines 1.7 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 postPatch = stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' 23 substituteInPlace Makefile.in --replace "tests" " " 24 25 substituteInPlace doc/Makefile.am --replace 'flex.1: $(top_srcdir)/configure.ac' 'flex.1: ' 26 ''; 27 28 depsBuildBuild = [ buildPackages.stdenv.cc ]; 29 nativeBuildInputs = [ autoreconfHook help2man ]; 30 buildInputs = [ bison ]; 31 propagatedBuildInputs = [ m4 ]; 32 33 preConfigure = stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' 34 export ac_cv_func_malloc_0_nonnull=yes 35 export ac_cv_func_realloc_0_nonnull=yes 36 ''; 37 38 postConfigure = stdenv.lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) '' 39 sed -i Makefile -e 's/-no-undefined//;' 40 ''; 41 42 dontDisableStatic = stdenv.buildPlatform != stdenv.hostPlatform; 43 44 meta = { 45 homepage = https://github.com/westes/flex; 46 description = "A fast lexical analyser generator"; 47 platforms = stdenv.lib.platforms.unix; 48 }; 49}