[jack-audio-connection-kit] - no Firewire on s390(x) - fix building on other arches than x86 and ppc

Dan Horák sharkcz at fedoraproject.org
Wed Sep 1 08:12:00 UTC 2010


commit a040891a59bb20ec6796b8ae654a7778f60c5151
Author: Dan Horák <dan at danny.cz>
Date:   Wed Sep 1 10:11:58 2010 +0200

    - no Firewire on s390(x)
    - fix building on other arches than x86 and ppc

 jack-audio-connection-kit-1.9.5-64bit.patch  |  273 ++++++++++++++++++++++++++
 jack-audio-connection-kit-1.9.5-atomic.patch |   61 ++++++
 jack-audio-connection-kit-1.9.5-cycles.patch |   55 +++++
 jack-audio-connection-kit.spec               |   18 ++-
 4 files changed, 406 insertions(+), 1 deletions(-)
---
diff --git a/jack-audio-connection-kit-1.9.5-64bit.patch b/jack-audio-connection-kit-1.9.5-64bit.patch
new file mode 100644
index 0000000..6ba57dd
--- /dev/null
+++ b/jack-audio-connection-kit-1.9.5-64bit.patch
@@ -0,0 +1,273 @@
+diff -up jack-1.9.5/common/JackAPI.cpp.s390x jack-1.9.5/common/JackAPI.cpp
+--- jack-1.9.5/common/JackAPI.cpp.s390x	2010-08-28 15:34:33.000000000 +0200
++++ jack-1.9.5/common/JackAPI.cpp	2010-08-28 15:35:59.000000000 +0200
+@@ -317,7 +317,7 @@ EXPORT void* jack_port_get_buffer(jack_p
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_get_buffer");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -337,7 +337,7 @@ EXPORT const char* jack_port_name(const 
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_name");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -357,7 +357,7 @@ EXPORT const char* jack_port_short_name(
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_short_name");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -377,7 +377,7 @@ EXPORT int jack_port_flags(const jack_po
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_flags");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -397,7 +397,7 @@ EXPORT const char* jack_port_type(const 
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_type");
+ #endif
+- #if defined(__x86_64__) || defined(__ppc64__)
++ #if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -417,7 +417,7 @@ EXPORT jack_port_type_id_t jack_port_typ
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_type_id");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -437,7 +437,7 @@ EXPORT int jack_port_connected(const jac
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_connected");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -458,7 +458,7 @@ EXPORT int jack_port_connected_to(const 
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_connected_to");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -488,7 +488,7 @@ EXPORT int jack_port_tie(jack_port_t* sr
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_tie");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t src_aux = (uint64_t)src;
+ #else
+     uint32_t src_aux = (uint32_t)src;
+@@ -498,7 +498,7 @@ EXPORT int jack_port_tie(jack_port_t* sr
+         jack_error("jack_port_tie called with a NULL src port");
+         return -1;
+     }
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t dst_aux = (uint64_t)dst;
+ #else
+     uint32_t dst_aux = (uint32_t)dst;
+@@ -522,7 +522,7 @@ EXPORT int jack_port_untie(jack_port_t* 
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_untie");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -542,7 +542,7 @@ EXPORT jack_nframes_t jack_port_get_late
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_get_latency");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -563,7 +563,7 @@ EXPORT void jack_port_set_latency(jack_p
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_set_latency");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -585,7 +585,7 @@ EXPORT int jack_recompute_total_latency(
+ #endif
+ 
+     JackClient* client = (JackClient*)ext_client;
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -630,7 +630,7 @@ EXPORT int jack_port_set_name(jack_port_
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_set_name");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -660,7 +660,7 @@ EXPORT int jack_port_set_alias(jack_port
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_set_alias");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -683,7 +683,7 @@ EXPORT int jack_port_unset_alias(jack_po
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_unset_alias");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -706,7 +706,7 @@ EXPORT int jack_port_get_aliases(const j
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_get_aliases");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -726,7 +726,7 @@ EXPORT int jack_port_request_monitor(jac
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_request_monitor");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -769,7 +769,7 @@ EXPORT int jack_port_ensure_monitor(jack
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_ensure_monitor");
+ #endif
+- #if defined(__x86_64__) || defined(__ppc64__)
++ #if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -789,7 +789,7 @@ EXPORT int jack_port_monitoring_input(ja
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_monitoring_input");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -1128,7 +1128,7 @@ EXPORT jack_port_t* jack_port_register(j
+         jack_error("jack_port_register called with a NULL port name or a NULL port_type");
+         return NULL;
+     } else {
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+         return (jack_port_t *)((uint64_t)client->PortRegister(port_name, port_type, flags, buffer_size));
+ #else
+         return (jack_port_t *)client->PortRegister(port_name, port_type, flags, buffer_size);
+@@ -1146,7 +1146,7 @@ EXPORT int jack_port_unregister(jack_cli
+         jack_error("jack_port_unregister called with a NULL client");
+         return -1;
+     }
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -1169,7 +1169,7 @@ EXPORT int jack_port_is_mine(const jack_
+         jack_error("jack_port_is_mine called with a NULL client");
+         return -1;
+     }
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -1187,7 +1187,7 @@ EXPORT const char** jack_port_get_connec
+ #ifdef __CLIENTDEBUG__
+     JackGlobals::CheckContext("jack_port_get_connections");
+ #endif
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -1215,7 +1215,7 @@ EXPORT const char** jack_port_get_all_co
+         return NULL;
+     }
+ 
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -1242,7 +1242,7 @@ EXPORT jack_nframes_t jack_port_get_tota
+         return 0;
+     }
+ 
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)port;
+ #else
+     uint32_t port_aux = (uint32_t)port;
+@@ -1307,7 +1307,7 @@ EXPORT int jack_port_disconnect(jack_cli
+         jack_error("jack_port_disconnect called with a NULL client");
+         return -1;
+     }
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     uint64_t port_aux = (uint64_t)src;
+ #else
+     uint32_t port_aux = (uint32_t)src;
+@@ -1383,7 +1383,7 @@ EXPORT jack_port_t* jack_port_by_name(ja
+         if (!manager)
+             return NULL;
+         int res = manager->GetPort(portname); // returns a port index at least > 1
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+         return (res == NO_PORT) ? NULL : (jack_port_t*)((uint64_t)res);
+ #else
+         return (res == NO_PORT) ? NULL : (jack_port_t*)res;
+@@ -1397,7 +1397,7 @@ EXPORT jack_port_t* jack_port_by_id(jack
+     JackGlobals::CheckContext("jack_port_by_id");
+ #endif
+     /* jack_port_t* type is actually the port index */
+-#if defined(__x86_64__) || defined(__ppc64__)
++#if defined(__x86_64__) || defined(__ppc64__) || defined (__s390x__)
+     return (jack_port_t*)((uint64_t)id);
+ #else
+     return (jack_port_t*)id;
diff --git a/jack-audio-connection-kit-1.9.5-atomic.patch b/jack-audio-connection-kit-1.9.5-atomic.patch
new file mode 100644
index 0000000..33a00ee
--- /dev/null
+++ b/jack-audio-connection-kit-1.9.5-atomic.patch
@@ -0,0 +1,61 @@
+diff -up jack-1.9.5/linux/JackAtomic_os.h.atomic jack-1.9.5/linux/JackAtomic_os.h
+--- jack-1.9.5/linux/JackAtomic_os.h.atomic	2010-08-28 15:23:58.000000000 +0200
++++ jack-1.9.5/linux/JackAtomic_os.h	2010-09-01 09:29:03.000000000 +0200
+@@ -22,23 +22,23 @@ Foundation, Inc., 59 Temple Place - Suit
+ 
+ #include "JackTypes.h"
+ 
+-#ifdef __PPC__
++#if defined(__PPC__)
+ 
+ static inline int CAS(register UInt32 value, register UInt32 newvalue, register volatile void* addr)
+ {
+     register int result;
+     register UInt32 tmp;
+     asm volatile (
+-        "# CAS					\n"
+-        "	lwarx	%4, 0, %1	\n"         // creates a reservation on addr
+-        "	cmpw	%4, %2		\n"        //  test value at addr
+-        "	bne-	1f          \n"
+-        "	sync            	\n"         //  synchronize instructions
+-        "	stwcx.	%3, 0, %1	\n"         //  if the reservation is not altered
++        "# CAS                                  \n"
++        "       lwarx   %4, 0, %1       \n"         // creates a reservation on addr
++        "       cmpw    %4, %2          \n"        //  test value at addr
++        "       bne-    1f          \n"
++        "       sync                    \n"         //  synchronize instructions
++        "       stwcx.  %3, 0, %1       \n"         //  if the reservation is not altered
+         //  stores the new value at addr
+-        "	bne-	1f          \n"
++        "       bne-    1f          \n"
+         "   li      %0, 1       \n"
+-        "	b		2f          \n"
++        "       b               2f          \n"
+         "1:                     \n"
+         "   li      %0, 0       \n"
+         "2:                     \n"
+@@ -48,9 +48,7 @@ static inline int CAS(register UInt32 va
+     return result;
+ }
+ 
+-#endif
+-
+-#if defined(__i386__) || defined(__x86_64__)
++#elif defined(__i386__) || defined(__x86_64__)
+ 
+ #define LOCK "lock ; "
+ 
+@@ -67,6 +65,13 @@ static inline char CAS(volatile UInt32 v
+     return ret;
+ }
+ 
++#else
++
++static inline int CAS(register UInt32 value, register UInt32 newvalue, register volatile void* addr)
++{
++    return __sync_val_compare_and_swap((UInt32 *)addr, value, newvalue);
++}
++
+ #endif
+ 
+ #endif
diff --git a/jack-audio-connection-kit-1.9.5-cycles.patch b/jack-audio-connection-kit-1.9.5-cycles.patch
new file mode 100644
index 0000000..a9d0d95
--- /dev/null
+++ b/jack-audio-connection-kit-1.9.5-cycles.patch
@@ -0,0 +1,55 @@
+diff -up jack-1.9.5/linux/cycles.h.cycles jack-1.9.5/linux/cycles.h
+--- jack-1.9.5/linux/cycles.h.cycles	2010-08-28 16:03:40.000000000 +0200
++++ jack-1.9.5/linux/cycles.h	2010-08-28 16:05:47.000000000 +0200
+@@ -39,7 +39,7 @@
+ 
+ #ifdef __linux__
+ 
+-#ifdef __x86_64__
++#if defined(__x86_64__)
+ 
+ typedef unsigned long cycles_t;
+ extern cycles_t cacheflush_time;
+@@ -51,9 +51,7 @@ static inline unsigned long get_cycles(v
+     return (((unsigned long)hi)<<32) | ((unsigned long)lo);
+ }
+ 
+-#endif
+-
+-#ifdef __PPC__
++#elif defined(__PPC__)
+ 
+ /* PowerPC */
+ 
+@@ -82,9 +80,7 @@ static inline cycles_t get_cycles(void)
+     return ret;
+ }
+ 
+-#endif
+-
+-#ifdef __i386__
++#elif defined(__i386__)
+ 
+ typedef unsigned long long cycles_t;
+ 
+@@ -101,8 +97,19 @@ static inline cycles_t get_cycles (void)
+     return ret;
+ }
+ 
+-#endif
++#else
++
++/* fallback solution */
++typedef unsigned long cycles_t;
++
++static inline cycles_t get_cycles (void)
++{
++    return 0;
++}
++
+ 
+ #endif
+ 
++#endif /* __linux__ */
++
+ #endif /* __jack_cycles_h__ */
diff --git a/jack-audio-connection-kit.spec b/jack-audio-connection-kit.spec
index 1ffc83b..31c633a 100644
--- a/jack-audio-connection-kit.spec
+++ b/jack-audio-connection-kit.spec
@@ -4,7 +4,7 @@
 Summary:       The Jack Audio Connection Kit
 Name:          jack-audio-connection-kit
 Version:       1.9.5
-Release:       1%{?dist}
+Release:       2%{?dist}
 # The entire source (~500 files) is a mixture of these three licenses
 License:       GPLv2 and GPLv2+ and LGPLv2+
 Group:         System Environment/Daemons
@@ -26,6 +26,13 @@ Patch3:        jack-manpages.patch
 Patch4:        jack-realtime-compat.patch
 # Compile against celt-0.8.0
 Patch5:        jack-celt08.patch
+# Use GCC atomic operation for other arches
+Patch6:        %{name}-1.9.5-atomic.patch
+# Treat s390x as 64-bit arch
+Patch7:        %{name}-1.9.5-64bit.patch
+# Add fallback get_cycles() solution
+Patch8:        %{name}-1.9.5-cycles.patch
+
 
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: alsa-lib-devel
@@ -33,8 +40,10 @@ BuildRequires: dbus-devel
 BuildRequires: celt-devel
 BuildRequires: doxygen
 BuildRequires: expat-devel
+%ifnarch s390 s390x
 BuildRequires: libffado-devel
 BuildRequires: libfreebob-devel
+%endif
 BuildRequires: libsamplerate-devel
 BuildRequires: libsndfile-devel
 BuildRequires: ncurses-devel
@@ -85,6 +94,9 @@ Small example clients that use the Jack Audio Connection Kit.
 %if 0%{?fedora} > 13
 %patch5 -p1 -b .celt08
 %endif
+%patch6 -p1 -b .atomic
+%patch7 -p1 -b .64bit
+%patch8 -p1 -b .cycles
 
 # Fix encoding issues
 for file in ChangeLog README TODO; do
@@ -214,6 +226,10 @@ exit 0
 
 
 %changelog
+* Thu Aug 26 2010 Dan Horák <dan[at]danny.cz> - 1.9.5-2
+- no Firewire on s390(x)
+- fix building on other arches than x86 and ppc
+
 * Mon Jul 19 2010 Orcan Ogetbil <oget[dot]fedora[at]gmail[dot]com> - 1.9.5-1
 - Jack 2!
 


More information about the scm-commits mailing list