Fix bundled build on Fedora
Fedora uses "lib64" for the CMake output directory. The current search
path is limited to "lib". This fix searches in "lib" and "lib64 for
applicable libraries in a bundled build.
@@ -421,8 +421,15 @@ fn copy_dynamic_libraries(sdl2_compiled_path: &PathBuf, target_os: &str) {
copy_library_file(&src_dll_path, &target_path);
} else if target_os != "emscripten" {
// Find all libraries build and copy them, symlinks included.
- let lib_path = sdl2_compiled_path.join("lib");
- for entry in std::fs::read_dir(&lib_path).expect("Couldn't readdir lib") {
+ let mut found = false;
+ let lib_dirs = &["lib", "lib64"];
+ for lib_dir in lib_dirs {
+ let lib_path = sdl2_compiled_path.join(lib_dir);
+ if lib_path.exists() {
+ found = true;
+ for entry in std::fs::read_dir(&lib_path)
+ .unwrap_or_else(|_| panic!("Couldn't readdir {}", lib_dir))
+ {
let entry = entry.expect("Error looking at lib dir");
if let Ok(file_type) = entry.file_type() {
if file_type.is_symlink() {
@@ -432,6 +439,12 @@ fn copy_dynamic_libraries(sdl2_compiled_path: &PathBuf, target_os: &str) {
}
}
}
+ break;
+ }
+ }
+ if !found {
+ panic!("Failed to find CMake output dir");
+ }
}
}
