Tweak linux_glibc properties for musl builds in external/python/cpython3
For convenience, builds against musl libc currently use the
linux_glibc properties because they are almost always linux-specific
and not glibc-specific. In preparation for removing this hack,
tweak the linux_glibc properties by either moving them to host_linux,
which will apply to linux_glibc, linux_musl and linux_bionic, or
by setting appropriate musl or linux_musl properties. Properties
that must not be repeated while musl uses linux_musl and also still
uses the linux_glibc properties are moved to glibc properties, which
don't apply to musl. Whether these stay as glibc properties or get
moved back to linux_glibc later once the musl hack is removed is TBD.
Bug: 223257095
Test: m checkbuild
Test: m USE_HOST_MUSL=true host-native
Change-Id: If44954d3b047be6784e4782457fd0ea695f79484
diff --git a/Android.bp b/Android.bp
index db5d4c2..d58fe9a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -71,7 +71,7 @@
properties: ["defaults"],
}
-// By default, disable the source and use the prebuilts for host linux_glibc
+// By default, disable the source and use the prebuilts for host linux
// and darwin. Overridden by cpython3-interp-force_build_host when
// force_build_host is true (set on aosp-build-tools).
cc_defaults {
@@ -81,6 +81,9 @@
linux_glibc: {
enabled: false,
},
+ linux_musl: {
+ enabled: false,
+ },
darwin: {
enabled: false,
},
@@ -94,6 +97,9 @@
linux_glibc: {
enabled: true,
},
+ linux_musl: {
+ enabled: true,
+ },
darwin: {
enabled: true,
},
@@ -167,10 +173,17 @@
linux_glibc_x86: {
enabled: false,
},
+ linux_musl_x86: {
+ enabled: false,
+ },
linux_glibc_x86_64: {
local_include_dirs: ["android/linux_x86_64/pyconfig"],
cflags: ["-DSOABI=\"cpython-39android-x86_64-linux-gnu\""],
},
+ linux_musl_x86_64: {
+ local_include_dirs: ["android/linux_x86_64/pyconfig"],
+ cflags: ["-DSOABI=\"cpython-39android-x86_64-linux-gnu\""],
+ },
windows: {
enabled: false,
},
@@ -358,10 +371,6 @@
target: {
linux_glibc_x86_64: {
host_ldlibs: ["-lutil"],
- static_libs: [
- "libopenssl_ssl",
- "libopenssl_crypto",
- ],
},
linux: {
// Due to test infra limitations, Python native symbols are linked
@@ -375,15 +384,20 @@
"-framework SystemConfiguration",
"-framework CoreFoundation",
],
- static_libs: [
- "libopenssl_ssl",
- "libopenssl_crypto",
- ],
},
host: {
static_libs: [
"libsqlite",
"liblog",
+ "libopenssl_ssl",
+ "libopenssl_crypto",
+ ],
+ },
+ linux_bionic: {
+ // Linux Bionic doesn't have openssl prebuilts
+ exclude_static_libs: [
+ "libopenssl_ssl",
+ "libopenssl_crypto",
],
},
android: {
@@ -425,6 +439,9 @@
linux_glibc_x86_64: {
srcs: ["android/linux_x86_64/config.c"],
},
+ linux_musl_x86_64: {
+ srcs: ["android/linux_x86_64/config.c"],
+ },
darwin: {
srcs: ["android/darwin_x86_64/config.c"],
},
@@ -483,6 +500,13 @@
"libopenssl_crypto",
],
},
+ linux_musl_x86_64: {
+ srcs: [":py3-c-modules-linux_x86_64"],
+ static_libs: [
+ "libopenssl_ssl",
+ "libopenssl_crypto",
+ ],
+ },
darwin: {
srcs: [":py3-c-modules-darwin_x86_64"],
static_libs: [