Merge branch 'develop' of github.com:DiegoMagdaleno/spack into develop

Fix linking libgit2 on Darwin
This commit is contained in:
Diego Magdaleno 2020-04-05 22:03:03 -05:00
parent dd7a413f48
commit 50321f7986

View File

@ -4,6 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import * from spack import *
import sys
class Libgit2(CMakePackage): class Libgit2(CMakePackage):
@ -16,7 +17,7 @@ class Libgit2(CMakePackage):
homepage = "https://libgit2.github.com/" homepage = "https://libgit2.github.com/"
url = "https://github.com/libgit2/libgit2/archive/v0.26.0.tar.gz" url = "https://github.com/libgit2/libgit2/archive/v0.26.0.tar.gz"
maintainers = ["AndrewGaspar"] maintainers = ["AndrewGaspar", "DiegoMagdaleno"]
version('1.0.0', sha256='6a1fa16a7f6335ce8b2630fbdbb5e57c4027929ebc56fcd1ac55edb141b409b4') version('1.0.0', sha256='6a1fa16a7f6335ce8b2630fbdbb5e57c4027929ebc56fcd1ac55edb141b409b4')
version('0.99.0', sha256='174024310c1563097a6613a0d3f7539d11a9a86517cd67ce533849065de08a11') version('0.99.0', sha256='174024310c1563097a6613a0d3f7539d11a9a86517cd67ce533849065de08a11')
@ -96,3 +97,22 @@ def cmake_args(self):
'-DBUILD_CLAR={0}'.format('ON' if self.run_tests else 'OFF')) '-DBUILD_CLAR={0}'.format('ON' if self.run_tests else 'OFF'))
return args return args
# This fixes a linking error on Darwin based operating systems
# as far as i know this issue happened on Darwin 19, in macOS versions
# macOS catalina, this should link the symbol to its correct place.
# I dont know if the issue
# is present on other operating systems, so for now
# we only execute this if is platform is Darwin, also install_name_tool is
# a mach tool only.
@run_after('install')
def fix_linking(self):
if sys.platform == 'darwin':
install_name_tool = which('install_name_tool')
install_name_tool('-change', 'libssh2.1.dylib',
'{0}'.format(
self.spec['libssh2'].prefix.lib
+ '/libssh2.1.0.1.dylib'),
'{0}'.format(
prefix.lib + '/libgit2.1.0.0.dylib'))