From 28529f9eaf59a0ad98eeecd07d3572fcb96057c4 Mon Sep 17 00:00:00 2001 From: Pedro Demarchi Gomes Date: Thu, 7 Oct 2021 20:01:40 -0300 Subject: [PATCH] re2 pic support (#26513) --- var/spack/repos/builtin/packages/grpc/package.py | 3 +-- var/spack/repos/builtin/packages/re2/package.py | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/grpc/package.py b/var/spack/repos/builtin/packages/grpc/package.py index 40ee6574bd..f7ad7d21f9 100644 --- a/var/spack/repos/builtin/packages/grpc/package.py +++ b/var/spack/repos/builtin/packages/grpc/package.py @@ -51,8 +51,7 @@ class Grpc(CMakePackage): depends_on('zlib') depends_on('c-ares') depends_on('abseil-cpp', when='@1.27:') - depends_on('re2+shared', when='@1.33.1:+shared') - depends_on('re2', when='@1.33.1:') + depends_on('re2+pic', when='@1.33.1:') def cmake_args(self): args = [ diff --git a/var/spack/repos/builtin/packages/re2/package.py b/var/spack/repos/builtin/packages/re2/package.py index 61a5d595ef..bcae22283e 100644 --- a/var/spack/repos/builtin/packages/re2/package.py +++ b/var/spack/repos/builtin/packages/re2/package.py @@ -19,9 +19,15 @@ class Re2(CMakePackage): variant('shared', default=False, description='Build shared instead of static libraries') + variant('pic', default=True, + description='Enable position independent code') + + # shared libs must have position-independent code + conflicts('+shared ~pic') def cmake_args(self): args = [ - self.define_from_variant('BUILD_SHARED_LIBS', 'shared') + self.define_from_variant('BUILD_SHARED_LIBS', 'shared'), + self.define_from_variant('CMAKE_POSITION_INDEPENDENT_CODE', 'pic') ] return args