(#14651) pcre2: add 10.42 + modernize more for conan v2

* add pcre2/10.41

* modernize more

* change patch_type of patches

* add 10.42 instead of 10.41
This commit is contained in:
SpaceIm
2022-12-14 00:28:02 +01:00
committed by GitHub
parent d20b69e9a6
commit e984e7fdd9
5 changed files with 32 additions and 35 deletions

View File

@@ -1,4 +1,7 @@
sources:
"10.42":
url: "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2"
sha256: "8d36cd8cb6ea2a4c2bb358ff6411b0c788633a2a45dabbf1aeb4b701d1b5e840"
"10.40":
url: "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.40/pcre2-10.40.tar.bz2"
sha256: "14e4b83c4783933dc17e964318e6324f7cae1bc75d8f3c79bc6969f00c159d68"
@@ -34,35 +37,35 @@ patches:
"10.40":
- patch_file: "patches/0001-fix-cmake-1.39.patch"
patch_description: "correct the order of cmake_minimum_required() and project()"
patch_type: "backport"
patch_type: "conan"
patch_source: "https://github.com/PCRE2Project/pcre2/pull/142"
"10.39":
- patch_file: "patches/0001-fix-cmake-1.39.patch"
patch_description: "correct the order of cmake_minimum_required() and project()"
patch_type: "backport"
patch_type: "conan"
patch_source: "https://github.com/PCRE2Project/pcre2/pull/142"
"10.37":
- patch_file: "patches/0001-fix-cmake-1.36.patch"
patch_description: "correct the order of cmake_minimum_required() and project()"
patch_type: "backport"
patch_type: "conan"
patch_source: "https://github.com/PCRE2Project/pcre2/pull/142"
"10.36":
- patch_file: "patches/0001-fix-cmake-1.36.patch"
patch_description: "correct the order of cmake_minimum_required() and project()"
patch_type: "backport"
patch_type: "conan"
patch_source: "https://github.com/PCRE2Project/pcre2/pull/142"
"10.35":
- patch_file: "patches/0001-fix-cmake-1.35.patch"
patch_description: "correct the order of cmake_minimum_required() and project()"
patch_type: "backport"
patch_type: "conan"
patch_source: "https://github.com/PCRE2Project/pcre2/pull/142"
"10.33":
- patch_file: "patches/0001-fix-cmake-1.33.patch"
patch_description: "correct the order of cmake_minimum_required() and project()"
patch_type: "backport"
patch_type: "conan"
patch_source: "https://github.com/PCRE2Project/pcre2/pull/142"
"10.32":
- patch_file: "patches/0001-fix-cmake-1.32.patch"
patch_description: "correct the order of cmake_minimum_required() and project()"
patch_type: "backport"
patch_type: "conan"
patch_source: "https://github.com/PCRE2Project/pcre2/pull/142"

View File

@@ -1,12 +1,12 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
from conan.tools.scm import Version
import os
required_conan_version = ">=1.50.0"
required_conan_version = ">=1.53.0"
class PCRE2Conan(ConanFile):
@@ -44,8 +44,7 @@ class PCRE2Conan(ConanFile):
}
def export_sources(self):
for p in self.conan_data.get("patches", {}).get(self.version, []):
copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder)
export_conandata_patches(self)
def config_options(self):
if self.settings.os == "Windows":
@@ -53,20 +52,17 @@ class PCRE2Conan(ConanFile):
def configure(self):
if self.options.shared:
del self.options.fPIC
try:
del self.settings.compiler.libcxx
except Exception:
pass
try:
del self.settings.compiler.cppstd
except Exception:
pass
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")
if not self.options.build_pcre2grep:
del self.options.with_zlib
del self.options.with_bzip2
del self.options.grep_support_callout_fork
def layout(self):
cmake_layout(self, src_folder="src")
def requirements(self):
if self.options.get_safe("with_zlib"):
self.requires("zlib/1.2.13")
@@ -74,14 +70,11 @@ class PCRE2Conan(ConanFile):
self.requires("bzip2/1.0.8")
def validate(self):
if not self.info.options.build_pcre2_8 and not self.info.options.build_pcre2_16 and not self.info.options.build_pcre2_32:
if not self.options.build_pcre2_8 and not self.options.build_pcre2_16 and not self.options.build_pcre2_32:
raise ConanInvalidConfiguration("At least one of build_pcre2_8, build_pcre2_16 or build_pcre2_32 must be enabled")
if self.info.options.build_pcre2grep and not self.info.options.build_pcre2_8:
if self.options.build_pcre2grep and not self.options.build_pcre2_8:
raise ConanInvalidConfiguration("build_pcre2_8 must be enabled for the pcre2grep program")
def layout(self):
cmake_layout(self, src_folder="src")
def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)

View File

@@ -1,5 +1,5 @@
from conan import ConanFile
from conan.tools.build import cross_building
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
import os
@@ -7,19 +7,20 @@ import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
def requirements(self):
self.requires(self.tested_reference_str)
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not cross_building(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -1,10 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package LANGUAGES C)
project(test_package)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
find_package(PCRE2 REQUIRED 8BIT CONFIG)
add_executable(${PROJECT_NAME} ../test_package/test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE PCRE2::8BIT)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)

View File

@@ -1,4 +1,6 @@
versions:
"10.42":
folder: all
"10.40":
folder: all
"10.39":