build: add `curl-lint`/`lint` targets, `CURL_LINT` cmake option
No binary (build failed)
—
(log yok)
| @@ -173,7 +173,7 @@ jobs: | |
| .github/scripts/shellcheck.sh | |
| - name: 'spacecheck' | |
| - | run: .github/scripts/spacecheck.pl |
| + | run: scripts/spacecheck.pl |
| - name: 'yamlcheck' | |
| run: .github/scripts/yamlcheck.sh | |
| @@ -500,6 +500,8 @@ if(WINDOWS_STORE) | |
| set(CURL_DISABLE_TELNET ON) # telnet code needs fixing to compile for UWP. | |
| endif() | |
| + | option(CURL_LINT "Run lint checks while building" OFF) |
| + | |
| find_package(Perl) | |
| if(PERL_EXECUTABLE) | |
| @@ -513,6 +515,18 @@ if(PERL_EXECUTABLE) | |
| COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/firefox-db2pem.sh" "lib/ca-bundle.crt" | |
| DEPENDS "${PROJECT_SOURCE_DIR}/scripts/firefox-db2pem.sh" | |
| ) | |
| + | if(CURL_LINT) |
| + | set(_lint_all ALL) |
| + | endif() |
| + | add_custom_target(curl-lint "${_lint_all}" |
| + | COMMENT "Running lint checks" VERBATIM USES_TERMINAL |
| + | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} |
| + | COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/checksrc-all.pl" |
| + | COMMAND "${PERL_EXECUTABLE}" "${PROJECT_SOURCE_DIR}/scripts/spacecheck.pl" |
| + | DEPENDS |
| + | "${PROJECT_SOURCE_DIR}/scripts/checksrc-all.pl" "${PROJECT_SOURCE_DIR}/scripts/checksrc.pl" |
| + | "${PROJECT_SOURCE_DIR}/scripts/spacecheck.pl" |
| + | ) |
| endif() | |
| option(BUILD_LIBCURL_DOCS "Build libcurl man pages" ON) | |
| @@ -200,6 +200,9 @@ checksrc: | |
| (cd docs/examples && $(MAKE) checksrc) | |
| (cd packages && $(MAKE) checksrc) | |
| + | lint: checksrc |
| + | @PERL@ $(top_srcdir)/scripts/spacecheck.pl |
| + | |
| tidy: | |
| (cd src && $(MAKE) tidy) | |
| (cd lib && $(MAKE) tidy) | |
| @@ -241,6 +241,7 @@ target_link_libraries(my_target PRIVATE CURL::libcurl) | |
| - `CURL_LIBCURL_SOVERSION`: Enable libcurl SOVERSION. Default: `ON` for supported platforms | |
| - `CURL_LIBCURL_VERSIONED_SYMBOLS`: Enable libcurl versioned symbols. Default: `OFF` | |
| - `CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX`: Override default versioned symbol prefix. Default: `<TLS-BACKEND>_` or `MULTISSL_` | |
| + | - `CURL_LINT`: Run lint checks while building. Default: `OFF` |
| - `CURL_LTO`: Enable compiler Link Time Optimizations. Default: `OFF` | |
| - `CURL_STATIC_CRT`: Build libcurl with static CRT with MSVC (`/MT`) (requires UCRT, static libcurl or no curl executable). Default: `OFF` | |
| - `CURL_TARGET_WINDOWS_VERSION`: Minimum target Windows version as hex string. | |
| @@ -544,6 +545,7 @@ Note: These variables are internal and subject to change. | |
| - `curl-completion-zsh`: Build shell completions for zsh (built by default if enabled) | |
| - `curl-ca-bundle`: Build the CA bundle via `scripts/mk-ca-bundle.pl` | |
| - `curl-ca-firefox`: Build the CA bundle via `scripts/firefox-db2pem.sh` | |
| + | - `curl-lint`: Run lint checks. |
| - `curl-listcats`: Generate help category constants for `src/tool_help.h` from documentation. | |
| - `curl-listhelp`: Generate `src/tool_listhelp.c` from documentation. | |
| - `curl-optiontable`: Generate `lib/easyoptions.c` from documentation. | |
| @@ -25,8 +25,8 @@ | |
| EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl checksrc-all.pl \ | |
| mk-ca-bundle.pl mk-unity.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen \ | |
| dmaketgz maketgz release-tools.sh verify-release cmakelint.sh mdlinkcheck \ | |
| - | CMakeLists.txt perlcheck.sh pythonlint.sh randdisable wcurl top-complexity \ |
| - | extract-unit-protos .checksrc |
| + | CMakeLists.txt perlcheck.sh pythonlint.sh spacecheck.pl randdisable wcurl \ |
| + | top-complexity extract-unit-protos .checksrc |
| dist_bin_SCRIPTS = wcurl | |