fix(cli): properly handle RUSTFLAGS env var
This commit is contained in:
parent
110f2196a4
commit
d84cbe88bd
1 changed files with 6 additions and 4 deletions
|
@ -211,19 +211,21 @@ export class BuildCommand extends Command {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let rustflags = process.env.RUSTFLAGS ?? ''
|
const rustflags = process.env.RUSTFLAGS
|
||||||
|
? process.env.RUSTFLAGS.split(' ')
|
||||||
|
: []
|
||||||
if (triple.raw.includes('musl')) {
|
if (triple.raw.includes('musl')) {
|
||||||
if (!rustflags.includes('target-feature=-crt-static')) {
|
if (!rustflags.includes('target-feature=-crt-static')) {
|
||||||
rustflags += '-C target-feature=-crt-static'
|
rustflags.push('-C target-feature=-crt-static')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isStrip && !rustflags.includes('-C link-arg=-s')) {
|
if (this.isStrip && !rustflags.includes('-C link-arg=-s')) {
|
||||||
rustflags += '-C link-arg=-s'
|
rustflags.push('-C link-arg=-s')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rustflags.length > 0) {
|
if (rustflags.length > 0) {
|
||||||
additionalEnv['RUSTFLAGS'] = rustflags
|
additionalEnv['RUSTFLAGS'] = rustflags.join(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.useZig) {
|
if (this.useZig) {
|
||||||
|
|
Loading…
Reference in a new issue