1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 04:56:01 +01:00

Add cmark dependency

`cmark` is a more robust library for constructing Markdown than
`lowdown`. It is also more portable. Unfortunately it doesn't have a
terminal mode, so we cannot get rid of lowdown yet.

The `--enable-markdown` flag is renamed to `--enable-lowdown`
accordingly.
This commit is contained in:
John Ericson 2024-01-15 13:21:38 -05:00
parent dbcd4cd6ba
commit d17d358d10
4 changed files with 16 additions and 10 deletions

View file

@ -4,6 +4,7 @@ BOOST_LDFLAGS = @BOOST_LDFLAGS@
BUILD_SHARED_LIBS = @BUILD_SHARED_LIBS@ BUILD_SHARED_LIBS = @BUILD_SHARED_LIBS@
CC = @CC@ CC = @CC@
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
CMARK_LIBS = @CMARK_LIBS@
CXX = @CXX@ CXX = @CXX@
CXXFLAGS = @CXXFLAGS@ CXXFLAGS = @CXXFLAGS@
CXXLTO = @CXXLTO@ CXXLTO = @CXXLTO@

View file

@ -372,21 +372,24 @@ PKG_CHECK_MODULES([RAPIDCHECK], [rapidcheck rapidcheck_gtest])
PKG_CHECK_MODULES([NLOHMANN_JSON], [nlohmann_json >= 3.9]) PKG_CHECK_MODULES([NLOHMANN_JSON], [nlohmann_json >= 3.9])
# Look for cmark library.
PKG_CHECK_MODULES([CMARK], [libcmark], [CXXFLAGS="$CMARK_CFLAGS $CXXFLAGS"])
# Look for lowdown library. # Look for lowdown library.
AC_ARG_ENABLE([markdown], AS_HELP_STRING([--enable-markdown], [Enable Markdown rendering in the Nix binary (requires lowdown) [default=auto]]), AC_ARG_ENABLE([lowdown], AS_HELP_STRING([--enable-lowdown], [Enable Markdown rendering in the Nix binary (requires lowdown) [default=auto]]),
enable_markdown=$enableval, enable_markdown=auto) enable_lowdown=$enableval, enable_lowdown=auto)
AS_CASE(["$enable_markdown"], AS_CASE(["$enable_lowdown"],
[yes | auto], [ [yes | auto], [
PKG_CHECK_MODULES([LOWDOWN], [lowdown >= 0.9.0], [ PKG_CHECK_MODULES([LOWDOWN], [lowdown >= 0.9.0], [
CXXFLAGS="$LOWDOWN_CFLAGS $CXXFLAGS" CXXFLAGS="$LOWDOWN_CFLAGS $CXXFLAGS"
have_lowdown=1 have_lowdown=1
AC_DEFINE(HAVE_LOWDOWN, 1, [Whether lowdown is available and should be used for Markdown rendering.]) AC_DEFINE(HAVE_LOWDOWN, 1, [Whether lowdown is available and should be used for Markdown rendering.])
], [ ], [
AS_IF([test "x$enable_markdown" == "xyes"], [AC_MSG_ERROR([--enable-markdown was specified, but lowdown was not found.])]) AS_IF([test "x$enable_lowdown" == "xyes"], [AC_MSG_ERROR([--enable-lowdown was specified, but lowdown was not found.])])
]) ])
], ],
[no], [have_lowdown=], [no], [have_lowdown=],
[AC_MSG_ERROR([bad value "$enable_markdown" for --enable-markdown, must be one of: yes, no, auto])]) [AC_MSG_ERROR([bad value "$enable_lowdown" for --enable-lowdown, must be one of: yes, no, auto])])
# Look for libgit2. # Look for libgit2.

View file

@ -23,6 +23,7 @@
, libseccomp , libseccomp
, libsodium , libsodium
, man , man
, cmark
, lowdown , lowdown
, mdbook , mdbook
, mdbook-linkcheck , mdbook-linkcheck
@ -79,7 +80,7 @@
, enableGC ? !stdenv.hostPlatform.isWindows , enableGC ? !stdenv.hostPlatform.isWindows
# Whether to enable Markdown rendering in the Nix binary. # Whether to enable Markdown rendering in the Nix binary.
, enableMarkdown ? !stdenv.hostPlatform.isWindows , enableLowdown ? !stdenv.hostPlatform.isWindows
# Which interactive line editor library to use for Nix's repl. # Which interactive line editor library to use for Nix's repl.
# #
@ -228,7 +229,8 @@ in {
toml11 toml11
xz xz
({ inherit readline editline; }.${readlineFlavor}) ({ inherit readline editline; }.${readlineFlavor})
] ++ lib.optionals enableMarkdown [ cmark
] ++ lib.optionals enableLowdown [
lowdown lowdown
] ++ lib.optionals buildUnitTests [ ] ++ lib.optionals buildUnitTests [
gtest gtest
@ -255,7 +257,7 @@ in {
(lib.enableFeature doInstallCheck "functional-tests") (lib.enableFeature doInstallCheck "functional-tests")
(lib.enableFeature enableManual "doc-gen") (lib.enableFeature enableManual "doc-gen")
(lib.enableFeature enableGC "gc") (lib.enableFeature enableGC "gc")
(lib.enableFeature enableMarkdown "markdown") (lib.enableFeature enableLowdown "lowdown")
(lib.enableFeature installUnitTests "install-unit-tests") (lib.enableFeature installUnitTests "install-unit-tests")
(lib.withFeatureAs true "readline-flavor" readlineFlavor) (lib.withFeatureAs true "readline-flavor" readlineFlavor)
] ++ lib.optionals (!forDevShell) [ ] ++ lib.optionals (!forDevShell) [

View file

@ -90,9 +90,9 @@ in
# Toggles some settings for better coverage. Windows needs these # Toggles some settings for better coverage. Windows needs these
# library combinations, and Debian build Nix with GNU readline too. # library combinations, and Debian build Nix with GNU readline too.
buildReadlineNoMarkdown = forAllSystems (system: buildReadlineNoLowdown = forAllSystems (system:
self.packages.${system}.nix.override { self.packages.${system}.nix.override {
enableMarkdown = false; enableLowdown = false;
readlineFlavor = "readline"; readlineFlavor = "readline";
} }
); );