2021-09-10 13:29:06 +02:00
|
|
|
{ lib, stdenv, fetchpatch, fetchurl, boost }:
|
2010-04-30 14:23:26 +02:00
|
|
|
|
2021-02-12 04:26:59 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "source-highlight";
|
2019-11-13 18:41:39 +01:00
|
|
|
version = "3.1.9";
|
2010-04-30 14:23:26 +02:00
|
|
|
|
2021-09-28 17:33:26 +02:00
|
|
|
outputs = [ "out" "doc" "dev" ];
|
|
|
|
|
2010-04-30 14:23:26 +02:00
|
|
|
src = fetchurl {
|
2021-02-12 04:26:59 +01:00
|
|
|
url = "mirror://gnu/src-highlite/${pname}-${version}.tar.gz";
|
2019-11-13 18:41:39 +01:00
|
|
|
sha256 = "148w47k3zswbxvhg83z38ifi85f9dqcpg7icvvw1cm6bg21x4zrs";
|
2013-12-10 12:02:53 +01:00
|
|
|
};
|
2010-04-30 14:23:26 +02:00
|
|
|
|
2021-09-10 13:29:06 +02:00
|
|
|
patches = [
|
|
|
|
# gcc-11 compat upstream patch
|
|
|
|
(fetchpatch {
|
2023-11-03 23:57:31 +01:00
|
|
|
url = "https://git.savannah.gnu.org/cgit/src-highlite.git/patch/?id=904949c9026cb772dc93fbe0947a252ef47127f4";
|
|
|
|
hash = "sha256-h9DyD+pmlQT5dmKjWI9t0gCIYHe7pYkP55LnOqsE0vI=";
|
2021-09-10 13:29:06 +02:00
|
|
|
excludes = [ "ChangeLog" ];
|
|
|
|
})
|
2021-11-09 00:34:29 +01:00
|
|
|
|
|
|
|
# Upstream fix for clang-13 and gcc-12 test support
|
|
|
|
(fetchpatch {
|
|
|
|
name = "gcc-12.patch";
|
2023-11-03 23:57:31 +01:00
|
|
|
url = "https://git.savannah.gnu.org/cgit/src-highlite.git/patch/?id=ab9fe5cb9b85c5afab94f2a7f4b6d7d473c14ee9";
|
|
|
|
hash = "sha256-wmSLgLnLuFE+IC6AjxzZp/HEnaOCS1VfY2cac0T7Y+w=";
|
|
|
|
})
|
|
|
|
] ++ lib.optionals stdenv.cc.isClang [
|
|
|
|
# Adds compatibility with C++17 by removing the `register` storage class specifier.
|
|
|
|
(fetchpatch {
|
|
|
|
name = "remove-register-keyword";
|
|
|
|
url = "https://git.savannah.gnu.org/cgit/src-highlite.git/patch/?id=416b39758dba2c74515584514a959ad1b0ad50d1";
|
|
|
|
hash = "sha256-R5A7IGHhU82EqceMCsuNBanhRz4dFVqiaH8637dr7jw=";
|
|
|
|
includes = [ "lib/*" ];
|
2021-11-09 00:34:29 +01:00
|
|
|
})
|
2021-09-10 13:29:06 +02:00
|
|
|
];
|
|
|
|
|
2020-08-31 13:52:09 +02:00
|
|
|
# source-highlight uses it's own binary to generate documentation.
|
|
|
|
# During cross-compilation, that binary was built for the target
|
|
|
|
# platform architecture, so it can't run on the build host.
|
2021-09-10 13:29:06 +02:00
|
|
|
postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
|
2020-08-31 13:52:09 +02:00
|
|
|
substituteInPlace Makefile.in --replace "src doc tests" "src tests"
|
|
|
|
'';
|
|
|
|
|
|
|
|
strictDeps = true;
|
2013-12-10 12:02:53 +01:00
|
|
|
buildInputs = [ boost ];
|
|
|
|
|
2021-09-28 17:33:26 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--with-boost=${boost.out}"
|
2022-07-08 13:54:44 +02:00
|
|
|
"--with-bash-completion=${placeholder "out"}/share/bash-completion/completions"
|
2021-09-28 17:33:26 +02:00
|
|
|
];
|
2013-12-10 12:02:53 +01:00
|
|
|
|
2021-11-09 00:34:29 +01:00
|
|
|
doCheck = true;
|
2021-09-11 10:33:33 +02:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
# Upstream uses the same intermediate files in multiple tests, running
|
|
|
|
# them in parallel by make will eventually break one or more tests.
|
|
|
|
enableParallelChecking = false;
|
2010-04-30 14:23:26 +02:00
|
|
|
|
2021-02-12 04:26:59 +01:00
|
|
|
meta = with lib; {
|
2013-12-10 12:02:53 +01:00
|
|
|
description = "Source code renderer with syntax highlighting";
|
2021-02-12 04:26:59 +01:00
|
|
|
longDescription = ''
|
|
|
|
GNU Source-highlight, given a source file, produces a document
|
|
|
|
with syntax highlighting.
|
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.gnu.org/software/src-highlite/";
|
2021-02-12 04:26:59 +01:00
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
2010-04-30 14:23:26 +02:00
|
|
|
};
|
|
|
|
}
|