[rbdoom3bfg] 01/02: 80-disable-cpu-features.patch refined & forwarded, tweaked d/rules to use it

Tobias Frost tobi at moszumanska.debian.org
Fri Jun 19 14:21:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

tobi pushed a commit to branch master
in repository rbdoom3bfg.

commit 3dca85b5ffd473d3afc889274361f8bde1cc084e
Author: Tobias Frost <tobi at coldtobi.de>
Date:   Fri Jun 19 16:20:16 2015 +0200

    80-disable-cpu-features.patch refined & forwarded, tweaked d/rules to use it
---
 debian/patches/80-disable-cpu-features.patch | 141 ++++++++++++++++++++++++++-
 debian/rules                                 |   2 +-
 2 files changed, 137 insertions(+), 6 deletions(-)

diff --git a/debian/patches/80-disable-cpu-features.patch b/debian/patches/80-disable-cpu-features.patch
index fa21121..59706de 100644
--- a/debian/patches/80-disable-cpu-features.patch
+++ b/debian/patches/80-disable-cpu-features.patch
@@ -1,25 +1,156 @@
 Description: Do not use CPU features like sse and mmx
  Those features are not guaranteed to be supported even on i386/amd64, so it
  is better to stick to the GCC's default.
+ The patch introduces this by modifying CMakeOptions
 Author: Tobias Frost <tobi at debian.org>
-Forwarded: not-needed, Debian specific
-Last-Update: 2015-06-12
+Forwarded: https://github.com/RobertBeckebans/RBDOOM-3-BFG/pull/228
+Last-Update: 2015-06-19
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 --- a/neo/CMakeLists.txt
 +++ b/neo/CMakeLists.txt
-@@ -61,7 +61,10 @@
+@@ -36,6 +36,12 @@
+ option(USE_SYSTEM_LIBGLEW
+                 "Use the system libglew instead of the bundled one" OFF)
+ 
++set(CPU_TYPE "" CACHE STRING "When set, passes this string as CPU-ID which will be embedded into the binary.")
++
++set(CPU_OPTIMIZATION "-mmmx -msse -msse2" CACHE STRING "Which CPU specific optimitations should be used beside the compiler's default?")
++
++option(USE_INTRINSICS "Compile using intrinsics (e.g mmx, sse, msse2)" ON)
++
+ if(UNIX)
+ 	set(OPENAL TRUE)
+ endif()
+@@ -61,7 +67,15 @@
  	#add_definitions(-Wall)
  	add_definitions(-Werror=format-security)
  	add_definitions(-Werror=format)
 -	add_definitions(-mmmx -msse -msse2)
-+#	add_definitions(-mmmx -msse -msse2)
 +	if(CPU_TYPE)
 +		add_definitions(-DCPUSTRING="${CPU_TYPE}")
 +	endif()
++	if (CPU_OPTIMIZATION)
++		add_definitions(${CPU_OPTIMIZATION})
++	endif()
++	if (USE_INTRINSICS)
++		add_definitions(-DUSE_INTRINSICS)
++	endif()
  	if(WIN32)
  		# require msvcr70.dll or newer for _aligned_malloc etc
  		# I think it is from Visual C++ .NET 2002, so it should be available on any remotely modern system.
+@@ -78,12 +92,12 @@
+ 	#endif()
+ 	
+ 	# the warnings are used for every profile anyway, so put them in a variable
+-	set(my_warn_flags "-Wno-pragmas -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch -Wno-unused-value -Winvalid-pch -Wno-multichar")
++	set(my_warn_flags "-Wno-pragmas -Wno-unused-variable -Wno-switch -Wno-unused-value -Winvalid-pch -Wno-multichar")
+ 	
+ 	if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ 		# append clang-specific settings for warnings (the second one make sure clang doesn't complain
+ 		# about unknown -W flags, like -Wno-unused-but-set-variable)
+-		set(my_warn_flags "${my_warn_flags} -Wno-local-type-template-args -Wno-unknown-warning-option -Wno-inline-new-delete")
++		set(my_warn_flags "${my_warn_flags} -Wno-local-type-template-args -Wno-unknown-warning-option -Wno-inline-new-delete -Wno-switch-enum")
+ 	endif()
+ 	
+ 	if(NOT CMAKE_CROSSCOMPILING AND ONATIVE)
+@@ -1491,22 +1505,22 @@
+ 	list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/jobs/ShadowShared.cpp)
+ 	list(REMOVE_ITEM RBDOOM3_PRECOMPILED_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/renderer/RenderLog.cpp)
+ 
+-##	foreach( src_file ${RBDOOM3_PRECOMPILED_SOURCES} )
+-##		#message(STATUS "-include precompiled.h for ${src_file}")
+-##		set_source_files_properties(
+-##			${src_file}
+-##			PROPERTIES
+-##			COMPILE_FLAGS "-include ${CMAKE_CURRENT_SOURCE_DIR}/idlib/precompiled.h"
+-##			)
+-##	endforeach()
+-
+-##	# precompiled magic for GCC/clang, adapted from https://gist.github.com/573926
+-##	STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
+-##	SET(_compiler_FLAGS ${${_flags_var_name}})
+-##	GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
+-##	FOREACH(item ${_directory_flags})
+-##		LIST(APPEND _compiler_FLAGS " -I${item}")
+-##	ENDFOREACH(item)
++	foreach( src_file ${RBDOOM3_PRECOMPILED_SOURCES} )
++		#message(STATUS "-include precompiled.h for ${src_file}")
++		set_source_files_properties(
++			${src_file}
++			PROPERTIES
++			COMPILE_FLAGS "-include ${CMAKE_CURRENT_SOURCE_DIR}/idlib/precompiled.h"
++			)
++	endforeach()
++
++	# precompiled magic for GCC/clang, adapted from https://gist.github.com/573926
++	STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
++	SET(_compiler_FLAGS ${${_flags_var_name}})
++	GET_DIRECTORY_PROPERTY(_directory_flags INCLUDE_DIRECTORIES)
++	FOREACH(item ${_directory_flags})
++		LIST(APPEND _compiler_FLAGS " -I${item}")
++	ENDFOREACH(item)
+ 
+ 	GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
+ 	LIST(APPEND _compiler_FLAGS ${_directory_flags})
+@@ -1515,11 +1529,11 @@
+ 	# we need to recreate the precompiled header for RBDoom3BFG 
+ 	# (i.e. can't use the one created for idlib before)
+ 	# because some definitions (e.g. -D__IDLIB__ -D__DOOM_DLL__) differ
+-##	add_custom_target(precomp_header_rbdoom3bfg ALL
+-##	                  COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header idlib/precompiled.h -o idlib/precompiled.h.gch
+-##	                  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+-##	                  COMMENT "Creating idlib/precompiled.h.gch for RBDoom3BFG"
+-##	                  )
++	add_custom_target(precomp_header_rbdoom3bfg ALL
++	                  COMMAND ${CMAKE_CXX_COMPILER} ${_compiler_FLAGS} -x c++-header idlib/precompiled.h -o idlib/precompiled.h.gch
++	                  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
++	                  COMMENT "Creating idlib/precompiled.h.gch for RBDoom3BFG"
++	                  )
+ 	
+ 	if(WIN32)
+ 		set(remove_command "del")
+@@ -1529,22 +1543,22 @@
+ 	# it's ugly enough that the precompiled header binary needs to be in the 
+ 	# source directory (instead of the build directory), so let's at least
+ 	# delete it after build.
+-##	add_custom_target(rm_precomp_header ALL
+-##	                  COMMAND ${remove_command} "idlib/precompiled.h.gch"
+-##	                  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+-##	                  COMMENT "remove idlib/precompiled.h.gch"
+-##	                  )
++	add_custom_target(rm_precomp_header ALL
++	                  COMMAND ${remove_command} "idlib/precompiled.h.gch"
++	                  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
++	                  COMMENT "remove idlib/precompiled.h.gch"
++	                  )
+ 	
+ 	# make sure this is run after creating idlib
+-#	add_dependencies(precomp_header_rbdoom3bfg idlib)
++	add_dependencies(precomp_header_rbdoom3bfg idlib)
+ 	
+-	add_executable(rbdoom3bfg WIN32 ${RBDOOM3_SOURCES})
++	add_executable(RBDoom3BFG WIN32 ${RBDOOM3_SOURCES})
+ 	
+ 	# make sure precompiled header is created before executable is compiled
+-	add_dependencies(rbdoom3bfg precomp_header_rbdoom3bfg)
++	add_dependencies(RBDoom3BFG precomp_header_rbdoom3bfg)
+ 	
+ 	# make sure precompiled header is deleted after executable is compiled
+-##	add_dependencies(rm_precomp_header rbdoom3bfg)
++	add_dependencies(rm_precomp_header RBDoom3BFG)
+ 	
+ 
+ 	if(NOT WIN32)
+@@ -1556,7 +1570,7 @@
+ 			set(DL_LIBRARY dl)
+ 		endif()
+ 
+-		target_link_libraries(rbdoom3bfg
++		target_link_libraries(RBDoom3BFG
+ 			idlib
+ 			${OPENGL_LIBRARIES}
+ 			pthread
 --- a/neo/idlib/sys/sys_intrinsics.h
 +++ b/neo/idlib/sys/sys_intrinsics.h
 @@ -29,7 +29,10 @@
@@ -39,7 +170,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  
  #elif defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
  
-+#if not defined(CPUSTRING)
++#ifndef CPUSTRING
  #if defined(__i386__)
  #define	CPUSTRING						"x86"
  #elif defined(__x86_64__)
diff --git a/debian/rules b/debian/rules
index 08d3b66..2e8aa43 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,7 +13,7 @@ override_dh_auto_configure:
 	 -DSDL2=ON -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \
 	 -DUSE_SYSTEM_ZLIB=ON -DUSE_SYSTEM_LIBPNG=ON \
 	 -DUSE_SYSTEM_LIBJPEG=ON -DUSE_SYSTEM_LIBGLEW=ON \
-	 -DCPU_TYPE=$(DEB_BUILD_ARCH_CPU)
+	 -DCPU_TYPE=$(DEB_BUILD_ARCH_CPU) -DCPU_OPTIMIZATION="" -DUSE_INTRINSICS=OFF
 
          #-DCMAKE_BUILD_TYPE=RelWithDebInfo
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/rbdoom3bfg.git



More information about the Pkg-games-commits mailing list