2021-12-06 16:07:01 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "cmark";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "0.31.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-02-02 18:25:31 +00:00
|
|
|
owner = "commonmark";
|
2021-06-28 23:13:55 +00:00
|
|
|
repo = pname;
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = version;
|
2024-02-07 01:22:34 +00:00
|
|
|
sha256 = "sha256-GBesKTp9DqoFAmCc0RB+XePvzV9g+w+oyrD1nCgyklI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2022-11-04 12:27:35 +00:00
|
|
|
cmakeFlags =
|
|
|
|
# Link the executable with the shared library on system with shared libraries.
|
|
|
|
lib.optional (!stdenv.hostPlatform.isStatic) "-DCMARK_STATIC=OFF"
|
|
|
|
# Do not attempt to build .so library on static platform.
|
|
|
|
++ lib.optional stdenv.hostPlatform.isStatic "-DCMARK_SHARED=OFF";
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2021-08-18 13:19:15 +00:00
|
|
|
doCheck = true;
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2021-08-18 13:19:15 +00:00
|
|
|
preCheck = let
|
|
|
|
lib_path = if stdenv.isDarwin then "DYLD_FALLBACK_LIBRARY_PATH" else "LD_LIBRARY_PATH";
|
|
|
|
in ''
|
|
|
|
export ${lib_path}=$(readlink -f ./src)
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "CommonMark parsing and rendering library and program in C";
|
2023-02-02 18:25:31 +00:00
|
|
|
homepage = "https://github.com/commonmark/cmark";
|
|
|
|
changelog = "https://github.com/commonmark/cmark/raw/${version}/changelog.txt";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ maintainers.michelk ];
|
2023-02-02 18:25:31 +00:00
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd2;
|
|
|
|
};
|
|
|
|
}
|