fix: nohup
This commit is contained in:
@@ -5,7 +5,15 @@ import * as path from "node:path";
|
||||
|
||||
const packageDir = path.join(import.meta.dir, "..");
|
||||
const repoRoot = path.join(packageDir, "..", "..");
|
||||
const outputPath = path.join(packageDir, "dist", "omp");
|
||||
// Optional cross-compile target, e.g. CROSS_TARGET=linux-arm64 → bun build
|
||||
// --target=bun-linux-arm64, embeds the matching native, outputs dist/omp-<target>.
|
||||
const crossTarget = Bun.env.CROSS_TARGET || null;
|
||||
const [crossPlatform, crossArch] = crossTarget ? crossTarget.split("-") : [null, null];
|
||||
// x64 uses the baseline bun runtime so it runs under Rosetta / pre-AVX2 CPUs
|
||||
// (the modern bun-linux-x64 target SIGILLs under Apple-Silicon Rosetta).
|
||||
const bunTarget = crossTarget ? (crossTarget === "linux-x64" ? "bun-linux-x64-baseline" : `bun-${crossTarget}`) : null;
|
||||
const outName = crossTarget ? `omp-${crossTarget}` : "omp";
|
||||
const outputPath = path.join(packageDir, "dist", outName);
|
||||
|
||||
// Transformers.js is an optional, native-heavy dependency that is never bundled
|
||||
// into the binary; the tiny-model worker `bun install`s it into a runtime cache
|
||||
@@ -17,7 +25,7 @@ const transformersVersion = (
|
||||
).version;
|
||||
|
||||
function shouldAdhocSignDarwinBinary(): boolean {
|
||||
return process.platform === "darwin";
|
||||
return process.platform === "darwin" && !crossTarget;
|
||||
}
|
||||
|
||||
async function runCommand(
|
||||
@@ -43,7 +51,10 @@ async function main(): Promise<void> {
|
||||
try {
|
||||
await runCommand(["bun", "--cwd=../stats", "scripts/generate-client-bundle.ts", "--generate"]);
|
||||
await runCommand(["bun", "scripts/generate-docs-index.ts", "--generate"]);
|
||||
await runCommand(["bun", "--cwd=../natives", "run", "embed:native"]);
|
||||
await runCommand(
|
||||
["bun", "--cwd=../natives", "run", "embed:native"],
|
||||
crossTarget ? { ...Bun.env, TARGET_PLATFORM: crossPlatform as string, TARGET_ARCH: crossArch as string } : Bun.env,
|
||||
);
|
||||
await runCommand(["bun", "scripts/embed-mupdf-wasm.ts", "--generate"]);
|
||||
try {
|
||||
const buildEnv = shouldAdhocSignDarwinBinary() ? { ...Bun.env, BUN_NO_CODESIGN_MACHO_BINARY: "1" } : Bun.env;
|
||||
@@ -52,6 +63,7 @@ async function main(): Promise<void> {
|
||||
"bun",
|
||||
"build",
|
||||
"--compile",
|
||||
...(bunTarget ? ["--target", bunTarget] : []),
|
||||
"--no-compile-autoload-bunfig",
|
||||
"--no-compile-autoload-dotenv",
|
||||
"--no-compile-autoload-tsconfig",
|
||||
@@ -85,7 +97,7 @@ async function main(): Promise<void> {
|
||||
"./packages/coding-agent/src/extensibility/legacy-pi-ai-shim.ts",
|
||||
"./packages/coding-agent/src/extensibility/legacy-pi-coding-agent-shim.ts",
|
||||
"--outfile",
|
||||
"packages/coding-agent/dist/omp",
|
||||
`packages/coding-agent/dist/${outName}`,
|
||||
],
|
||||
buildEnv,
|
||||
repoRoot,
|
||||
|
||||
Reference in New Issue
Block a user