From: Viktor Szakats Date: Thu, 31 Jul 2025 14:38:34 +0000 (+0200) Subject: build: if no perl, fix to use the pre-built hugehelp, if present X-Git-Tag: curl-8_16_0~280 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54da6f5a3281c9c66a184e23302e22c48ca1773c;p=thirdparty%2Fcurl.git build: if no perl, fix to use the pre-built hugehelp, if present - cmake: Before this patch a missing perl disabled the curl manual. After this patch, it automatically picks up a pre-built hugehelp, if present (= when building from a release tarball). Follow-up to 0035ff45c59437db1a8ffe960b40905c8582b149 #16081 - autotools: Rework behavior when perl is missing. Before this patch it caused a hard error when docs/manual/ca-embed were enabled. Of these, docs were enabled by default. After this patch, doc generation is automatically skipped, with a warning. Manual generation falls back to using a pre-built hugehelp, or a stub if that's missing. CA-embed is automatically skipped, with a warning. Slight difference from cmake: When built with no perl and no pre-built hugehelp, the manual is enabled, but the content is empty; with cmake it's disabled proper. Follow-up to 137aecfbf1e933e7228a4f62cc977eabffb2afbf #13514 Follow-up to 541321507e386744c3ea1200cc83cc98338e27d7 #12857 Also: - GHA/distcheck: verify if the pre-built hugehelp makes it into curl. - GHA/distcheck: streamline disabling perl with autotools. - GHA/distcheck: `--disable-docs` no longer required to build without perl. Passing it also implicitly disables the curl manual, which is undesired in these tests. - cmake: drop redundant `HAVE_MANUAL_TOOLS` interim variable. - cmake: move two `set()` lines close to their counterparts. Follow-up to 25119fbaaa76a182d4b08d64853d0a8db9181219 #18104 Closes #18118 --- diff --git a/.github/workflows/distcheck.yml b/.github/workflows/distcheck.yml index 03032023f6..42633ef040 100644 --- a/.github/workflows/distcheck.yml +++ b/.github/workflows/distcheck.yml @@ -113,7 +113,7 @@ jobs: make test-ci make install curl-install/bin/curl --disable --version - curl-install/bin/curl --manual | wc -l + curl-install/bin/curl --manual | wc -l | grep -v '^ *0$' popd scripts/checksrc-all.pl @@ -127,9 +127,6 @@ jobs: with: name: 'release-tgz' - - name: 'disable preinstalled perl' - run: sudo mv "$(command -v perl)" "$(command -v perl)"-disabled - - name: 'build & install' run: | echo "::stop-commands::$(uuidgen)" @@ -137,11 +134,11 @@ jobs: pushd curl-99.98.97 mkdir build pushd build - ../configure --prefix="$PWD"/curl-install --enable-werror --without-ssl --without-libpsl --disable-docs + ../configure --prefix="$PWD"/curl-install --enable-werror --without-ssl --without-libpsl ac_cv_path_PERL= make make install curl-install/bin/curl --disable --version - curl-install/bin/curl --manual | wc -l + curl-install/bin/curl --manual | wc -l | grep -v '^ *0$' popd verify-in-tree-autotools: @@ -154,19 +151,16 @@ jobs: with: name: 'release-tgz' - - name: 'disable preinstalled perl' - run: sudo mv "$(command -v perl)" "$(command -v perl)"-disabled - - name: 'build & install' run: | echo "::stop-commands::$(uuidgen)" tar xvf curl-99.98.97.tar.gz pushd curl-99.98.97 - ./configure --prefix="$PWD"/curl-install --enable-werror --without-ssl --without-libpsl --disable-docs + ./configure --prefix="$PWD"/curl-install --enable-werror --without-ssl --without-libpsl ac_cv_path_PERL= make make install curl-install/bin/curl --disable --version - curl-install/bin/curl --manual | wc -l + curl-install/bin/curl --manual | wc -l | grep -v '^ *0$' verify-out-of-tree-cmake: name: 'CM out-of-tree !perl' @@ -188,7 +182,7 @@ jobs: cmake --install build export LD_LIBRARY_PATH="$PWD/curl-install/lib:$LD_LIBRARY_PATH" curl-install/bin/curl --disable --version - curl-install/bin/curl --manual | wc -l + curl-install/bin/curl --manual | wc -l | grep -v '^ *0$' verify-in-tree-cmake: name: 'CM in-tree !perl' @@ -210,7 +204,7 @@ jobs: cmake --install . export LD_LIBRARY_PATH="$PWD/curl-install/lib:$LD_LIBRARY_PATH" curl-install/bin/curl --disable --version - curl-install/bin/curl --manual | wc -l + curl-install/bin/curl --manual | wc -l | grep -v '^ *0$' missing-files: name: 'missing files' diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a63b04d82..7e3cfff3ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -532,13 +532,8 @@ option(BUILD_LIBCURL_DOCS "Build libcurl man pages" ON) option(BUILD_MISC_DOCS "Build misc man pages (e.g. curl-config and mk-ca-bundle)" ON) option(ENABLE_CURL_MANUAL "Build the man page for curl and enable its -M/--manual option" ON) -if(ENABLE_CURL_MANUAL OR BUILD_LIBCURL_DOCS) - if(PERL_FOUND) - set(HAVE_MANUAL_TOOLS ON) - endif() - if(NOT HAVE_MANUAL_TOOLS) - message(WARNING "Perl not found. Will not build manuals.") - endif() +if((ENABLE_CURL_MANUAL OR BUILD_LIBCURL_DOCS) AND NOT PERL_FOUND) + message(WARNING "Perl not found. Will not build manuals.") endif() # If we are on AIX, do the _ALL_SOURCE magic @@ -2034,7 +2029,7 @@ else() set(CURL_BUILD_TESTING OFF) endif() -if(HAVE_MANUAL_TOOLS) +if(PERL_FOUND) set(CURL_MANPAGE "${PROJECT_BINARY_DIR}/docs/cmdline-opts/curl.1") set(CURL_ASCIIPAGE "${PROJECT_BINARY_DIR}/docs/cmdline-opts/curl.txt") add_subdirectory(docs) diff --git a/acinclude.m4 b/acinclude.m4 index e10e4a01e0..105874fbe0 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1284,9 +1284,14 @@ AS_HELP_STRING([--without-ca-embed], [Don't embed a default CA bundle in the cur CURL_CA_EMBED='' if test "x$want_ca_embed" != "xno" -a "x$want_ca_embed" != "xunset" -a -f "$want_ca_embed"; then - CURL_CA_EMBED="$want_ca_embed" - AC_SUBST(CURL_CA_EMBED) - AC_MSG_RESULT([$want_ca_embed]) + if test -n "$PERL"; then + CURL_CA_EMBED="$want_ca_embed" + AC_SUBST(CURL_CA_EMBED) + AC_MSG_RESULT([$want_ca_embed]) + else + AC_MSG_RESULT([no]) + AC_MSG_WARN([perl was not found. Will not do CA embed.]) + fi else AC_MSG_RESULT([no]) fi diff --git a/configure.ac b/configure.ac index 7cce097794..a76761d797 100644 --- a/configure.ac +++ b/configure.ac @@ -280,6 +280,10 @@ AS_HELP_STRING([--with-rustls=PATH],[where to look for Rustls, PATH points to th fi ]) +AC_PATH_PROG(PERL, perl,, $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin) +AC_SUBST(PERL) +AM_CONDITIONAL(PERL, test -n "$PERL") + TEST_NGHTTPX=nghttpx AC_ARG_WITH(test-nghttpx,dnl AS_HELP_STRING([--with-test-nghttpx=PATH],[where to find nghttpx for testing]), @@ -1056,7 +1060,10 @@ AS_HELP_STRING([--disable-docs],[Disable documentation]), AC_MSG_RESULT(yes) BUILD_DOCS=1 ) - +if test -z "$PERL" -a "x$BUILD_DOCS" != "x0"; then + AC_MSG_WARN([perl was not found. Will not build documentation.]) + BUILD_DOCS=0 +fi dnl ************************************************************ dnl disable C code generation support @@ -4218,16 +4225,6 @@ fi CURL_CHECK_NONBLOCKING_SOCKET -AC_PATH_PROG(PERL, perl,, - $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin) -AC_SUBST(PERL) - -if test "x$BUILD_DOCS" != "x0" -o "x$USE_MANUAL" != "x0" -o "x$CURL_CA_EMBED" != "x"; then - if test -z "$PERL"; then - AC_MSG_ERROR([perl was not found, needed for docs, manual and CA embed]) - fi -fi - dnl set variable for use in automakefile(s) AM_CONDITIONAL(BUILD_DOCS, test x"$BUILD_DOCS" = x1) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 51b2b76b87..68d068727f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,31 +28,34 @@ set(_curl_cfiles_gen "") set(_curl_hfiles_gen "") set(_curl_definitions "") -if(ENABLE_CURL_MANUAL AND HAVE_MANUAL_TOOLS) - list(APPEND _curl_definitions "USE_MANUAL") - add_custom_command(OUTPUT "tool_hugehelp.c" - COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_setup.h\"" > "tool_hugehelp.c" - COMMAND ${CMAKE_COMMAND} -E echo "/* !checksrc! disable COPYRIGHT all */" >> "tool_hugehelp.c" - COMMAND ${CMAKE_COMMAND} -E echo "/* !checksrc! disable INCLUDEDUP all */" >> "tool_hugehelp.c" - COMMAND ${CMAKE_COMMAND} -E echo "/* !checksrc! disable LONGLINE all */" >> "tool_hugehelp.c" - COMMAND ${CMAKE_COMMAND} -E echo "#ifndef HAVE_LIBZ" >> "tool_hugehelp.c" - COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" < "${CURL_ASCIIPAGE}" >> "tool_hugehelp.c" - COMMAND ${CMAKE_COMMAND} -E echo "#else" >> "tool_hugehelp.c" - COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c < "${CURL_ASCIIPAGE}" >> "tool_hugehelp.c" - COMMAND ${CMAKE_COMMAND} -E echo "#endif /* HAVE_LIBZ */" >> "tool_hugehelp.c" - DEPENDS - generate-curl.1 - "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" - "${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h" - "${CURL_ASCIIPAGE}" - VERBATIM) +if(ENABLE_CURL_MANUAL AND (PERL_FOUND OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.c")) + if(PERL_FOUND) + add_custom_command(OUTPUT "tool_hugehelp.c" + COMMAND ${CMAKE_COMMAND} -E echo "#include \"tool_setup.h\"" > "tool_hugehelp.c" + COMMAND ${CMAKE_COMMAND} -E echo "/* !checksrc! disable COPYRIGHT all */" >> "tool_hugehelp.c" + COMMAND ${CMAKE_COMMAND} -E echo "/* !checksrc! disable INCLUDEDUP all */" >> "tool_hugehelp.c" + COMMAND ${CMAKE_COMMAND} -E echo "/* !checksrc! disable LONGLINE all */" >> "tool_hugehelp.c" + COMMAND ${CMAKE_COMMAND} -E echo "#ifndef HAVE_LIBZ" >> "tool_hugehelp.c" + COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" < "${CURL_ASCIIPAGE}" >> "tool_hugehelp.c" + COMMAND ${CMAKE_COMMAND} -E echo "#else" >> "tool_hugehelp.c" + COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" -c < "${CURL_ASCIIPAGE}" >> "tool_hugehelp.c" + COMMAND ${CMAKE_COMMAND} -E echo "#endif /* HAVE_LIBZ */" >> "tool_hugehelp.c" + DEPENDS + generate-curl.1 + "${CMAKE_CURRENT_SOURCE_DIR}/mkhelp.pl" + "${CMAKE_CURRENT_SOURCE_DIR}/tool_hugehelp.h" + "${CURL_ASCIIPAGE}" + VERBATIM) + else() + message(STATUS "Perl not found. Using the pre-built tool_hugehelp.c found in the source tree.") + endif() list(APPEND _curl_cfiles_gen "tool_hugehelp.c") list(APPEND _curl_hfiles_gen "tool_hugehelp.h") + list(APPEND _curl_definitions "USE_MANUAL") endif() if(CURL_CA_EMBED_SET) if(PERL_FOUND) - list(APPEND _curl_definitions "CURL_CA_EMBED") add_custom_command(OUTPUT "tool_ca_embed.c" COMMAND "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/mk-file-embed.pl" --var curl_ca_embed < "${CURL_CA_EMBED}" > "tool_ca_embed.c" @@ -61,6 +64,7 @@ if(CURL_CA_EMBED_SET) "${CURL_CA_EMBED}" VERBATIM) list(APPEND _curl_cfiles_gen "tool_ca_embed.c") + list(APPEND _curl_definitions "CURL_CA_EMBED") else() message(WARNING "Perl not found. Will not embed the CA bundle.") endif() diff --git a/src/Makefile.am b/src/Makefile.am index 78e2f81243..14202cf945 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -141,6 +141,7 @@ curl_CPPFLAGS += -DUSE_MANUAL $(ASCIIPAGE): cd $(top_builddir)/docs && $(MAKE) +if PERL if HAVE_LIBZ # This generates the tool_hugehelp.c file in both uncompressed and # compressed formats. @@ -163,6 +164,19 @@ $(HUGE): $(ASCIIPAGE) $(MKHELP) echo '#include "tool_setup.h"' >> $(HUGE); \ $(PERL) $(MKHELP) < $(ASCIIPAGE) >> $(HUGE) ) endif +else # PERL +$(HUGE): + $(HUGECMD)( \ + if test ! -f "$(srcdir)/$(HUGE)"; then \ + echo '/* !checksrc! disable COPYRIGHT all */' > $(HUGE); \ + echo '#include "tool_hugehelp.h"' >> $(HUGE); \ + echo 'void hugehelp(void) {}' >> $(HUGE); \ + echo 'void showhelp(const char *trigger, const char *arg, const char *endarg)' >> $(HUGE); \ + echo '{' >> $(HUGE); \ + echo ' (void)trigger; (void)arg; (void)endarg;' >> $(HUGE); \ + echo '}' >> $(HUGE); \ + fi) +endif else # USE_MANUAL # built-in manual has been disabled, make a blank file