Skip to content

Commit 5b3d6bf

Browse files
committed
fix: statically link prebuilt Linux binaries against musl
Fixes #300
1 parent 2b7e82a commit 5b3d6bf

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/release-prebuilt-npm.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ jobs:
3434
include:
3535
- package_name: hunkdiff-linux-arm64
3636
runner: ubuntu-24.04-arm
37+
target_triple: bun-linux-arm64-musl
3738
- package_name: hunkdiff-linux-x64
3839
runner: ubuntu-latest
40+
target_triple: bun-linux-x64-musl
3941
- package_name: hunkdiff-windows-x64
4042
runner: windows-latest
4143
- package_name: hunkdiff-darwin-x64
@@ -55,6 +57,8 @@ jobs:
5557
run: bun install --frozen-lockfile
5658

5759
- name: Build host artifact
60+
env:
61+
HUNK_TARGET_TRIPLE: ${{ matrix.target_triple }}
5862
run: |
5963
bun run build:bin
6064
bun run ./scripts/build-prebuilt-artifact.ts --expect-package "${{ matrix.package_name }}"

scripts/build-bin.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ const legacyOutfile = path.join(distDir, process.platform === "win32" ? "otdiff.
1212
mkdirSync(distDir, { recursive: true });
1313
rmSync(legacyOutfile, { force: true });
1414

15+
const buildArgs = ["bun", "build", "--compile"];
16+
const targetTriple = process.env.HUNK_TARGET_TRIPLE;
17+
if (targetTriple) {
18+
buildArgs.push("--target", targetTriple);
19+
}
20+
buildArgs.push(path.join(repoRoot, "src", "main.tsx"), "--outfile", outfile);
21+
1522
const proc = Bun.spawnSync(
16-
["bun", "build", "--compile", path.join(repoRoot, "src", "main.tsx"), "--outfile", outfile],
23+
buildArgs,
1724
{
1825
cwd: repoRoot,
1926
stdin: "inherit",

0 commit comments

Comments
 (0)