diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 68516be..c53f564 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -93,22 +93,18 @@ jobs: # Linux launcher is statically linked; the Windows launcher has # crafter-build.dll + libcrafter-build.dll.a alongside the exe. for march in x86-64-v2 x86-64-v3 x86-64-v4; do - # Short suffix (v2/v3/v4) for archive filenames; the upload-artifact - # steps below reference these short names. - short=${march##*-} - stage_lin=$(mktemp -d) mkdir -p "$stage_lin/bin" "$stage_lin/lib" cp "bin/crafter.build-exe-x86_64-pc-linux-gnu-$march/crafter-build" "$stage_lin/bin/" cp "bin/crafter.build-lib-x86_64-pc-linux-gnu-$march/libcrafter-build.a" "$stage_lin/lib/" cp -r share "$stage_lin/" - tar czf "dist/crafter-build-linux-x86_64-$short.tar.gz" -C "$stage_lin" . + tar czf "dist/crafter-build-linux-x86_64-$march.tar.gz" -C "$stage_lin" . stage_win=$(mktemp -d) mkdir -p "$stage_win/bin" cp "bin/crafter.build-exe-x86_64-w64-mingw32-$march"/* "$stage_win/bin/" cp -r share "$stage_win/" - (cd "$stage_win" && zip -r "$GITHUB_WORKSPACE/dist/crafter-build-windows-x86_64-$short.zip" .) + (cd "$stage_win" && zip -r "$GITHUB_WORKSPACE/dist/crafter-build-windows-x86_64-$march.zip" .) done ls -la dist/ diff --git a/implementations/Crafter.Build-Platform.cpp b/implementations/Crafter.Build-Platform.cpp index 9938c8c..080fa29 100644 --- a/implementations/Crafter.Build-Platform.cpp +++ b/implementations/Crafter.Build-Platform.cpp @@ -49,32 +49,7 @@ fs::path Crafter::GetCrafterBuildHome() { #else fs::path hostExe = fs::read_symlink("/proc/self/exe"); #endif - - // Walk up from the exe's directory looking for share/crafter-build with - // a known module source present as a sentinel. Handles: - // /bin/crafter-build -> /share/crafter-build (FHS install) - // /bin/crafter-build -> /share/crafter-build (build.sh) - // /bin//crafter-build -> /share/crafter-build (self-host) - fs::path dir = hostExe.parent_path(); - std::vector tried; - for (;;) { - fs::path candidate = dir / "share" / "crafter-build"; - tried.push_back(candidate); - std::error_code ec; - if (fs::exists(candidate / "Crafter.Build.cppm", ec)) { - return candidate; - } - fs::path parent = dir.parent_path(); - if (parent == dir) break; - dir = parent; - } - std::string msg = std::format( - "could not locate crafter-build runtime assets relative to {} (set CRAFTER_BUILD_HOME). Tried:", - hostExe.string()); - for (const auto& p : tried) { - msg += "\n " + p.string(); - } - throw std::runtime_error(msg); + return hostExe.parent_path().parent_path() / "share" / "crafter-build"; } #if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32)