Compare commits
2 commits
af41ee5084
...
be1986ca08
| Author | SHA1 | Date | |
|---|---|---|---|
| be1986ca08 | |||
| 307db7169d |
2 changed files with 32 additions and 3 deletions
|
|
@ -93,18 +93,22 @@ jobs:
|
||||||
# Linux launcher is statically linked; the Windows launcher has
|
# Linux launcher is statically linked; the Windows launcher has
|
||||||
# crafter-build.dll + libcrafter-build.dll.a alongside the exe.
|
# crafter-build.dll + libcrafter-build.dll.a alongside the exe.
|
||||||
for march in x86-64-v2 x86-64-v3 x86-64-v4; do
|
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)
|
stage_lin=$(mktemp -d)
|
||||||
mkdir -p "$stage_lin/bin" "$stage_lin/lib"
|
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-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 "bin/crafter.build-lib-x86_64-pc-linux-gnu-$march/libcrafter-build.a" "$stage_lin/lib/"
|
||||||
cp -r share "$stage_lin/"
|
cp -r share "$stage_lin/"
|
||||||
tar czf "dist/crafter-build-linux-x86_64-$march.tar.gz" -C "$stage_lin" .
|
tar czf "dist/crafter-build-linux-x86_64-$short.tar.gz" -C "$stage_lin" .
|
||||||
|
|
||||||
stage_win=$(mktemp -d)
|
stage_win=$(mktemp -d)
|
||||||
mkdir -p "$stage_win/bin"
|
mkdir -p "$stage_win/bin"
|
||||||
cp "bin/crafter.build-exe-x86_64-w64-mingw32-$march"/* "$stage_win/bin/"
|
cp "bin/crafter.build-exe-x86_64-w64-mingw32-$march"/* "$stage_win/bin/"
|
||||||
cp -r share "$stage_win/"
|
cp -r share "$stage_win/"
|
||||||
(cd "$stage_win" && zip -r "$GITHUB_WORKSPACE/dist/crafter-build-windows-x86_64-$march.zip" .)
|
(cd "$stage_win" && zip -r "$GITHUB_WORKSPACE/dist/crafter-build-windows-x86_64-$short.zip" .)
|
||||||
done
|
done
|
||||||
|
|
||||||
ls -la dist/
|
ls -la dist/
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,32 @@ fs::path Crafter::GetCrafterBuildHome() {
|
||||||
#else
|
#else
|
||||||
fs::path hostExe = fs::read_symlink("/proc/self/exe");
|
fs::path hostExe = fs::read_symlink("/proc/self/exe");
|
||||||
#endif
|
#endif
|
||||||
return hostExe.parent_path().parent_path() / "share" / "crafter-build";
|
|
||||||
|
// Walk up from the exe's directory looking for share/crafter-build with
|
||||||
|
// a known module source present as a sentinel. Handles:
|
||||||
|
// <prefix>/bin/crafter-build -> <prefix>/share/crafter-build (FHS install)
|
||||||
|
// <repo>/bin/crafter-build -> <repo>/share/crafter-build (build.sh)
|
||||||
|
// <repo>/bin/<arch>/crafter-build -> <repo>/share/crafter-build (self-host)
|
||||||
|
fs::path dir = hostExe.parent_path();
|
||||||
|
std::vector<fs::path> 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32)
|
#if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue