This repository has been archived by the owner on May 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Guillaume Fournier
committed
Jan 14, 2024
1 parent
06e3d69
commit 2352ba9
Showing
4 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
SUMMARY = "A small replacement for GNU readline() for UNIX" | ||
LICENSE = "CLOSED" | ||
|
||
SRC_URI = "git://github.com/troglobit/editline.git;branch=master;protocol=https" | ||
SRCREV = "ecabef273ebf4193c5d6aff196de1c204169bc52" | ||
S = "${WORKDIR}/git" | ||
|
||
inherit autotools pkgconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git a/configure.ac b/configure.ac | ||
index 281ba2c32..c58e0f2fd 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -347,8 +347,23 @@ AC_ARG_ENABLE(doc-gen, AS_HELP_STRING([--disable-doc-gen],[disable documentation | ||
doc_generate=$enableval, doc_generate=yes) | ||
AC_SUBST(doc_generate) | ||
|
||
+ | ||
# Look for lowdown library. | ||
-PKG_CHECK_MODULES([LOWDOWN], [lowdown >= 0.9.0], [CXXFLAGS="$LOWDOWN_CFLAGS $CXXFLAGS"]) | ||
+AC_ARG_ENABLE([markdown], AS_HELP_STRING([--enable-markdown], [Enable Markdown rendering in the Nix binary (requires lowdown) [default=auto]]), | ||
+ enable_markdown=$enableval, enable_markdown=auto) | ||
+AS_CASE(["$enable_markdown"], | ||
+ [yes | auto], [ | ||
+ PKG_CHECK_MODULES([LOWDOWN], [lowdown >= 0.9.0], [ | ||
+ CXXFLAGS="$LOWDOWN_CFLAGS $CXXFLAGS" | ||
+ have_lowdown=1 | ||
+ 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.])]) | ||
+ ]) | ||
+ ], | ||
+ [no], [have_lowdown=], | ||
+ [AC_MSG_ERROR([bad value "$enable_markdown" for --enable-markdown, must be one of: yes, no, auto])]) | ||
+ | ||
|
||
# Setuid installations. | ||
AC_CHECK_FUNCS([setresuid setreuid lchown]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
diff --git a/src/libcmd/markdown.cc b/src/libcmd/markdown.cc | ||
index 8b3bbc1b5..e0d5ba0fc 100644 | ||
--- a/src/libcmd/markdown.cc | ||
+++ b/src/libcmd/markdown.cc | ||
@@ -4,14 +4,15 @@ | ||
#include "terminal.hh" | ||
|
||
#include <sys/queue.h> | ||
+#if HAVE_LOWDOWN | ||
#include <lowdown.h> | ||
- | ||
+#endif | ||
namespace nix { | ||
|
||
std::string renderMarkdownToTerminal(std::string_view markdown) | ||
{ | ||
int windowWidth = getWindowSize().second; | ||
- | ||
+#if HAVE_LOWDOWN | ||
struct lowdown_opts opts { | ||
.type = LOWDOWN_TERM, | ||
.maxdepth = 20, | ||
@@ -48,6 +49,9 @@ std::string renderMarkdownToTerminal(std::string_view markdown) | ||
throw Error("allocation error while rendering Markdown"); | ||
|
||
return filterANSIEscapes(std::string(buf->data, buf->size), !shouldANSI()); | ||
+#else | ||
+ return std::string(markdown); | ||
+#endif | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
SUMMARY = "Nix package manager" | ||
LICENSE = "LGPL-2.1" | ||
LIC_FILES_CHKSUM = "file://${WORKDIR}/git/COPYING;md5=fbc093901857fcd118f065f900982c24" | ||
|
||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" | ||
|
||
SRC_URI += "git://github.com/NixOS/nix.git;branch=latest-release;protocol=https \ | ||
file://configure.ac.patch \ | ||
file://markdown.cc.patch \ | ||
" | ||
|
||
SRCREV = "50f8f1c8bc019a4c0fd098b9ac674b94cfc6af0d" | ||
S = "${WORKDIR}/git" | ||
|
||
inherit autotools-brokensep pkgconfig systemd | ||
|
||
DEPENDS += " \ | ||
bison-native \ | ||
clang-native \ | ||
autoconf-archive \ | ||
jq-native \ | ||
boost \ | ||
openssl \ | ||
libarchive \ | ||
curl \ | ||
libsodium \ | ||
brotli \ | ||
libeditline \ | ||
libseccomp \ | ||
bdwgc \ | ||
nlohmann-json \ | ||
libgit2 \ | ||
" | ||
RDEPENDS:${PN} += " \ | ||
boost \ | ||
openssl \ | ||
libarchive \ | ||
curl \ | ||
libsodium \ | ||
brotli \ | ||
libeditline \ | ||
libseccomp \ | ||
bdwgc \ | ||
nlohmann-json \ | ||
libgit2 \ | ||
" | ||
|
||
PACKAGES = "${PN} ${PN}-dev ${PN}-dbg" | ||
FILES:${PN} += "${libdir}/tmpfiles.d/*" | ||
INSANE_SKIP:${PN} += "dev-so" | ||
SOLIBS = ".so" | ||
|
||
|
||
do_install:append(){ | ||
# Remove unneeded things that we don't want on the nao. | ||
rm -r "${D}/usr/share/" | ||
|
||
# Move service and socket to destination where systemd.bbclass can work with it. | ||
install -d "${D}${systemd_unitdir}/system/" | ||
mv "${D}/usr/lib/systemd/system/nix-daemon.service" "${D}/usr/lib/systemd/system/nix-daemon.socket" "${D}${systemd_unitdir}/system/" | ||
rm -r "${D}/usr/lib/systemd" | ||
} | ||
|
||
|
||
SYSTEMD_SERVICE:${PN} = "nix-daemon.service nix-daemon.socket" | ||
|
||
EXTRA_OECONF += "--disable-cpuid --disable-tests --disable-doc-gen" | ||
PARALLEL_MAKE = "-j 16" |