Skip to content

Commit f03c856

Browse files
committed
docs: ascii version of manpage without nroff
Create ASCII version of manpage without nroff - build src/tool_hugegelp.c from the ascii manpage - move the the manpage and the ascii version build to docs/cmdline-opts - remove all use of nroff from the build process - should make the build entirely reproducible (by avoiding nroff) - partly reverts 2620aa9 to build libcurl option man pages one by one in cmake because the appveyor builds got all crazy until I did The ASCII version of the manpage - is built with gen.pl, just like the manpage is - has a right-justified column making the appearance similar to the previous version - uses a 4-space indent per level (instead of the old version's 7) - does not do hyphenation of words (which nroff does) History We first made the curl build use nroff for building the hugehelp file in December 1998, for curl 5.2. Closes curl#13047
1 parent 9978d40 commit f03c856

22 files changed

+279
-256
lines changed

CMake/Macros.cmake

-29
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,6 @@ macro(curl_internal_test CURL_TEST)
6868
endif()
6969
endmacro()
7070

71-
macro(curl_nroff_check)
72-
find_program(NROFF NAMES gnroff nroff)
73-
if(NROFF)
74-
# Need a way to write to stdin, this will do
75-
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/nroff-input.txt" "test")
76-
# Tests for a valid nroff option to generate a manpage
77-
foreach(_MANOPT "-man" "-mandoc")
78-
execute_process(COMMAND "${NROFF}" ${_MANOPT}
79-
OUTPUT_VARIABLE NROFF_MANOPT_OUTPUT
80-
INPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/nroff-input.txt"
81-
ERROR_QUIET)
82-
# Save the option if it was valid
83-
if(NROFF_MANOPT_OUTPUT)
84-
message("Found *nroff option: -- ${_MANOPT}")
85-
set(NROFF_MANOPT ${_MANOPT})
86-
set(NROFF_USEFUL ON)
87-
break()
88-
endif()
89-
endforeach()
90-
# No need for the temporary file
91-
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/nroff-input.txt")
92-
if(NOT NROFF_USEFUL)
93-
message(WARNING "Found no *nroff option to get plaintext from man pages")
94-
endif()
95-
else()
96-
message(WARNING "Found no *nroff program")
97-
endif()
98-
endmacro()
99-
10071
macro(optional_dependency DEPENDENCY)
10172
set(CURL_${DEPENDENCY} AUTO CACHE STRING "Build curl with ${DEPENDENCY} support (AUTO, ON or OFF)")
10273
set_property(CACHE CURL_${DEPENDENCY} PROPERTY STRINGS AUTO ON OFF)

CMakeLists.txt

+2-5
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,10 @@ option(ENABLE_CURL_MANUAL "to build the man page for curl and enable its -M/--ma
312312

313313
if(ENABLE_CURL_MANUAL OR BUILD_LIBCURL_DOCS)
314314
if(PERL_FOUND)
315-
curl_nroff_check()
316-
if(NROFF_USEFUL)
317-
set(HAVE_MANUAL_TOOLS ON)
318-
endif()
315+
set(HAVE_MANUAL_TOOLS ON)
319316
endif()
320317
if(NOT HAVE_MANUAL_TOOLS)
321-
message(WARNING "Perl not found, or nroff not useful. Will not build manuals.")
318+
message(WARNING "Perl not found. Will not build manuals.")
322319
endif()
323320
endif()
324321

GIT-INFO

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ following software installed:
3636
o libtool 1.4.2 (or later)
3737
o GNU m4 (required by autoconf)
3838

39-
o nroff + perl
39+
o perl
4040

41-
If you don't have nroff and perl and you for some reason don't want to
42-
install them, you can rename the source file src/tool_hugehelp.c.cvs to
43-
src/tool_hugehelp.c and avoid having to generate this file. This will
44-
give you a stubbed version of the file that doesn't contain actual content.
41+
If you don't have perl and don't want to install it, you can rename the
42+
source file src/tool_hugehelp.c.cvs to src/tool_hugehelp.c and avoid having
43+
to generate this file. This will give you a stubbed version of the file
44+
that doesn't contain actual content.

Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ CLEANFILES = $(VC14_LIBVCXPROJ) $(VC14_SRCVCXPROJ) \
134134

135135
bin_SCRIPTS = curl-config
136136

137-
SUBDIRS = lib src scripts
137+
SUBDIRS = lib docs src scripts
138138
DIST_SUBDIRS = $(SUBDIRS) tests packages scripts include docs
139139

140140
pkgconfigdir = $(libdir)/pkgconfig

configure.ac

-38
Original file line numberDiff line numberDiff line change
@@ -3826,10 +3826,6 @@ AC_CHECK_DECL([fseeko],
38263826

38273827
CURL_CHECK_NONBLOCKING_SOCKET
38283828

3829-
dnl ************************************************************
3830-
dnl nroff tool stuff
3831-
dnl
3832-
38333829
AC_PATH_PROG( PERL, perl, ,
38343830
$PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
38353831
AC_SUBST(PERL)
@@ -3844,40 +3840,6 @@ fi
38443840
dnl set variable for use in automakefile(s)
38453841
AM_CONDITIONAL(BUILD_DOCS, test x"$BUILD_DOCS" = x1)
38463842

3847-
AC_PATH_PROGS( NROFF, gnroff nroff, ,
3848-
$PATH:/usr/bin/:/usr/local/bin )
3849-
AC_SUBST(NROFF)
3850-
3851-
if test -n "$NROFF"; then
3852-
dnl only check for nroff options if an nroff command was found
3853-
3854-
AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3855-
MANOPT="-man"
3856-
mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3857-
if test -z "$mancheck"; then
3858-
MANOPT="-mandoc"
3859-
mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3860-
if test -z "$mancheck"; then
3861-
MANOPT=""
3862-
AC_MSG_RESULT([failed])
3863-
AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3864-
else
3865-
AC_MSG_RESULT([$MANOPT])
3866-
fi
3867-
else
3868-
AC_MSG_RESULT([$MANOPT])
3869-
fi
3870-
AC_SUBST(MANOPT)
3871-
fi
3872-
3873-
if test -z "$MANOPT"
3874-
then
3875-
dnl if no nroff tool was found, or no option that could convert man pages
3876-
dnl was found, then disable the built-in manual stuff
3877-
AC_MSG_WARN([disabling built-in manual])
3878-
USE_MANUAL="no";
3879-
fi
3880-
38813843
dnl *************************************************************************
38823844
dnl If the manual variable still is set, then we go with providing a built-in
38833845
dnl manual

docs/INTERNALS.md

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ versions of libs and build tools.
4343
- GNU M4 1.4
4444
- perl 5.6
4545
- roffit 0.5
46-
- nroff any version that supports `-man [in] [out]`
4746
- cmake 3.7
4847

4948
Library Symbols

docs/Makefile.am

+2-21
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ MK_CA_DOCS = mk-ca-bundle.1
3030
CURLCONF_DOCS = curl-config.1
3131
endif
3232

33-
man_MANS = $(abs_builddir)/curl.1 curl-config.1
33+
man_MANS = curl-config.1
3434
CURLPAGES = curl-config.md mk-ca-bundle.md
3535

36-
# Build targets in this file (.) before cmdline-opts to ensure that
37-
# the curl.1 rule below runs first
3836
SUBDIRS = . cmdline-opts libcurl
3937
DIST_SUBDIRS = $(SUBDIRS) examples
4038

4139
if BUILD_DOCS
42-
CLEANFILES = curl.1 mk-ca-bundle.1 curl-config.1
40+
CLEANFILES = mk-ca-bundle.1 curl-config.1
4341
endif
4442

4543
EXTRA_DIST = \
@@ -112,20 +110,6 @@ SUFFIXES = .1 .md
112110

113111
all: $(MK_CA_DOCS)
114112

115-
# $(abs_builddir) is to disable VPATH when searching for this file, which
116-
# would otherwise find the copy in $(srcdir) which breaks the $(HUGE)
117-
# rule in src/Makefile.am in out-of-tree builds that references the file in the
118-
# build directory.
119-
#
120-
# First, seed the used copy of curl.1 with the prebuilt copy (in an out-of-tree
121-
# build), then run make recursively to rebuild it only if its dependencies
122-
# have changed.
123-
$(abs_builddir)/curl.1:
124-
if test "$(top_builddir)x" != "$(top_srcdir)x" -a -e "$(srcdir)/curl.1"; then \
125-
$(INSTALL_DATA) "$(srcdir)/curl.1" $@ \
126-
&& touch -r "$(srcdir)/curl.1" $@; fi
127-
cd cmdline-opts && $(MAKE)
128-
129113
.md.1:
130114
$(CD2)$(CD2NROFF)
131115

@@ -135,6 +119,3 @@ mk-ca-bundle.1: mk-ca-bundle.md
135119

136120
distclean:
137121
rm -f $(CLEANFILES)
138-
139-
dist-hook:
140-
cp $(builddir)/curl.1 $(builddir)/curl.1.dist

docs/TODO

-9
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@
177177
18.29 --retry and transfer timeouts
178178

179179
19. Build
180-
19.1 avoid nroff
181180
19.2 Enable PIE and RELRO by default
182181
19.3 Do not use GNU libtool on OpenBSD
183182
19.4 Package curl for Windows in a signed installer
@@ -1291,14 +1290,6 @@
12911290

12921291
19. Build
12931292

1294-
19.1 avoid nroff
1295-
1296-
With the switch to the markdown-like documentation format since curl 8.6.0,
1297-
it should (with a manageable amount of work) be possible to render an ASCII
1298-
version of the man page without involving nroff and thus remove that
1299-
dependency for building the hugehelp file, used to build in the man page into
1300-
the curl command line tool.
1301-
13021293
19.2 Enable PIE and RELRO by default
13031294

13041295
Especially when having programs that execute curl via the command line, PIE

docs/cmdline-opts/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@
2121
# SPDX-License-Identifier: curl
2222
#
2323
###########################################################################
24-
set(MANPAGE "${CURL_BINARY_DIR}/docs/curl.1")
24+
set(MANPAGE "${CURL_BINARY_DIR}/docs/cmdline-opts/curl.1")
25+
set(ASCIIPAGE "${CURL_BINARY_DIR}/docs/cmdline-opts/curl.txt")
2526

2627
# Load DPAGES and OTHERPAGES from shared file
2728
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
2829
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
2930

3031
add_custom_command(OUTPUT "${MANPAGE}"
3132
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && "${PERL_EXECUTABLE}" "./gen.pl" mainpage ${DPAGES} > "${MANPAGE}"
33+
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && "${PERL_EXECUTABLE}" "./gen.pl" ascii ${DPAGES} > "${ASCIIPAGE}"
3234
VERBATIM
3335
)
3436
add_custom_target(generate-curl.1 ALL DEPENDS "${MANPAGE}")

docs/cmdline-opts/Makefile.am

+17-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424

2525
AUTOMAKE_OPTIONS = foreign no-dependencies
2626

27-
MANPAGE = $(top_builddir)/docs/curl.1
27+
MANPAGE = curl.1
28+
ASCIIPAGE = curl.txt
29+
30+
man_MANS = $(MANPAGE)
2831

2932
include Makefile.inc
3033

@@ -35,10 +38,21 @@ GN_0 = @echo " GENERATE" $@;
3538
GN_1 =
3639
GN_ = $(GN_0)
3740

38-
all: $(MANPAGE)
41+
if BUILD_DOCS
42+
CLEANFILES = $(MANPAGE) $(ASCIIPAGE)
43+
44+
all: $(MANPAGE) $(ASCIIPAGE)
45+
46+
endif
3947

4048
$(MANPAGE): $(DPAGES) $(SUPPORT) mainpage.idx Makefile.inc gen.pl
41-
$(GEN)(rm -f $(MANPAGE) && cd $(srcdir) && @PERL@ ./gen.pl mainpage $(DPAGES) > $(builddir)/manpage.tmp.$$$$ && mv $(builddir)/manpage.tmp.$$$$ $(MANPAGE))
49+
$(GEN)(rm -f $(MANPAGE) && (cd $(srcdir) && @PERL@ ./gen.pl mainpage $(DPAGES)) > manpage.tmp.$$$$ && mv manpage.tmp.$$$$ $(MANPAGE))
50+
51+
$(ASCIIPAGE): $(DPAGES) $(SUPPORT) mainpage.idx Makefile.inc gen.pl
52+
$(GEN)(rm -f $(ASCIIPAGE) && (cd $(srcdir) && @PERL@ ./gen.pl ascii $(DPAGES)) > asciipage.tmp.$$$$ && mv asciipage.tmp.$$$$ $(ASCIIPAGE))
4253

4354
listhelp:
4455
./gen.pl listhelp $(DPAGES) > $(top_builddir)/src/tool_listhelp.c
56+
57+
dist-hook: $(MANPAGE)
58+
cp $(MANPAGE) $(MANPAGE).dist

docs/cmdline-opts/_PROGRESS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Copyright (C) Daniel Stenberg, <[email protected]>, et al. -->
22
<!-- SPDX-License-Identifier: curl -->
3-
# "PROGRESS METER"
3+
# PROGRESS METER
44

55
curl normally displays a progress meter during operations, indicating the
66
amount of transferred data, transfer speeds and estimated time left, etc. The

0 commit comments

Comments
 (0)