diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2024-01-19 19:03:38 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2024-01-26 19:12:37 -0300 |
commit | 0d4ed02177909a5a2b8717f0e0bb5871453a6e6b (patch) | |
tree | 79c9824493460ec8798b3766c28698d3d5719c82 /pkgs/by-name/md | |
parent | 4b7a5975a58b4275fcb36be2d2ba032f2826c60e (diff) |
md4c: migrate to by-name
Diffstat (limited to 'pkgs/by-name/md')
-rw-r--r-- | pkgs/by-name/md/md4c/0001-fix-pkgconfig.patch | 44 | ||||
-rw-r--r-- | pkgs/by-name/md/md4c/package.nix | 67 |
2 files changed, 111 insertions, 0 deletions
diff --git a/pkgs/by-name/md/md4c/0001-fix-pkgconfig.patch b/pkgs/by-name/md/md4c/0001-fix-pkgconfig.patch new file mode 100644 index 0000000000000..e0e9f3d96b2b4 --- /dev/null +++ b/pkgs/by-name/md/md4c/0001-fix-pkgconfig.patch @@ -0,0 +1,44 @@ +From 0ab8f5a6ee305cf4edcebfdc7b9eb5f98302de75 Mon Sep 17 00:00:00 2001 +From: Leif Middelschulte <Leif.Middelschulte@klsmartin.com> +Date: Fri, 17 Sep 2021 16:16:17 +0200 +Subject: [PATCH] pc.in: use _FULL_ variable variants + +Nix' cmake packaging handler replaces the CMAKE_INSTALL_INCLUDEDIR +with the absolute path. Which break package +portability (i.e. `prefix`-usage). +--- + src/md4c-html.pc.in | 6 ++---- + src/md4c.pc.in | 6 ++---- + 2 files changed, 4 insertions(+), 8 deletions(-) + +diff --git a/src/md4c-html.pc.in b/src/md4c-html.pc.in +index 504bb52..fec7df4 100644 +--- a/src/md4c-html.pc.in ++++ b/src/md4c-html.pc.in +@@ -1,7 +1,5 @@ +-prefix=@CMAKE_INSTALL_PREFIX@ +-exec_prefix=@CMAKE_INSTALL_PREFIX@ +-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ ++libdir=@CMAKE_INSTALL_FULL_LIBDIR@ ++includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + + Name: @PROJECT_NAME@ HTML renderer + Description: Markdown to HTML converter library. +diff --git a/src/md4c.pc.in b/src/md4c.pc.in +index cd8842d..b5d81f8 100644 +--- a/src/md4c.pc.in ++++ b/src/md4c.pc.in +@@ -1,7 +1,5 @@ +-prefix=@CMAKE_INSTALL_PREFIX@ +-exec_prefix=@CMAKE_INSTALL_PREFIX@ +-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ ++libdir=@CMAKE_INSTALL_FULL_LIBDIR@ ++includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + + Name: @PROJECT_NAME@ + Description: Markdown parser library with a SAX-like callback-based interface. +-- +2.31.0 + diff --git a/pkgs/by-name/md/md4c/package.nix b/pkgs/by-name/md/md4c/package.nix new file mode 100644 index 0000000000000..fa7959b83e0d4 --- /dev/null +++ b/pkgs/by-name/md/md4c/package.nix @@ -0,0 +1,67 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, pkg-config +}: + +stdenv.mkDerivation rec { + pname = "md4c"; + version = "0.4.8"; + + src = fetchFromGitHub { + owner = "mity"; + repo = pname; + rev = "release-${version}"; + hash = "sha256-+LObAD5JB8Vb4Rt4hTo1Z4ispxzfFkkXA2sw6TKB7Yo="; + }; + + patches = [ + # We set CMAKE_INSTALL_LIBDIR to the absolute path in $out, so + # prefix and exec_prefix cannot be $out, too + # Use CMake's _FULL_ variables instead of `prefix` concatenation. + ./0001-fix-pkgconfig.patch + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + meta = with lib; { + description = "Markdown parser made in C"; + longDescription = '' + MD4C is Markdown parser implementation in C, with the following features: + + - Compliance: Generally, MD4C aims to be compliant to the latest version + of CommonMark specification. Currently, we are fully compliant to + CommonMark 0.29. + - Extensions: MD4C supports some commonly requested and accepted + extensions. See below. + - Performance: MD4C is very fast. + - Compactness: MD4C parser is implemented in one source file and one + header file. There are no dependencies other than standard C library. + - Embedding: MD4C parser is easy to reuse in other projects, its API is + very straightforward: There is actually just one function, md_parse(). + - Push model: MD4C parses the complete document and calls few callback + functions provided by the application to inform it about a start/end of + every block, a start/end of every span, and with any textual contents. + - Portability: MD4C builds and works on Windows and POSIX-compliant + OSes. (It should be simple to make it run also on most other platforms, + at least as long as the platform provides C standard library, including + a heap memory management.) + - Encoding: MD4C by default expects UTF-8 encoding of the input + document. But it can be compiled to recognize ASCII-only control + characters (i.e. to disable all Unicode-specific code), or (on Windows) + to expect UTF-16 (i.e. what is on Windows commonly called just + "Unicode"). See more details below. + - Permissive license: MD4C is available under the MIT license. + ''; + homepage = "https://github.com/mity/md4c"; + license = licenses.mit; + maintainers = with maintainers; [ AndersonTorres ]; + mainProgram = "md2html"; + platforms = platforms.all; + }; +} +# TODO: enable tests (needs Python) |