diff options
author | Nguyễn Gia Phong <cnx@loang.net> | 2023-08-30 11:31:40 +0900 |
---|---|---|
committer | Nguyễn Gia Phong <cnx@loang.net> | 2023-08-30 14:47:34 +0900 |
commit | bb25f70192a3276f2cca2913e9012d2c56393bd6 (patch) | |
tree | 356a76368c9547256ffa9fc0d8118bf6dd5d8379 /md4c | |
parent | eb04d8c8cb4521bf611b8df46a96c4132af2520b (diff) | |
download | bux-bb25f70192a3276f2cca2913e9012d2c56393bd6.tar.gz |
Add md4c bug 107
References: https://github.com/mity/md4c/issues/107
Diffstat (limited to 'md4c')
-rw-r--r-- | md4c/107.md | 1 | ||||
-rw-r--r-- | md4c/default.nix | 67 | ||||
-rw-r--r-- | md4c/fix-pkgconfig.patch | 14 |
3 files changed, 82 insertions, 0 deletions
diff --git a/md4c/107.md b/md4c/107.md new file mode 100644 index 0000000..7096fb8 --- /dev/null +++ b/md4c/107.md @@ -0,0 +1 @@ +***foo *bar baz*** diff --git a/md4c/default.nix b/md4c/default.nix new file mode 100644 index 0000000..d5fb39e --- /dev/null +++ b/md4c/default.nix @@ -0,0 +1,67 @@ +# Recipe for building md4c at specific snapshot +# +# SPDX-FileCopyrightText: 2021 Anderson Torres +# SPDX-FileCopyrightText: 2021 Thomas Gerbet +# SPDX-FileCopyrightText: 2021 Leif Middelschulte +# SPDX-License-Identifier: MIT +# +# SPDX-FileCopyrightText: 2023 Nguyễn Gia Phong +# SPDX-License-Identifier: AGPL-3.0-or-later + +{ lib, stdenv, version, fetchFromGitHub, commit, hash +, binRenameHook, cmake, pkg-config }: + +stdenv.mkDerivation rec { + pname = "md4c"; + inherit version; + + src = fetchFromGitHub { + owner = "mity"; + repo = pname; + rev = commit; + inherit hash; + }; + + 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. + ./fix-pkgconfig.patch + ]; + + nativeBuildInputs = [ binRenameHook 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; + platforms = platforms.all; + }; +} diff --git a/md4c/fix-pkgconfig.patch b/md4c/fix-pkgconfig.patch new file mode 100644 index 0000000..cf3c264 --- /dev/null +++ b/md4c/fix-pkgconfig.patch @@ -0,0 +1,14 @@ +diff --git a/md4c/md4c.pc.in b/md4c/md4c.pc.in +index 61c78d890249..72943b52d050 100644 +--- a/md4c/md4c.pc.in ++++ b/md4c/md4c.pc.in +@@ -1,7 +1,7 @@ + prefix=@CMAKE_INSTALL_PREFIX@ + exec_prefix=@CMAKE_INSTALL_PREFIX@ +-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ ++libdir=@CMAKE_INSTALL_LIBDIR@ ++includedir=@CMAKE_INSTALL_INCLUDEDIR@ + + Name: @PROJECT_NAME@ + Description: @PROJECT_DESCRIPTION@ |