Skip to content

Commit

Permalink
curl: build-manual tweaks
Browse files Browse the repository at this point in the history
- cmake: enable building manuals when not building from a curl release
  tarball with curl 8.6.0 and newer. With upstream fixes in place these
  are expected to work better than before.

- cmake: drop the local `tool_hugehelp.c` hack for curl 8.6.0 and newer.

- autotools: skip re-building `curl.1` and `tool_hugehelp.c` if they are
  already present (just like we do in cmake builds now). This is the
  case when building from a curl source release tarball.
  • Loading branch information
vszakats committed Jan 22, 2024
1 parent b3eca87 commit d2e86ec
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
12 changes: 11 additions & 1 deletion curl-autotools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,17 @@ _VER="$1"
LDFLAGS_LIB+=" -Wl,--output-def,${_DEF_NAME}"
fi

# If the source tarball provides these pre-built, just use them without
# trying to rebuild them. Rebuilding introduces env-specific differences
# via `nroff`.
if [ -f 'docs/curl.1' ] && \
[ -f 'src/tool_hugehelp.c' ]; then
options+=' --disable-manual'
CPPFLAGS+=' -DUSE_MANUAL=1' # Use pre-built manual
else
options+=' --enable-manual'
fi

options+=' --enable-static --enable-shared'

(
Expand All @@ -406,7 +417,6 @@ _VER="$1"
--disable-tls-srp \
--enable-warnings \
--enable-symbol-hiding \
--enable-manual \
--enable-verbose \
--enable-http-auth \
--enable-doh \
Expand Down
22 changes: 16 additions & 6 deletions curl-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,21 @@ _VER="$1"
options+=' -DCURL_USE_LIBPSL=OFF'
fi

# Official method correctly enables the manual, but with the side-effect
# of rebuilding tool_hugehelp.c (with empty content). We work around this
# by enabling the manual directly via its C flag.
options+=' -DENABLE_MANUAL=OFF -DUSE_MANUAL=OFF'
CPPFLAGS+=' -DUSE_MANUAL=1'
# If the source tarball provides these pre-built, just use them without
# trying to rebuild them. Rebuilding introduces env-specific differences
# via `nroff`.
if [ -f 'docs/curl.1' ] && \
[ -f 'src/tool_hugehelp.c' ]; then
options+=' -DENABLE_MANUAL=OFF -DUSE_MANUAL=OFF'
CPPFLAGS+=' -DUSE_MANUAL=1' # Use pre-built manual
# 8.5.0 and earlier have issues with `ENABLE_MANUAL` and/or may end up
# building an empty manual.
elif [ "${CURL_VER_}" = '8.5.0' ]; then
options+=' -DENABLE_MANUAL=OFF -DUSE_MANUAL=OFF'
CPPFLAGS+=' -DUSE_MANUAL=1'
else
options+=' -DENABLE_MANUAL=ON' # Build it
fi

if [ "${CW_DEV_LLD_REPRODUCE:-}" = '1' ] && [ "${_LD}" = 'lld' ]; then
LDFLAGS_BIN+=" -Wl,--reproduce=$(pwd)/$(basename "$0" .sh)-bin.tar"
Expand Down Expand Up @@ -444,7 +454,7 @@ _VER="$1"
"-DCMAKE_SHARED_LINKER_FLAGS=${LDFLAGS} ${LDFLAGS_LIB} ${LIBS}" # --debug-find --debug-trycompile
fi

if [[ "${_CONFIG}" != *'nocurltool'* ]]; then
if [[ "${_CONFIG}" != *'nocurltool'* ]] && [ "${CURL_VER_}" = '8.5.0' ]; then
# When doing an out of tree build, this is necessary to avoid make
# re-generating the embedded manual with blank content.
if [ -f src/tool_hugehelp.c ]; then
Expand Down

0 comments on commit d2e86ec

Please sign in to comment.