Recipe for "speed dreams".

This commit is contained in:
Adrien Destugues
2016-01-24 17:00:23 +01:00
parent 9efb6a54e4
commit 72857d0ed4
2 changed files with 262 additions and 0 deletions

View File

@@ -0,0 +1,192 @@
From 6d2b5532404c192832d2164eac0fc571af9c9b33 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 14:37:04 +0100
Subject: Haiku fixes
- Search for plib in the right place
- Do not try to use X11
diff --git a/cmake/FindPLIB.cmake b/cmake/FindPLIB.cmake
index 519c3c0..eb167aa 100644
--- a/cmake/FindPLIB.cmake
+++ b/cmake/FindPLIB.cmake
@@ -16,14 +16,14 @@ IF(NOT APPLE)
FIND_PATH(PLIB_PLIBINCLUDE_DIR plib/ssg.h
HINTS ENV PLIB_DIR
PATH_SUFFIXES
- Headers include/plib include
+ Headers include/plib include develop/headers develop/headers/plib
PATHS
#Additional MacOS Paths
- ~/Library/Frameworks/plib.framework
- /Library/Frameworks/plib.framework
- /System/Library/Frameworks/plib.framework # Tiger
-
+ ~/Library/Frameworks/plib.framework
+ /Library/Frameworks/plib.framework
+ /System/Library/Frameworks/plib.framework # Tiger
/usr /usr/local
+ /system
DOC "Location of plib")
ENDIF(NOT APPLE)
diff --git a/src/libs/tgfclient/CMakeLists.txt b/src/libs/tgfclient/CMakeLists.txt
index 28cbc42..820bab1 100644
--- a/src/libs/tgfclient/CMakeLists.txt
+++ b/src/libs/tgfclient/CMakeLists.txt
@@ -55,12 +55,12 @@ IF(WIN32)
TARGET_LINK_LIBRARIES(tgfclient winmm)
ENDIF(WIN32)
-IF(UNIX)
+IF(UNIX AND NOT HAIKU)
ADD_X11_LIBRARY(tgfclient)
IF(OPTION_XRANDR)
ADD_XRANDR_LIBRARY(tgfclient)
ENDIF(OPTION_XRANDR)
-ENDIF(UNIX)
+ENDIF(UNIX AND NOT HAIKU)
IF(UNIX)
SD_INSTALL_FILES(LIB lib TARGETS tgfclient)
--
2.7.0
From a10bc460b15c85fb4dca46b58314d93e5794cfb5 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 16:09:57 +0100
Subject: Disable code unsupported on Haiku.
diff --git a/src/libs/tgf/linuxspec.cpp b/src/libs/tgf/linuxspec.cpp
index 042eb39..0c3adfb 100644
--- a/src/libs/tgf/linuxspec.cpp
+++ b/src/libs/tgf/linuxspec.cpp
@@ -690,6 +690,7 @@ unsigned linuxGetNumberOfCPUs()
* Remarks
*
*/
+#ifndef __HAIKU__
std::string cpuSet2String(const cpu_set_t* pCPUSet)
{
std::ostringstream ossCPUSet;
@@ -703,6 +704,7 @@ std::string cpuSet2String(const cpu_set_t* pCPUSet)
return ossCPUSet.str();
}
+#endif
bool
linuxSetThreadAffinity(int nCPUId)
--
2.7.0
From a642d83163efdcf233c7bb044d183cf91c3662fd Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 16:20:36 +0100
Subject: isnan vs std::isnan.
diff --git a/src/drivers/human/human.cpp b/src/drivers/human/human.cpp
index 7011a19..76373e5 100644
--- a/src/drivers/human/human.cpp
+++ b/src/drivers/human/human.cpp
@@ -1094,7 +1094,7 @@ common_drive(const int index, tCarElt* car, tSituation *s)
}
ax0 = ax0 * cmd[CMD_THROTTLE].pow;
car->_accelCmd = pow(fabs(ax0), 1.0f / cmd[CMD_THROTTLE].sens) / (1.0 + cmd[CMD_THROTTLE].spdSens * car->_speed_x / 1000.0);
- if (isnan (car->_accelCmd)) {
+ if (std::isnan (car->_accelCmd)) {
car->_accelCmd = 0;
}
/* printf(" axO:%f accelCmd:%f\n", ax0, car->_accelCmd); */
diff --git a/src/libs/learning/policy.cpp b/src/libs/learning/policy.cpp
index 665528b..0c9c2bf 100644
--- a/src/libs/learning/policy.cpp
+++ b/src/libs/learning/policy.cpp
@@ -436,7 +436,7 @@ int DiscretePolicy::SelectAction (int s, real r, int forced_a)
// if P[][] remains unchanged between updates.
// -- removed because it doesn't work! --
//P[i][j] += 0.01*delta * e[i][j] * (1.-P[i][j]);
- if ((fabs (Q[i][j])>1000.0)||(isnan(Q[i][j]))) {
+ if ((fabs (Q[i][j])>1000.0)||(std::isnan(Q[i][j]))) {
printf ("u: %d %d %f %f\n", i,j,Q[i][j], ad * e[i][j]);
}
@@ -522,7 +522,7 @@ void DiscretePolicy::loadFile (char* f)
if( readSize < (int unsigned)n_actions )
fprintf(stderr, "Error when reading file");
for (j=0; j<n_actions; j++) {
- if ((fabs (Q[i][j])>100.0)||(isnan(Q[i][j]))) {
+ if ((fabs (Q[i][j])>100.0)||(std::isnan(Q[i][j]))) {
printf ("l: %d %d %f\n", i,j,Q[i][j]);
Q[i][j] = 0.0;
}
@@ -585,7 +585,7 @@ void DiscretePolicy::saveFile (char* f) {
if( writeSize < (int unsigned)n_actions)
fprintf( stderr, "Failed to write all data to file %s\n", f);
for (int j=0; j<n_actions; j++) {
- if ((fabs (Q[i][j])>100.0)||(isnan(Q[i][j]))) {
+ if ((fabs (Q[i][j])>100.0)||(std::isnan(Q[i][j]))) {
printf ("s: %d %d %f\n", i,j,Q[i][j]);
}
}
diff --git a/src/modules/simu/simuv2.1/simu.cpp b/src/modules/simu/simuv2.1/simu.cpp
index 0c39a83..c12adbf 100644
--- a/src/modules/simu/simuv2.1/simu.cpp
+++ b/src/modules/simu/simuv2.1/simu.cpp
@@ -28,6 +28,7 @@
#include "sim.h"
+using namespace std;
tCar *SimCarTable = 0;
--
2.7.0
From e8f9258df870e75165c3b5c82c9049b7880132bf Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 16:22:54 +0100
Subject: Do not link against dl
diff --git a/src/tools/nfsperf/CMakeLists.txt b/src/tools/nfsperf/CMakeLists.txt
index fbfc0be..bc2fe61 100755
--- a/src/tools/nfsperf/CMakeLists.txt
+++ b/src/tools/nfsperf/CMakeLists.txt
@@ -16,9 +16,9 @@ ADD_EXECUTABLE(${_TARGET_NAME} ${NFSPERF_SOURCES})
ADD_SDLIB_LIBRARY(${_TARGET_NAME} tgf txml)
-IF(UNIX)
+IF(UNIX AND NOT HAIKU)
TARGET_LINK_LIBRARIES(${_TARGET_NAME} dl)
-ENDIF(UNIX)
+ENDIF(UNIX AND NOT HAIKU)
IF(UNIX)
SD_INSTALL_FILES(MAN man6 PREFIX ${SOURCE_DIR}/doc/man FILES ${_TARGET_NAME}.6)
diff --git a/src/tools/xmlversion/CMakeLists.txt b/src/tools/xmlversion/CMakeLists.txt
index 3518f93..e65a43e 100644
--- a/src/tools/xmlversion/CMakeLists.txt
+++ b/src/tools/xmlversion/CMakeLists.txt
@@ -20,9 +20,9 @@ ELSE(CMAKE_SKIP_RPATH OR CMAKE_SKIP_BUILD_RPATH)
ADD_SDLIB_LIBRARY(xmlversion tgf txml)
ENDIF(CMAKE_SKIP_RPATH OR CMAKE_SKIP_BUILD_RPATH)
-IF(UNIX)
+IF(UNIX AND NOT HAIKU)
TARGET_LINK_LIBRARIES(xmlversion dl)
-ENDIF(UNIX)
+ENDIF(UNIX AND NOT HAIKU)
GET_TARGET_PROPERTY(XMLVERSION_BUILDLOC xmlversion LOCATION)
FILE(WRITE ${CMAKE_BINARY_DIR}/xmlversion_loc.txt ${XMLVERSION_BUILDLOC})
--
2.7.0

View File

@@ -0,0 +1,70 @@
SUMMARY="Open Motorsport Simulator"
DESCRIPTION="Speed Dreams is a 3d cross-platform, open source motorsport simulation and racing game.
Speed Dreams is a fork of the open racing car simulator Torcs, aiming to implement exciting new \
features, cars, tracks and AI opponents to make a more enjoyable game for the player, as well as \
constantly improving visual and physics realism."
HOMEPAGE="http://www.speed-dreams.org/"
LICENSE="GNU GPL v2"
COPYRIGHT="2009 Jean-Philippe Meuret"
REVISION="1"
ARCHITECTURES="!x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
SOURCE_URI="http://sourceforge.net/projects/speed-dreams/files/2.0.0/speed-dreams-src-base-2.0.0-r4687.tar.xz"
CHECKSUM_SHA256="86d219caf26a9523345b2cc5fdb3d5daa1f7e272d409dc237ce5e2f0b37ae606"
SOURCE_DIR=""
PATCHES="speed_dreams-$portVersion.patchset"
SOURCE_URI_2="http://sourceforge.net/projects/speed-dreams/files/2.0.0/speed-dreams-src-partial-build-patch-2.0.0-r4687.tar.xz"
CHECKSUM_SHA256_2="1f01189b9af4bce3ed9de3e7fc16ca7bfa65f17b4c2ed3d3881537e880a0351c"
PROVIDES="
speed_dreams$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libenet$secondaryArchSuffix
lib:libglu$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:libopenal$secondaryArchSuffix
lib:libplibnet$secondaryArchSuffix
lib:libpng$secondaryArchSuffix
lib:libsdl$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libenet$secondaryArchSuffix
devel:libglu$secondaryArchSuffix
devel:libjpeg$secondaryArchSuffix
devel:libopenal$secondaryArchSuffix
devel:libplibnet$secondaryArchSuffix
devel:libpng$secondaryArchSuffix
devel:libsdl$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
"
BUILD()
{
# Apply the "partial build" patch
cp -r ../sources-2/* .
mkdir -p build
cd build
cmake .. -Wno-dev -DSD_LOCALDIR=~/config/settings/speed-dreams -DCMAKE_INSTALL_PREFIX=$appsDir
make $jobArgs
}
INSTALL()
{
cd build
make install
}