[openjk] 02/08: Add patches for portability to non-x86 non-ARM architectures
Simon McVittie
smcv at debian.org
Fri May 8 22:45:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository openjk.
commit c4d76c99416aa6c0b396df78e1404aae3bc77e98
Author: Simon McVittie <smcv at debian.org>
Date: Fri May 8 10:26:36 2015 +0100
Add patches for portability to non-x86 non-ARM architectures
---
...e-Architecture-from-CMAKE_SYSTEM_PROCESSO.patch | 62 +++++++++++++++++
...-fsigned-char-to-gcc-on-all-architectures.patch | 37 ++++++++++
...-CMAKE_SIZEOF_VOID_P-instead-of-ARCH_BITS.patch | 78 ++++++++++++++++++++++
...86-specific-flags-on-x86-family-not-on-no.patch | 78 ++++++++++++++++++++++
debian/patches/series | 4 ++
5 files changed, 259 insertions(+)
diff --git a/debian/patches/build-derive-Architecture-from-CMAKE_SYSTEM_PROCESSO.patch b/debian/patches/build-derive-Architecture-from-CMAKE_SYSTEM_PROCESSO.patch
new file mode 100644
index 0000000..e1a2ff4
--- /dev/null
+++ b/debian/patches/build-derive-Architecture-from-CMAKE_SYSTEM_PROCESSO.patch
@@ -0,0 +1,62 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Wed, 29 Apr 2015 22:00:21 +0100
+Subject: build: derive Architecture from CMAKE_SYSTEM_PROCESSOR
+
+There are more architectures than just x86, x86-64 and ARM, and the
+Quake III engine supports most of them. I haven't seen anything
+in OpenJK that is particularly platform-specific, other than what's
+fixed in this branch.
+
+Forwarded: no
+---
+ CMakeLists.txt | 30 +++++++++++++++++++-----------
+ 1 file changed, 19 insertions(+), 11 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f5c60ad..6af09dd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -76,24 +76,32 @@ endif()
+ # Custom CMake Modules needed
+ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/CMakeModules")
+
+-# Arch Suffix
+-if (CMAKE_SIZEOF_VOID_P MATCHES "8")
+- if(WIN32)
++# ${Architecture} must match ARCH_STRING in q_platform.h,
++# and is used in DLL names (jagamex86.dll, jagamex86.dylib, jagamei386.so).
++if(WIN32)
++ if(CMAKE_SIZEOF_VOID_P MATCHES "8")
+ set(Architecture "x86_64")
+ set(WIN64 TRUE)
+ else()
+- set(Architecture "x86_64")
+- endif()
+-else()
+- if(WIN32)
+ set(Architecture "x86")
+ set(WIN64 FALSE)
+- elseif(APPLE)
+- set(Architecture "x86")
+- elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
++ endif()
++else()
++ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+ set(Architecture "arm")
++ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
++ if(APPLE)
++ set(Architecture "x86")
++ else()
++ # e.g. Linux
++ set(Architecture "i386")
++ endif()
++ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc")
++ set(Architecture "ppc")
++ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc64")
++ set(Architecture "ppc64")
+ else()
+- set(Architecture "i386")
++ set(Architecture "${CMAKE_SYSTEM_PROCESSOR}")
+ endif()
+ endif()
+
diff --git a/debian/patches/build-pass-fsigned-char-to-gcc-on-all-architectures.patch b/debian/patches/build-pass-fsigned-char-to-gcc-on-all-architectures.patch
new file mode 100644
index 0000000..116ac8d
--- /dev/null
+++ b/debian/patches/build-pass-fsigned-char-to-gcc-on-all-architectures.patch
@@ -0,0 +1,37 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Wed, 29 Apr 2015 21:41:36 +0100
+Subject: build: pass -fsigned-char to gcc on all architectures
+
+This option is universally available, and the Quake III engine
+assumes it. It is the default on x86 but not on, for instance,
+ARM and PowerPC.
+
+Forwarded: no
+---
+ CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0bd140b..0089201 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -180,8 +180,8 @@ else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-comment")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char")
+ if (Architecture STREQUAL "arm")
+- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char")
+ else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mstackrealign")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse")
+@@ -199,8 +199,8 @@ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-comment")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char")
+ if (Architecture STREQUAL "arm")
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char")
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstackrealign")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse")
diff --git a/debian/patches/build-use-CMAKE_SIZEOF_VOID_P-instead-of-ARCH_BITS.patch b/debian/patches/build-use-CMAKE_SIZEOF_VOID_P-instead-of-ARCH_BITS.patch
new file mode 100644
index 0000000..0de8743
--- /dev/null
+++ b/debian/patches/build-use-CMAKE_SIZEOF_VOID_P-instead-of-ARCH_BITS.patch
@@ -0,0 +1,78 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Wed, 29 Apr 2015 21:50:14 +0100
+Subject: build: use CMAKE_SIZEOF_VOID_P instead of ARCH_BITS
+
+cmake already has a standard way to distinguish between 32- and 64-bit
+platforms; there's no advantage in adding another.
+
+Forwarded: no
+---
+ CMakeLists.txt | 2 --
+ code/CMakeLists.txt | 4 ++--
+ codemp/CMakeLists.txt | 4 ++--
+ 3 files changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0089201..f5c60ad 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -78,7 +78,6 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/CMakeModules")
+
+ # Arch Suffix
+ if (CMAKE_SIZEOF_VOID_P MATCHES "8")
+- set(ARCH_BITS 64)
+ if(WIN32)
+ set(Architecture "x86_64")
+ set(WIN64 TRUE)
+@@ -86,7 +85,6 @@ if (CMAKE_SIZEOF_VOID_P MATCHES "8")
+ set(Architecture "x86_64")
+ endif()
+ else()
+- set(ARCH_BITS 32)
+ if(WIN32)
+ set(Architecture "x86")
+ set(WIN64 FALSE)
+diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
+index 394c1c5..2cbaead 100644
+--- a/code/CMakeLists.txt
++++ b/code/CMakeLists.txt
+@@ -72,7 +72,7 @@ if(BuildSPEngine OR BuildJK2SPEngine)
+ endif()
+
+ if(UseInternalSDL2)
+- if(ARCH_BITS EQUAL 32)
++ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(SPEngineLibraries
+ ${SPEngineLibraries}
+ ${OpenJKLibDir}/SDL2/lib/x86/SDL2.lib
+@@ -404,7 +404,7 @@ if(BuildSPEngine OR BuildJK2SPEngine)
+ if(WIN32)
+ add_executable(${ProjectName} WIN32 ${SPEngineFiles})
+ if(UseInternalSDL2)
+- if(ARCH_BITS EQUAL 32)
++ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(SPEngineExtraInstallFiles
+ ${OpenJKLibDir}/SDL2/bin/x86/SDL2.dll
+ )
+diff --git a/codemp/CMakeLists.txt b/codemp/CMakeLists.txt
+index 31a80d5..b031541 100644
+--- a/codemp/CMakeLists.txt
++++ b/codemp/CMakeLists.txt
+@@ -388,7 +388,7 @@ if(BuildMPEngine)
+ endif()
+
+ if(UseInternalSDL2)
+- if(ARCH_BITS EQUAL 32)
++ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(MPEngineLibraries
+ ${MPEngineLibraries}
+ ${OpenJKLibDir}/SDL2/lib/x86/SDL2.lib
+@@ -569,7 +569,7 @@ if(BuildMPEngine)
+ if(WIN32)
+ add_executable(${MPEngine} WIN32 ${MPEngineFiles})
+ if(UseInternalSDL2)
+- if(ARCH_BITS EQUAL 32)
++ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(MPEngineExtraInstallFiles
+ ${OpenJKLibDir}/SDL2/bin/x86/SDL2.dll
+ )
diff --git a/debian/patches/build-use-x86-specific-flags-on-x86-family-not-on-no.patch b/debian/patches/build-use-x86-specific-flags-on-x86-family-not-on-no.patch
new file mode 100644
index 0000000..5df2f34
--- /dev/null
+++ b/debian/patches/build-use-x86-specific-flags-on-x86-family-not-on-no.patch
@@ -0,0 +1,78 @@
+From: Simon McVittie <smcv at debian.org>
+Date: Wed, 29 Apr 2015 21:49:35 +0100
+Subject: build: use x86-specific flags on x86 family, not on non-ARM
+
+There are plenty of CPU architectures that are neither ARM nor the
+x86 family, for instance PowerPC and ARM64.
+
+Forwarded: no
+---
+ CMakeLists.txt | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6af09dd..e98b415 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -79,6 +79,7 @@ list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/CMakeModules")
+ # ${Architecture} must match ARCH_STRING in q_platform.h,
+ # and is used in DLL names (jagamex86.dll, jagamex86.dylib, jagamei386.so).
+ if(WIN32)
++ set(X86 ON)
+ if(CMAKE_SIZEOF_VOID_P MATCHES "8")
+ set(Architecture "x86_64")
+ set(WIN64 TRUE)
+@@ -87,15 +88,20 @@ if(WIN32)
+ set(WIN64 FALSE)
+ endif()
+ else()
++ set(X86 OFF)
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
+ set(Architecture "arm")
+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
++ set(X86 ON)
+ if(APPLE)
+ set(Architecture "x86")
+ else()
+ # e.g. Linux
+ set(Architecture "i386")
+ endif()
++ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^x86.64$")
++ set(X86 ON)
++ set(Architecture "x86_64")
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc")
+ set(Architecture "ppc")
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc64")
+@@ -174,7 +180,7 @@ else()
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb")
+
+- if (NOT Architecture STREQUAL "arm")
++ if (X86)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
+ endif()
+@@ -187,8 +193,11 @@ else()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-comment")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsigned-char")
+- if (Architecture STREQUAL "arm")
+- else()
++ if (X86)
++ # "x86 vm will crash without -mstackrealign since MMX
++ # instructions will be used no matter what and they
++ # corrupt the frame pointer in VM calls"
++ # -ioquake3 Makefile
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mstackrealign")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpmath=sse")
+ endif()
+@@ -206,8 +215,7 @@ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char")
+- if (Architecture STREQUAL "arm")
+- else()
++ if (X86)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mstackrealign")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse")
+ endif()
diff --git a/debian/patches/series b/debian/patches/series
index 96f5f7d..4b6c061 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,6 +4,10 @@ codeJK2-replace-__cdecl-with-QDECL.patch
Use-C-11-compliant-string-concatenation.patch
SP-JK2-g_savegame-silence-compiler-warning.patch
JK2-icarus-include-string.h-for-strcmp-memcpy-in-inl.patch
+build-pass-fsigned-char-to-gcc-on-all-architectures.patch
+build-use-CMAKE_SIZEOF_VOID_P-instead-of-ARCH_BITS.patch
+build-derive-Architecture-from-CMAKE_SYSTEM_PROCESSO.patch
+build-use-x86-specific-flags-on-x86-family-not-on-no.patch
g_utils-stub-out-debug-code-to-write-to-a-misc-Windo.patch
Use-NET_Sleep-or-Sys_Sleep-in-SP-to-avoid-busy-waiti.patch
Don-t-link-renderer-and-clients-to-a-bunch-of-unnece.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git
More information about the Pkg-games-commits
mailing list