Skip to content

Commit 50321f7

Browse files
Merge branch 'develop' of github.com:DiegoMagdaleno/spack into develop
Fix linking libgit2 on Darwin
1 parent dd7a413 commit 50321f7

File tree

1 file changed

+21
-1
lines changed
  • var/spack/repos/builtin/packages/libgit2

1 file changed

+21
-1
lines changed

var/spack/repos/builtin/packages/libgit2/package.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
55

66
from spack import *
7+
import sys
78

89

910
class Libgit2(CMakePackage):
@@ -16,7 +17,7 @@ class Libgit2(CMakePackage):
1617
homepage = "https://libgit2.github.com/"
1718
url = "https://github.com/libgit2/libgit2/archive/v0.26.0.tar.gz"
1819

19-
maintainers = ["AndrewGaspar"]
20+
maintainers = ["AndrewGaspar", "DiegoMagdaleno"]
2021

2122
version('1.0.0', sha256='6a1fa16a7f6335ce8b2630fbdbb5e57c4027929ebc56fcd1ac55edb141b409b4')
2223
version('0.99.0', sha256='174024310c1563097a6613a0d3f7539d11a9a86517cd67ce533849065de08a11')
@@ -96,3 +97,22 @@ def cmake_args(self):
9697
'-DBUILD_CLAR={0}'.format('ON' if self.run_tests else 'OFF'))
9798

9899
return args
100+
101+
# This fixes a linking error on Darwin based operating systems
102+
# as far as i know this issue happened on Darwin 19, in macOS versions
103+
# macOS catalina, this should link the symbol to its correct place.
104+
105+
# I dont know if the issue
106+
# is present on other operating systems, so for now
107+
# we only execute this if is platform is Darwin, also install_name_tool is
108+
# a mach tool only.
109+
@run_after('install')
110+
def fix_linking(self):
111+
if sys.platform == 'darwin':
112+
install_name_tool = which('install_name_tool')
113+
install_name_tool('-change', 'libssh2.1.dylib',
114+
'{0}'.format(
115+
self.spec['libssh2'].prefix.lib
116+
+ '/libssh2.1.0.1.dylib'),
117+
'{0}'.format(
118+
prefix.lib + '/libgit2.1.0.0.dylib'))

0 commit comments

Comments
 (0)