Files
nixpkgs/pkgs/development/python-modules/sipsimple/pjsip-0001-NEON.patch
OPNA2608 045b6b3da2 python3Packages.sipsimple: Fix build on aarch64
And apply potential fixes for riscv and loongarch64 as well.
2025-08-12 17:34:02 +02:00

134 lines
4.4 KiB
Diff

From c18466834e4f845dfc9383c6944a72f31a78fafc Mon Sep 17 00:00:00 2001
From: Andrey <loukhnov@lotes-tm.ru>
Date: Thu, 14 Nov 2024 05:51:54 +0300
Subject: [PATCH 1/3] Correct cpu features detection during cross-compiation
(#4151)
---
aconfigure | 48 +++++++++++++++++++++++++++++++++++++++++++++---
aconfigure.ac | 35 ++++++++++++++++++++++++++++++++---
2 files changed, 77 insertions(+), 6 deletions(-)
diff --git a/aconfigure b/aconfigure
index 57716969d..eac120472 100755
--- a/aconfigure
+++ b/aconfigure
@@ -8997,6 +8997,36 @@ $as_echo "Checking if libyuv is disabled...no" >&6; }
fi
+SAVED_CFLAGS="$CFLAGS"
+case $target_cpu in
+ arm*)
+ CFLAGS="-mfpu=neon $CFLAGS"
+ ;;
+ aarch64*)
+ CFLAGS="-march=armv8-a+simd $CFLAGS"
+ ;;
+esac
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ax_cv_support_neon_ext=yes
+else $as_nop
+ ax_cv_support_neon_ext=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+CFLAGS="$SAVED_CFLAGS"
+
@@ -9064,9 +9094,21 @@ $as_echo "Checking if libwebrtc is disabled...no" >&6; }
;;
*win32* | *w32* | *darwin* | *linux*)
case $target in
- armv7l*gnueabihf)
- ac_webrtc_instset=neon
- ac_webrtc_cflags="-DWEBRTC_ARCH_ARMV7 -mfloat-abi=hard -mfpu=neon"
+ arm*gnueabihf)
+ if test "x$ax_cv_support_neon_ext" = "xyes"; then
+ ac_webrtc_instset=neon
+ ac_webrtc_cflags="-DWEBRTC_ARCH_ARMV7 -mfloat-abi=hard -mfpu=neon"
+ else
+ ac_webrtc_instset=generic
+ fi
+ ;;
+ aarch64*)
+ if test "x$ax_cv_support_neon_ext" = "xyes"; then
+ ac_webrtc_instset=neon
+ ac_webrtc_cflags="-DWEBRTC_ARCH_ARM64"
+ else
+ ac_webrtc_instset=generic
+ fi
;;
arm-apple-darwin*)
ac_webrtc_instset=neon
diff --git a/aconfigure.ac b/aconfigure.ac
index 48ff9f18e..fc472c7de 100644
--- a/aconfigure.ac
+++ b/aconfigure.ac
@@ -2057,6 +2057,23 @@ AC_ARG_ENABLE(libyuv,
AC_MSG_RESULT([Checking if libyuv is disabled...no]))
+dnl proper neon detector
+SAVED_CFLAGS="$CFLAGS"
+case $target_cpu in
+ arm*)
+ CFLAGS="-mfpu=neon $CFLAGS"
+ ;;
+ aarch64*)
+ CFLAGS="-march=armv8-a+simd $CFLAGS"
+ ;;
+esac
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM()],
+ [ax_cv_support_neon_ext=yes],
+ [ax_cv_support_neon_ext=no]
+)
+CFLAGS="$SAVED_CFLAGS"
+
dnl # Include webrtc
AC_SUBST(ac_no_webrtc)
AC_SUBST(ac_webrtc_instset)
@@ -2121,9 +2138,21 @@ AC_ARG_ENABLE(libwebrtc,
;;
*win32* | *w32* | *darwin* | *linux*)
case $target in
- armv7l*gnueabihf)
- ac_webrtc_instset=neon
- ac_webrtc_cflags="-DWEBRTC_ARCH_ARMV7 -mfloat-abi=hard -mfpu=neon"
+ arm*gnueabihf)
+ if test "x$ax_cv_support_neon_ext" = "xyes"; then
+ ac_webrtc_instset=neon
+ ac_webrtc_cflags="-DWEBRTC_ARCH_ARMV7 -mfloat-abi=hard -mfpu=neon"
+ else
+ ac_webrtc_instset=generic
+ fi
+ ;;
+ aarch64*)
+ if test "x$ax_cv_support_neon_ext" = "xyes"; then
+ ac_webrtc_instset=neon
+ ac_webrtc_cflags="-DWEBRTC_ARCH_ARM64"
+ else
+ ac_webrtc_instset=generic
+ fi
;;
*)
ac_webrtc_instset=sse2
--
2.50.1