Commit Graph

142 Commits

Author SHA1 Message Date
Edward Thomson
488560c270 Merge pull request #7079 from Faless/fix/static_linker_flags
Fix MSVC cross compilation
2025-06-04 10:29:09 +01:00
Fabio Alessandrelli
4c7bca5e2f Fix MSVC cross compilation
Currently, the DefaultCFlags.cmake overrides the
CMAKE_STATIC_LINKER_FLAGS to suppress linker warnings about files with
no symbols defined.

This has the side effect of breaking MSVC cross compilation (where
CMAKE_STATIC_LINKER_FLAGS is used to specify the /MACHINE:ARCH flag)

This commit make sure we append to CMAKE_STATIC_LINKER_FLAGS instead of
replacing its values
2025-05-27 19:00:09 +02:00
Laurence McGlashan
1d2bdab7f8 Update SelectSSH.cmake 2025-01-13 12:16:44 +00:00
Edward Thomson
4802272f68 cmake: remove "embedded libssh2"
Compiling libssh2 into libgit2 directly is madness. If users want to
create a single library that contains libssh2, then they should link a
static library.
2025-01-02 21:13:50 +00:00
Edward Thomson
4546929e00 cmake: case insensitive options
It's hard to remember whether it's `-DUSE_HTTPS=mbedTLS` or
`-DUSE_HTTPS=mbedtls`. Even worse for things like `builtin` which we may
have been inconsistent about. Allow for case insensitive options.
2025-01-02 12:36:46 +00:00
Edward Thomson
c4c284e46f cmake: standardize HTTPS backend definitions
There were a few oddities around HTTPS provider selection: namely,
`GIT_OPENSSL_DYNAMIC` implied `GIT_OPENSSL`, which made a bit of sense,
until we added FIPS support. In addition, dynamic OpenSSL for _hashes_
and dynamic OpenSSL for HTTPS was conflated in a few places.

Untangle these, and make `GIT_HTTPS_*` the define, for consistency with
other feature provider selection.
2025-01-02 12:36:11 +00:00
Edward Thomson
9efdbe3834 cmake: standardize leak check option
The `GIT_WIN32_LEAKCHECK` option is a debugging option, so it should be
`GIT_DEBUG_LEAKCHECK_WIN32`
2025-01-02 12:36:11 +00:00
Edward Thomson
94d8883dcf cmake: update verbiage on feature enablement 2025-01-02 12:36:11 +00:00
Edward Thomson
bab249d82e cmake: standardize xdiff options 2025-01-02 12:36:11 +00:00
Edward Thomson
2b581ef517 cmake: update threads
For consistency with other backend/provider selection, allow
`USE_THREADS` to select the threads provider.
2025-01-02 12:36:11 +00:00
Edward Thomson
890d70856c cmake: update nanosecond selection
For consistency, specify the nanosecond option in the same way as other
options, and identify it as such. Split the detection of platform
support (`FindStatNsec`) and its selection (`SelectNsec`).
2025-01-02 12:36:11 +00:00
Edward Thomson
8bbd2f406e cmake: use DEBUG_LEAK_CHECKER as option
The `USE_` prefix for inputs denotes a backend; the `DEBUG_` prefix
denotes a debugging option. Make `DEBUG_LEAK_CHECKER` the name of the
leak checking option.
2025-01-02 12:36:11 +00:00
Edward Thomson
c9974d28b2 cmake: update Negotiate backend selection 2025-01-02 12:36:11 +00:00
Edward Thomson
fb59acb246 cmake: update NTLM feature enablement 2025-01-02 12:36:09 +00:00
Edward Thomson
9ea1f6d4ed cmake: standardize iconv options 2025-01-02 11:45:47 +00:00
Edward Thomson
78a8c44cc1 cmake: standardize regex options
Selecting regular expression backend should be specified in the same way
as everything else; `USE_REGEX`. Keep `REGEX_BACKEND` as an optional
fallback.
2025-01-02 11:45:47 +00:00
Edward Thomson
fdb73f5d1d cmake: simplify compression selection 2025-01-02 11:45:47 +00:00
Edward Thomson
c4a65c34c2 cmake: standardize builtin sha1dc selection
All `USE_*` options are now `builtin`. Use that for the builtin sha1dc
implementation, keeping `CollisionDetection` for backward compatibility.
2025-01-02 11:45:47 +00:00
Edward Thomson
550cf62021 cmake: warn for not using sha1dc
git's hash algorithm is sha1dc, it is not sha1. Per Linus:

> Honestly, git has effectively already moved from SHA1 to SHA1DC.
>
> So the actual known attack and weakness of SHA1 should simply not be
> part of the discussion for the next hash. You can basically say "we're
> _already_ on the second hash, we just picked one that was so
> compatible with SHA1 that nobody even really noticed.

Warn users who try to compile with SHA1 instead of SHA1DC.
2024-12-28 09:52:42 +00:00
Edward Thomson
e0c255dbd6 zlib: add zlib backend status to git2_features.h
Add the status of the zlib backend (builtin or external) to
`git2_features.h`.
2024-12-22 15:37:56 +00:00
Edward Thomson
e536b2c50c cmake: enforce USE_SHA1 and USE_SHA256 validity 2024-10-22 11:45:58 +01:00
Edward Thomson
d1d65787b4 cmake: enforce USE_HTTPS validity 2024-10-22 11:45:58 +01:00
Edward Thomson
2125e3c64d cmake: enforce USE_SSH validity
Validate the USE_SSH option fits into our valid options; don't
assume a default.
2024-10-22 11:13:43 +01:00
Edward Thomson
0c675b8c84 cmake: enforce USE_HTTP_PARSER validity
When `-DUSE_HTTP_PARSER=...` is specified, ensure that the specified
HTTP Parser is valid, do not fallback to builtin.

Restore `-DUSE_HTTP_PARSER=system` for backcompatibility.
2024-10-22 10:07:12 +01:00
Edward Thomson
3d268285f9 sha: support FIPS-compliant OpenSSL for SHA1 2024-10-10 00:01:16 +01:00
Marcin Dabrowski
7f7dfe71cc Add OpenSSL-FIPS CMake flag
Usage of the deprecated 'SHA256_*' OpenSSL API in a FIPS compliant
environment results in OpenSSL's assertion failure with the following
description:
"OpenSSL internal error, assertion failed: Low level API call to
 digest SHA256 forbidden in FIPS mode!"

This commit adds a possibility to use the OpenSSL's 'EVP_MD*' API instead
of the deprecated 'SHA256_*' API, by extending the optional CMake flag
'USE_SHA256' with the new option called 'OpenSSL-FIPS'.
The new option is used to choose a hashing backend used by libgit2 to
calculate SHA256 hashes, in a similar way that currently existing
options like 'OpenSSL', 'OpenSSL-Dynamic', 'mbedTLS' etc do.

'OpenSSL-FIPS' is a fully opt-in option which is purposely not
interfering with the existing options, because, after running some
benchmarks, it's been discovered that using the 'EVP_MD*' API causes
hashing to be a bit slower in comparison to using the deprecated
'SHA256_*' API.

Another change introduced in this commit is the enhancement of the
Nightly workflow (nightly.yml) which will cause libgit2 to be
automatically built with '-DUSE_SHA256="OpenSSL-FIPS"' CMake flag,
on Linux, macOS and Windows.
2024-10-09 14:53:44 +02:00
Edward Thomson
41f6f72910 iOS Updates
Some minor refactoring for iOS:

- Roll back clar changes; these should be a bit more measured, and occur
  in clar upstream.
- Move iOS to nightly builds
2024-09-26 16:59:53 +02:00
Kyle
871208e991 Fix iconv link issue 2024-09-05 13:53:14 +08:00
Kyle
841164ec39 Fix regcomp_l compile issue 2024-09-05 00:07:31 +08:00
Kyle
4b63eb5dc8 Fix iOS build issue 2024-09-05 00:07:30 +08:00
Edward Thomson
fb1797de63 Merge remote-tracking branch 'origin/main' into libgit2-httpparser 2024-04-23 00:09:50 +01:00
Edward Thomson
d02b549dab http: make llhttp the default 2024-04-22 22:21:23 +01:00
Edward Thomson
d396819101 http: abstract http parsing out of httpclient
Avoid #ifdef's in httpclient.c, and move http parsing into its own file.
2024-04-22 22:21:23 +01:00
Edward Thomson
bfe0ac7632 Merge pull request #6631 from chris-forks/add-dl
add dl to LIBGIT2_SYSTEM_LIBS
2024-02-17 14:27:39 +00:00
Edward Thomson
e696528aa8 Update cmake/SelectHTTPSBackend.cmake 2024-02-17 14:27:19 +00:00
Stephen Gallagher
06e384a0a4 Enable llhttp for HTTP parsing
Fixes: https://github.com/libgit2/libgit2/issues/6074

We now try to use llhttp by default, falling back to http-parser
if the former is not available.

As a last resort, we use the bundled http-parser.

Co-authored-by: Sergio Correia <scorreia@redhat.com>
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: Sergio Correia <scorreia@redhat.com>
2024-02-07 17:01:59 -05:00
Edward Thomson
9d767b9d5e cmake: rename FindIconv to avoid collision with cmake
cmake now includes `FindIconv`. Rename ours to avoid any confusion.
2023-12-14 22:26:05 +00:00
Christopher Fujino
8dd5d60e80 guard 2023-09-09 20:50:42 -07:00
Christopher Fujino
40556c798a add dl to LIBGIT2_SYSTEM_LIBS 2023-09-09 20:06:12 -07:00
Edward Thomson
a8b052faab ssh: introduce GIT_SSH_EXEC for external OpenSSH
We can now use the `git_process` class to invoke OpenSSH and use it as
an SSH transport. This may be preferred over libssh2 for a variety of
callers.
2023-08-30 20:46:22 +01:00
Edward Thomson
3fccf7468b ssh: GIT_SSH_LIBSSH2 is now distinct from GIT_SSH
We may want to support SSH but with a different provider that is not
libssh2. Add GIT_SSH to indicate that we have some inbuilt SSH support
and GIT_SSH_LIBSSH2 to indicate that support is via libssh2. This is
similar to how we support GIT_HTTPS and GIT_OPENSSL, for example.
2023-08-30 20:46:21 +01:00
Christoph Reiter
86872834c5 cmake: fix openssl build on win32
since f15c8ac71a libgit unconditionally depends on secur32 on Windows
but only added it in cmake for the winhttp and schannel variants.
In case libgit is built against openssl it would fail to link.

This moves secur32 out of the https backend selection code into
the global win32 condition (and while at it also adds ws2_32 to the .pc file)
2023-08-19 10:44:25 +02:00
Edward Thomson
52db5d11c5 Revert "CMake: Search for ssh2 instead of libssh2." 2023-08-10 09:52:04 +01:00
Fabio Alessandrelli
933c09dbec CMake: Search for ssh2 instead of libssh2.
Fixes "CMake Error: could not resolve ssh2" on Windows-MSVC.
2023-06-25 07:15:02 +02:00
Edward Thomson
3335738579 cmake: refactor check_prototype_definition
Introduce `check_prototype_definition_safe` that is safe for `Werror`
usage.
2023-05-12 21:49:29 +01:00
Edward Thomson
abb0b31317 Merge pull request #6482 from libgit2/ethomson/xdiff
xdiff: move xdiff to 'deps'
2023-04-13 23:08:15 +01:00
Edward Thomson
f15c8ac71a http: add SSPI authentication on Windows
Add support for SSPI on Windows, which offers NTLM and Negotiate
authentication.
2023-03-21 09:15:14 +00:00
Edward Thomson
f68f542eb6 http: introduce schannel streams for windows
Provide a stream interface for Schannel - the native crypto APIs - on
Windows. This allows Windows to use the same HTTP transport that all the
other platforms use, with its own native crypto.

Ultimately this allows us to deprecate WinHTTP and we need not add
support for our socket changes in two places (our HTTP stack and the
WinHTTP stack).
2023-03-21 09:09:48 +00:00
Edward Thomson
462dbe21d0 xdiff: move xdiff to 'deps'
xdiff is a dependency (from git core) and more properly belongs in the
'deps' directory. Move it there, and add a stub for cmake to resolve
xdiff from the system location in the future. (At present, bundled xdiff
remains hardcoded.)
2023-03-03 09:45:12 +00:00
Edward Thomson
d63f1fe245 cmake: support older cmakes 2023-02-13 10:27:10 +00:00