On Mon, 20 May 2013 at 00:31:30 +0100, Simon McVittie wrote:
> [some instructions]
> 
> If you have a working pre-Altivec, non-SPE PowerPC (probably a "G3" Mac)
> or you know someone who does, that would also be useful to test on.

I forgot to attach a modified patch. Please try applying this patch
and setting USE_ALTIVEC=0 in debian/rules, instead of the version that
tests __NO_FPRS__ alongside Q3_VM.

Thanks,
    S
>From 6cb56d6ba2ef47813548efcbc02d26eb942ba713 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Sun, 19 May 2013 22:57:06 +0100
Subject: [PATCH] [untested] Add support for PowerPCs without Altivec

Debian's powerpc port still supports baseline PowerPCs without Altivec
(e.g. Mac G3), and its powerpcspe port is a variant of PowerPC in
which "Signal Processing Engine" extensions replace, and are
incompatible with, the Altivec opcodes.

(The Signal Processing Engine should not be confused with
Synergistic Processing Elements, as seen in the Playstation 3;
those don't conflict with having Altivec.)
---
 Makefile                  |   30 ++++++++++++++++++++++++------
 README                    |    2 ++
 code/qcommon/q_platform.h |    2 +-
 3 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 9561445..20876b2 100644
--- a/Makefile
+++ b/Makefile
@@ -215,6 +215,10 @@ ifndef USE_RENDERER_DLOPEN
 USE_RENDERER_DLOPEN=1
 endif
 
+ifndef USE_ALTIVEC
+USE_ALTIVEC=1
+endif
+
 ifndef DEBUG_CFLAGS
 DEBUG_CFLAGS=-g -O0
 endif
@@ -335,11 +339,15 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")
     HAVE_VM_COMPILED=true
   else
   ifeq ($(ARCH),ppc)
-    BASE_CFLAGS += -maltivec
+    ifeq ($(USE_ALTIVEC),1)
+      BASE_CFLAGS += -maltivec -DUSE_ALTIVEC
+    endif
     HAVE_VM_COMPILED=true
   endif
   ifeq ($(ARCH),ppc64)
-    BASE_CFLAGS += -maltivec
+    ifeq ($(USE_ALTIVEC),1)
+      BASE_CFLAGS += -maltivec -DUSE_ALTIVEC
+    endif
     HAVE_VM_COMPILED=true
   endif
   ifeq ($(ARCH),sparc)
@@ -409,11 +417,17 @@ ifeq ($(PLATFORM),darwin)
   BASE_CFLAGS = -Wall -Wimplicit -Wstrict-prototypes
 
   ifeq ($(ARCH),ppc)
-    BASE_CFLAGS += -arch ppc -faltivec -mmacosx-version-min=10.2
+    BASE_CFLAGS += -arch ppc -mmacosx-version-min=10.2
+    ifeq ($(USE_ALTIVEC),1)
+      BASE_CFLAGS += -faltivec -DUSE_ALTIVEC
+    endif
     OPTIMIZEVM += -O3
   endif
   ifeq ($(ARCH),ppc64)
-    BASE_CFLAGS += -arch ppc64 -faltivec -mmacosx-version-min=10.2
+    BASE_CFLAGS += -arch ppc64 -mmacosx-version-min=10.2
+    ifeq ($(USE_ALTIVEC),1)
+      BASE_CFLAGS += -faltivec -DUSE_ALTIVEC
+    endif
   endif
   ifeq ($(ARCH),x86)
     OPTIMIZEVM += -march=prescott -mfpmath=sse
@@ -717,11 +731,15 @@ ifeq ($(PLATFORM),openbsd)
     HAVE_VM_COMPILED=true
   else
   ifeq ($(ARCH),ppc)
-    BASE_CFLAGS += -maltivec
+    ifeq ($(USE_ALTIVEC),1)
+      BASE_CFLAGS += -maltivec -DUSE_ALTIVEC
+    endif
     HAVE_VM_COMPILED=true
   endif
   ifeq ($(ARCH),ppc64)
-    BASE_CFLAGS += -maltivec
+    ifeq ($(USE_ALTIVEC),1)
+      BASE_CFLAGS += -maltivec -DUSE_ALTIVEC
+    endif
     HAVE_VM_COMPILED=true
   endif
   ifeq ($(ARCH),sparc64)
diff --git a/README b/README
index 1f4cf49..6d35132 100644
--- a/README
+++ b/README
@@ -105,6 +105,8 @@ Makefile.local:
   USE_INTERNAL_OGG   - build and link against internal ogg library
   USE_INTERNAL_OPUS  - build and link against internal opus/opusfile libraries
   USE_LOCAL_HEADERS  - use headers local to ioq3 instead of system ones
+  USE_ALTIVEC        - set to 0 to support older or embedded PowerPCs
+                       without Altivec
   DEBUG_CFLAGS       - C compiler flags to use for building debug version
   COPYDIR            - the target installation directory
   TEMPDIR            - specify user defined directory for temp files
diff --git a/code/qcommon/q_platform.h b/code/qcommon/q_platform.h
index 9ae85d5..fb0ddff 100644
--- a/code/qcommon/q_platform.h
+++ b/code/qcommon/q_platform.h
@@ -44,7 +44,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #if (defined(powerc) || defined(powerpc) || defined(ppc) || \
 	defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY)
 #define idppc 1
-#if defined(__VEC__)
+#if defined(__VEC__) && defined(USE_ALTIVEC)
 #define idppc_altivec 1
 #ifdef MACOS_X  // Apple's GCC does this differently than the FSF.
 #define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
-- 
1.7.10.4

Reply via email to