Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 98 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchpatch, 5 fetchurl, 6 boost, 7 updateAutotoolsGnuConfigScriptsHook, 8 llvmPackages, 9}: 10 11stdenv.mkDerivation rec { 12 pname = "source-highlight"; 13 version = "3.1.9"; 14 15 outputs = [ 16 "out" 17 "doc" 18 "dev" 19 ]; 20 21 src = fetchurl { 22 url = "mirror://gnu/src-highlite/${pname}-${version}.tar.gz"; 23 sha256 = "148w47k3zswbxvhg83z38ifi85f9dqcpg7icvvw1cm6bg21x4zrs"; 24 }; 25 26 patches = [ 27 # gcc-11 compat upstream patch 28 (fetchpatch { 29 url = "https://git.savannah.gnu.org/cgit/src-highlite.git/patch/?id=904949c9026cb772dc93fbe0947a252ef47127f4"; 30 hash = "sha256-h9DyD+pmlQT5dmKjWI9t0gCIYHe7pYkP55LnOqsE0vI="; 31 excludes = [ "ChangeLog" ]; 32 }) 33 34 # Upstream fix for clang-13 and gcc-12 test support 35 (fetchpatch { 36 name = "gcc-12.patch"; 37 url = "https://git.savannah.gnu.org/cgit/src-highlite.git/patch/?id=ab9fe5cb9b85c5afab94f2a7f4b6d7d473c14ee9"; 38 hash = "sha256-wmSLgLnLuFE+IC6AjxzZp/HEnaOCS1VfY2cac0T7Y+w="; 39 }) 40 ] 41 ++ lib.optionals stdenv.cc.isClang [ 42 # Adds compatibility with C++17 by removing the `register` storage class specifier. 43 (fetchpatch { 44 name = "remove-register-keyword"; 45 url = "https://git.savannah.gnu.org/cgit/src-highlite.git/patch/?id=416b39758dba2c74515584514a959ad1b0ad50d1"; 46 hash = "sha256-R5A7IGHhU82EqceMCsuNBanhRz4dFVqiaH8637dr7jw="; 47 includes = [ "lib/*" ]; 48 }) 49 ]; 50 51 # source-highlight uses it's own binary to generate documentation. 52 # During cross-compilation, that binary was built for the target 53 # platform architecture, so it can't run on the build host. 54 postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' 55 substituteInPlace Makefile.in --replace "src doc tests" "src tests" 56 ''; 57 58 strictDeps = true; 59 # necessary to build on FreeBSD native pending inclusion of 60 # https://git.savannah.gnu.org/cgit/config.git/commit/?id=e4786449e1c26716e3f9ea182caf472e4dbc96e0 61 nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]; 62 buildInputs = [ 63 boost 64 ] 65 ++ lib.optional (stdenv.targetPlatform.useLLVM or false) ( 66 llvmPackages.compiler-rt.override { 67 doFakeLibgcc = true; 68 } 69 ); 70 71 configureFlags = [ 72 "--with-boost=${boost.out}" 73 "--with-bash-completion=${placeholder "out"}/share/bash-completion/completions" 74 ]; 75 76 doCheck = true; 77 78 enableParallelBuilding = true; 79 # Upstream uses the same intermediate files in multiple tests, running 80 # them in parallel by make will eventually break one or more tests. 81 enableParallelChecking = false; 82 83 meta = with lib; { 84 description = "Source code renderer with syntax highlighting"; 85 longDescription = '' 86 GNU Source-highlight, given a source file, produces a document 87 with syntax highlighting. 88 ''; 89 homepage = "https://www.gnu.org/software/src-highlite/"; 90 license = licenses.gpl3Plus; 91 platforms = platforms.unix; 92 maintainers = with maintainers; [ SuperSandro2000 ]; 93 }; 94} 95// lib.optionalAttrs (stdenv.targetPlatform.useLLVM or false) { 96 # Force linking to "libgcc" so tests pass 97 NIX_CFLAGS_COMPILE = "-lgcc"; 98}