Use OpenSSL on windows too, build libgit2, ssh2 with cmake.

And update the libraries.
This commit is contained in:
Fabio Alessandrelli
2023-06-24 14:39:33 +02:00
committed by Rémi Verschelde
parent ef24a3673d
commit 0d0c30784d
12 changed files with 265 additions and 259 deletions

6
thirdparty/SCsub vendored
View File

@@ -1,6 +0,0 @@
#!/usr/bin/env python
Import("env")
SConscript("ssh2/SCsub")
SConscript("git2/SCsub")

131
thirdparty/git2/SCsub vendored
View File

@@ -1,131 +0,0 @@
#!/usr/bin/env python
# Adopted from https://github.com/goostengine/goost/blob/20d8ce4c7d74c26832d69283305b25a72165784a/modules/git/SCsub
Import("env")
Import("ssl")
env_git = env.Clone()
# Thirdparty source files.
libgit2_sources = []
libgit2_sources += Glob("libgit2/src/" + "*.c")
libgit2_sources += Glob("libgit2/src/allocators/" + "*.c")
libgit2_sources += Glob("libgit2/src/hash/sha1/sha1dc/sha1.c")
libgit2_sources += Glob("libgit2/src/hash/sha1/sha1dc/ubc_check.c")
libgit2_sources += Glob("libgit2/src/hash/sha1/collisiondetect.c")
libgit2_sources += Glob("libgit2/src/transports/" + "*.c")
libgit2_sources += Glob("libgit2/src/hash/transports/" + "*.c")
libgit2_sources += Glob("libgit2/src/hash/xdiff/" + "*.c")
libgit2_sources += Glob("libgit2/src/xdiff/" + "*.c")
libgit2_sources += Glob("libgit2/src/streams/" + "*.c")
libgit2_sources += Glob("libgit2/deps/http-parser/" + "*.c")
libgit2_sources += Glob("libgit2/deps/pcre/" + "*.c")
libgit2_sources += Glob("libgit2/deps/zlib/" + "*.c")
if "32" in env["arch"]:
env_git.Prepend(CPPDEFINES=["GIT_ARCH_32"])
else:
env_git.Prepend(CPPDEFINES=["GIT_ARCH_64"])
env_git.Prepend(
CPPPATH=[
"libgit2/include/",
"libgit2/src/",
"libgit2/deps/http-parser/",
"libgit2/deps/pcre/",
"libgit2/deps/zlib/",
"libgit2/deps/ntlmclient/",
"../ssh2/libssh2/include/",
]
)
env_git.Prepend(
CPPDEFINES=[
"GIT_THREADS",
"GIT_SSH",
"GIT_SSH_MEMORY_CREDENTIALS",
"LIBGIT2_NO_FEATURES_H",
"GIT_SHA1_COLLISIONDETECT",
"GIT_HTTPS",
"SRC_UTIL_H_",
"GIT_REGEX_BUILTIN",
]
)
if env_git["platform"] == "windows":
libgit2_sources += Glob("libgit2/src/win32/" + "*.c")
env_git.Prepend(
CPPDEFINES=[
"GIT_WINHTTP",
"HAVE_SYS_STAT_H",
"HAVE_SYS_TYPES_H",
"HAVE_WINDOWS_H",
"HAVE_STDINT_H",
"HAVE_INTTYPES_H",
"HAVE_MEMMOVE",
"HAVE_STRERROR",
"HAVE_STRTOLL",
"HAVE__STRTOI64",
"SUPPORT_PCRE8",
"NO_RECURSE",
"HAVE_LONG_LONG",
"HAVE_UNSIGNED_LONG_LONG",
("NEWLINE", "10"),
("POSIX_MALLOC_THRESHOLD", "10"),
("LINK_SIZE", "2"),
("PARENS_NEST_LIMIT", "250"),
("MATCH_LIMIT", "10000000"),
("MATCH_LIMIT_RECURSION", "10000000"),
"PCREGREP_BUFSIZE",
("MAX_NAME_SIZE", "32"),
("MAX_NAME_COUNT", "10000"),
"HAVE_WINCNG",
"LIBSSH2_WINCNG"
]
)
if env_git["platform"] in ["linux", "macos"]:
env_git.Append(CCFLAGS="-fPIC")
libgit2_sources += Glob("libgit2/src/unix/" + "*.c")
libgit2_sources += [
"libgit2/deps/ntlmclient/crypt_openssl.c",
"libgit2/deps/ntlmclient/unicode_builtin.c"
]
env_git.Prepend(
CPPDEFINES=[
"HAVE_DIRENT_H",
"HAVE_SYS_STAT_H",
"HAVE_SYS_TYPES_H",
"HAVE_UNISTD_H",
"HAVE_STDINT_H",
"HAVE_INTTYPES_H",
"HAVE_BCOPY",
"HAVE_MEMMOVE",
"HAVE_STRERROR",
"HAVE_STRTOLL",
"HAVE_STRTOQ",
"SUPPORT_PCRE8",
"NO_RECURSE",
"HAVE_LONG_LONG",
"HAVE_UNSIGNED_LONG_LONG",
("NEWLINE", "10"),
("POSIX_MALLOC_THRESHOLD", "10"),
("LINK_SIZE", "2"),
("PARENS_NEST_LIMIT", "250"),
("MATCH_LIMIT", "10000000"),
("MATCH_LIMIT_RECURSION", "10000000"),
"PCREGREP_BUFSIZE",
("MAX_NAME_SIZE", "32"),
("MAX_NAME_COUNT", "10000"),
"GIT_OPENSSL",
"GIT_USE_FUTIMENS",
"GIT_USE_STAT_MTIM",
"CRYPT_OPENSSL",
"UNICODE_BUILTIN"
]
)
env_git.Depends(libgit2_sources, ssl)
env_git.StaticLibrary(target="../bin/" + "git2", source=libgit2_sources)

110
thirdparty/ssh2/SCsub vendored
View File

@@ -1,110 +0,0 @@
#!/usr/bin/env python
# Adopted from https://github.com/nodegit/nodegit/blob/4561dcb7c120474a4553baa27e4c4c2f4be23a2b/vendor/libgit2.gyp
Import("env")
Import("ssl")
env_ssh2 = env.Clone()
# Thirdparty source files.
libssh2_sources = [
"libssh2/src/agent.c",
"libssh2/src/bcrypt_pbkdf.c",
"libssh2/src/blowfish.c",
"libssh2/src/crypt.c",
"libssh2/src/keepalive.c",
"libssh2/src/libgcrypt.c",
"libssh2/src/openssl.c",
"libssh2/src/publickey.c",
"libssh2/src/sftp.c",
"libssh2/src/version.c",
"libssh2/src/channel.c",
"libssh2/src/global.c",
"libssh2/src/kex.c",
"libssh2/src/mac.c",
"libssh2/src/packet.c",
"libssh2/src/scp.c",
"libssh2/src/transport.c",
"libssh2/src/comp.c",
"libssh2/src/hostkey.c",
"libssh2/src/knownhost.c",
"libssh2/src/misc.c",
"libssh2/src/pem.c",
"libssh2/src/session.c",
"libssh2/src/userauth_kbd_packet.c",
"libssh2/src/userauth.c",
]
env_ssh2.Prepend(
CPPPATH=[
"libssh2/include/"
"libssh2/src/"
]
)
if env_ssh2["platform"] == "windows":
env_ssh2.Append(
CPPPATH=[
"libssh2/include/",
"libssh2/win32/"
]
)
libssh2_sources += ["libssh2/src/agent_win.c", "libssh2/src/wincng.c"]
env_ssh2.Append(
CPPDEFINES=[
"LIBSSH2_WINCNG",
"HAVE_WINCNG"
]
)
env_ssh2.Append(LIBS=["crypt32", "user32"])
if env_ssh2["platform"] in ["linux", "macos"]:
env_ssh2.Append(CCFLAGS="-fPIC")
env_ssh2.Append(
CPPPATH=[
".",
"libssh2/include/",
]
)
libssh2_sources += ["libssh2/src/openssl.c"]
env_ssh2.Append(
CPPDEFINES=[
"LIBSSH2_CONFIG_H",
"HAVE_SYS_UIO_H",
("HAVE_ALLOCA", 1),
("HAVE_ALLOCA_H", 1),
("HAVE_ARPA_INET_H", 1),
("HAVE_ERRNO_H", 1),
("HAVE_FCNTL_H", 1),
("HAVE_GETTIMEOFDAY", 1),
("HAVE_GETTIMEOFDAY", 1),
("HAVE_INTTYPES_H", 1),
("HAVE_LONGLONG", 1),
("HAVE_NETINET_IN_H", 1),
("HAVE_O_NONBLOCK", 1),
("HAVE_SELECT", 1),
("HAVE_STDINT_H", 1),
("HAVE_STDIO_H", 1),
("HAVE_STDLIB_H", 1),
("HAVE_STRINGS_H", 1),
("HAVE_STRING_H", 1),
("HAVE_STRTOLL", 1),
("HAVE_SYS_IOCTL_H", 1),
("HAVE_SYS_SOCKET_H", 1),
("HAVE_SYS_STAT_H", 1),
("HAVE_SYS_TIME_H", 1),
("HAVE_SYS_TYPES_H", 1),
("HAVE_SYS_UIO_H", 1),
("HAVE_SYS_UN_H", 1),
("HAVE_UNISTD_H", 1),
("LIBSSH2_CLEAR_MEMORY", 1),
("LIBSSH2_DH_GEX_NEW", 1),
("LIBSSH2_OPENSSL", 1),
("LT_OBJDIR", ".libs/"),
("STDC_HEADERS", 1)
]
)
env_ssh2.Depends(libssh2_sources, ssl)
env_ssh2.StaticLibrary(target="../bin/" + "ssh2", source=libssh2_sources)