Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libgit2/1.0.1: add an option to specify the regex backend to use #3685

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions recipes/libgit2/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class LibGit2Conan(ConanFile):
"with_https": [False, "openssl", "mbedtls", "winhttp", "security"],
"with_sha1": ["collisiondetection", "commoncrypto", "openssl", "mbedtls", "generic", "win32"],
"with_ntlmclient": [True, False],
"with_regex": ["auto", "builtin", "pcre", "pcre2", "regcomp_l", "regcomp"],
}
default_options = {
"shared": False,
Expand All @@ -32,6 +33,7 @@ class LibGit2Conan(ConanFile):
"with_https": "openssl",
"with_sha1": "collisiondetection",
"with_ntlmclient": True,
"with_regex": "auto",
}

@property
Expand Down Expand Up @@ -65,6 +67,10 @@ def configure(self):
if self.settings.os != "Windows":
raise ConanInvalidConfiguration("win32 is only valid on Windows")

if self.options.with_regex == "regcomp" or self.options.with_regex == "regcomp_l":
remiburtin marked this conversation as resolved.
Show resolved Hide resolved
if self.settings.compiler == "Visual Studio":
raise ConanInvalidConfiguration("{} isn't supported by Visual Studio".format(self.options.with_regex))

@property
def _need_openssl(self):
return "openssl" in (self.options.with_https, self.options.with_sha1)
Expand All @@ -73,6 +79,15 @@ def _need_openssl(self):
def _need_mbedtls(self):
return "mbedtls" in (self.options.with_https, self.options.with_sha1)

@property
def _with_regex(self):
if self.options.with_regex == "auto":
if tools.is_apple_os(self.settings.os):
return "regcomp_l"
else:
return "builtin"
return self.options.with_regex

def requirements(self):
self.requires("zlib/1.2.11")
self.requires("http_parser/2.9.4")
Expand All @@ -84,6 +99,10 @@ def requirements(self):
self.requires("mbedtls/2.16.3-gpl")
if tools.is_apple_os(self.settings.os) and self.options.with_iconv:
self.requires("libiconv/1.16")
if self.options.with_regex == "pcre":
self.requires("pcre/8.44")
elif self.options.with_regex == "pcre2":
self.requires("pcre2/10.35")

def source(self):
tools.get(**self.conan_data["sources"][self.version])
Expand Down Expand Up @@ -124,6 +143,8 @@ def _configure_cmake(self):
cmake.definitions["BUILD_EXAMPLES"] = False
cmake.definitions["USE_HTTP_PARSER"] = "system"

cmake.definitions["REGEX_BACKEND"] = self._with_regex

if self.settings.compiler == "Visual Studio":
cmake.definitions["STATIC_CRT"] = "MT" in str(self.settings.compiler.runtime)

Expand Down