Skip to content

Commit

Permalink
add rpath flag if not using cc shims
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Nov 15, 2023
1 parent 6f3f56e commit 7217dac
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libexec/stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const pkg = await pantry.resolve(parse(pkgname))
const pantry_sh = await pantry.getScript(pkg, 'build', deps)
const sup_PATH = [new Path(new URL(import.meta.url).pathname).parent().parent().join("share/brewkit")]

if (!deps.find(({pkg}) => pkg.project == 'llvm.org' || pkg.project == 'gnu.org/gcc')) {
const use_cc_shims = !deps.find(({pkg}) => pkg.project == 'llvm.org' || pkg.project == 'gnu.org/gcc')

if (use_cc_shims) {
/// add our helper cc toolchain unless the package has picked its own toolchain
sup_PATH.push(new Path(new URL(import.meta.url).pathname).parent().parent().join("share/toolchain/bin"))

Expand Down Expand Up @@ -110,6 +112,10 @@ if (host().platform == 'linux' && host().arch == 'x86-64') {
env['CFLAGS'] = [`${env['CFLAGS']?.[0] ?? ''} -fPIC`.trim()]
env['CXXFLAGS'] = [`${env['CXXFLAGS']?.[0] ?? ''} -fPIC`.trim()]
}
if (host().platform == 'darwin' && !use_cc_shims) {
// our shims inject this but if we aren’t using them we need to add it manually or everything breaks
env['LDFLAGS'] = [`${env['LDFLAGS']?.[0] ?? ''} -Wl,-rpath,${useConfig().prefix}`.trim()]
}

const text = undent`
#!/usr/bin/env -S pkgx bash
Expand Down

0 comments on commit 7217dac

Please sign in to comment.