Skip to content

Commit

Permalink
update 1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
toge committed May 19, 2024
1 parent b5d07b3 commit 3d00ee6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
10 changes: 5 additions & 5 deletions recipes/libgit2/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sources:
"1.8.0":
url: "https://github.com/libgit2/libgit2/archive/v1.8.0.tar.gz"
sha256: "9e1d6a880d59026b675456fbb1593c724c68d73c34c0d214d6eb848e9bbd8ae4"
"1.8.1":
url: "https://github.com/libgit2/libgit2/archive/v1.8.1.tar.gz"
sha256: "8c1eaf0cf07cba0e9021920bfba9502140220786ed5d8a8ec6c7ad9174522f8e"
"1.7.2":
url: "https://github.com/libgit2/libgit2/archive/v1.7.2.tar.gz"
sha256: "de384e29d7efc9330c6cdb126ebf88342b5025d920dcb7c645defad85195ea7f"
Expand All @@ -24,8 +24,8 @@ sources:
url: "https://github.com/libgit2/libgit2/archive/v1.0.1.tar.gz"
sha256: "1775427a6098f441ddbaa5bd4e9b8a043c7401e450ed761e69a415530fea81d2"
patches:
"1.8.0":
- patch_file: "patches/1.8.0-0001-fix-cmake.patch"
"1.8.1":
- patch_file: "patches/1.8.1-0001-fix-cmake.patch"
patch_description: "use cci's packages"
patch_type: "conan"
"1.7.2":
Expand Down
26 changes: 21 additions & 5 deletions recipes/libgit2/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class LibGit2Conan(ConanFile):
"with_sha1": ["collisiondetection", "commoncrypto", "openssl", "mbedtls", "generic", "win32"],
"with_ntlmclient": [True, False],
"with_regex": ["builtin", "pcre", "pcre2", "regcomp_l", "regcomp"],
"with_http_parser": ["http-parser", "llhttp"],
}
default_options = {
"shared": False,
Expand All @@ -44,6 +45,7 @@ class LibGit2Conan(ConanFile):
"with_sha1": "collisiondetection",
"with_ntlmclient": True,
"with_regex": "builtin",
"with_http_parser": "http-parser",
}

def export_sources(self):
Expand All @@ -62,6 +64,10 @@ def config_options(self):
if self.settings.os == "Macos":
self.options.with_regex = "regcomp_l"

# < 1.8.1 requries http_parser only.
if Version(self.version) < "1.8.1":
del self.options.with_http_parser

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
Expand All @@ -73,7 +79,11 @@ def layout(self):

def requirements(self):
self.requires("zlib/[>=1.2.11 <2]")
self.requires("http_parser/2.9.4")
if Version(self.version) < "1.8.1" or self.options.get_safe("with_http_parser") == "http-parser":
self.requires("http_parser/2.9.4")
else:
self.requires("llhttp/9.1.3")

if self.options.with_libssh2:
self.requires("libssh2/1.11.0")
if self._need_openssl:
Expand Down Expand Up @@ -138,7 +148,10 @@ def source(self):
def generate(self):
tc = CMakeToolchain(self)
tc.variables["THREADSAFE"] = self.options.threadsafe
tc.variables["USE_SSH"] = self.options.with_libssh2
if Version(self.version) < "1.8.1":
tc.variables["USE_SSH"] = self.options.with_libssh2
else:
tc.variables["USE_SSH"] = "libssh2" if self.options.with_libssh2 else False
tc.variables["USE_ICONV"] = self.options.get_safe("with_iconv", False)
tc.variables["USE_HTTPS"] = self._cmake_https[str(self.options.with_https)]
tc.variables["USE_SHA1"] = self._cmake_sha1[str(self.options.with_sha1)]
Expand All @@ -147,16 +160,19 @@ def generate(self):
tc.variables["BUILD_CLAR"] = False
tc.variables["BUILD_CLI"] = False
tc.variables["BUILD_EXAMPLES"] = False
tc.variables["USE_HTTP_PARSER"] = "system"
if Version(self.version) < "1.8.1":
tc.variables["USE_HTTP_PARSER"] = "system"
else:
tc.variables["USE_HTTP_PARSER"] = self.options.get_safe("with_http_parser")
tc.variables["REGEX_BACKEND"] = self.options.with_regex
if is_msvc(self):
tc.variables["STATIC_CRT"] = is_msvc_static_runtime(self)
if Version(self.version) >= "1.8.0":
tc.variables["USE_SSH"] = "libssh2"
# REGEX_BACKEND is SET(), avoid options overriding it
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.generate()
deps = CMakeDeps(self)
if self.options.get_safe("with_http_parser") == "llhttp":
deps.set_property("llhttp", "cmake_file_name", "LLHTTP")
deps.generate()

def build(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
diff --git a/cmake/SelectHTTPParser.cmake b/cmake/SelectHTTPParser.cmake
index 955aea3..ff94eb8 100644
index 4fc1f69..1e8d83e 100644
--- a/cmake/SelectHTTPParser.cmake
+++ b/cmake/SelectHTTPParser.cmake
@@ -1,10 +1,10 @@
# Optional external dependency: http-parser
if(USE_HTTP_PARSER STREQUAL "system")
if(USE_HTTP_PARSER STREQUAL "http-parser")
- find_package(HTTPParser)
+ find_package(http_parser)

Expand All @@ -15,8 +15,8 @@ index 955aea3..ff94eb8 100644
+ list(APPEND LIBGIT2_SYSTEM_INCLUDES ${http_parser_INCLUDE_DIRS})
+ list(APPEND LIBGIT2_SYSTEM_LIBS ${http_parser_LIBRARIES})
list(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
add_feature_info(http-parser ON "http-parser support (system)")
else()
set(GIT_HTTPPARSER_HTTPPARSER 1)
add_feature_info(http-parser ON "using http-parser (system)")
diff --git a/cmake/SelectHTTPSBackend.cmake b/cmake/SelectHTTPSBackend.cmake
index d293001..acffba9 100644
--- a/cmake/SelectHTTPSBackend.cmake
Expand Down
2 changes: 1 addition & 1 deletion recipes/libgit2/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
versions:
"1.8.0":
"1.8.1":
folder: "all"
"1.7.2":
folder: "all"
Expand Down

0 comments on commit 3d00ee6

Please sign in to comment.