Skip to content

Commit

Permalink
rust-bootstrap: fix zlib dependency (spack#47894)
Browse files Browse the repository at this point in the history
x
  • Loading branch information
haampie authored Dec 4, 2024
1 parent f82554a commit 16fd77f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions var/spack/repos/builtin/packages/rust-bootstrap/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
Expand Down

0 comments on commit 16fd77f

Please sign in to comment.