Re: [PATCH] libpng: Added "--enable-hardware-optimizations" instead of "--enable-arm-neon". Because "--enable-arm-neon" only works for armv7, but doesn't work for aarch64. But in fact neon is also enabled for aarch64 by default.

Andre McCurdy

On Mon, Dec 12, 2022 at 6:38 PM leimaohui <leimaohui@...> wrote:

Reference to libpng-1.6.38/configure,if enable_hardware_optimizations is
enabled, libpng can judge whether enable enable_arm_neon according
to $host_cpu.
$ cat libpng-1.6.38/configure
if test ${enable_hardware_optimizations+y}
then :
# allow enabling hardware optimization on any system:
case "$host_cpu" in

printf "%s\n" "#define PNG_ARM_NEON_OPT 2" >>confdefs.h

Signed-off-by: Lei Maohui <leimaohui@...>
meta/recipes-multimedia/libpng/ | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-multimedia/libpng/ b/meta/recipes-multimedia/libpng/
index dc627203ef..7da71d9d3b 100644
--- a/meta/recipes-multimedia/libpng/
+++ b/meta/recipes-multimedia/libpng/
@@ -22,7 +22,7 @@ BINCONFIG = "${bindir}/libpng-config ${bindir}/libpng16-config"
inherit autotools binconfig-disabled pkgconfig

# Work around missing symbols
-EXTRA_OECONF:append:class-target = " ${@bb.utils.contains("TUNE_FEATURES", "neon", "--enable-arm-neon=on", "--enable-arm-neon=off", d)}"
+EXTRA_OECONF:append:class-target = " --enable-hardware-optimizations=on "
It's difficult (impossible?) to automatically detect whether an ARM
target supports NEON at build time, so this looks unlikely to work.
Testing for NEON either needs to happen at run time or the information
needs to be passed from the build system as an explicit configure
option (ie the original approach here).

If you don't want to pass NEON options to 64bit ARM targets then add
an over-ride which only applies to 32bit ARM targets.

Or in this case, if the configure script is wrong to try to enable
NEON for 64bit ARM targets, patch the configure script and submit the
patch upstream.

PACKAGES =+ "${PN}-tools"


Join { to automatically receive all group messages.