diff mbox

[1/2] package/jack2: Fix build on xtensa

Message ID 20160523223033.0500246d@free-electrons.com
State Not Applicable
Headers show

Commit Message

Thomas Petazzoni May 23, 2016, 8:30 p.m. UTC
Hello,

On Mon, 23 May 2016 18:47:55 +0200, Bernd Kuhls wrote:
> Fixes
> http://autobuild.buildroot.net/results/1ee/1ee48356d8da5e0ebf3e5b61b02fed81704a01dd/
> 
> Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
> ---
>  package/jack2/0003-Add-support-for-xtensa.patch | 34 +++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>  create mode 100644 package/jack2/0003-Add-support-for-xtensa.patch

So we've already added an exclusion for nios2, now xtensa and arc, and
the list was already long.

Isn't it time to find a better solution, like the below patch?

(Took me a while to cook, I had never used this waf thing until now...)

I've tested that it properly detects the absence of NGREG on Xtensa.
However, I have not tested on architectures where it exists, so I hope
I didn't do any typo.

Best regards,

Thomas

From 754205cfccc7b28732c2a952a14d1434b67eb074 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Mon, 23 May 2016 22:28:12 +0200
Subject: [PATCH] Add check for the NGREG macro

The NGREG macro is not available on all CPU architectures. Rather than
making a long list of exclusions longer and longer, add a waf check to
test for its functionality.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 dbus/sigsegv.c | 4 ++--
 wscript        | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Thomas Petazzoni May 26, 2016, 6:43 p.m. UTC | #1
Hello,

On Mon, 23 May 2016 22:30:33 +0200, Thomas Petazzoni wrote:

> I've tested that it properly detects the absence of NGREG on Xtensa.
> However, I have not tested on architectures where it exists, so I hope
> I didn't do any typo.

Bernd, do you think you will have some time to propose a patch based on
something similar to what I suggested, to fix the NGREG jack2 failure?

Thanks!

Thomas
Bernd Kuhls May 26, 2016, 8:33 p.m. UTC | #2
[posted and mailed]

Thomas Petazzoni <thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
@public.gmane.org> wrote in news:20160526204326.2308bcad@free-electrons.com:

> Bernd, do you think you will have some time to propose a patch based on
> something similar to what I suggested, to fix the NGREG jack2 failure?

Hi Thomas,

honestly not this month, sorry; if it is not urgent I will have a look at it 
in the coming weeks. I am not using jack2 myself so my testing capabilities 
are limited to compilation tests.

Regards, Bernd
diff mbox

Patch

diff --git a/dbus/sigsegv.c b/dbus/sigsegv.c
index df2c42c..35c5151 100644
--- a/dbus/sigsegv.c
+++ b/dbus/sigsegv.c
@@ -106,7 +106,7 @@  static void signal_segv(int signum, siginfo_t* info, void*ptr) {
     jack_error("info.si_errno = %d", info->si_errno);
     jack_error("info.si_code  = %d (%s)", info->si_code, si_code_str);
     jack_error("info.si_addr  = %p", info->si_addr);
-#if !defined(__alpha__) && !defined(__ia64__) && !defined(__FreeBSD_kernel__) && !defined(__arm__) && !defined(__hppa__) && !defined(__sh__) && !defined(__aarch64__)
+#if HAVE_NGREG
     for(i = 0; i < NGREG; i++)
         jack_error("reg[%02d]       = 0x" REGFORMAT, i, 
 #if defined(__powerpc64__)
@@ -119,7 +119,7 @@  static void signal_segv(int signum, siginfo_t* info, void*ptr) {
                 ucontext->uc_mcontext.gregs[i]
 #endif
                 );
-#endif /* alpha, ia64, kFreeBSD, arm, hppa */
+#endif /* NGREG */
 
 #if defined(SIGSEGV_STACK_X86) || defined(SIGSEGV_STACK_IA64)
 # if defined(SIGSEGV_STACK_IA64)
diff --git a/wscript b/wscript
index 63ba3aa..a0838b0 100644
--- a/wscript
+++ b/wscript
@@ -168,6 +168,8 @@  def configure(conf):
 
     conf.check_cc(header_name='execinfo.h', define_name="HAVE_EXECINFO_H", mandatory=False)
     conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
+    conf.check_cc(fragment="#include <ucontext.h>\nint main() { return NGREG; }\n",
+                  define_name="HAVE_NGREG", mandatory=False)
 
     if conf.is_defined('HAVE_SAMPLERATE'):
         conf.env['LIB_SAMPLERATE'] = ['samplerate']