[DO-973] harfbuzz package (!10)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/10
This commit is contained in:
76
recipes/pcre2/all/conandata.yml
Normal file
76
recipes/pcre2/all/conandata.yml
Normal file
@@ -0,0 +1,76 @@
|
||||
sources:
|
||||
"10.44":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2"
|
||||
sha256: "d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96"
|
||||
"10.43":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PCRE2Project/pcre2/releases/download/pcre2-10.43/pcre2-10.43.tar.bz2"
|
||||
sha256: "e2a53984ff0b07dfdb5ae4486bbb9b21cca8e7df2434096cc9bf1b728c350bcb"
|
||||
"10.42":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2"
|
||||
sha256: "8d36cd8cb6ea2a4c2bb358ff6411b0c788633a2a45dabbf1aeb4b701d1b5e840"
|
||||
"10.40":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PCRE2Project/pcre2/releases/download/pcre2-10.40/pcre2-10.40.tar.bz2"
|
||||
sha256: "14e4b83c4783933dc17e964318e6324f7cae1bc75d8f3c79bc6969f00c159d68"
|
||||
"10.39":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.bz2"
|
||||
sha256: "0f03caf57f81d9ff362ac28cd389c055ec2bf0678d277349a1a4bee00ad6d440"
|
||||
"10.37":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PhilipHazel/pcre2/releases/download/pcre2-10.37/pcre2-10.37.tar.bz2"
|
||||
sha256: "4d95a96e8b80529893b4562be12648d798b957b1ba1aae39606bbc2ab956d270"
|
||||
"10.36":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PhilipHazel/pcre2/releases/download/pcre2-10.36/pcre2-10.36.tar.bz2"
|
||||
sha256: "a9ef39278113542968c7c73a31cfcb81aca1faa64690f400b907e8ab6b4a665c"
|
||||
"10.35":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PhilipHazel/pcre2/releases/download/pcre2-10.35/pcre2-10.35.tar.bz2"
|
||||
sha256: "9ccba8e02b0ce78046cdfb52e5c177f0f445e421059e43becca4359c669d4613"
|
||||
"10.33":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PhilipHazel/pcre2/releases/download/pcre2-10.33/pcre2-10.33.tar.bz2"
|
||||
sha256: "35514dff0ccdf02b55bd2e9fa586a1b9d01f62332c3356e379eabb75f789d8aa"
|
||||
"10.32":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/PhilipHazel/pcre2/releases/download/pcre2-10.32/pcre2-10.32.tar.bz2"
|
||||
sha256: "f29e89cc5de813f45786580101aaee3984a65818631d4ddbda7b32f699b87c2e"
|
||||
patches:
|
||||
"10.42":
|
||||
- patch_file: "patches/0002-fix-cmake-c-std.patch"
|
||||
patch_description: "make the C99 requirement explicit"
|
||||
patch_type: "conan"
|
||||
patch_source: "https://github.com/PCRE2Project/pcre2/pull/193"
|
||||
"10.40":
|
||||
- patch_file: "patches/0001-fix-cmake-1.39.patch"
|
||||
patch_description: "correct the order of cmake_minimum_required() and project()"
|
||||
patch_type: "conan"
|
||||
patch_source: "https://github.com/PCRE2Project/pcre2/pull/142"
|
||||
- patch_file: "patches/0002-fix-cmake-c-std.patch"
|
||||
patch_description: "make the C99 requirement explicit"
|
||||
patch_type: "conan"
|
||||
patch_source: "https://github.com/PCRE2Project/pcre2/pull/193"
|
||||
"10.39":
|
||||
- patch_file: "patches/0001-fix-cmake-1.39.patch"
|
||||
patch_description: "correct the order of cmake_minimum_required() and project()"
|
||||
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: "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: "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: "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: "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: "conan"
|
||||
patch_source: "https://github.com/PCRE2Project/pcre2/pull/142"
|
||||
221
recipes/pcre2/all/conanfile.py
Normal file
221
recipes/pcre2/all/conanfile.py
Normal file
@@ -0,0 +1,221 @@
|
||||
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, 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.53.0"
|
||||
|
||||
|
||||
class PCRE2Conan(ConanFile):
|
||||
name = "pcre2"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://www.pcre.org/"
|
||||
description = "Perl Compatible Regular Expressions"
|
||||
topics = ("regex", "regexp", "perl")
|
||||
license = "BSD-3-Clause"
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"build_pcre2_8": [True, False],
|
||||
"build_pcre2_16": [True, False],
|
||||
"build_pcre2_32": [True, False],
|
||||
"build_pcre2grep": [True, False],
|
||||
"with_zlib": [True, False],
|
||||
"with_bzip2": [True, False],
|
||||
"support_jit": [True, False],
|
||||
"grep_support_callout_fork": [True, False],
|
||||
"link_size": [2, 3, 4],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"build_pcre2_8": True,
|
||||
"build_pcre2_16": True,
|
||||
"build_pcre2_32": True,
|
||||
"build_pcre2grep": True,
|
||||
"with_zlib": True,
|
||||
"with_bzip2": True,
|
||||
"support_jit": False,
|
||||
"grep_support_callout_fork": True,
|
||||
"link_size": 2,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
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.11 <2]")
|
||||
if self.options.get_safe("with_bzip2"):
|
||||
self.requires("bzip2/1.0.8")
|
||||
|
||||
def validate(self):
|
||||
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.options.build_pcre2grep and not self.options.build_pcre2_8:
|
||||
raise ConanInvalidConfiguration("build_pcre2_8 must be enabled for the pcre2grep program")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
# Mandatory because upstream CMakeLists overrides BUILD_SHARED_LIBS as a CACHE variable
|
||||
# (see https://github.com/conan-io/conan/issues/11840)
|
||||
tc.variables["BUILD_SHARED_LIBS"] = self.options.shared
|
||||
if Version(self.version) >= "10.38":
|
||||
tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared
|
||||
tc.variables["PCRE2_BUILD_PCRE2GREP"] = self.options.build_pcre2grep
|
||||
tc.variables["PCRE2_SUPPORT_LIBZ"] = self.options.get_safe("with_zlib", False)
|
||||
tc.variables["PCRE2_SUPPORT_LIBBZ2"] = self.options.get_safe("with_bzip2", False)
|
||||
tc.variables["PCRE2_BUILD_TESTS"] = False
|
||||
if is_msvc(self):
|
||||
tc.variables["PCRE2_STATIC_RUNTIME"] = is_msvc_static_runtime(self)
|
||||
tc.variables["PCRE2_DEBUG"] = self.settings.build_type == "Debug"
|
||||
tc.variables["PCRE2_BUILD_PCRE2_8"] = self.options.build_pcre2_8
|
||||
tc.variables["PCRE2_BUILD_PCRE2_16"] = self.options.build_pcre2_16
|
||||
tc.variables["PCRE2_BUILD_PCRE2_32"] = self.options.build_pcre2_32
|
||||
tc.variables["PCRE2_SUPPORT_JIT"] = self.options.support_jit
|
||||
tc.variables["PCRE2_LINK_SIZE"] = self.options.link_size
|
||||
tc.variables["PCRE2GREP_SUPPORT_CALLOUT_FORK"] = self.options.get_safe("grep_support_callout_fork", False)
|
||||
if Version(self.version) < "10.38":
|
||||
# relocatable shared libs on Macos
|
||||
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
|
||||
tc.generate()
|
||||
|
||||
cd = CMakeDeps(self)
|
||||
cd.generate()
|
||||
|
||||
def _patch_sources(self):
|
||||
apply_conandata_patches(self)
|
||||
cmakelists = os.path.join(self.source_folder, "CMakeLists.txt")
|
||||
# Do not add ${PROJECT_SOURCE_DIR}/cmake because it contains a custom
|
||||
# FindPackageHandleStandardArgs.cmake which can break conan generators
|
||||
if Version(self.version) < "10.34":
|
||||
replace_in_file(self, cmakelists, "SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)", "")
|
||||
else:
|
||||
replace_in_file(self, cmakelists, "LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)", "")
|
||||
# Avoid CMP0006 error (macos bundle)
|
||||
replace_in_file(self, cmakelists,
|
||||
"RUNTIME DESTINATION bin",
|
||||
"RUNTIME DESTINATION bin BUNDLE DESTINATION bin")
|
||||
# pcre2-config does not correctly include '-static' in static library names
|
||||
if is_msvc(self):
|
||||
replace = None
|
||||
if Version(self.version) > "10.42":
|
||||
replace = "configure_file(pcre2-config.in"
|
||||
elif Version(self.version) >= "10.38":
|
||||
replace = "CONFIGURE_FILE(pcre2-config.in"
|
||||
postfix = "-static" if not self.options.shared else ""
|
||||
if replace:
|
||||
if self.settings.build_type == "Debug":
|
||||
postfix += "d"
|
||||
replace_in_file(self, cmakelists, replace, f'set(LIB_POSTFIX "{postfix}")\n{replace}')
|
||||
|
||||
def build(self):
|
||||
self._patch_sources()
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENCE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "cmake"))
|
||||
rmdir(self, os.path.join(self.package_folder, "man"))
|
||||
rmdir(self, os.path.join(self.package_folder, "share"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_file_name", "PCRE2")
|
||||
self.cpp_info.set_property("pkg_config_name", "libpcre2")
|
||||
if self.options.build_pcre2_8:
|
||||
# pcre2-8
|
||||
self.cpp_info.components["pcre2-8"].set_property("cmake_target_name", "PCRE2::8BIT")
|
||||
self.cpp_info.components["pcre2-8"].set_property("pkg_config_name", "libpcre2-8")
|
||||
self.cpp_info.components["pcre2-8"].libs = [self._lib_name("pcre2-8")]
|
||||
if not self.options.shared:
|
||||
self.cpp_info.components["pcre2-8"].defines.append("PCRE2_STATIC")
|
||||
# pcre2-posix
|
||||
self.cpp_info.components["pcre2-posix"].set_property("cmake_target_name", "PCRE2::POSIX")
|
||||
self.cpp_info.components["pcre2-posix"].set_property("pkg_config_name", "libpcre2-posix")
|
||||
self.cpp_info.components["pcre2-posix"].libs = [self._lib_name("pcre2-posix")]
|
||||
self.cpp_info.components["pcre2-posix"].requires = ["pcre2-8"]
|
||||
if Version(self.version) >= "10.43" and is_msvc(self) and self.options.shared:
|
||||
self.cpp_info.components["pcre2-posix"].defines.append("PCRE2POSIX_SHARED=1")
|
||||
|
||||
# pcre2-16
|
||||
if self.options.build_pcre2_16:
|
||||
self.cpp_info.components["pcre2-16"].set_property("cmake_target_name", "PCRE2::16BIT")
|
||||
self.cpp_info.components["pcre2-16"].set_property("pkg_config_name", "libpcre2-16")
|
||||
self.cpp_info.components["pcre2-16"].libs = [self._lib_name("pcre2-16")]
|
||||
if not self.options.shared:
|
||||
self.cpp_info.components["pcre2-16"].defines.append("PCRE2_STATIC")
|
||||
# pcre2-32
|
||||
if self.options.build_pcre2_32:
|
||||
self.cpp_info.components["pcre2-32"].set_property("cmake_target_name", "PCRE2::32BIT")
|
||||
self.cpp_info.components["pcre2-32"].set_property("pkg_config_name", "libpcre2-32")
|
||||
self.cpp_info.components["pcre2-32"].libs = [self._lib_name("pcre2-32")]
|
||||
if not self.options.shared:
|
||||
self.cpp_info.components["pcre2-32"].defines.append("PCRE2_STATIC")
|
||||
|
||||
if self.options.build_pcre2grep:
|
||||
bin_path = os.path.join(self.package_folder, "bin")
|
||||
self.output.info(f"Appending PATH environment variable: {bin_path}")
|
||||
self.env_info.PATH.append(bin_path)
|
||||
# FIXME: This is a workaround to avoid ConanException. zlib and bzip2
|
||||
# are optional requirements of pcre2grep executable, not of any pcre2 lib.
|
||||
if self.options.with_zlib:
|
||||
self.cpp_info.components["pcre2-8"].requires.append("zlib::zlib")
|
||||
if self.options.with_bzip2:
|
||||
self.cpp_info.components["pcre2-8"].requires.append("bzip2::bzip2")
|
||||
|
||||
# TODO: to remove in conan v2 once cmake_find_package* & pkg_config generator removed
|
||||
self.cpp_info.names["cmake_find_package"] = "PCRE2"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "PCRE2"
|
||||
self.cpp_info.names["pkg_config"] = "libpcre2"
|
||||
if self.options.build_pcre2_8:
|
||||
self.cpp_info.components["pcre2-8"].names["cmake_find_package"] = "8BIT"
|
||||
self.cpp_info.components["pcre2-8"].names["cmake_find_package_multi"] = "8BIT"
|
||||
self.cpp_info.components["pcre2-posix"].names["cmake_find_package"] = "POSIX"
|
||||
self.cpp_info.components["pcre2-posix"].names["cmake_find_package_multi"] = "POSIX"
|
||||
if self.options.build_pcre2_16:
|
||||
self.cpp_info.components["pcre2-16"].names["cmake_find_package"] = "16BIT"
|
||||
self.cpp_info.components["pcre2-16"].names["cmake_find_package_multi"] = "16BIT"
|
||||
if self.options.build_pcre2_32:
|
||||
self.cpp_info.components["pcre2-32"].names["cmake_find_package"] = "32BIT"
|
||||
self.cpp_info.components["pcre2-32"].names["cmake_find_package_multi"] = "32BIT"
|
||||
|
||||
def _lib_name(self, name):
|
||||
libname = name
|
||||
if Version(self.version) >= "10.38" and is_msvc(self) and not self.options.shared:
|
||||
libname += "-static"
|
||||
if self.settings.os == "Windows":
|
||||
if self.settings.build_type == "Debug":
|
||||
libname += "d"
|
||||
if self.settings.compiler == "gcc" and self.options.shared:
|
||||
libname += ".dll"
|
||||
return libname
|
||||
17
recipes/pcre2/all/patches/0001-fix-cmake-1.32.patch
Normal file
17
recipes/pcre2/all/patches/0001-fix-cmake-1.32.patch
Normal file
@@ -0,0 +1,17 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -83,13 +83,13 @@
|
||||
# 2018-06-19 PH added checks for stdint.h and inttypes.h
|
||||
# 2018-06-27 PH added Daniel's patch to increase the stack for MSVC
|
||||
|
||||
-PROJECT(PCRE2 C)
|
||||
|
||||
# Increased minimum to 2.8.0 to support newer add_test features. Set policy
|
||||
# CMP0026 to avoid warnings for the use of LOCATION in GET_TARGET_PROPERTY.
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
|
||||
CMAKE_POLICY(SET CMP0026 OLD)
|
||||
+PROJECT(PCRE2 C)
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) # for FindReadline.cmake
|
||||
|
||||
14
recipes/pcre2/all/patches/0001-fix-cmake-1.33.patch
Normal file
14
recipes/pcre2/all/patches/0001-fix-cmake-1.33.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -86,10 +86,10 @@
|
||||
# 2018-11-16 PH added PCRE2GREP_SUPPORT_CALLOUT_FORK support and tidied
|
||||
# 2019-02-16 PH hacked to avoid CMP0026 policy issue (see comments below)
|
||||
|
||||
-PROJECT(PCRE2 C)
|
||||
|
||||
# Increased minimum to 2.8.0 to support newer add_test features.
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
|
||||
+PROJECT(PCRE2 C)
|
||||
|
||||
# Set policy CMP0026 to avoid warnings for the use of LOCATION in
|
||||
# GET_TARGET_PROPERTY. This should no longer be required.
|
||||
14
recipes/pcre2/all/patches/0001-fix-cmake-1.35.patch
Normal file
14
recipes/pcre2/all/patches/0001-fix-cmake-1.35.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -93,10 +93,10 @@
|
||||
# 2020-04-25 Carlo added function check for mkostemp used in ProtExecAllocator
|
||||
# 2020-04-28 PH added function check for memfd_create based on Carlo's patch
|
||||
|
||||
-PROJECT(PCRE2 C)
|
||||
|
||||
# Increased minimum to 2.8.0 to support newer add_test features.
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
|
||||
+PROJECT(PCRE2 C)
|
||||
|
||||
# Set policy CMP0026 to avoid warnings for the use of LOCATION in
|
||||
# GET_TARGET_PROPERTY. This should no longer be required.
|
||||
14
recipes/pcre2/all/patches/0001-fix-cmake-1.36.patch
Normal file
14
recipes/pcre2/all/patches/0001-fix-cmake-1.36.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -95,10 +95,10 @@
|
||||
# 2020-05-25 PH added a check for Intel CET
|
||||
# 2020-12-03 PH altered the definition of pcre2test as suggested by Daniel
|
||||
|
||||
-PROJECT(PCRE2 C)
|
||||
|
||||
# Increased minimum to 2.8.5 to support GNUInstallDirs.
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
|
||||
+PROJECT(PCRE2 C)
|
||||
|
||||
# Set policy CMP0026 to avoid warnings for the use of LOCATION in
|
||||
# GET_TARGET_PROPERTY. This should no longer be required.
|
||||
15
recipes/pcre2/all/patches/0001-fix-cmake-1.39.patch
Normal file
15
recipes/pcre2/all/patches/0001-fix-cmake-1.39.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -100,11 +100,11 @@
|
||||
# 2021-08-28 PH increased minimum version
|
||||
# 2021-08-28 PH added test for realpath()
|
||||
|
||||
-PROJECT(PCRE2 C)
|
||||
|
||||
# Increased minimum to 2.8.5 to support GNUInstallDirs.
|
||||
# Increased minimum to 3.0.0 because older than 2.8.12 is deprecated.
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
|
||||
+PROJECT(PCRE2 C)
|
||||
|
||||
# Set policy CMP0026 to avoid warnings for the use of LOCATION in
|
||||
# GET_TARGET_PROPERTY. This should no longer be required.
|
||||
52
recipes/pcre2/all/patches/0002-fix-cmake-c-std.patch
Normal file
52
recipes/pcre2/all/patches/0002-fix-cmake-c-std.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 12b0e40ee4556318e5a0da3155f28bdfd7c5bc35 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>
|
||||
Date: Sun, 15 Jan 2023 14:38:44 -0800
|
||||
Subject: [PATCH] build: make the C99 requirement explicit
|
||||
|
||||
Recent code uses C99 syntax (as reported in #163, and therefore it
|
||||
will fail to build unless C99 (or higher) support is required by the
|
||||
compiler (gcc >= 5 does it by default).
|
||||
|
||||
For those unfortunate to need an older compiler that does require a
|
||||
flag to enable that, make sure that both autoconf and cmake make it
|
||||
explicit.
|
||||
|
||||
While testing the change with the ancient autoconf version listed as
|
||||
a prerequisite, noticed that the LT_INIT syntax introduced with 91485e5
|
||||
(Update configure.ac for latest version of autoconf., 2021-02-02), was
|
||||
not supported, so update the autoconf minimum as well.
|
||||
---
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index cec7dfb4..a8147575 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -107,1 +107,3 @@
|
||||
PROJECT(PCRE2 C)
|
||||
+set(CMAKE_C_STANDARD 99)
|
||||
+set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
||||
|
||||
# Set policy CMP0026 to avoid warnings for the use of LOCATION in
|
||||
# GET_TARGET_PROPERTY. This should no longer be required.
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index ce5bda3c..67b2fdce 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -22,7 +22,7 @@ m4_define(libpcre2_posix_version, [3:4:0])
|
||||
# NOTE: The CMakeLists.txt file searches for the above variables in the first
|
||||
# 50 lines of this file. Please update that if the variables above are moved.
|
||||
|
||||
-AC_PREREQ([2.60])
|
||||
+AC_PREREQ([2.62])
|
||||
AC_INIT([PCRE2],pcre2_major.pcre2_minor[]pcre2_prerelease,[],[pcre2])
|
||||
AC_CONFIG_SRCDIR([src/pcre2.h.in])
|
||||
AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
|
||||
@@ -42,7 +42,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
remember_set_CFLAGS="$CFLAGS"
|
||||
|
||||
-AC_PROG_CC
|
||||
+m4_version_prereq(2.70, [AC_PROG_CC], [AC_PROG_CC_C99])
|
||||
AM_PROG_CC_C_O
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
7
recipes/pcre2/all/test_package/CMakeLists.txt
Normal file
7
recipes/pcre2/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(PCRE2 REQUIRED 8BIT CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE PCRE2::8BIT)
|
||||
10
recipes/pcre2/all/test_package/CMakeUserPresets.json
Normal file
10
recipes/pcre2/all/test_package/CMakeUserPresets.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": 4,
|
||||
"vendor": {
|
||||
"conan": {}
|
||||
},
|
||||
"include": [
|
||||
"build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json",
|
||||
"build/gcc-11.5-x86_64-17-release/generators/CMakePresets.json"
|
||||
]
|
||||
}
|
||||
26
recipes/pcre2/all/test_package/conanfile.py
Normal file
26
recipes/pcre2/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
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 can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
||||
34
recipes/pcre2/all/test_package/test_package.c
Normal file
34
recipes/pcre2/all/test_package/test_package.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#include <pcre2.h>
|
||||
|
||||
|
||||
int main() {
|
||||
pcre2_code *re;
|
||||
int rc;
|
||||
PCRE2_SIZE erroffset;
|
||||
int errcode;
|
||||
PCRE2_SIZE* ovector;
|
||||
const char *pattern = "\\w+";
|
||||
size_t pattern_size = strlen(pattern);
|
||||
const char *subject = "conan";
|
||||
size_t subject_size = strlen(subject);
|
||||
uint32_t options = 0;
|
||||
pcre2_match_data *match_data;
|
||||
uint32_t ovecsize = 128;
|
||||
|
||||
re = pcre2_compile(pattern, pattern_size, options, &errcode, &erroffset, NULL);
|
||||
match_data = pcre2_match_data_create(ovecsize, NULL);
|
||||
rc = pcre2_match(re, subject, subject_size, 0, options, match_data, NULL);
|
||||
ovector = pcre2_get_ovector_pointer(match_data);
|
||||
PCRE2_SPTR start = subject + ovector[0];
|
||||
PCRE2_SIZE slen = ovector[1] - ovector[0];
|
||||
printf("match: %.*s\n", (int)slen, (char *)start );
|
||||
pcre2_match_data_free(match_data);
|
||||
pcre2_code_free(re);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user