From 2791c286366e0b8a47af839c693b5d839b150055 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: May 14 2014 13:27:56 +0000 Subject: fix building with old bullet Signed-off-by: Igor Gnatenko --- diff --git a/0001-fix-.desktop-file-and-install-destinations.patch b/0001-fix-.desktop-file-and-install-destinations.patch index 242fdfd..1404ae4 100644 --- a/0001-fix-.desktop-file-and-install-destinations.patch +++ b/0001-fix-.desktop-file-and-install-destinations.patch @@ -1,7 +1,7 @@ From 434083d5647ae052693eff559acbd08de09cbc37 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sun, 11 May 2014 22:58:04 +0400 -Subject: [PATCH 1/3] fix .desktop file and install destinations +Subject: [PATCH 1/5] fix .desktop file and install destinations Signed-off-by: Igor Gnatenko --- diff --git a/0002-fix-srcs-for-new-bullet-API.patch b/0002-fix-srcs-for-new-bullet-API.patch deleted file mode 100644 index afbce20..0000000 --- a/0002-fix-srcs-for-new-bullet-API.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 9cf53410cf6500cb087fc9686a86f1e9cadbec7a Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sun, 11 May 2014 22:59:28 +0400 -Subject: [PATCH 2/3] fix srcs for new bullet API - -Signed-off-by: Igor Gnatenko ---- - src/physics/btKartRaycast.cpp | 4 ++-- - src/physics/physics.cpp | 7 ++----- - 2 files changed, 4 insertions(+), 7 deletions(-) - -diff --git a/src/physics/btKartRaycast.cpp b/src/physics/btKartRaycast.cpp -index 13b310f..7c00d42 100644 ---- a/src/physics/btKartRaycast.cpp -+++ b/src/physics/btKartRaycast.cpp -@@ -63,7 +63,7 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to, - - if (rayCallback.hasHit()) - { -- btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject); -+ const btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject); - if (body && body->hasContactResponse()) - { - result.m_hitPointInWorld = rayCallback.m_hitPointWorld; -@@ -88,7 +88,7 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to, - result.m_hitNormalInWorld.getZ()); - #endif - } -- return body; -+ return (void *) body; - } - } - return 0; -diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp -index fcff1f0..2d800cd 100644 ---- a/src/physics/physics.cpp -+++ b/src/physics/physics.cpp -@@ -438,7 +438,6 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies, - constraints, - numConstraints, info, - debugDrawer, -- stackAlloc, - dispatcher); - int currentNumManifolds = m_dispatcher->getNumManifolds(); - // We can't explode a rocket in a loop, since a rocket might collide with -@@ -450,10 +449,8 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies, - btPersistentManifold* contact_manifold = - m_dynamics_world->getDispatcher()->getManifoldByIndexInternal(i); - -- btCollisionObject* objA = -- static_cast(contact_manifold->getBody0()); -- btCollisionObject* objB = -- static_cast(contact_manifold->getBody1()); -+ const btCollisionObject* objA = contact_manifold->getBody0(); -+ const btCollisionObject* objB = contact_manifold->getBody1(); - - unsigned int num_contacts = contact_manifold->getNumContacts(); - if(!num_contacts) continue; // no real collision --- -1.9.0 - diff --git a/0002-unbundle-bullet.patch b/0002-unbundle-bullet.patch new file mode 100644 index 0000000..75fd37f --- /dev/null +++ b/0002-unbundle-bullet.patch @@ -0,0 +1,118 @@ +From 01468f607b03ba612aa9fb401641e611092915cd Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sun, 11 May 2014 22:59:28 +0400 +Subject: [PATCH 2/5] unbundle bullet + +Signed-off-by: Igor Gnatenko +--- + CMakeLists.txt | 12 +++++++----- + src/physics/btKartRaycast.cpp | 4 ++-- + src/physics/physics.cpp | 32 ++++++++++++++++++++------------ + 3 files changed, 29 insertions(+), 19 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2d87a98..9672f3f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -36,9 +36,13 @@ set(STK_INSTALL_BINARY_DIR "bin" CACHE + set(STK_INSTALL_DATA_DIR "share/supertuxkart" CACHE + STRING "Install data folder to this directory, absolute or relative to CMAKE_INSTALL_PREFIX") + ++include(FindPkgConfig) ++ + # Build the Bullet physics library +-add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet") +-include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src") ++pkg_search_module(BULLET REQUIRED bullet) ++include_directories(${BULLET_INCLUDE_DIRS}) ++string(REGEX REPLACE "\\." "" BULLET_VERSION_INT ${BULLET_VERSION}) ++add_definitions(-DBULLET_VERSION=${BULLET_VERSION_INT}) + + # Build the ENet UDP network library + add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet") +@@ -222,9 +226,7 @@ endif() + + # Common library dependencies + target_link_libraries(supertuxkart +- bulletdynamics +- bulletcollision +- bulletmath ++ ${BULLET_LIBRARIES} + enet + stkirrlicht + ${CURL_LIBRARIES} +diff --git a/src/physics/btKartRaycast.cpp b/src/physics/btKartRaycast.cpp +index 13b310f..7c00d42 100644 +--- a/src/physics/btKartRaycast.cpp ++++ b/src/physics/btKartRaycast.cpp +@@ -63,7 +63,7 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to, + + if (rayCallback.hasHit()) + { +- btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject); ++ const btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject); + if (body && body->hasContactResponse()) + { + result.m_hitPointInWorld = rayCallback.m_hitPointWorld; +@@ -88,7 +88,7 @@ void* btKartRaycaster::castRay(const btVector3& from, const btVector3& to, + result.m_hitNormalInWorld.getZ()); + #endif + } +- return body; ++ return (void *) body; + } + } + return 0; +diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp +index fcff1f0..b49446a 100644 +--- a/src/physics/physics.cpp ++++ b/src/physics/physics.cpp +@@ -432,14 +432,24 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies, + btStackAlloc* stackAlloc, + btDispatcher* dispatcher) + { +- btScalar returnValue= +- btSequentialImpulseConstraintSolver::solveGroup(bodies, numBodies, +- manifold, numManifolds, +- constraints, +- numConstraints, info, +- debugDrawer, +- stackAlloc, +- dispatcher); ++ #if BULLET_VERSION >= 282 ++ btScalar returnValue= ++ btSequentialImpulseConstraintSolver::solveGroup(bodies, numBodies, ++ manifold, numManifolds, ++ constraints, ++ numConstraints, info, ++ debugDrawer, ++ dispatcher); ++ #else ++ btScalar returnValue= ++ btSequentialImpulseConstraintSolver::solveGroup(bodies, numBodies, ++ manifold, numManifolds, ++ constraints, ++ numConstraints, info, ++ debugDrawer, ++ stackAlloc, ++ dispatcher); ++ #endif + int currentNumManifolds = m_dispatcher->getNumManifolds(); + // We can't explode a rocket in a loop, since a rocket might collide with + // more than one object, and/or more than once with each object (if there +@@ -450,10 +460,8 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies, + btPersistentManifold* contact_manifold = + m_dynamics_world->getDispatcher()->getManifoldByIndexInternal(i); + +- btCollisionObject* objA = +- static_cast(contact_manifold->getBody0()); +- btCollisionObject* objB = +- static_cast(contact_manifold->getBody1()); ++ const btCollisionObject* objA = contact_manifold->getBody0(); ++ const btCollisionObject* objB = contact_manifold->getBody1(); + + unsigned int num_contacts = contact_manifold->getNumContacts(); + if(!num_contacts) continue; // no real collision +-- +1.9.0 + diff --git a/0003-unbundle-all-libs.patch b/0003-unbundle-all-libs.patch deleted file mode 100644 index 9df349d..0000000 --- a/0003-unbundle-all-libs.patch +++ /dev/null @@ -1,348 +0,0 @@ -From f86ed73c08f40878754f705a796615387d02f02e Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sun, 11 May 2014 23:12:38 +0400 -Subject: [PATCH 3/3] unbundle all libs - -Signed-off-by: Igor Gnatenko ---- - CMakeLists.txt | 32 ++++++++-------- - cmake/FindENet.cmake | 48 +++++++++++++++++++++++ - cmake/FindIrrlicht.cmake | 94 +++++++++++++++++++++++++++++++++++++++++++++ - cmake/FindWiiUse.cmake | 99 ++++++++++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 256 insertions(+), 17 deletions(-) - create mode 100644 cmake/FindENet.cmake - create mode 100644 cmake/FindIrrlicht.cmake - create mode 100644 cmake/FindWiiUse.cmake - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2d87a98..8fa33bd 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -36,27 +36,27 @@ set(STK_INSTALL_BINARY_DIR "bin" CACHE - set(STK_INSTALL_DATA_DIR "share/supertuxkart" CACHE - STRING "Install data folder to this directory, absolute or relative to CMAKE_INSTALL_PREFIX") - -+INCLUDE (FindPkgConfig) -+ - # Build the Bullet physics library --add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet") --include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src") -+pkg_search_module(BULLET REQUIRED bullet) -+include_directories(${BULLET_INCLUDE_DIRS}) - - # Build the ENet UDP network library --add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet") --include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include") -+find_package(ENet REQUIRED) -+include_directories(${ENet_INCLUDE_DIRS}) - - # Build the irrlicht library --add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht") --include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/include") -+find_package(Irrlicht REQUIRED) -+include_directories(${IRRLICHT_INCLUDE_DIR}) - - # Build the Wiiuse library - # Note: wiiuse MUST be declared after irrlicht, since otherwise - # (at least on VS) irrlicht will find wiiuse io.h file because - # of the added include directory. - if(USE_WIIUSE) -- if(WIIUSE_BUILD) -- add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse") -- endif() -- include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse") -+ find_package(WiiUse REQUIRED) -+ include_directories(${WIIUSE_INCLUDE_DIR}) - endif() - - -@@ -222,14 +222,12 @@ endif() - - # Common library dependencies - target_link_libraries(supertuxkart -- bulletdynamics -- bulletcollision -- bulletmath -- enet -- stkirrlicht -+ ${BULLET_LIBRARIES} -+ ${ENet_LIBRARIES} -+ ${IRRLICHT_LIBRARIES} -+ IrrXML - ${CURL_LIBRARIES} - ${OGGVORBIS_LIBRARIES} -- ${IRRLICHT_XF86VM_LIBRARY} - ${OPENAL_LIBRARY} - ${OPENGL_LIBRARIES}) - -@@ -261,7 +259,7 @@ if(USE_WIIUSE) - target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/wiiuse.lib) - endif() - else() -- target_link_libraries(supertuxkart wiiuse bluetooth) -+ target_link_libraries(supertuxkart ${WIIUSE_LIBRARIES}) - endif() - add_definitions(-DENABLE_WIIUSE) - -diff --git a/cmake/FindENet.cmake b/cmake/FindENet.cmake -new file mode 100644 -index 0000000..91c2527 ---- /dev/null -+++ b/cmake/FindENet.cmake -@@ -0,0 +1,48 @@ -+# - Try to find enet -+# Once done this will define -+# -+# ENET_FOUND - system has enet -+# ENet_INCLUDE_DIRS - the enet include directory -+# ENet_LIBRARIES - the libraries needed to use enet -+# -+# $ENETDIR is an environment variable used for finding enet. -+# -+# Borrowed from The Mana World -+# http://themanaworld.org/ -+# -+# Several changes and additions by Fabian 'x3n' Landau -+# Lots of simplifications by Adrian Friedli -+# > www.orxonox.net < -+ -+FIND_PATH(ENet_INCLUDE_DIRS enet/enet.h -+ PATHS -+ $ENV{ENETDIR} -+ /usr/local -+ /usr -+ PATH_SUFFIXES include -+ ) -+ -+FIND_LIBRARY(ENet_LIBRARY -+ NAMES enet -+ PATHS -+ $ENV{ENETDIR} -+ /usr/local -+ /usr -+ PATH_SUFFIXES lib -+ ) -+ -+# handle the QUIETLY and REQUIRED arguments and set ENET_FOUND to TRUE if -+# all listed variables are TRUE -+INCLUDE(FindPackageHandleStandardArgs) -+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ENet DEFAULT_MSG ENet_LIBRARY ENet_INCLUDE_DIRS) -+ -+IF (ENET_FOUND) -+ IF(WIN32) -+ SET(WINDOWS_ENET_DEPENDENCIES "ws2_32;winmm") -+ SET(ENet_LIBRARIES ${ENet_LIBRARY} ${WINDOWS_ENET_DEPENDENCIES}) -+ ELSE(WIN32) -+ SET(ENet_LIBRARIES ${ENet_LIBRARY}) -+ ENDIF(WIN32) -+ENDIF (ENET_FOUND) -+ -+MARK_AS_ADVANCED(ENet_LIBRARY ENet_LIBRARIES ENet_INCLUDE_DIRS) -diff --git a/cmake/FindIrrlicht.cmake b/cmake/FindIrrlicht.cmake -new file mode 100644 -index 0000000..a1adc4b ---- /dev/null -+++ b/cmake/FindIrrlicht.cmake -@@ -0,0 +1,94 @@ -+#FindIrrlicht.cmake -+ -+set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)") -+ -+if( UNIX ) -+ # Unix -+else( UNIX ) -+ # Windows -+endif( UNIX ) -+ -+# Find include directory -+ -+if(NOT IRRLICHT_SOURCE_DIR STREQUAL "") -+ set(IRRLICHT_SOURCE_DIR_INCLUDE -+ "${IRRLICHT_SOURCE_DIR}/include" -+ ) -+ -+ set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a Irrlicht Irrlicht.lib) -+ -+ if(WIN32) -+ if(MSVC) -+ set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio") -+ set(IRRLICHT_LIBRARY_NAMES Irrlicht.lib) -+ else() -+ set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc") -+ set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a libIrrlicht.dll.a) -+ endif() -+ else() -+ set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Linux") -+ set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a) -+ endif() -+ -+ FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h -+ PATHS -+ ${IRRLICHT_SOURCE_DIR_INCLUDE} -+ NO_DEFAULT_PATH -+ ) -+ -+ FIND_LIBRARY(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES} -+ PATHS -+ ${IRRLICHT_SOURCE_DIR_LIBS} -+ NO_DEFAULT_PATH -+ ) -+ -+else() -+ -+ FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h -+ PATHS -+ /usr/local/include/irrlicht -+ /usr/include/irrlicht -+ ) -+ -+ FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.so Irrlicht -+ PATHS -+ /usr/local/lib -+ /usr/lib -+ /usr/lib64 -+ ) -+endif() -+ -+MESSAGE(STATUS "IRRLICHT_SOURCE_DIR = ${IRRLICHT_SOURCE_DIR}") -+MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}") -+MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}") -+ -+# On windows, find the dll for installation -+if(WIN32) -+ if(MSVC) -+ FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll -+ PATHS -+ "${IRRLICHT_SOURCE_DIR}/bin/Win32-VisualStudio" -+ DOC "Path of the Irrlicht dll (for installation)" -+ ) -+ else() -+ FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll -+ PATHS -+ "${IRRLICHT_SOURCE_DIR}/bin/Win32-gcc" -+ DOC "Path of the Irrlicht dll (for installation)" -+ ) -+ endif() -+ MESSAGE(STATUS "IRRLICHT_DLL = ${IRRLICHT_DLL}") -+endif(WIN32) -+ -+# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if -+# all listed variables are TRUE -+INCLUDE(FindPackageHandleStandardArgs) -+FIND_PACKAGE_HANDLE_STANDARD_ARGS(IRRLICHT DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR) -+ -+IF(IRRLICHT_FOUND) -+ SET(IRRLICHT_LIBRARIES ${IRRLICHT_LIBRARY}) -+ELSE(IRRLICHT_FOUND) -+ SET(IRRLICHT_LIBRARIES) -+ENDIF(IRRLICHT_FOUND) -+ -+MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL) -diff --git a/cmake/FindWiiUse.cmake b/cmake/FindWiiUse.cmake -new file mode 100644 -index 0000000..2657cbb ---- /dev/null -+++ b/cmake/FindWiiUse.cmake -@@ -0,0 +1,99 @@ -+# - try to find WiiUse library -+# -+# Cache Variables: (probably not for direct use in your scripts) -+# WIIUSE_INCLUDE_DIR -+# WIIUSE_LIBRARY -+# -+# Non-cache variables you might use in your CMakeLists.txt: -+# WIIUSE_FOUND -+# WIIUSE_INCLUDE_DIRS -+# WIIUSE_LIBRARIES -+# WIIUSE_RUNTIME_LIBRARIES - aka the dll for installing -+# WIIUSE_RUNTIME_LIBRARY_DIRS -+# -+# Requires these CMake modules: -+# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) -+# -+# Original Author: -+# 2009-2010 Ryan Pavlik -+# http://academic.cleardefinition.com -+# Iowa State University HCI Graduate Program/VRAC -+# -+# Copyright Iowa State University 2009-2010. -+# Distributed under the Boost Software License, Version 1.0. -+# (See accompanying file LICENSE_1_0.txt or copy at -+# http://www.boost.org/LICENSE_1_0.txt) -+ -+set(WIIUSE_ROOT_DIR -+ "${WIIUSE_ROOT_DIR}" -+ CACHE -+ PATH -+ "Directory to search for WiiUse") -+ -+if(CMAKE_SIZEOF_VOID_P MATCHES "8") -+ set(_LIBSUFFIXES /lib64 /lib) -+else() -+ set(_LIBSUFFIXES /lib) -+endif() -+ -+find_library(WIIUSE_LIBRARY -+ NAMES -+ wiiuse -+ PATHS -+ "${WIIUSE_ROOT_DIR}" -+ PATH_SUFFIXES -+ "${_LIBSUFFIXES}") -+ -+get_filename_component(_libdir "${WIIUSE_LIBRARY}" PATH) -+ -+find_path(WIIUSE_INCLUDE_DIR -+ NAMES -+ wiiuse.h -+ HINTS -+ "${_libdir}" -+ "${_libdir}/.." -+ PATHS -+ "${WIIUSE_ROOT_DIR}" -+ PATH_SUFFIXES -+ include/) -+ -+set(_deps_check) -+if(WIN32) -+ find_file(WIIUSE_RUNTIME_LIBRARY -+ NAMES -+ wiiuse.dll -+ HINTS -+ "${_libdir}" -+ "${_libdir}/.." -+ PATH_SUFFIXES -+ bin) -+ -+ set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}") -+ get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS -+ "${WIIUSE_RUNTIME_LIBRARY}" -+ PATH) -+ list(APPEND _deps_check WIIUSE_RUNTIME_LIBRARY) -+else() -+ set(WIIUSE_RUNTIME_LIBRARY "${WIIUSE_LIBRARY}") -+ set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}") -+ get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS -+ "${WIIUSE_LIBRARY}" -+ PATH) -+endif() -+ -+include(FindPackageHandleStandardArgs) -+find_package_handle_standard_args(WiiUse -+ DEFAULT_MSG -+ WIIUSE_LIBRARY -+ WIIUSE_INCLUDE_DIR -+ ${_deps_check}) -+ -+if(WIIUSE_FOUND) -+ set(WIIUSE_LIBRARIES "${WIIUSE_LIBRARY}") -+ set(WIIUSE_INCLUDE_DIRS "${WIIUSE_INCLUDE_DIR}") -+ mark_as_advanced(WIIUSE_ROOT_DIR) -+endif() -+ -+mark_as_advanced(WIIUSE_INCLUDE_DIR -+ WIIUSE_LIBRARY -+ WIIUSE_RUNTIME_LIBRARY) --- -1.9.0 - diff --git a/0003-unbundle-enet.patch b/0003-unbundle-enet.patch new file mode 100644 index 0000000..ed4906a --- /dev/null +++ b/0003-unbundle-enet.patch @@ -0,0 +1,94 @@ +From f71003a718a75843a4936702ec3c2bd90e804e3f Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 14 May 2014 16:28:29 +0400 +Subject: [PATCH 3/5] unbundle enet + +Signed-off-by: Igor Gnatenko +--- + CMakeLists.txt | 6 +++--- + cmake/FindENet.cmake | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 52 insertions(+), 3 deletions(-) + create mode 100644 cmake/FindENet.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9672f3f..bd525f8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -45,8 +45,8 @@ string(REGEX REPLACE "\\." "" BULLET_VERSION_INT ${BULLET_VERSION}) + add_definitions(-DBULLET_VERSION=${BULLET_VERSION_INT}) + + # Build the ENet UDP network library +-add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet") +-include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include") ++find_package(ENet REQUIRED) ++include_directories(${ENet_INCLUDE_DIRS}) + + # Build the irrlicht library + add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht") +@@ -227,7 +227,7 @@ endif() + # Common library dependencies + target_link_libraries(supertuxkart + ${BULLET_LIBRARIES} +- enet ++ ${ENet_LIBRARIES} + stkirrlicht + ${CURL_LIBRARIES} + ${OGGVORBIS_LIBRARIES} +diff --git a/cmake/FindENet.cmake b/cmake/FindENet.cmake +new file mode 100644 +index 0000000..b6c146c +--- /dev/null ++++ b/cmake/FindENet.cmake +@@ -0,0 +1,49 @@ ++# - Try to find enet ++# Once done this will define ++# ++# ENET_FOUND - system has enet ++# ENet_INCLUDE_DIRS - the enet include directory ++# ENet_LIBRARIES - the libraries needed to use enet ++# ++# $ENETDIR is an environment variable used for finding enet. ++# ++# Borrowed from The Mana World ++# http://themanaworld.org/ ++# ++# Several changes and additions by Fabian 'x3n' Landau ++# Lots of simplifications by Adrian Friedli ++# > www.orxonox.net < ++ ++FIND_PATH(ENet_INCLUDE_DIRS enet/enet.h ++ PATHS ++ $ENV{ENETDIR} ++ /usr/local ++ /usr ++ PATH_SUFFIXES include ++ ) ++ ++FIND_LIBRARY(ENet_LIBRARY ++ NAMES enet ++ PATHS ++ $ENV{ENETDIR} ++ /usr/local ++ /usr ++ PATH_SUFFIXES lib ++ ) ++ ++# handle the QUIETLY and REQUIRED arguments and set ENET_FOUND to TRUE if ++# all listed variables are TRUE ++INCLUDE(FindPackageHandleStandardArgs) ++FIND_PACKAGE_HANDLE_STANDARD_ARGS(ENet DEFAULT_MSG ENet_LIBRARY ENet_INCLUDE_DIRS) ++ ++IF (ENET_FOUND) ++ IF(WIN32) ++ SET(WINDOWS_ENET_DEPENDENCIES "ws2_32;winmm") ++ SET(ENet_LIBRARIES ${ENet_LIBRARY} ${WINDOWS_ENET_DEPENDENCIES}) ++ ELSE(WIN32) ++ SET(ENet_LIBRARIES ${ENet_LIBRARY}) ++ ENDIF(WIN32) ++ENDIF (ENET_FOUND) ++ ++MARK_AS_ADVANCED(ENet_LIBRARY ENet_LIBRARIES ENet_INCLUDE_DIRS) ++ +-- +1.9.0 + diff --git a/0004-unbundle-irrlicht.patch b/0004-unbundle-irrlicht.patch new file mode 100644 index 0000000..c2ca27b --- /dev/null +++ b/0004-unbundle-irrlicht.patch @@ -0,0 +1,143 @@ +From d86ff9a4e8ee4d7df53f26a686a0e4defcd749be Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 14 May 2014 16:39:13 +0400 +Subject: [PATCH 4/5] unbundle irrlicht + +Signed-off-by: Igor Gnatenko +--- + CMakeLists.txt | 8 ++--- + cmake/FindIrrlicht.cmake | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 98 insertions(+), 4 deletions(-) + create mode 100644 cmake/FindIrrlicht.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bd525f8..861b76c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -49,8 +49,8 @@ find_package(ENet REQUIRED) + include_directories(${ENet_INCLUDE_DIRS}) + + # Build the irrlicht library +-add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht") +-include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/include") ++find_package(Irrlicht REQUIRED) ++include_directories(${IRRLICHT_INCLUDE_DIR}) + + # Build the Wiiuse library + # Note: wiiuse MUST be declared after irrlicht, since otherwise +@@ -228,10 +228,10 @@ endif() + target_link_libraries(supertuxkart + ${BULLET_LIBRARIES} + ${ENet_LIBRARIES} +- stkirrlicht ++ ${IRRLICHT_LIBRARIES} ++ IrrXML + ${CURL_LIBRARIES} + ${OGGVORBIS_LIBRARIES} +- ${IRRLICHT_XF86VM_LIBRARY} + ${OPENAL_LIBRARY} + ${OPENGL_LIBRARIES}) + +diff --git a/cmake/FindIrrlicht.cmake b/cmake/FindIrrlicht.cmake +new file mode 100644 +index 0000000..8c94ec2 +--- /dev/null ++++ b/cmake/FindIrrlicht.cmake +@@ -0,0 +1,94 @@ ++#FindIrrlicht.cmake ++ ++set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)") ++ ++if( UNIX ) ++ # Unix ++else( UNIX ) ++ # Windows ++endif( UNIX ) ++ ++# Find include directory ++ ++if(NOT IRRLICHT_SOURCE_DIR STREQUAL "") ++ set(IRRLICHT_SOURCE_DIR_INCLUDE ++ "${IRRLICHT_SOURCE_DIR}/include" ++ ) ++ ++ set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a Irrlicht Irrlicht.lib) ++ ++ if(WIN32) ++ if(MSVC) ++ set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio") ++ set(IRRLICHT_LIBRARY_NAMES Irrlicht.lib) ++ else() ++ set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc") ++ set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a libIrrlicht.dll.a) ++ endif() ++ else() ++ set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Linux") ++ set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a) ++ endif() ++ ++ FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h ++ PATHS ++ ${IRRLICHT_SOURCE_DIR_INCLUDE} ++ NO_DEFAULT_PATH ++ ) ++ ++ FIND_LIBRARY(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES} ++ PATHS ++ ${IRRLICHT_SOURCE_DIR_LIBS} ++ NO_DEFAULT_PATH ++ ) ++ ++else() ++ ++ FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h ++ PATHS ++ /usr/local/include/irrlicht ++ /usr/include/irrlicht ++ ) ++ ++ FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.so Irrlicht ++ PATHS ++ /usr/local/lib ++ /usr/lib ++ /usr/lib64 ++ ) ++endif() ++ ++MESSAGE(STATUS "IRRLICHT_SOURCE_DIR = ${IRRLICHT_SOURCE_DIR}") ++MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}") ++MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}") ++ ++# On windows, find the dll for installation ++if(WIN32) ++ if(MSVC) ++ FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll ++ PATHS ++ "${IRRLICHT_SOURCE_DIR}/bin/Win32-VisualStudio" ++ DOC "Path of the Irrlicht dll (for installation)" ++ ) ++ else() ++ FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll ++ PATHS ++ "${IRRLICHT_SOURCE_DIR}/bin/Win32-gcc" ++ DOC "Path of the Irrlicht dll (for installation)" ++ ) ++ endif() ++ MESSAGE(STATUS "IRRLICHT_DLL = ${IRRLICHT_DLL}") ++endif(WIN32) ++ ++# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if ++# all listed variables are TRUE ++INCLUDE(FindPackageHandleStandardArgs) ++FIND_PACKAGE_HANDLE_STANDARD_ARGS(IRRLICHT DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR) ++ ++IF(IRRLICHT_FOUND) ++ SET(IRRLICHT_LIBRARIES ${IRRLICHT_LIBRARY}) ++ELSE(IRRLICHT_FOUND) ++ SET(IRRLICHT_LIBRARIES) ++ENDIF(IRRLICHT_FOUND) ++ ++MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL) +-- +1.9.0 + diff --git a/0005-unbundle-wiiuse.patch b/0005-unbundle-wiiuse.patch new file mode 100644 index 0000000..414145a --- /dev/null +++ b/0005-unbundle-wiiuse.patch @@ -0,0 +1,146 @@ +From f67c7bee8b308c2e8427154cee2ab9290befca7d Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 14 May 2014 16:44:37 +0400 +Subject: [PATCH 5/5] unbundle wiiuse + +Signed-off-by: Igor Gnatenko +--- + CMakeLists.txt | 7 ++-- + cmake/FindWiiUse.cmake | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 102 insertions(+), 4 deletions(-) + create mode 100644 cmake/FindWiiUse.cmake + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 861b76c..a28498c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -57,10 +57,9 @@ include_directories(${IRRLICHT_INCLUDE_DIR}) + # (at least on VS) irrlicht will find wiiuse io.h file because + # of the added include directory. + if(USE_WIIUSE) +- if(WIIUSE_BUILD) +- add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse") +- endif() + include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse") ++ find_package(WiiUse REQUIRED) ++ include_directories(${WIIUSE_INCLUDE_DIR}) + endif() + + +@@ -263,7 +262,7 @@ if(USE_WIIUSE) + target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/wiiuse.lib) + endif() + else() +- target_link_libraries(supertuxkart wiiuse bluetooth) ++ target_link_libraries(supertuxkart ${WIIUSE_LIBRARIES}) + endif() + add_definitions(-DENABLE_WIIUSE) + +diff --git a/cmake/FindWiiUse.cmake b/cmake/FindWiiUse.cmake +new file mode 100644 +index 0000000..2657cbb +--- /dev/null ++++ b/cmake/FindWiiUse.cmake +@@ -0,0 +1,99 @@ ++# - try to find WiiUse library ++# ++# Cache Variables: (probably not for direct use in your scripts) ++# WIIUSE_INCLUDE_DIR ++# WIIUSE_LIBRARY ++# ++# Non-cache variables you might use in your CMakeLists.txt: ++# WIIUSE_FOUND ++# WIIUSE_INCLUDE_DIRS ++# WIIUSE_LIBRARIES ++# WIIUSE_RUNTIME_LIBRARIES - aka the dll for installing ++# WIIUSE_RUNTIME_LIBRARY_DIRS ++# ++# Requires these CMake modules: ++# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) ++# ++# Original Author: ++# 2009-2010 Ryan Pavlik ++# http://academic.cleardefinition.com ++# Iowa State University HCI Graduate Program/VRAC ++# ++# Copyright Iowa State University 2009-2010. ++# Distributed under the Boost Software License, Version 1.0. ++# (See accompanying file LICENSE_1_0.txt or copy at ++# http://www.boost.org/LICENSE_1_0.txt) ++ ++set(WIIUSE_ROOT_DIR ++ "${WIIUSE_ROOT_DIR}" ++ CACHE ++ PATH ++ "Directory to search for WiiUse") ++ ++if(CMAKE_SIZEOF_VOID_P MATCHES "8") ++ set(_LIBSUFFIXES /lib64 /lib) ++else() ++ set(_LIBSUFFIXES /lib) ++endif() ++ ++find_library(WIIUSE_LIBRARY ++ NAMES ++ wiiuse ++ PATHS ++ "${WIIUSE_ROOT_DIR}" ++ PATH_SUFFIXES ++ "${_LIBSUFFIXES}") ++ ++get_filename_component(_libdir "${WIIUSE_LIBRARY}" PATH) ++ ++find_path(WIIUSE_INCLUDE_DIR ++ NAMES ++ wiiuse.h ++ HINTS ++ "${_libdir}" ++ "${_libdir}/.." ++ PATHS ++ "${WIIUSE_ROOT_DIR}" ++ PATH_SUFFIXES ++ include/) ++ ++set(_deps_check) ++if(WIN32) ++ find_file(WIIUSE_RUNTIME_LIBRARY ++ NAMES ++ wiiuse.dll ++ HINTS ++ "${_libdir}" ++ "${_libdir}/.." ++ PATH_SUFFIXES ++ bin) ++ ++ set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}") ++ get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS ++ "${WIIUSE_RUNTIME_LIBRARY}" ++ PATH) ++ list(APPEND _deps_check WIIUSE_RUNTIME_LIBRARY) ++else() ++ set(WIIUSE_RUNTIME_LIBRARY "${WIIUSE_LIBRARY}") ++ set(WIIUSE_RUNTIME_LIBRARIES "${WIIUSE_RUNTIME_LIBRARY}") ++ get_filename_component(WIIUSE_RUNTIME_LIBRARY_DIRS ++ "${WIIUSE_LIBRARY}" ++ PATH) ++endif() ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args(WiiUse ++ DEFAULT_MSG ++ WIIUSE_LIBRARY ++ WIIUSE_INCLUDE_DIR ++ ${_deps_check}) ++ ++if(WIIUSE_FOUND) ++ set(WIIUSE_LIBRARIES "${WIIUSE_LIBRARY}") ++ set(WIIUSE_INCLUDE_DIRS "${WIIUSE_INCLUDE_DIR}") ++ mark_as_advanced(WIIUSE_ROOT_DIR) ++endif() ++ ++mark_as_advanced(WIIUSE_INCLUDE_DIR ++ WIIUSE_LIBRARY ++ WIIUSE_RUNTIME_LIBRARY) +-- +1.9.0 + diff --git a/supertuxkart.spec b/supertuxkart.spec index e843650..bb3e5dc 100644 --- a/supertuxkart.spec +++ b/supertuxkart.spec @@ -1,6 +1,6 @@ Name: supertuxkart Version: 0.8.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Kids 3D go-kart racing game featuring Tux Group: Amusements/Games License: GPLv2+ and GPLv3 and CC-BY-SA @@ -11,8 +11,10 @@ Source2: supertuxkart-0.7.3-license-clarification.txt Patch0: supertuxkart-fhs.patch # tracked in github.com/ignatenkobrain/stk-code/ in fedora-0.8.1 branch Patch1: 0001-fix-.desktop-file-and-install-destinations.patch -Patch2: 0002-fix-srcs-for-new-bullet-API.patch -Patch3: 0003-unbundle-all-libs.patch +Patch2: 0002-unbundle-bullet.patch +Patch3: 0003-unbundle-enet.patch +Patch4: 0004-unbundle-irrlicht.patch +Patch5: 0005-unbundle-wiiuse.patch BuildRequires: cmake BuildRequires: libvorbis-devel freeglut-devel desktop-file-utils BuildRequires: openal-soft-devel freealut-devel >= 1.1.0-10 libtool @@ -47,6 +49,8 @@ cp -p %{SOURCE2} . %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 # Delete bundled libs rm -rf lib/ sed -i -e '/setAnimationStrength/s/^/\/\//' src/karts/kart_model.cpp @@ -89,6 +93,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %{_datadir}/%{name} %changelog +* Wed May 14 2014 Igor Gnatenko - 0.8.1-5 +- fix building with old bullet + * Sun May 11 2014 Igor Gnatenko - 0.8.1-4 - enable wiimote support (asked in stk-owner@)