cmake: improve ~/+ownlibs (#29847)

* remove openssl variant

* require internal curl to have external openssl.

* Fix dependencies

* mono: remove ~openssl reference
This commit is contained in:
Harmen Stoppels 2022-04-05 18:59:09 +02:00 committed by GitHub
parent 16c5091026
commit 935faeb0c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 33 deletions

View File

@ -157,7 +157,6 @@ class Cmake(Package):
variant('ownlibs', default=True, description='Use CMake-provided third-party libraries') variant('ownlibs', default=True, description='Use CMake-provided third-party libraries')
variant('qt', default=False, description='Enables the build of cmake-gui') variant('qt', default=False, description='Enables the build of cmake-gui')
variant('doc', default=False, description='Enables the generation of html and man page documentation') variant('doc', default=False, description='Enables the generation of html and man page documentation')
variant('openssl', default=True, description="Enable openssl for curl bootstrapped by CMake when using +ownlibs")
variant('ncurses', default=os.name != 'nt', description='Enables the build of the ncurses gui') variant('ncurses', default=os.name != 'nt', description='Enables the build of the ncurses gui')
# See https://gitlab.kitware.com/cmake/cmake/-/issues/21135 # See https://gitlab.kitware.com/cmake/cmake/-/issues/21135
@ -171,31 +170,29 @@ class Cmake(Package):
conflicts('+ownlibs %nvhpc') conflicts('+ownlibs %nvhpc')
conflicts('+ncurses %nvhpc') conflicts('+ncurses %nvhpc')
# Really this should conflict since it's enabling or disabling openssl for with when('~ownlibs'):
# CMake's internal copy of curl. Ideally we'd want a way to have the depends_on('curl')
# openssl variant disabled when ~ownlibs but there's not really a way to depends_on('expat')
# tie the values of those togethor, so for now we're just going to ignore depends_on('zlib')
# the openssl variant entirely when ~ownlibs # expat/zlib are used in CMake/CTest, so why not require them in libarchive.
# conflicts('~ownlibs', when='+openssl') depends_on('libarchive@3.1.0: xar=expat compression=zlib')
depends_on('libarchive@3.3.3:', when='@3.15.0:')
depends_on('libuv@1.0.0:1.10', when='@3.7.0:3.10.3')
depends_on('libuv@1.10.0:1.10', when='@3.11.0:3.11')
depends_on('libuv@1.10.0:', when='@3.12.0:')
depends_on('rhash', when='@3.8.0:')
with when('+ownlibs'):
depends_on('openssl')
depends_on('openssl@:1.0', when='@:3.6.9')
depends_on('curl', when='~ownlibs')
depends_on('expat', when='~ownlibs')
depends_on('zlib', when='~ownlibs')
depends_on('bzip2', when='~ownlibs')
depends_on('xz', when='~ownlibs')
depends_on('libarchive@3.1.0:', when='~ownlibs')
depends_on('libarchive@3.3.3:', when='@3.15.0:~ownlibs')
depends_on('libuv@1.0.0:1.10', when='@3.7.0:3.10.3~ownlibs')
depends_on('libuv@1.10.0:1.10', when='@3.11.0:3.11~ownlibs')
depends_on('libuv@1.10.0:', when='@3.12.0:~ownlibs')
depends_on('rhash', when='@3.8.0:~ownlibs')
depends_on('qt', when='+qt') depends_on('qt', when='+qt')
depends_on('python@2.7.11:', when='+doc', type='build')
depends_on('py-sphinx', when='+doc', type='build')
depends_on('openssl', when='+openssl+ownlibs')
depends_on('openssl@:1.0', when='@:3.6.9+openssl+ownlibs')
depends_on('ncurses', when='+ncurses') depends_on('ncurses', when='+ncurses')
with when('+doc'):
depends_on('python@2.7.11:', type='build')
depends_on('py-sphinx', type='build')
# Cannot build with Intel, should be fixed in 3.6.2 # Cannot build with Intel, should be fixed in 3.6.2
# https://gitlab.kitware.com/cmake/cmake/issues/16226 # https://gitlab.kitware.com/cmake/cmake/issues/16226
patch('intel-c-gnu11.patch', when='@3.6.0:3.6.1') patch('intel-c-gnu11.patch', when='@3.6.0:3.6.1')
@ -268,7 +265,7 @@ def flag_handler(self, name, flags):
def setup_build_environment(self, env): def setup_build_environment(self, env):
spec = self.spec spec = self.spec
if '+openssl' in spec: if '+ownlibs' in spec:
env.set('OPENSSL_ROOT_DIR', spec['openssl'].prefix) env.set('OPENSSL_ROOT_DIR', spec['openssl'].prefix)
def bootstrap_args(self): def bootstrap_args(self):
@ -317,10 +314,10 @@ def bootstrap_args(self):
# inside a ctest environment # inside a ctest environment
args.append('-DCMake_TEST_INSTALL=OFF') args.append('-DCMake_TEST_INSTALL=OFF')
# When building our own private copy of curl then we need to properly # When building our own private copy of curl we still require an
# enable / disable oepnssl # external openssl.
if '+ownlibs' in spec: if '+ownlibs' in spec:
args.append('-DCMAKE_USE_OPENSSL=%s' % str('+openssl' in spec)) args.append('-DCMAKE_USE_OPENSSL=ON')
args.append('-DBUILD_CursesDialog=%s' % str('+ncurses' in spec)) args.append('-DBUILD_CursesDialog=%s' % str('+ncurses' in spec))
@ -328,7 +325,7 @@ def bootstrap_args(self):
rpaths = spack.build_environment.get_rpaths(self) rpaths = spack.build_environment.get_rpaths(self)
prefixes = spack.build_environment.get_cmake_prefix_path(self) prefixes = spack.build_environment.get_cmake_prefix_path(self)
args.extend([ args.extend([
'-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=OFF', '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON',
'-DCMAKE_INSTALL_RPATH={0}'.format(";".join(str(v) for v in rpaths)), '-DCMAKE_INSTALL_RPATH={0}'.format(";".join(str(v) for v in rpaths)),
'-DCMAKE_PREFIX_PATH={0}'.format(";".join(str(v) for v in prefixes)) '-DCMAKE_PREFIX_PATH={0}'.format(";".join(str(v) for v in prefixes))
]) ])

View File

@ -23,9 +23,7 @@ class Mono(AutotoolsPackage):
description='Point SpecialFolder.CommonApplicationData folder ' description='Point SpecialFolder.CommonApplicationData folder '
'into Spack installation instead of /usr/share') 'into Spack installation instead of /usr/share')
# Spack's openssl interacts badly with mono's vendored depends_on('cmake', type=('build'))
# "boringssl", don't drag it in w/ cmake
depends_on('cmake~openssl', type=('build'))
depends_on('iconv') depends_on('iconv')
depends_on('perl', type=('build')) depends_on('perl', type=('build'))
depends_on('python', type=('build')) depends_on('python', type=('build'))