From bfac636f78f60edcfc2d425ada43705aeb818000 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Sat, 17 Oct 2020 15:32:39 +0300 Subject: mandoc: don't remove less -T support, make it optional --- README | 36 --------------- README.md | 54 +++++++++++++++++++++++ patches/0040-mandoc-port-to-musl.patch | 81 +++++++++++++++++----------------- usr.bin/mandoc/main.c | 17 +++++++ 4 files changed, 111 insertions(+), 77 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index b8515eb..0000000 --- a/README +++ /dev/null @@ -1,36 +0,0 @@ -otools ------- - -Some OpenBSD userland utilities meant to be included in Carbs Linux base. - -Currently includes the following software: -- diff -- doas -- m4 -- mandoc -- md5 -- nc -- patch -- pax -- signify - -You can build software individually by calling 'make ', and the -program will be built to the root directory of the source. The Makefile -is bsdmake compatible. - -requirements ------------- - -In order to build 'mandoc', you need to either have zlib installed, or edit -config.mk to use the in-source zlib. - -In order to build 'nc', you need to have a libtls implementation. Carbs Linux -uses libtls-bearssl by default. - - -patch directory ---------------- - -The patch directory doesn't serve any function but to keep track of the applied -patches under revision control. The sources here are already patched. - diff --git a/README.md b/README.md new file mode 100644 index 0000000..89ec05a --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +otools +------ + +Some OpenBSD userland utilities meant to be included in Carbs Linux base. + +Currently includes the following software: +- diff +- doas +- m4 +- mandoc +- md5 +- nc +- patch +- pax +- signify + +You can build software individually by calling 'make ', and the +program will be built to the root directory of the source. The Makefile +is bsdmake compatible. + + +requirements +------------ + +In order to build 'mandoc', you need to either have zlib installed, or edit +config.mk to use the in-source zlib. + +In order to build 'nc', you need to have a libtls implementation. Carbs Linux +uses libtls-bearssl by default. + + +notes +----- + +If you want the manpager to have tags support (doesn't work on busybox less), +you will need to do the following: + + echo CFLAGS += -DHAVE_LESS_T >> config.mk + + +If you are unsure whether your less implementation includes tag support, run +the following: + + :> testfile + less -F -T testfile testfile && echo CFLAGS += -DHAVE_LESS_T >> config.mk + rm testfile + + +patch directory +--------------- + +The patch directory doesn't serve any function but to keep track of the applied +patches under revision control. The sources here are already patched. + diff --git a/patches/0040-mandoc-port-to-musl.patch b/patches/0040-mandoc-port-to-musl.patch index fe2b769..60c503f 100644 --- a/patches/0040-mandoc-port-to-musl.patch +++ b/patches/0040-mandoc-port-to-musl.patch @@ -61,47 +61,6 @@ diff -upr a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c #include #include -diff -upr a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c ---- a/usr.bin/mandoc/main.c 2020-04-03 01:10:27.000000000 +0300 -+++ b/usr.bin/mandoc/main.c 2020-10-15 20:36:12.432111094 +0300 -@@ -405,8 +405,10 @@ main(int argc, char *argv[]) - } - if (search.arch == NULL) - search.arch = getenv("MACHINE"); -+#ifdef MACHINE - if (search.arch == NULL) - search.arch = MACHINE; -+#endif - if (outmode == OUTMODE_ONE) - search.firstmatch = 1; - } -@@ -1183,7 +1185,6 @@ spawn_pager(struct tag_files *tag_files, - char *argv[MAX_PAGER_ARGS]; - const char *pager; - char *cp; -- size_t cmdlen; - int argc, use_ofn; - pid_t pager_pid; - -@@ -1218,18 +1219,6 @@ spawn_pager(struct tag_files *tag_files, - /* For more(1) and less(1), use the tag file. */ - - use_ofn = 1; -- if (*tag_files->tfn != '\0' && (cmdlen = strlen(argv[0])) >= 4) { -- cp = argv[0] + cmdlen - 4; -- if (strcmp(cp, "less") == 0 || strcmp(cp, "more") == 0) { -- argv[argc++] = mandoc_strdup("-T"); -- argv[argc++] = tag_files->tfn; -- if (tag_target != NULL) { -- argv[argc++] = mandoc_strdup("-t"); -- argv[argc++] = tag_target; -- use_ofn = 0; -- } -- } -- } - if (use_ofn) - argv[argc++] = tag_files->ofn; - argv[argc] = NULL; diff -upr a/usr.bin/mandoc/mandoc_ohash.c b/usr.bin/mandoc/mandoc_ohash.c --- a/usr.bin/mandoc/mandoc_ohash.c 2015-10-19 21:58:20.000000000 +0300 +++ b/usr.bin/mandoc/mandoc_ohash.c 2020-10-15 20:22:30.788037370 +0300 @@ -157,3 +116,43 @@ diff -upr a/usr.bin/mandoc/tag.c b/usr.bin/mandoc/tag.c #include #include +diff -up a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c +--- a/usr.bin/mandoc/main.c 2020-04-03 01:10:27.000000000 +0300 ++++ b/usr.bin/mandoc/main.c 2020-10-17 15:16:29.615721780 +0300 +@@ -405,8 +405,10 @@ main(int argc, char *argv[]) + } + if (search.arch == NULL) + search.arch = getenv("MACHINE"); ++#ifdef MACHINE + if (search.arch == NULL) + search.arch = MACHINE; ++#endif + if (outmode == OUTMODE_ONE) + search.firstmatch = 1; + } +@@ -1183,7 +1185,9 @@ spawn_pager(struct tag_files *tag_files, + char *argv[MAX_PAGER_ARGS]; + const char *pager; + char *cp; ++#ifdef HAVE_LESS_T + size_t cmdlen; ++#endif + int argc, use_ofn; + pid_t pager_pid; + +@@ -1218,6 +1222,7 @@ spawn_pager(struct tag_files *tag_files, + /* For more(1) and less(1), use the tag file. */ + + use_ofn = 1; ++#ifdef HAVE_LESS_T + if (*tag_files->tfn != '\0' && (cmdlen = strlen(argv[0])) >= 4) { + cp = argv[0] + cmdlen - 4; + if (strcmp(cp, "less") == 0 || strcmp(cp, "more") == 0) { +@@ -1230,6 +1235,7 @@ spawn_pager(struct tag_files *tag_files, + } + } + } ++#endif + if (use_ofn) + argv[argc++] = tag_files->ofn; + argv[argc] = NULL; diff --git a/usr.bin/mandoc/main.c b/usr.bin/mandoc/main.c index 6f2174a..acdbd91 100644 --- a/usr.bin/mandoc/main.c +++ b/usr.bin/mandoc/main.c @@ -1185,6 +1185,9 @@ spawn_pager(struct tag_files *tag_files, char *tag_target) char *argv[MAX_PAGER_ARGS]; const char *pager; char *cp; +#ifdef HAVE_LESS_T + size_t cmdlen; +#endif int argc, use_ofn; pid_t pager_pid; @@ -1219,6 +1222,20 @@ spawn_pager(struct tag_files *tag_files, char *tag_target) /* For more(1) and less(1), use the tag file. */ use_ofn = 1; +#ifdef HAVE_LESS_T + if (*tag_files->tfn != '\0' && (cmdlen = strlen(argv[0])) >= 4) { + cp = argv[0] + cmdlen - 4; + if (strcmp(cp, "less") == 0 || strcmp(cp, "more") == 0) { + argv[argc++] = mandoc_strdup("-T"); + argv[argc++] = tag_files->tfn; + if (tag_target != NULL) { + argv[argc++] = mandoc_strdup("-t"); + argv[argc++] = tag_target; + use_ofn = 0; + } + } + } +#endif if (use_ofn) argv[argc++] = tag_files->ofn; argv[argc] = NULL; -- cgit v1.2.3