| auto ar_path = lib_archive_path(params, lib); | auto ar_path = lib_archive_path(params, lib); | ||||
| if (fs::is_regular_file(ar_path)) { | if (fs::is_regular_file(ar_path)) { | ||||
| // XXX: We don't want to just export the archive simply because it exists! | |||||
| // We should check that we actually generated one as part of the | |||||
| // build, otherwise we might end up packaging a random static lib. | |||||
| auto ar_dest = lib_out_root / ar_path.filename(); | auto ar_dest = lib_out_root / ar_path.filename(); | ||||
| fs::copy_file(ar_path, ar_dest); | fs::copy_file(ar_path, ar_dest); | ||||
| pairs.emplace_back("Path", fs::relative(ar_dest, lml_parent_dir).string()); | pairs.emplace_back("Path", fs::relative(ar_dest, lml_parent_dir).string()); | ||||
| return std::nullopt; | return std::nullopt; | ||||
| } | } | ||||
| spdlog::info("Create archive for {}: {}", lib.name(), arc.out_path.string()); | |||||
| auto ar_cmd = params.toolchain.create_archive_command(arc); | auto ar_cmd = params.toolchain.create_archive_command(arc); | ||||
| if (fs::exists(arc.out_path)) { | if (fs::exists(arc.out_path)) { | ||||
| fs::remove(arc.out_path); | fs::remove(arc.out_path); | ||||
| } | } | ||||
| spdlog::info("Create archive for {}: {}", lib.name(), arc.out_path.string()); | |||||
| fs::create_directories(arc.out_path.parent_path()); | fs::create_directories(arc.out_path.parent_path()); | ||||
| auto ar_res = run_proc(ar_cmd); | auto ar_res = run_proc(ar_cmd); | ||||
| if (!ar_res.okay()) { | if (!ar_res.okay()) { |