mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-03-19 20:42:34 +01:00
88 lines
3.2 KiB
Diff
88 lines
3.2 KiB
Diff
diff --git a/Makefile.in b/Makefile.in
|
|
index 9647e46..990b04f 100644
|
|
--- a/Makefile.in
|
|
+++ b/Makefile.in
|
|
@@ -86,7 +86,11 @@ LIBREADLINE_CPPFLAGS= $(LIBREADLINE_CPPFLAGS_$(LIBREADLINE_FOUND))
|
|
|
|
############## LOWDOWN #########################################
|
|
LIBLOWDOWN_FOUND= @LIBLOWDOWN_FOUND@
|
|
-LIBLOWDOWN_CFLAGS_1= @LIBLOWDOWN_CFLAGS@
|
|
+LIBLOWDOWN_MAJOR= @LIBLOWDOWN_MAJOR@
|
|
+LIBLOWDOWN_MINOR= @LIBLOWDOWN_MINOR@
|
|
+LIBLOWDOWN_CFLAGS_1= @LIBLOWDOWN_CFLAGS@ \
|
|
+ -DLIBLOWDOWN_MAJOR=$(LIBLOWDOWN_MAJOR) \
|
|
+ -DLIBLOWDOWN_MINOR=$(LIBLOWDOWN_MINOR)
|
|
LIBLOWDOWN_LIBS_1= @LIBLOWDOWN_LIBS@
|
|
LIBLOWDOWN_CFLAGS= $(LIBLOWDOWN_CFLAGS_$(LIBLOWDOWN_FOUND))
|
|
LIBLOWDOWN_LIBS= $(LIBLOWDOWN_LIBS_$(LIBLOWDOWN_FOUND))
|
|
diff --git a/configure b/configure
|
|
index 560b097d..01ccb884 100755
|
|
--- a/configure
|
|
+++ b/configure
|
|
@@ -117,6 +117,8 @@ find_package() {
|
|
export ${2}_CFLAGS="$($PKG_CONFIG --cflags $1 | sed 's|-D_XOPEN_SOURCE=[[:digit:]]*||g')"
|
|
export ${2}_LIBS="$($PKG_CONFIG --libs $1)"
|
|
export ${2}_FOUND=1
|
|
+ export ${2}_VERSION="$($PKG_CONFIG --modversion $1)"
|
|
+
|
|
printf " found\n" >&2
|
|
}
|
|
|
|
@@ -288,6 +290,12 @@ fi
|
|
# Lowdown
|
|
if [ $ENABLE_LIBLOWDOWN -eq 1 ]; then
|
|
find_package lowdown LIBLOWDOWN optional
|
|
+
|
|
+ # Workaround for breaking API changes and header without versions:
|
|
+ #
|
|
+ # See https://github.com/kristapsdz/lowdown/issues/148
|
|
+ LIBLOWDOWN_MAJOR=$(echo $LIBLOWDOWN_VERSION | cut -d. -f1)
|
|
+ LIBLOWDOWN_MINOR=$(echo $LIBLOWDOWN_VERSION | cut -d. -f2)
|
|
else
|
|
LIBLOWDOWN_FOUND=0
|
|
fi
|
|
@@ -333,6 +341,8 @@ sed \
|
|
-e "s|@LIBLOWDOWN_FOUND@|$LIBLOWDOWN_FOUND|g" \
|
|
-e "s|@LIBLOWDOWN_CFLAGS@|$LIBLOWDOWN_CFLAGS|g" \
|
|
-e "s|@LIBLOWDOWN_LIBS@|$LIBLOWDOWN_LIBS|g" \
|
|
+ -e "s|@LIBLOWDOWN_MAJOR@|$LIBLOWDOWN_MAJOR|g" \
|
|
+ -e "s|@LIBLOWDOWN_MINOR@|$LIBLOWDOWN_MINOR|g" \
|
|
-e "s|@CONFIGURE_CMD_ARGS@|$CONFIGURE_CMD_ARGS|g" \
|
|
-e "s|@CC@|$CC|g" \
|
|
-e "s|@CCOM@|$CCOM|g" \
|
|
@@ -392,7 +402,7 @@ echo " LIBREADLINE_CFLAGS: ${LIBREADLINE_CFLAGS}"
|
|
echo " LIBREADLINE_LIBS: ${LIBREADLINE_LIBS}"
|
|
fi
|
|
if [ $LIBLOWDOWN_FOUND -eq 1 ]; then
|
|
-echo " Using lowdown:"
|
|
+echo " Using lowdown ${LIBLOWDOWN_VERSION}:"
|
|
echo " LIBLOWDOWN_CFLAGS: ${LIBLOWDOWN_CFLAGS}"
|
|
echo " LIBLOWDOWN_LIBS: ${LIBLOWDOWN_LIBS}"
|
|
fi
|
|
diff --git a/src/cmd/cmd.c b/src/cmd/cmd.c
|
|
index 4b1c0e1..f1f6666 100644
|
|
--- a/src/cmd/cmd.c
|
|
+++ b/src/cmd/cmd.c
|
|
@@ -179,9 +179,20 @@ gcli_pretty_print(char const *input, int indent, int maxlinelen, FILE *stream)
|
|
if (!gcli_config_have_colours(g_clictx))
|
|
opts.oflags |= (LOWDOWN_TERM_NOANSI|LOWDOWN_TERM_NOCOLOUR);
|
|
|
|
+ /* Lowdown 1.4.0 broke the api in a minor version update. Work around
|
|
+ * this by checking versions.
|
|
+ *
|
|
+ * See: https://github.com/kristapsdz/lowdown/issues/148 and
|
|
+ * https://github.com/kristapsdz/lowdown/releases/tag/VERSION_1_4_0 */
|
|
+#if LIBLOWDOWN_MAJOR >= 1 && LIBLOWDOWN_MINOR >= 4
|
|
+ opts.term.vmargin = 1;
|
|
+ opts.term.hmargin = indent - 4; /* somehow there's always 4 spaces being emitted by lowdown */
|
|
+ opts.term.cols = maxlinelen;
|
|
+#else
|
|
opts.vmargin = 1;
|
|
- opts.hmargin = indent - 4; /* somehow there's always 4 spaces being emitted by lowdown */
|
|
+ opts.hmargin = indent - 4;
|
|
opts.cols = maxlinelen;
|
|
+#endif
|
|
|
|
if ((doc = lowdown_doc_new(&opts)) == NULL)
|
|
err(1, NULL);
|