forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(conan-io#18986) librhash: migrate to Conan v2
* librhash: migrate to Conan v2 * librhash: use OpenSSL v1 * librhash: bump deps * librhash: fix installation * librhash: downgrade OpenSSL * librhash: switch to custom CMakeLists.txt The build scripts in the project are quite non-standard and not too portable. Based on rhash/RHash#103 * librhash: bump openssl * librhash: add v1.4.4 * librhash: fix the list of sources used in CMakeLists.txt * librhash: fix missing lib prefix for libs * librhash: don't use PROJECT_NAME
- Loading branch information
1 parent
66693ed
commit da8b387
Showing
9 changed files
with
143 additions
and
120 deletions.
There are no files selected for viewing
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,48 @@ | ||
# Based on https://github.com/rhash/RHash/pull/103 | ||
cmake_minimum_required(VERSION 3.15) | ||
project(rhash LANGUAGES C) | ||
|
||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/../version.h" versionfile) | ||
string(REGEX MATCH "#define VERSION \"([0-9]*)\.([0-9]*)\.([0-9]*)\"" _ ${versionfile}) | ||
set(RHASH_VERSION_MAJOR ${CMAKE_MATCH_1}) | ||
set(RHASH_VERSION_MINOR ${CMAKE_MATCH_2}) | ||
set(RHASH_VERSION_PATCH ${CMAKE_MATCH_3}) | ||
set(RHASH_VERSION "${RHASH_VERSION_MAJOR}.${RHASH_VERSION_MINOR}.${RHASH_VERSION_PATCH}") | ||
|
||
option(USE_OPENSSL "Enable OpenSSL (optimized hash functions) support" ON) | ||
|
||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) | ||
|
||
# Get the list of source files from the Makefile | ||
# https://github.com/rhash/RHash/blob/v1.4.4/librhash/Makefile#L6 | ||
file(READ Makefile MAKEFILE_CONTENTS) | ||
if("${MAKEFILE_CONTENTS}" MATCHES "SOURCES *= *([^\n]+)") | ||
string(REPLACE " " ";" SOURCE_FILES ${CMAKE_MATCH_1}) | ||
else() | ||
message(FATAL_ERROR "SOURCES line not found in Makefile") | ||
endif() | ||
|
||
add_library(rhash ${SOURCE_FILES}) | ||
|
||
if(USE_OPENSSL) | ||
find_package(OpenSSL REQUIRED) | ||
target_link_libraries(rhash OpenSSL::Crypto) | ||
target_compile_definitions(rhash PUBLIC USE_OPENSSL) | ||
endif() | ||
|
||
if(MSVC) | ||
target_compile_definitions(rhash PRIVATE _CRT_SECURE_NO_DEPRECATE) | ||
endif() | ||
|
||
set_target_properties(rhash PROPERTIES | ||
COMPILE_DEFINITIONS IN_RHASH | ||
DEFINE_SYMBOL RHASH_EXPORTS | ||
VERSION ${RHASH_VERSION} | ||
SOVERSION ${RHASH_VERSION_MAJOR}) | ||
|
||
install(TARGETS rhash | ||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib | ||
ARCHIVE DESTINATION lib) | ||
|
||
install(FILES "rhash.h" "rhash_torrent.h" DESTINATION include) |
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,11 +1,10 @@ | ||
sources: | ||
"1.4.4": | ||
url: "https://downloads.sourceforge.net/project/rhash/rhash/1.4.4/rhash-1.4.4-src.tar.gz" | ||
sha256: "8e7d1a8ccac0143c8fe9b68ebac67d485df119ea17a613f4038cda52f84ef52a" | ||
"1.4.2": | ||
url: "https://downloads.sourceforge.net/project/rhash/rhash/1.4.2/rhash-1.4.2-src.tar.gz" | ||
sha256: "600d00f5f91ef04194d50903d3c79412099328c42f28ff43a0bdb777b00bec62" | ||
"1.3.9": | ||
url: "https://downloads.sourceforge.net/project/rhash/rhash/1.3.9/rhash-1.3.9-src.tar.gz" | ||
sha256: "42b1006f998adb189b1f316bf1a60e3171da047a85c4aaded2d0d26c1476c9f6" | ||
patches: | ||
"1.4.2": | ||
- patch_file: "patches/0001-1.4.2-fix-compiler-detection.patch" | ||
base_path: "source_subfolder" |
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
29 changes: 0 additions & 29 deletions
29
recipes/librhash/all/patches/0001-1.4.2-fix-compiler-detection.patch
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,17 +1,26 @@ | ||
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 SolaceTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
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 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,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package/) |
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,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class SolaceTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
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) |
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,4 +1,6 @@ | ||
versions: | ||
1.4.4: | ||
folder: all | ||
1.4.2: | ||
folder: all | ||
1.3.9: | ||
|