From e6c94e91269520dd324820e43dd89abeee08b508 Mon Sep 17 00:00:00 2001 From: Dan Lipsa Date: Fri, 30 Jun 2023 13:10:18 -0400 Subject: [PATCH] XZ package (Windows): install .dll files in bin (#35888) Windows runtime library loading searches PATH, and therefore bin/ is the appropriate place to put .dll files. Prior to this change, XZ was installing both .dll and .lib files to the lib/ directory. --- .../repos/builtin/packages/xz/package.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/xz/package.py b/var/spack/repos/builtin/packages/xz/package.py index 560604a781..301792b24f 100644 --- a/var/spack/repos/builtin/packages/xz/package.py +++ b/var/spack/repos/builtin/packages/xz/package.py @@ -111,18 +111,26 @@ def msbuild_args(self): def install(self, pkg, spec, prefix): with working_dir(self.build_directory): - # Ensure we have libs directory mkdirp(prefix.lib) + mkdirp(prefix.bin) libs_to_find = [] - if "libs=shared" in self.pkg.spec: - libs_to_find.extend(["*.dll", "*.lib"]) - else: + dlls_to_find = [] + if self.pkg.spec.satisfies("libs=shared"): + dlls_to_find.append("*.dll") + if self.pkg.spec.satisfies("libs=static"): libs_to_find.append("*.lib") for lib in libs_to_find: libs_to_install = glob.glob( os.path.join(self.build_directory, "**", lib), recursive=True ) - for library in libs_to_install: - install(library, prefix.lib) + for lib_to_install in libs_to_install: + install(lib_to_install, prefix.lib) + for dll in dlls_to_find: + dlls_to_install = glob.glob( + os.path.join(self.build_directory, "**", dll), recursive=True + ) + for dll_to_install in dlls_to_install: + install(dll_to_install, prefix.bin) + with working_dir(pkg.stage.source_path): install_tree(os.path.join("src", "liblzma", "api"), prefix.include)