-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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: add version 1.7.2, support conan v2 #18458
Merged
Merged
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
fd20266
libgit2: add version 1.6.4, support conan v2
toge 40ed77d
set CMP0091 to NEW
toge 28c2bf1
update 1.7.0, fix CMakeLists.txt of 1.0.1
toge 22a6482
support libssh2 in 1.7.0
toge ecc36e4
Merge branch 'master' into libgit2-1.6.4
toge c2cd815
fix cmake in 0.27.x and 0.28.x
toge ae21891
disable CHECK_LIBRARY_EXISTS
toge b1eaf57
link secur32
toge a0a0ee5
use `is_msvc()`
toge e99f103
Merge branch 'master' into libgit2-1.6.4
toge 974ef8c
update 1.7.1
toge 8ca3d60
Merge branch 'libgit2-1.6.4' of https://github.com/toge/conan-center-…
toge 701d719
Merge branch 'master' into libgit2-1.6.4
toge 22a6255
libcurl version range
toge e34284d
zlib version range
toge f0658aa
Fix zlib range version
uilianries fed112b
Fix libcurl range version
uilianries 37a3dc7
Merge branch 'master' into libgit2-1.6.4
toge 45b0b17
Add zlib range to 0.28.x branch
AbrilRBS 7aa9087
Merge branch 'master' into libgit2-1.6.4
toge 70afd59
Merge branch 'master' into libgit2-1.6.4
toge f181d53
Merge branch 'master' into libgit2-1.6.4
toge 15b732d
Merge branch 'master' into libgit2-1.6.4
toge 6ccaf17
Merge branch 'master' into libgit2-1.6.4
toge 51bbd22
update 1.7.2
toge 592eb96
remove versions in config.yml
toge c75ed03
revert
toge d3e80d1
Merge branch 'master' into libgit2-1.6.4
toge 09f2eb5
Merge branch 'master' into libgit2-1.6.4
toge 33f0fcb
Remove 0.X releases
AbrilRBS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime | ||
from conans import ConanFile, tools, CMake | ||
from conans.errors import ConanInvalidConfiguration | ||
import functools | ||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.microsoft import is_msvc_static_runtime, is_msvc | ||
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir | ||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout | ||
from conan.tools.apple import is_apple_os | ||
import os | ||
|
||
required_conan_version = ">=1.45.0" | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
|
||
class LibGit2Conan(ConanFile): | ||
|
@@ -38,43 +41,42 @@ class LibGit2Conan(ConanFile): | |
"with_sha1": "collisiondetection", | ||
} | ||
|
||
exports_sources = "CMakeLists.txt" | ||
generators = "cmake", "cmake_find_package" | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
def export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
if not tools.is_apple_os(self.settings.os): | ||
if not is_apple_os(self): | ||
del self.options.with_iconv | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
del self.settings.compiler.cppstd | ||
del self.settings.compiler.libcxx | ||
self.options.rm_safe("fPIC") | ||
self.settings.rm_safe("compiler.libcxx") | ||
self.settings.rm_safe("compiler.cppstd") | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
@property | ||
def _need_openssl(self): | ||
return "openssl" in (self.options.with_https, self.options.with_sha1) | ||
|
||
def requirements(self): | ||
self.requires("zlib/1.2.12") | ||
self.requires("zlib/[>=1.2.12 <2]") | ||
self.requires("http_parser/2.9.4") | ||
if self.options.with_libssh2: | ||
self.requires("libssh2/1.10.0") | ||
self.requires("libssh2/1.11.0") | ||
if self.settings.os != "Windows": | ||
self.requires("libcurl/7.83.1") | ||
self.requires("libcurl/[>=7.83 <9]") | ||
if self._need_openssl: | ||
self.requires("openssl/1.1.1o") | ||
self.requires("openssl/[>=1.1 <4]") | ||
|
||
def validate(self): | ||
if self.options.with_https == "security": | ||
if not tools.is_apple_os(self.settings.os): | ||
if not is_apple_os(self): | ||
raise ConanInvalidConfiguration("security is only valid for Apple products") | ||
elif self.options.with_https == "winhttp": | ||
if self.settings.os != "Windows": | ||
|
@@ -85,8 +87,7 @@ def validate(self): | |
raise ConanInvalidConfiguration("win32 is only valid on Windows") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], | ||
destination=self._source_subfolder, strip_root=True) | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
_cmake_https = { | ||
"openssl": "OpenSSL", | ||
|
@@ -103,49 +104,32 @@ def source(self): | |
"win32": "Win32", | ||
} | ||
|
||
@functools.lru_cache(1) | ||
def _configure_cmake(self): | ||
cmake = CMake(self) | ||
cmake.definitions["THREADSAFE"] = self.options.threadsafe | ||
cmake.definitions["USE_SSH"] = self.options.with_libssh2 | ||
|
||
cmake.definitions["USE_ICONV"] = self.options.get_safe("with_iconv", False) | ||
|
||
cmake.definitions["USE_HTTPS"] = self._cmake_https[str(self.options.with_https)] | ||
cmake.definitions["SHA1_BACKEND"] = self._cmake_sha1[str(self.options.with_sha1)] | ||
|
||
cmake.definitions["BUILD_CLAR"] = False | ||
cmake.definitions["BUILD_EXAMPLES"] = False | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["THREADSAFE"] = self.options.threadsafe | ||
tc.variables["USE_SSH"] = self.options.with_libssh2 | ||
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["SHA1_BACKEND"] = self._cmake_sha1[str(self.options.with_sha1)] | ||
tc.variables["BUILD_CLAR"] = False | ||
tc.variables["BUILD_EXAMPLES"] = False | ||
if is_msvc(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to set |
||
cmake.definitions["STATIC_CRT"] = is_msvc_static_runtime(self) | ||
|
||
cmake.configure() | ||
return cmake | ||
|
||
def _patch_sources(self): | ||
tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), | ||
"FIND_PKGLIBRARIES(LIBSSH2 libssh2)", | ||
"FIND_PACKAGE(Libssh2 REQUIRED)\n" | ||
"\tSET(LIBSSH2_FOUND ON)\n" | ||
"\tSET(LIBSSH2_INCLUDE_DIRS ${Libssh2_INCLUDE_DIRS})\n" | ||
"\tSET(LIBSSH2_LIBRARIES ${Libssh2_LIBRARIES})\n" | ||
"\tSET(LIBSSH2_LIBRARY_DIRS ${Libssh2_LIB_DIRS})") | ||
|
||
tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), | ||
"FIND_PKGLIBRARIES(CURL libcurl)", | ||
"FIND_PACKAGE(CURL REQUIRED)\n") | ||
tc.variables["STATIC_CRT"] = is_msvc_static_runtime(self) | ||
tc.generate() | ||
deps = CMakeDeps(self) | ||
deps.generate() | ||
|
||
def build(self): | ||
self._patch_sources() | ||
cmake = self._configure_cmake() | ||
apply_conandata_patches(self) | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy("COPYING", src=self._source_subfolder, dst="licenses") | ||
cmake = self._configure_cmake() | ||
copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||
cmake = CMake(self) | ||
cmake.install() | ||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
|
||
def package_info(self): | ||
self.cpp_info.set_property("pkg_config_name", "libgit2") | ||
|
52 changes: 52 additions & 0 deletions
52
recipes/libgit2/0.27.x/patches/0.27.10-0001-fix-cmake.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 83898c5..bc7934e 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -11,8 +11,8 @@ | ||
# Install: | ||
# > cmake --build . --target install | ||
|
||
-PROJECT(libgit2 C) | ||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) | ||
+PROJECT(libgit2 C) | ||
CMAKE_POLICY(SET CMP0015 NEW) | ||
IF (POLICY CMP0051) | ||
CMAKE_POLICY(SET CMP0051 NEW) | ||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | ||
index 2080933..8b310fa 100644 | ||
--- a/src/CMakeLists.txt | ||
+++ b/src/CMakeLists.txt | ||
@@ -126,7 +126,7 @@ IF (WIN32 AND WINHTTP) | ||
LIST(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32") | ||
ELSE () | ||
IF (CURL) | ||
- FIND_PKGLIBRARIES(CURL libcurl) | ||
+ FIND_PACKAGE(CURL REQUIRED) | ||
ENDIF () | ||
IF (CURL_FOUND) | ||
SET(GIT_CURL 1) | ||
@@ -287,7 +287,11 @@ ENDIF() | ||
|
||
# Optional external dependency: libssh2 | ||
IF (USE_SSH) | ||
- FIND_PKGLIBRARIES(LIBSSH2 libssh2) | ||
+ FIND_PACKAGE(Libssh2 REQUIRED) | ||
+ SET(LIBSSH2_FOUND ON) | ||
+ SET(LIBSSH2_INCLUDE_DIRS ${Libssh2_INCLUDE_DIRS}) | ||
+ SET(LIBSSH2_LIBRARIES ${Libssh2_LIBRARIES}) | ||
+ SET(LIBSSH2_LIBRARY_DIRS ${Libssh2_LIB_DIRS}) | ||
ENDIF() | ||
IF (LIBSSH2_FOUND) | ||
SET(GIT_SSH 1) | ||
@@ -295,10 +299,7 @@ IF (LIBSSH2_FOUND) | ||
LIST(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES}) | ||
LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS}) | ||
|
||
- CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS) | ||
- IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS) | ||
- SET(GIT_SSH_MEMORY_CREDENTIALS 1) | ||
- ENDIF() | ||
+ SET(GIT_SSH_MEMORY_CREDENTIALS 1) | ||
ELSE() | ||
MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.") | ||
ENDIF() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
project(test_package LANGUAGES C) | ||
|
||
find_package(libgit2 REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} libgit2::libgit2) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE libgit2::libgit2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the
0.27
recipe can be dropped altogether.