Add +pic variant by default such that consumers of the static version of pcre2 can use it in a shared library. Fixes #47614 (#48071)
This commit is contained in:
parent
92dbb55703
commit
6cbd9dcf13
@ -31,12 +31,18 @@ class Pcre2(AutotoolsPackage, CMakePackage):
|
||||
|
||||
depends_on("c", type="build")
|
||||
|
||||
variant("multibyte", default=True, description="Enable support for 16 and 32 bit characters.")
|
||||
variant("jit", default=False, description="enable Just-In-Time compiling support")
|
||||
variant("multibyte", default=True, description="Enable support for 16 and 32 bit characters")
|
||||
variant("jit", default=False, description="Enable Just-In-Time compiling support")
|
||||
variant(
|
||||
"pic",
|
||||
default=True,
|
||||
description="Build the static library with the option position independent code enabled",
|
||||
)
|
||||
|
||||
# Building static+shared can cause naming colisions and other problems
|
||||
# for dependents on Windows. It generally does not cause problems on
|
||||
# other systems, so this variant is not exposed for non-Windows.
|
||||
variant("shared", default=True, description="build shared pcre2", when="platform=windows")
|
||||
variant("shared", default=True, description="Build shared pcre2", when="platform=windows")
|
||||
build_system("autotools", "cmake", default="autotools")
|
||||
|
||||
with when("build_system=cmake"):
|
||||
@ -60,6 +66,10 @@ def libs(self):
|
||||
|
||||
|
||||
class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):
|
||||
def build_environment(self, env):
|
||||
if "+pic" in self.spec:
|
||||
env.append_flags("CFLAGS", self.compiler.cc_pic_flag)
|
||||
|
||||
def configure_args(self):
|
||||
args = []
|
||||
|
||||
@ -79,6 +89,7 @@ def cmake_args(self):
|
||||
args.append(self.define_from_variant("PCRE2_BUILD_PCRE2_16", "multibyte"))
|
||||
args.append(self.define_from_variant("PCRE2_BUILD_PCRE2_32", "multibyte"))
|
||||
args.append(self.define_from_variant("PCRE2_SUPPORT_JIT", "jit"))
|
||||
args.append(self.define_from_variant("PCRE2_STATIC_PIC", "pic"))
|
||||
# Don't need to check for on or off, just if the variant is available
|
||||
# If not specified, the build system will build both static and shared
|
||||
# by default, this is in parity with the autotools build, so on
|
||||
|
Loading…
Reference in New Issue
Block a user