forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust-bootstrap: fix zlib dependency (spack#47894)
x
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,12 @@ class RustBootstrap(Package): | |
if os in rust_releases[release] and target in rust_releases[release][os]: | ||
version(release, sha256=rust_releases[release][os][target]) | ||
|
||
# rust-ldd and libLLVM both depend on zlib, which is not vendored. | ||
depends_on("zlib-api") | ||
depends_on("zlib-ng +shared", when="^[virtuals=zlib-api] zlib-ng") | ||
depends_on("zlib +shared", when="^[virtuals=zlib-api] zlib") | ||
depends_on("[email protected]:", when="platform=linux", type="build") | ||
|
||
def url_for_version(self, version): | ||
if self.os not in ("linux", "darwin"): | ||
return None | ||
|
@@ -151,6 +157,15 @@ def url_for_version(self, version): | |
url = "https://static.rust-lang.org/dist/rust-{0}-{1}-{2}.tar.gz" | ||
return url.format(version, target, os) | ||
|
||
@run_before("install", when="platform=linux") | ||
def fixup_rpaths(self): | ||
# set rpaths of libLLVM.so and rust-ldd to zlib's lib directory | ||
rpaths = self.spec["zlib-api"].libs.directories | ||
|
||
for binary in find(self.stage.source_path, ["libLLVM.so.*", "rust-lld"]): | ||
patchelf = Executable("patchelf") | ||
patchelf("--add-rpath", ":".join(rpaths), binary) | ||
|
||
def install(self, spec, prefix): | ||
install_script = Executable("./install.sh") | ||
install_args = [f"--prefix={prefix}", "--without=rust-docs"] | ||
|