Skip to contentSkip to conversation

support Android target in all build system

PATCH In review Hsia-Jun Li 2 participants 6 messages Dec 16, 2021 – Dec 17, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover support Android target in all build system

From: "Hsia-Jun(Randy) Li" <[email protected]>

Both meson and cmake would work fine, left those GNU autotools, customer script projects.

The behaviour of meson would become that as the following for the Android target:
lib/libfoo.so is the real binary library lib/libfoo.so.x -> libfoo.so
lib/libfoo.so.x.y -> libfoo.so

But when you tell the autotools the target host is android, it won't make any difference in its output library. I would like to fix that but I am not good at m4 script.

Hsia-Jun(Randy) Li (3):
cmake.bbclass: support android os
classes/meson: support Android os
[WIP]: openssl: fix Android target

 meta/classes/cmake.bbclass                         | 2 ++
 meta/classes/meson-routines.bbclass                | 2 ++
 meta/recipes-connectivity/openssl/openssl_3.0.0.bb | 4 ++++
 3 files changed, 8 insertions(+)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 cmake.bbclass: support android os

From: "Hsia-Jun(Randy) Li" <[email protected]>

---
 meta/classes/cmake.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/cmake.bbclass +2 -0
index 92b9197c48..40ae4fba08 100644
@@ -69,6 +69,8 @@ OECMAKE_TARGET_COMPILE ?= "all"
 OECMAKE_TARGET_INSTALL ?= "install"
 
 def map_host_os_to_system_name(host_os):
+    if host_os.startswith('android'):
+        return 'Android'
     if host_os.startswith('mingw'):
         return 'Windows'
     if host_os.startswith('linux'):
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/3 classes/meson: support Android os

In reply to Hsia-Jun Li

From: "Hsia-Jun(Randy) Li" <[email protected]>

---
 meta/classes/meson-routines.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/meson-routines.bbclass +2 -0
index be3aeedeba..f9a06a16d8 100644
@@ -32,6 +32,8 @@ def meson_cpu_family(var, d):
 # https://mesonbuild.com/Reference-tables.html#operating-system-names
 def meson_operating_system(var, d):
     os = d.getVar(var)
+    if "android" in os:
+        return "android"
     if "mingw" in os:
         return "windows"
     # avoid e.g 'linux-gnueabi'
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/3 : openssl: fix Android target

In reply to Hsia-Jun Li

From: "Hsia-Jun(Randy) Li" <[email protected]>

It is fair to regard Android as Linux target, we repack the sysroot, so we don't need to bother those helper from openssl.

---
 meta/recipes-connectivity/openssl/openssl_3.0.0.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-connectivity/openssl/openssl_3.0.0.bb +4 -0
index da73ed6bc3..c2e07fcb0a 100644
@@ -58,6 +58,10 @@ DEPRECATED_CRYPTO_FLAGS ?= ""
 do_configure () {
 	os=${HOST_OS}
 	case $os in
+    linux-androideabi | \
+    linux-android )
+		os=linux
+		;;
 	linux-gnueabi |\
 	linux-gnuspe |\
 	linux-musleabi |\
Signature · 1 line
2.17.1
#4 lore raw
In reply to Hsia-Jun Li
Quoted 11 lines · Hsia-Jun Li

From: "Hsia-Jun(Randy) Li" <[email protected]>

Both meson and cmake would work fine, left those GNU autotools, customer script projects.

The behaviour of meson would become that as the following for the Android target:
lib/libfoo.so is the real binary library lib/libfoo.so.x -> libfoo.so
lib/libfoo.so.x.y -> libfoo.so

Quoted 8 lines

But when you tell the autotools the target host is android, it won't make any difference in its output library. I would like to fix that but I am not good at m4 script.

Hsia-Jun(Randy) Li (3):
cmake.bbclass: support android os
classes/meson: support Android os
[WIP]: openssl: fix Android target

The first couple of patches look ok but I'd like to understand whether there is real world usable output from the build after applying them? If not, I think we should probably wait until we can see the bigger picture of what other changes would be needed to make this work rather than making tweaks piecemeal.

Can you describe what level of functionality these patches give to a build?

Cheers,

Richard

#5 lore raw
Quoted 19 lines · Richard Purdie

CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 15 lines · Hsia-Jun Li

From: "Hsia-Jun(Randy) Li" <[email protected]>

Both meson and cmake would work fine, left those GNU autotools, customer script projects.

The behaviour of meson would become that as the following for the Android target:
lib/libfoo.so is the real binary library lib/libfoo.so.x -> libfoo.so
lib/libfoo.so.x.y -> libfoo.so

But when you tell the autotools the target host is android, it won't make any difference in its output library. I would like to fix that but I am not good at m4 script.

Quoted 7 lines
Quoted 4 lines

Hsia-Jun(Randy) Li (3):
cmake.bbclass: support android os
classes/meson: support Android os
[WIP]: openssl: fix Android target

The first couple of patches look ok but I'd like to understand whether there is real world usable output from the build after applying them? If not, I think we

https://github.com/hizukiayaka/meta-android-ndk
https://github.com/hizukiayaka/meta-android-ndk/blob/master/recipes-core/proxy-libintl/proxy-libintl_git.bb
Which provides the 'virtual/libintl' in Android, that would need meson.

Quoted 2 lines

should probably wait until we can see the bigger picture of what other changes would be needed to make this work rather than making tweaks piecemeal.

The target is building a Gstreamer(media service) for Android VNDK(in /vendor partition).
Now, I still fight with glib-2.0 and python3, the dependency of python3 need to be patched, some of them as I said they are using autotools, it would still product library links likes

ERROR: ncurses-6.3-r0 do_package: QA Issue: ncurses: Files/directories were installed but not shipped in any package:
/usr/lib/libtic.so
/usr/lib/libcurses.so
/usr/lib/libpanel.so
/usr/lib/libmenu.so
/usr/lib/libform.so
/usr/lib/libticw.so
/usr/lib/libpanelw.so
/usr/lib/libmenuw.so
/usr/lib/libformw.so
/usr/lib/libncurses.so
/usr/lib/libncursesw.so
/usr/lib/libtermcap.so
/usr/lib/libtinfo.so

Quoted 2 lines

Can you describe what level of functionality these patches give to a build?

At lease we could have a few simple applications that would work in Android, likes the unit test from libpng.

Quoted 5 lines

Cheers,

Richard

Signature · 1 line
Hsia-Jun(Randy) Li