Commit Graph

156 Commits

Author SHA1 Message Date
Viktor Szakats
58a95b6a49
build: do not publish HAVE_BORINGSSL, HAVE_AWSLC macros
Syncing this up with CMake.

Source code uses the built-in `OPENSSL_IS_AWSLC` and
`OPENSSL_IS_BORINSSL` macros to detect BoringSSL and AWS-LC. No help is
necessary from the build tools.

The one use of `HAVE_BORINGSSL` in the source turned out to be no longer
necessary for warning-free BoringSSL + Schannel builds. Ref: #1610 #2634

autotools detects this anyway for display purposes.
CMake detects this to decide whether to use the BoringSSL-specific
crypto lib with ngtcp2. It detects AWS-LC, but doesn't use the detection
result just yet (planned in #12066).

Ref: #11964

Reviewed-by: Daniel Stenberg
Reviewed-by: Jay Satiro
Closes #12065
2023-10-08 22:29:45 +00:00
Viktor Szakats
ce3dce9015
tidy-up: mostly whitespace nits
- delete completed TODO from `./CMakeLists.txt`.
- convert a C++ comment to C89 in `./CMake/CurlTests.c`.
- delete duplicate EOLs from EOF.
- add missing EOL at EOF.
- delete whitespace at EOL (except from expected test results).
- convert tabs to spaces.
- convert CRLF EOLs to LF in GHA yaml.
- text casing fixes in `./CMakeLists.txt`.
- fix a codespell typo in `packages/OS400/initscript.sh`.

Closes #11772
2023-08-31 23:02:10 +00:00
Daniel Stenberg
2e160c9c65
tool: add "variable" support
Add support for command line variables. Set variables with --variable
name=content or --variable name@file (where "file" can be stdin if set
to a single dash (-)).

Variable content is expanded in option parameters using "{{name}}"
(without the quotes) if the option name is prefixed with
"--expand-". This gets the contents of the variable "name" inserted, or
a blank if the name does not exist as a variable. Insert "{{" verbatim
in the string by prefixing it with a backslash, like "\\{{".

Import an environment variable with --variable %name. It makes curl exit
with an error if the environment variable is not set. It can also rather
get a default value if the variable does not exist, using =content or
@file like shown above.

Example: get the USER environment variable into the URL:

 --variable %USER
 --expand-url = "https://example.com/api/{{USER}}/method"

When expanding variables, curl supports a set of functions that can make
the variable contents more convenient to use. It can trim leading and
trailing white space with "trim", output the contents as a JSON quoted
string with "json", URL encode it with "url" and base 64 encode it with
"b64". To apply functions to a variable expansion, add them colon
separated to the right side of the variable. They are then performed in
a left to right order.

Example: get the contents of a file called $HOME/.secret into a variable
called "fix". Make sure that the content is trimmed and percent-encoded
sent as POST data:

  --variable %HOME=/home/default
  --expand-variable fix@{{HOME}}/.secret
  --expand-data "{{fix:trim:url}}"
  https://example.com/

Documented. Many new test cases.

Co-brainstormed-by: Emanuele Torre
Assisted-by: Jat Satiro
Closes #11346
2023-07-31 11:51:34 +02:00
wangzhikun
7bfb10c180 winbuild: improve check for static zlib
- Check for zlib static library name zlibstatic.lib.

zlib's static library has a different name depending on how it was
built. zlibstatic.lib is output by cmake. zlibstat.lib is output by
their pre-generated Visual Studio project files (in the contrib
directory) and defines ZLIB_WINAPI (ie it's meant to use stdcall
instead of cdecl if you end up exporting the zlib functions).

Prior to this change the makefile only checked for the latter.

Closes https://github.com/curl/curl/pull/11521
2023-07-29 15:05:10 -04:00
Jay Satiro
80b7f05baf winbuild: fix makefile clean
- Fix and move 'clean' code that removes the output and obj directories
  trees from MakefileBuild.vc to Makefile.vc.

Prior to this change the 'clean' code did not work right because the
variables containing the directory names were not fully initialized and
the rmdir syntax was sometimes incorrect (typos). DIRDIST for example
was set to ..\builds\ and not ..\builds\$(CONFIG_NAME_LIB)\ so it would
remove the former and not the latter. If WITH_PREFIX was set then that
directory was removed instead.

Also, DIRDIST (the output directory) even if initialized should not be
removed by MakefileBuild.vc because by that time it could be set to a
user directory that may contain other files if WITH_PREFIX is set (eg we
don't want rmdir /s /q C:\usr\local). Therefore we remove from
Makefile.vc before any of that happens. I added a comment in both
makefiles explaining this.

Closes https://github.com/curl/curl/pull/10576
2023-02-23 03:49:37 -05:00
Fredrik
3f11122b2f winbuild: document that arm64 is supported
Building an arm64 version works flawlessly with the VS arm64 toolset.

Closes https://github.com/curl/curl/pull/10332
2023-01-24 03:42:17 -05:00
Daniel Stenberg
2bc1d775f5
copyright: update all copyright lines and remove year ranges
- they are mostly pointless in all major jurisdictions
- many big corporations and projects already don't use them
- saves us from pointless churn
- git keeps history for us
- the year range is kept in COPYING

checksrc is updated to allow non-year using copyright statements

Closes #10205
2023-01-03 09:19:21 +01:00
Viktor Szakats
b51560b9ff
winidn: drop WANT_IDN_PROTOTYPES
`WANT_IDN_PROTOTYPES` was necessary to avoid using a header that came
via an optional package. MS stopped distributing this package some
years ago and the winidn definitions are part of standard headers (via
`windows.h`) since Vista.

Auto-detect Vista inside `lib/idn_win32.c` and enable the manual
definitions if building for an older Windows.

This allows to delete this manual knob from all build-systems.

Also drop the `_SAL_VERSION` sub-case:

Our manual definitions are now only enabled with old systems. We assume
that code analysis is not run on such systems, allowing us to delete the
SAL-friendly flavour of these.

Reviewed-by: Jay Satiro
Closes #9793
2022-10-26 09:45:23 +00:00
Viktor Szakats
0c327464ca
tidy-up: delete parallel/unused feature flags
Detecting headers and lib separately makes sense when headers come in
variations or with extra ones, but this wasn't the case here. These were
duplicate/parallel macros that we had to keep in sync with each other
for a working build. This patch leaves a single macro for each of these
dependencies:

- Rely on `HAVE_LIBZ`, delete parallel `HAVE_ZLIB_H`.

  Also delete CMake logic making sure these two were in sync, along with
  a toggle to turn off that logic, called `CURL_SPECIAL_LIBZ`.

  Also delete stray `HAVE_ZLIB` defines.

  There is also a `USE_ZLIB` variant in `lib/config-dos.h`. This patch
  retains it for compatibility and deprecates it.

- Rely on `USE_LIBSSH2`, delete parallel `HAVE_LIBSSH2_H`.

  Also delete `LIBSSH2_WIN32`, `LIBSSH2_LIBRARY` from
  `winbuild/MakefileBuild.vc`, these have a role when building libssh2
  itself. And `CURL_USE_LIBSSH`, which had no use at all.

  Also delete stray `HAVE_LIBSSH2` defines.

- Rely on `USE_LIBSSH`, delete parallel `HAVE_LIBSSH_LIBSSH_H`.

  Also delete `LIBSSH_WIN32`, `LIBSSH_LIBRARY` and `HAVE_LIBSSH` from
  `winbuild/MakefileBuild.vc`, these were the result of copy-pasting the
  libssh2 line, and were not having any use.

- Delete unused `HAVE_LIBPSL_H` and `HAVE_LIBPSL`.

Reviewed-by: Daniel Stenberg

Closes #9652
2022-10-06 15:30:13 +00:00
Daniel Stenberg
fd1ce3d4b0
docs: spellfixes
Pointed by the new CI job
2022-09-21 15:20:08 +02:00
Daniel Stenberg
8bc6a38cef
winbuild/MakefileBuild.vc: handle spaces in libssh(2) include paths
Patched-by: Mark Itzcovitz
Bug: https://curl.se/mail/lib-2022-09/0038.html

Closes #9536
2022-09-20 08:37:27 +02:00
Daniel Stenberg
fda897f5a1
docs: fix proselint complaints 2022-09-19 17:32:12 +02:00
chemodax
8a7ecb57e7 winbuild: Use NMake batch-rules for compilation
- Invoke cl compiler once for each group of .c files.

This is significantly improves compilation time. For example in my
environment: 40 s --> 20 s.

Prior to this change cl was invoked per .c file.

Closes https://github.com/curl/curl/pull/9512
2022-09-16 16:13:08 -04:00
Daniel Stenberg
f65f750742
curl_ctype: convert to macros-only
This no longer provide functions, only macros. Runs faster and produces
smaller output.

The biggest precaution this change brings:

DO NOT use post/pre-increments when passing arguments to the macros.

Closes #9429
2022-09-06 08:36:33 +02:00
max.mehl
ad9bc5976d
copyright: make repository REUSE compliant
Add licensing and copyright information for all files in this repository. This
either happens in the file itself as a comment header or in the file
`.reuse/dep5`.

This commit also adds a Github workflow to check pull requests and adapts
copyright.pl to the changes.

Closes #8869
2022-06-13 09:13:00 +02:00
Nick Banks
37492ebbfa
msh3: add support for QUIC and HTTP/3 using msh3
Considered experimental, as the other HTTP/3 backends.

Closes #8517
2022-04-10 18:23:04 +02:00
Jay Satiro
ccea329848 winbuild: Add a Visual Studio example to the README
- Add an example that explains in detail how the user can add libcurl to
  their Visual Studio project.

Ref: https://github.com/curl/curl/issues/8591

Closes https://github.com/curl/curl/pull/8592
2022-03-22 14:24:07 -04:00
Philip H
c652621928
winbuild/README.md: fixup dead link
Closes #8597
2022-03-18 09:10:56 +01:00
illusory-dream
2cadc890ce
winbuild: add parameter WITH_SSH
For building with libssh
Closes #8514
2022-02-26 14:17:15 +01:00
Jeremy Falcon
86c9146209 winbuild/README.md: clarify GEN_PDB option
- Document that GEN_PDB option creates an external database.

Ref: https://github.com/curl/curl/issues/7502
2021-08-09 13:02:52 -04:00
Daniel Stenberg
04cca4f5f1
winbuild/MakefileBuild.vc: bump copyright year 2021-07-21 08:42:19 +02:00
Jay Satiro
6b84f53686 winbuild: support alternate nghttp2 static lib name
- Support both nghttp2.lib and nghttp2_static.lib for static nghttp2.

nghttp2 briefly changed its static lib name to nghttp2_static, but then
made the _static suffix optional.

Ref: https://github.com/nghttp2/nghttp2/pull/1394
Ref: https://github.com/nghttp2/nghttp2/pull/1418
Ref: https://github.com/nghttp2/nghttp2/issues/1466

Reported-by: Pierre Yager

Fixes https://github.com/curl/curl/issues/7446
Closes https://github.com/curl/curl/pull/7447
2021-07-20 02:16:15 -04:00
Daniel Stenberg
ce8a38fe80
winbuild/README: VC should be set to 6 'or larger'
Previously it listed all versions up to 15 (missing 16) but this new
phrasing is more open ended.

Reported-by: Hugh Macdonald
Fixes #7253
Closes #7254
2021-06-14 16:26:25 +02:00
Daniel Stenberg
5c8849cede
winbuild: remove docs from Makefiles and refer to README.md
Reduce risk for conflicting docs and makes it to a single place to fix
and polish.

add these missing options to the readme:

ENABLE_OPENSSL_AUTO_LOAD_CONFIG and ENABLE_UNICODE

clarify ENABLE_SCHANNEL default varies

Fixes #6216
Closes #6227
Co-Authored-by: Jay Satiro
2020-11-22 23:02:25 +01:00
Daniel Stenberg
ac0a88fd25
copyright: fix year ranges
Follow-up from 4d2f800677
2020-11-05 08:22:10 +01:00
Daniel Stenberg
4d2f800677
curl.se: new home
Closes #6172
2020-11-04 23:59:47 +01:00
Daniel Stenberg
47dd957daf
curl: use curlx_dynbuf for realloc when loading config files
... fixes an integer overflow at the same time.

Reported-by: ihsinme on github
Assisted-by: Jay Satiro

Closes #5946
2020-09-14 08:32:45 +02:00
Daniel Stenberg
953088d2c8
winbuild/rundebug.cmd: remove
Seems to have been added by mistake? Not included in dists.

Closes #5919
2020-09-05 21:48:23 +02:00
Daniel Stenberg
f31b2e7cb8
winbuild/README.md: make <options> visible
Follow-up to be753add31
2020-08-26 15:57:04 +02:00
Daniel Stenberg
be753add31
winbuild: convert the instruction text to README.md
Closes #5861
2020-08-26 15:49:21 +02:00
Daniel Stenberg
2429f45a97
TLS naming: fix more Winssl and Darwinssl leftovers
The CMake option is now called CMAKE_USE_SCHANNEL

The winbuild flag is USE_SCHANNEL

The CI jobs and build scripts only use the new names and the new name
options

Tests now require 'Schannel' (when necessary)

Closes #5795
2020-08-08 00:19:21 +02:00
Cameron Cawley
790137b0f7
win32: Add Curl_verify_windows_version() to curlx
Closes https://github.com/curl/curl/pull/5754
2020-08-02 17:58:44 +02:00
Marcel Raad
a55c835e6b
curl_multibyte: add to curlx
This will also be needed in the tool and tests.

Ref: https://github.com/curl/curl/pull/3758#issuecomment-482197512
Closes https://github.com/curl/curl/pull/3784
2020-05-14 18:13:27 +02:00
Daniel Stenberg
9a8b3b3e13
copyright: fix out-of-date copyright ranges and missing headers
Reported by the new script 'scripts/copyright.pl'. The script has a
regex whitelist for the files that don't need copyright headers.

Removed three (mostly usesless) README files from docs/

Closes #5141
2020-03-24 15:05:59 +01:00
Jay Satiro
b0a9e3c28c winbuild: Document CURL_STATICLIB requirement for static libcurl
A static libcurl (ie winbuild mode=static) requires that the user define
CURL_STATICLIB when using it in their application. This is already
covered in the FAQ and INSTALL.md, but is a pretty important point so
now it's noted in the BUILD.WINDOWS.txt as well.

Assisted-by: Michael Vittiglio

Closes https://github.com/curl/curl/pull/4721
2019-12-15 17:31:23 -05:00
andrew_ishchuk
476a832094 winbuild: Define CARES_STATICLIB when WITH_CARES=static
When libcurl is built with MODE=static, c-ares is forced into static
linkage too. That doesn't happen when MODE=dll so linker would break
over undefined symbols.

closes https://github.com/curl/curl/pull/4688
2019-12-09 19:11:10 -05:00
Jay Satiro
9c1806ae46 build: Disable Visual Studio warning "conditional expression is constant"
- Disable warning C4127 "conditional expression is constant" globally
  in curl_setup.h for when building with Microsoft's compiler.

This mainly affects building with the Visual Studio project files found
in the projects dir.

Prior to this change the cmake and winbuild build systems already
disabled 4127 globally for when building with Microsoft's compiler.
Also, 4127 was already disabled for all build systems in the limited
circumstance of the WHILE_FALSE macro which disabled the warning
specifically for while(0). This commit removes the WHILE_FALSE macro and
all other cruft in favor of disabling globally in curl_setup.

Background:

We have various macros that cause 0 or 1 to be evaluated, which would
cause warning C4127 in Visual Studio. For example this causes it:

    #define Curl_resolver_asynch() 1

Full behavior is not clearly defined and inconsistent across versions.
However it is documented that since VS 2015 Update 3 Microsoft has
addressed this somewhat but not entirely, not warning on while(true) for
example.

Prior to this change some C4127 warnings occurred when I built with
Visual Studio using the generated projects in the projects dir.

Closes https://github.com/curl/curl/pull/4658
2019-12-01 19:01:02 -05:00
apique
1d7fe8390f
winbuild: add ENABLE_UNICODE option
Fixes https://github.com/curl/curl/issues/4308
Closes https://github.com/curl/curl/pull/4309
2019-10-04 11:29:08 +02:00
Joel Depooter
96a3ab7bc8
winbuild: Add manifest to curl.exe for proper OS version detection
This is a small fix to commit ebd213270a
in pull request #1221. That commit added the CURL_EMBED_MANIFEST flag to
CURL_RC_FLAGS. However, later in the file CURL_RC_FLAGS is
overwritten. The fix is to append values to CURL_RC_FLAGS instead of
overwriting

Closes #4399
2019-09-23 09:15:00 +02:00
Bernhard Walle
a765a30500
winbuild/MakefileBuild.vc: Add vssh
Without that modification, the Windows build using the makefiles doesn't
work.

Signed-off-by: Bernhard Walle <bernhard.walle@posteo.eu>

Fixes #4322
Closes #4323
2019-09-11 14:18:44 +02:00
Bernhard Walle
142d89edba winbuild/MakefileBuild.vc: Fix line endings
The file had mixed line endings.

Signed-off-by: Bernhard Walle <bernhard.walle@posteo.eu>
2019-09-11 12:56:22 +02:00
Daniel Stenberg
9736ac03ab winbuild: add vquic to list of build directories
This fixes the winbuild build method which broke several days ago
when experimental quic support was added in 3af0e76.

Reported-by: Michael Lee

Fixes https://github.com/curl/curl/issues/4158
2019-07-29 01:49:53 -04:00
Shankar Jadhavar
5feb58ca12 winbuild: Change Makefile to honor ENABLE_OPENSSL_AUTO_LOAD_CONFIG
- Made changes so that ENABLE_OPENSSL_AUTO_LOAD_CONFIG will be honored.

- Also removed some ^M chars from file.

Prior to this change while building on Windows platform even if we pass
the ENABLE_OPENSSL_AUTO_LOAD_CONFIG option with value as "no" it does
not set the CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG flag.

Closes https://github.com/curl/curl/pull/4086
2019-07-06 23:18:28 -04:00
Thomas Gamper
672ff597e5
winbuild: use WITH_PREFIX if given
Closes #4031
2019-06-17 13:39:51 +02:00
Steve Holme
2a32f5f457
winbuild: Use two space indentation
Closes #3930
2019-05-23 21:46:26 +01:00
Steve Holme
067c2c1c04 gen_resp_file.bat: Removed unnecessary @ from all but the first command
There is need to use @ on every command once echo has been turned off.

Closes #3854
2019-05-09 03:59:00 +01:00
Steve Holme
c23b8e827c winbuild: Add our standard copyright header to the winbuild batch files 2019-05-05 20:17:58 +01:00
Steve Holme
80637fc473 makedebug: Fix ERRORLEVEL detection after running where.exe
Closes #3838
2019-05-05 19:55:55 +01:00
Jan-E
79c4864a56 winbuild: Support MultiSSL builds
- Remove the lines in winbuild/Makefile.vc that generate an error with
  multiple SSL backends.

- Add /DCURL_WITH_MULTI_SSL in winbuild/MakefileBuild.vc if multiple SSL
  backends are set.

Closes https://github.com/curl/curl/pull/3772
2019-04-13 02:49:14 -04:00
Marcel Raad
07367e717a
winbuild: conditionally use /DZLIB_WINAPI
zlibwapi.lib (dynamic library) and zlibstat.lib (static library) have
the ZLIB_WINAPI define set by default. Using them requires that define
too.

Ref: https://zlib.net/DLL_FAQ.txt

Fixes https://github.com/curl/curl/issues/3133
Closes https://github.com/curl/curl/pull/3460
2019-01-14 10:14:06 +01:00