Source: supercollider
Severity: normal
Tags: patch
User: debian-powe...@lists.debian.org
Usertags: ppc64el

Dear Maintainer,

The package fails to build from source on ppc64el because the usage of altivec 
is not implemented for the architecture.
So, the workaround was to disable it for ppc64el.

While at it, Konstantinos also went ahead and fixed it for ppc32. He tested it 
and it builds.

So there are 2 patches attached:
 - ppc64el.debdiff which contains the disabling of altivec/vsx usage for ppc64el
 - altivec-powerpc.debdiff which contains Konstantinos' modifications.

Thanks.
Fernando


-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: ppc64el (ppc64le)

Kernel: Linux 3.16-trunk-powerpc64le (SMP w/32 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
diff -Nru supercollider-3.6.6~repack-2/debian/changelog supercollider-3.6.6~repack-2/debian/changelog
--- supercollider-3.6.6~repack-2/debian/changelog	2014-10-04 16:33:25.000000000 +0000
+++ supercollider-3.6.6~repack-2/debian/changelog	2014-10-24 12:23:30.000000000 +0000
@@ -1,3 +1,9 @@
+supercollider (1:3.6.6~repack-2-1ppc64el1) UNRELEASED; urgency=medium
+
+  * debian/rules: disabled altivec/vsx for ppc64el since the package does not support the usage for now 
+
+ -- Fernando Seiti Furusato <ferse...@br.ibm.com>  Fri, 24 Oct 2014 12:22:54 +0000
+
 supercollider (1:3.6.6~repack-2-1) unstable; urgency=low
 
   [ Dan Stowell ]
diff -Nru supercollider-3.6.6~repack-2/debian/rules supercollider-3.6.6~repack-2/debian/rules
--- supercollider-3.6.6~repack-2/debian/rules	2014-10-04 16:33:25.000000000 +0000
+++ supercollider-3.6.6~repack-2/debian/rules	2014-10-24 12:22:48.000000000 +0000
@@ -32,6 +32,11 @@
 	endif
 endif
 
+ifeq ("$(DEB_HOST_ARCH_CPU)","ppc64el")
+	CFLAGS=-mno-altivec -mno-vsx
+	CXXFLAGS=-mno-altivec -mno-vsx
+endif
+
 DEB_CMAKE_EXTRA_FLAGS = \
 	-DDSO_VISIBILITY=on \
 	-DSC_EL_BYTECOMPILE=off \
diff -Nru supercollider-3.6.6~repack-2/debian/changelog supercollider-3.6.6~repack-2/debian/changelog
--- supercollider-3.6.6~repack-2/debian/changelog	2014-10-04 16:33:25.000000000 +0000
+++ supercollider-3.6.6~repack-2/debian/changelog	2014-10-24 13:25:11.000000000 +0000
@@ -1,3 +1,10 @@
+supercollider (1:3.6.6~repack-2-1ppc64el1) UNRELEASED; urgency=medium
+
+  * debian/patches/altivec-powerpc.patch by Konstantinos Margaritis to enable altivec usage on powerpc. 
+  * debian/rules: enable supernova and altivec for powerpc
+
+ -- Fernando Seiti Furusato <ferse...@br.ibm.com>  Fri, 24 Oct 2014 13:19:58 +0000
+
 supercollider (1:3.6.6~repack-2-1) unstable; urgency=low
 
   [ Dan Stowell ]
diff -Nru supercollider-3.6.6~repack-2/debian/patches/altivec-powerpc.patch supercollider-3.6.6~repack-2/debian/patches/altivec-powerpc.patch
--- supercollider-3.6.6~repack-2/debian/patches/altivec-powerpc.patch	1970-01-01 00:00:00.000000000 +0000
+++ supercollider-3.6.6~repack-2/debian/patches/altivec-powerpc.patch	2014-10-24 13:21:51.000000000 +0000
@@ -0,0 +1,160 @@
+Description: This patch, by Konstantinos Margaritis, enables altivec usage on powerpc. 
+Author: Konstantinos Margaritis <mar...@freevec.org>
+
+--- supercollider-3.6.6~repack-2.orig/external_libraries/nova-simd/vec_altivec.hpp
++++ supercollider-3.6.6~repack-2/external_libraries/nova-simd/vec_altivec.hpp
+@@ -22,6 +22,8 @@
+ 
+ #include <altivec.h>
+ #undef bool
++#undef pixel
++#undef vector
+ 
+ #include "detail/vec_math.hpp"
+ #include "vec_int_altivec.hpp"
+@@ -39,13 +41,13 @@ namespace nova
+ 
+ template <>
+ struct vec<float>:
+-    vec_base<float, vector float, 4>
++    vec_base<float, __vector float, 4>
+ {
+-    typedef vector float internal_vector_type;
++    typedef __vector float internal_vector_type;
+     typedef float float_type;
+ 
+ private:
+-    typedef vec_base<float, vector float, 4> base;
++    typedef vec_base<float, __vector float, 4> base;
+ 
+     static internal_vector_type set_vector(float f0, float f1, float f2, float f3)
+     {
+@@ -231,7 +233,7 @@ private:
+         // adapted from http://developer.apple.com/hardwaredrivers/ve/algorithms.html
+ 
+         // Get the reciprocal estimate
+-        vector float estimate = vec_re(arg);
++        __vector float estimate = vec_re(arg);
+ 
+         // One round of Newton-Raphson refinement
+         return vec_madd(vec_nmsub(estimate, arg, gen_one()), estimate, estimate);
+@@ -284,7 +286,7 @@ public:
+ 
+     friend vec fast_reciprocal(const vec & arg)
+     {
+-        vector float estimate = vec_re(arg);
++        __vector float estimate = vec_re(arg.data_);
+         return estimate;
+     }
+ 
+@@ -316,8 +318,8 @@ public:
+     vec operator op(vec const & rhs) const \
+     { \
+         const internal_vector_type one = gen_one(); \
+-        vector unsigned int mask = (vector unsigned int)opcode(data_, rhs.data_); \
+-        return (internal_vector_type)vec_and(mask, (vector unsigned int)one); \
++        __vector unsigned int mask = (__vector unsigned int)opcode(data_, rhs.data_); \
++        return (internal_vector_type)vec_and(mask, (__vector unsigned int)one); \
+     }
+ 
+ #define vec_cmple_(a, b) vec_cmpge(b, a)
+@@ -367,7 +369,7 @@ public:
+ 
+     friend inline vec select(vec lhs, vec rhs, vec bitmask)
+     {
+-        return vec_sel(lhs.data_, rhs.data_, (vector unsigned int)bitmask.data_);
++        return vec_sel(lhs.data_, rhs.data_, (__vector unsigned int)bitmask.data_);
+     }
+ 
+     /* @} */
+@@ -395,14 +397,14 @@ private:
+         // adapted from http://developer.apple.com/hardwaredrivers/ve/algorithms.html
+ 
+         //Get the square root reciprocal estimate
+-        vector float zero =    gen_zero();
+-        vector float oneHalf = gen_05();
+-        vector float one =     gen_one();
+-        vector float estimate = vec_rsqrte(arg);
++        __vector float zero =    gen_zero();
++        __vector float oneHalf = gen_05();
++        __vector float one =     gen_one();
++        __vector float estimate = vec_rsqrte(arg);
+ 
+         //One round of Newton-Raphson refinement
+-        vector float estimateSquared = vec_madd(estimate, estimate, zero);
+-        vector float halfEstimate = vec_madd(estimate, oneHalf, zero);
++        __vector float estimateSquared = vec_madd(estimate, estimate, zero);
++        __vector float halfEstimate = vec_madd(estimate, oneHalf, zero);
+         return vec_madd(vec_nmsub(arg, estimateSquared, one), halfEstimate, estimate);
+     }
+ 
+--- supercollider-3.6.6~repack-2.orig/external_libraries/nova-simd/vec_int_altivec.hpp
++++ supercollider-3.6.6~repack-2/external_libraries/nova-simd/vec_int_altivec.hpp
+@@ -27,8 +27,8 @@ namespace detail {
+ 
+ struct int_vec_altivec
+ {
+-    typedef vector float fvec;
+-    typedef vector unsigned int ivec;
++    typedef __vector float fvec;
++    typedef __vector unsigned int ivec;
+     ivec data_;
+ 
+ private:
+@@ -58,7 +58,7 @@ public:
+         data_(arg.data_)
+     {}
+ 
+-    int_vec_altivec(vector signed int arg):
++    int_vec_altivec(__vector signed int arg):
+         data_((ivec)arg)
+     {}
+ 
+--- supercollider-3.6.6~repack-2.orig/include/common/SC_Altivec.h
++++ supercollider-3.6.6~repack-2/include/common/SC_Altivec.h
+@@ -21,20 +21,20 @@
+ #ifndef _SC_Altivec_
+ #define _SC_Altivec_
+ 
+-#if defined(HAS_ALTIVEC) || defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__)
++#if defined(HAS_ALTIVEC) || defined(__ALTIVEC__)
+ # include <altivec.h>
+ /* From <altivec.h>:
+    You are allowed to undef these for C++ compatibility. */
+-# ifdef bool
+-#  undef bool
+-# endif
++#undef vector
++#undef bool
++#undef pixel
+ #endif
+ 
+ #if __VEC__
+ 
+-typedef vector signed int vint32;
+-typedef vector unsigned int vuint32;
+-typedef vector float vfloat32;
++typedef __vector signed int vint32;
++typedef __vector unsigned int vuint32;
++typedef __vector float vfloat32;
+ 
+ // Since gcc 3.3 vector initializers are surrounded by brackets. <sk>
+ #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
+@@ -103,14 +103,14 @@ inline vint32 vload( int32 a, int32 b, i
+         return temp.vi;
+ }
+ 
+-inline vector float vec_float_1( void )
++inline vfloat32 vec_float_1( void )
+ {
+ 	return vec_ctf( vec_splat_u32(1), 0);
+ }
+ 
+-inline vector float vec_reciprocal( vector float v )
++inline vfloat32 vec_reciprocal( vfloat32 v )
+ {
+-	vector float reciprocal = vec_re( v );
++	vfloat32 reciprocal = vec_re( v );
+ 	return vec_madd( reciprocal, vec_nmsub( reciprocal, v, vec_float_1()), reciprocal ); //Newton Rapheson refinement
+ }
+ 
diff -Nru supercollider-3.6.6~repack-2/debian/patches/series supercollider-3.6.6~repack-2/debian/patches/series
--- supercollider-3.6.6~repack-2/debian/patches/series	2014-10-04 16:33:25.000000000 +0000
+++ supercollider-3.6.6~repack-2/debian/patches/series	2014-10-24 13:20:48.000000000 +0000
@@ -3,3 +3,4 @@
 supernova-i686-march-flag.patch
 system-lockfree.patch
 ftbfs-gcc-4.9.patch
+altivec-powerpc.patch
diff -Nru supercollider-3.6.6~repack-2/debian/rules supercollider-3.6.6~repack-2/debian/rules
--- supercollider-3.6.6~repack-2/debian/rules	2014-10-04 16:33:25.000000000 +0000
+++ supercollider-3.6.6~repack-2/debian/rules	2014-10-24 13:19:45.000000000 +0000
@@ -26,9 +26,9 @@
 	DEB_BUILD_SUPERNOVA=off
 else
 	ifeq ("$(DEB_HOST_ARCH_CPU)","powerpc")
-		DEB_BUILD_SUPERNOVA=off
-	else
 		DEB_BUILD_SUPERNOVA=on
+		CFLAGS =-maltivec -mabi=altivec
+		CXXFLAGS =-maltivec -mabi=altivec
 	endif
 endif
 

Reply via email to