Merge changes Iac0f4ca9,I4a56efb2
* changes: Support BUILD_HOST_static=1 for musl and linux_bionic builds Support building python pars against static or shared musl libc
This commit is contained in:
commit
ce73506a85
2 changed files with 17 additions and 10 deletions
20
cc/binary.go
20
cc/binary.go
|
@ -220,18 +220,18 @@ func newBinary(hod android.HostOrDeviceSupported, bazelable bool) (*Module, *bin
|
|||
func (binary *binaryDecorator) linkerInit(ctx BaseModuleContext) {
|
||||
binary.baseLinker.linkerInit(ctx)
|
||||
|
||||
if !ctx.toolchain().Bionic() && !ctx.toolchain().Musl() {
|
||||
if ctx.Os() == android.Linux {
|
||||
// Unless explicitly specified otherwise, host static binaries are built with -static
|
||||
// if HostStaticBinaries is true for the product configuration.
|
||||
if binary.Properties.Static_executable == nil && ctx.Config().HostStaticBinaries() {
|
||||
binary.Properties.Static_executable = BoolPtr(true)
|
||||
}
|
||||
} else {
|
||||
// Static executables are not supported on Darwin or Windows
|
||||
binary.Properties.Static_executable = nil
|
||||
if ctx.Os().Linux() && ctx.Host() {
|
||||
// Unless explicitly specified otherwise, host static binaries are built with -static
|
||||
// if HostStaticBinaries is true for the product configuration.
|
||||
if binary.Properties.Static_executable == nil && ctx.Config().HostStaticBinaries() {
|
||||
binary.Properties.Static_executable = BoolPtr(true)
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.Darwin() || ctx.Windows() {
|
||||
// Static executables are not supported on Darwin or Windows
|
||||
binary.Properties.Static_executable = nil
|
||||
}
|
||||
}
|
||||
|
||||
func (binary *binaryDecorator) static() bool {
|
||||
|
|
|
@ -423,6 +423,9 @@ func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
if ctx.Target().Os.Bionic() {
|
||||
launcherSharedLibDeps = append(launcherSharedLibDeps, "libc", "libdl", "libm")
|
||||
}
|
||||
if ctx.Target().Os == android.LinuxMusl && !ctx.Config().HostStaticBinaries() {
|
||||
launcherSharedLibDeps = append(launcherSharedLibDeps, "libc_musl")
|
||||
}
|
||||
|
||||
switch p.properties.Actual_version {
|
||||
case pyVersion2:
|
||||
|
@ -432,6 +435,7 @@ func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
if p.bootstrapper.autorun() {
|
||||
launcherModule = "py2-launcher-autorun"
|
||||
}
|
||||
|
||||
launcherSharedLibDeps = append(launcherSharedLibDeps, "libc++")
|
||||
|
||||
case pyVersion3:
|
||||
|
@ -441,6 +445,9 @@ func (p *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||
if p.bootstrapper.autorun() {
|
||||
launcherModule = "py3-launcher-autorun"
|
||||
}
|
||||
if ctx.Config().HostStaticBinaries() && ctx.Target().Os == android.LinuxMusl {
|
||||
launcherModule += "-static"
|
||||
}
|
||||
|
||||
if ctx.Device() {
|
||||
launcherSharedLibDeps = append(launcherSharedLibDeps, "liblog")
|
||||
|
|
Loading…
Reference in a new issue