Skip to content

Commit

Permalink
Merge pull request pkgxdev#16 from teaxyz/usePlatform().shell
Browse files Browse the repository at this point in the history
use bash on Linux for build.sh
  • Loading branch information
jhheider authored Jun 13, 2022
2 parents e09382c + afac19a commit 45995ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/hooks/usePlatform.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//lol FIXME

import { Installation } from "types";
import { run } from "utils";

Expand Down
15 changes: 9 additions & 6 deletions src/prefab/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ export default async function build({ pkg, deps }: Options): Promise<Path> {
const src = dst.join("src")
const env = await useShellEnv(deps)
const sh = await pantry.getBuildScript(pkg)
const platform = usePlatform()
const { platform, target } = usePlatform()

/// FIXME: no one likes this. `set -o pipefail` is the reason for this requirement.
const shell = platform === "linux" ? "bash" : "sh"

const cmd = dst.join("build.sh").write({ force: true, text: undent`
#!/bin/sh
#!/bin/${shell}
set -e
set -o pipefail
cd "${src}"
export CFLAGS="-target ${platform.target} $CFLAGS"
export CCFLAGS="-target ${platform.target} $CCFLAGS"
export CXXFLAGS="-target ${platform.target} $CXXFLAGS"
export LDFLAGS="-target ${platform.target} $LDFLAGS"
export CFLAGS="-target ${target} $CFLAGS"
export CCFLAGS="-target ${target} $CCFLAGS"
export CXXFLAGS="-target ${target} $CXXFLAGS"
export LDFLAGS="-target ${target} $LDFLAGS"
${expand(env.vars)}
Expand Down

0 comments on commit 45995ce

Please sign in to comment.