mirror of
https://github.com/curl/curl.git
synced 2026-08-25 01:33:31 +03:00
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 #13047
This commit is contained in:
parent
9978d40ddb
commit
f03c85635f
22 changed files with 280 additions and 257 deletions
|
|
@ -26,23 +26,18 @@ add_definitions(-DBUILDING_CURL)
|
|||
|
||||
if(ENABLE_CURL_MANUAL AND HAVE_MANUAL_TOOLS)
|
||||
add_definitions("-DUSE_MANUAL")
|
||||
# Use the C locale to ensure that only ASCII characters appear in the
|
||||
# embedded text. NROFF and MANOPT are set in the parent CMakeLists.txt
|
||||
add_custom_command(
|
||||
OUTPUT tool_hugehelp.c
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_setup.h\"" > tool_hugehelp.c
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "#ifndef HAVE_LIBZ" >> tool_hugehelp.c
|
||||
COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
|
||||
"${CURL_BINARY_DIR}/docs/curl.1" |
|
||||
"${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" >> tool_hugehelp.c
|
||||
COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" < "${CURL_BINARY_DIR}/docs/cmdline-opts/curl.txt" >> tool_hugehelp.c
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "#else" >> tool_hugehelp.c
|
||||
COMMAND env LC_ALL=C "${NROFF}" ${NROFF_MANOPT}
|
||||
"${CURL_BINARY_DIR}/docs/curl.1" |
|
||||
"${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c >> tool_hugehelp.c
|
||||
COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c < "${CURL_BINARY_DIR}/docs/cmdline-opts/curl.txt" >> tool_hugehelp.c
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "#endif /* HAVE_LIBZ */" >> tool_hugehelp.c
|
||||
DEPENDS
|
||||
generate-curl.1
|
||||
"${CURL_BINARY_DIR}/docs/curl.1"
|
||||
"${CURL_BINARY_DIR}/docs/cmdline-opts/curl.1"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h"
|
||||
VERBATIM)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ EXTRA_DIST = mkhelp.pl \
|
|||
Makefile.mk curl.rc Makefile.inc CMakeLists.txt .checksrc
|
||||
|
||||
# Use absolute directory to disable VPATH
|
||||
MANPAGE=$(abs_top_builddir)/docs/curl.1
|
||||
ASCIIPAGE=$(abs_top_builddir)/docs/cmdline-opts/curl.txt
|
||||
MKHELP=$(top_srcdir)/src/mkhelp.pl
|
||||
HUGE=tool_hugehelp.c
|
||||
|
||||
|
|
@ -113,24 +113,24 @@ CS_ = $(CS_0)
|
|||
if USE_MANUAL
|
||||
# Here are the stuff to create a built-in manual
|
||||
|
||||
$(MANPAGE):
|
||||
$(ASCIIPAGE):
|
||||
cd $(top_builddir)/docs && $(MAKE)
|
||||
|
||||
if HAVE_LIBZ
|
||||
# This generates the tool_hugehelp.c file in both uncompressed and
|
||||
# compressed formats.
|
||||
$(HUGE): $(MANPAGE) $(MKHELP)
|
||||
$(HUGE): $(ASCIIPAGE) $(MKHELP)
|
||||
$(HUGECMD) (echo '#include "tool_setup.h"' > $(HUGE); \
|
||||
echo '#ifndef HAVE_LIBZ' >> $(HUGE); \
|
||||
$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) >> $(HUGE); \
|
||||
$(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE); \
|
||||
echo '#else' >> $(HUGE); \
|
||||
$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) -c >> $(HUGE); \
|
||||
$(PERL) $(MKHELP) -c < $(ASCIIPAGE) >> $(HUGE); \
|
||||
echo '#endif /* HAVE_LIBZ */' >> $(HUGE) )
|
||||
else # HAVE_LIBZ
|
||||
# This generates the tool_hugehelp.c file uncompressed only
|
||||
$(HUGE): $(MANPAGE) $(MKHELP)
|
||||
$(HUGE): $(ASCIIPAGE) $(MKHELP)
|
||||
$(HUGECMD)(echo '#include "tool_setup.h"' > $(HUGE); \
|
||||
$(NROFF) $(MANPAGE) | $(PERL) $(MKHELP) >> $(HUGE) )
|
||||
$(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE) )
|
||||
endif
|
||||
|
||||
else # USE_MANUAL
|
||||
|
|
|
|||
|
|
@ -44,45 +44,8 @@ push @out, " \\___|\\___/|_| \\_\\_____|\n";
|
|||
my $olen=0;
|
||||
while (<STDIN>) {
|
||||
my $line = $_;
|
||||
|
||||
# this should be removed:
|
||||
$line =~ s/(.|_)//g;
|
||||
|
||||
# remove trailing CR from line. msysgit checks out files as line+CRLF
|
||||
$line =~ s/\r$//;
|
||||
|
||||
$line =~ s/\x1b\x5b[0-9]+m//g; # escape sequence
|
||||
if($line =~ /^([ \t]*\n|curl)/i) {
|
||||
# cut off headers and empty lines
|
||||
$wline++; # count number of cut off lines
|
||||
next;
|
||||
}
|
||||
|
||||
my $text = $line;
|
||||
$text =~ s/^\s+//g; # cut off preceding...
|
||||
$text =~ s/\s+$//g; # and trailing whitespaces
|
||||
|
||||
$tlen = length($text);
|
||||
|
||||
if($wline && ($olen == $tlen)) {
|
||||
# if the previous line with contents was exactly as long as
|
||||
# this line, then we ignore the newlines!
|
||||
|
||||
# We do this magic because a header may abort a paragraph at
|
||||
# any line, but we don't want that to be noticed in the output
|
||||
# here
|
||||
$wline=0;
|
||||
}
|
||||
$olen = $tlen;
|
||||
|
||||
if($wline) {
|
||||
# we only make one empty line max
|
||||
$wline = 0;
|
||||
push @out, "\n";
|
||||
}
|
||||
push @out, $line;
|
||||
}
|
||||
push @out, "\n"; # just an extra newline
|
||||
|
||||
print <<HEAD
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue