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.
This commit is contained in:
Dan Lipsa 2023-06-30 13:10:18 -04:00 committed by GitHub
parent af5b93bb97
commit e6c94e9126
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,18 +111,26 @@ def msbuild_args(self):
def install(self, pkg, spec, prefix): def install(self, pkg, spec, prefix):
with working_dir(self.build_directory): with working_dir(self.build_directory):
# Ensure we have libs directory
mkdirp(prefix.lib) mkdirp(prefix.lib)
mkdirp(prefix.bin)
libs_to_find = [] libs_to_find = []
if "libs=shared" in self.pkg.spec: dlls_to_find = []
libs_to_find.extend(["*.dll", "*.lib"]) if self.pkg.spec.satisfies("libs=shared"):
else: dlls_to_find.append("*.dll")
if self.pkg.spec.satisfies("libs=static"):
libs_to_find.append("*.lib") libs_to_find.append("*.lib")
for lib in libs_to_find: for lib in libs_to_find:
libs_to_install = glob.glob( libs_to_install = glob.glob(
os.path.join(self.build_directory, "**", lib), recursive=True os.path.join(self.build_directory, "**", lib), recursive=True
) )
for library in libs_to_install: for lib_to_install in libs_to_install:
install(library, prefix.lib) 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): with working_dir(pkg.stage.source_path):
install_tree(os.path.join("src", "liblzma", "api"), prefix.include) install_tree(os.path.join("src", "liblzma", "api"), prefix.include)