From 854aed25714b823820f0135322b6f0b6be9322d9 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sun, 1 Nov 2020 15:11:40 -0600 Subject: [PATCH] krb5: fix build with Apple Clang 12 (#19657) --- .../repos/builtin/packages/krb5/package.py | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/var/spack/repos/builtin/packages/krb5/package.py b/var/spack/repos/builtin/packages/krb5/package.py index 93367a3461..bdc99e1059 100644 --- a/var/spack/repos/builtin/packages/krb5/package.py +++ b/var/spack/repos/builtin/packages/krb5/package.py @@ -3,7 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +import re class Krb5(AutotoolsPackage): @@ -23,19 +23,32 @@ class Krb5(AutotoolsPackage): version('1.16.2', sha256='9f721e1fe593c219174740c71de514c7228a97d23eb7be7597b2ae14e487f027') version('1.16.1', sha256='214ffe394e3ad0c730564074ec44f1da119159d94281bbec541dc29168d21117') - def url_for_version(self, version): - url = 'https://kerberos.org/dist/krb5/{0}/krb5-{1}.tar.gz' - return url.format(version.up_to(2), version) - depends_on('bison', type='build') depends_on('openssl') configure_directory = 'src' build_directory = 'src' + executables = ['^krb5-config$'] + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)('--version', output=str, error=str) + match = re.search(r'Kerberos 5 release\s+(\S+)', output) + return match.group(1) if match else None + + def url_for_version(self, version): + url = 'https://kerberos.org/dist/krb5/{0}/krb5-{1}.tar.gz' + return url.format(version.up_to(2), version) + + def patch(self): + # https://github.com/Homebrew/homebrew-core/blob/master/Formula/krb5.rb + # https://krbdev.mit.edu/rt/Ticket/Display.html?id=8928 + filter_file( + 'void foo1() __attribute__((constructor));', + '#include \nvoid foo1() __attribute__((constructor));', + join_path(self.configure_directory, 'configure'), + string=True) + def configure_args(self): - args = ['--disable-debug', - '--disable-dependency-tracking', - '--disable-silent-rules', - '--without-system-verto'] - return args + return ['--without-system-verto']