Allow zlib to find external installations. (#44694)
* Allow zlib to find external installations. * Apply suggestions from code review * Fixed the determine_version function to loop over all of the potential libraries that could be installed by zlib. --------- Co-authored-by: John W. Parent <45471568+johnwparent@users.noreply.github.com>
This commit is contained in:
parent
90c8fe0182
commit
9c31ff74c4
@ -8,6 +8,7 @@
|
||||
# The AutotoolsPackage causes zlib to fail to build with PGI
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
|
||||
import spack.build_systems.generic
|
||||
import spack.build_systems.makefile
|
||||
@ -24,6 +25,9 @@ class Zlib(MakefilePackage, Package):
|
||||
url = "http://zlib.net/fossils/zlib-1.2.11.tar.gz"
|
||||
git = "https://github.com/madler/zlib.git"
|
||||
|
||||
tags = ["core-packages"]
|
||||
libraries = ["libz", "zlib", "zlibstatic", "zlibd", "zlibstaticd"]
|
||||
|
||||
version("1.3.1", sha256="9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23")
|
||||
version("1.3", sha256="ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e")
|
||||
version("1.2.13", sha256="b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30")
|
||||
@ -63,6 +67,18 @@ class Zlib(MakefilePackage, Package):
|
||||
|
||||
license("Zlib")
|
||||
|
||||
@classmethod
|
||||
def determine_version(cls, lib):
|
||||
for library in cls.libraries:
|
||||
for ext in library_extensions:
|
||||
if ext == "dylib":
|
||||
pattern = re.compile(rf"{library}\.(\d+\.\d+\.\d+)\.{ext}")
|
||||
else:
|
||||
pattern = re.compile(rf"{library}\.{ext}\.(\d+\.\d+\.\d+)")
|
||||
match = re.search(pattern, lib)
|
||||
if match:
|
||||
return match.group(1)
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
shared = "+shared" in self.spec
|
||||
|
Loading…
Reference in New Issue
Block a user