Various fixes for building on OpenBSD.
This commit is contained in:
parent
5615c39175
commit
f3d1135320
7 changed files with 51 additions and 5 deletions
2
3rdparty/hts_engine_API/lib/HTS_misc.c
vendored
2
3rdparty/hts_engine_API/lib/HTS_misc.c
vendored
|
@ -245,7 +245,7 @@ size_t HTS_ftell(HTS_File * fp)
|
||||||
} else if (fp->type == HTS_FILE) {
|
} else if (fp->type == HTS_FILE) {
|
||||||
fpos_t pos;
|
fpos_t pos;
|
||||||
fgetpos((FILE *) fp->pointer, &pos);
|
fgetpos((FILE *) fp->pointer, &pos);
|
||||||
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__ANDROID__)
|
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__ANDROID__) || defined(__OpenBSD__)
|
||||||
return (size_t) pos;
|
return (size_t) pos;
|
||||||
#else
|
#else
|
||||||
return (size_t) pos.__pos;
|
return (size_t) pos.__pos;
|
||||||
|
|
4
3rdparty/joystick/jsNone.cxx
vendored
4
3rdparty/joystick/jsNone.cxx
vendored
|
@ -22,6 +22,10 @@
|
||||||
|
|
||||||
#include "js.h"
|
#include "js.h"
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
#define TRUE JS_TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
struct os_specific_s ;
|
struct os_specific_s ;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,8 @@ elseif(WIN32)
|
||||||
MESSAGE("Installing: ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}")
|
MESSAGE("Installing: ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}")
|
||||||
|
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR
|
||||||
${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
|
||||||
|
${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11 REQUIRED)
|
||||||
|
|
||||||
|
@ -233,6 +234,10 @@ if(SP_FDMS)
|
||||||
set(ENABLE_SP_FDM 1)
|
set(ENABLE_SP_FDM 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||||
|
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib/libspeex/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(ENABLE_FGCOM)
|
if(ENABLE_FGCOM)
|
||||||
set(ENABLE_IAX 1)
|
set(ENABLE_IAX 1)
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib ) # for iaxclient.h
|
include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib ) # for iaxclient.h
|
||||||
|
@ -246,7 +251,7 @@ if(EVENT_INPUT)
|
||||||
add_definitions(-DWITH_EVENTINPUT)
|
add_definitions(-DWITH_EVENTINPUT)
|
||||||
find_library(IOKIT_FRAMEWORK IOKit)
|
find_library(IOKIT_FRAMEWORK IOKit)
|
||||||
list(APPEND EVENT_INPUT_LIBRARIES ${IOKIT_FRAMEWORK})
|
list(APPEND EVENT_INPUT_LIBRARIES ${IOKIT_FRAMEWORK})
|
||||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD")
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|FreeBSD|OpenBSD")
|
||||||
if(NOT UDEV_FOUND)
|
if(NOT UDEV_FOUND)
|
||||||
message(WARNING "UDev not found, event input is disabled!")
|
message(WARNING "UDev not found, event input is disabled!")
|
||||||
set(EVENT_INPUT 0)
|
set(EVENT_INPUT 0)
|
||||||
|
@ -321,6 +326,10 @@ if (MSVC)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||||
|
# include_directories("${CMAKE_SOURCE_DIR}/3rdparty/iaxclient/lib/libspeex/include")
|
||||||
|
#endif()
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
## Sqlite3 setup
|
## Sqlite3 setup
|
||||||
|
|
||||||
|
|
|
@ -84,4 +84,8 @@ function(setup_fgfs_libraries target)
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||||
target_link_libraries(${target} execinfo)
|
target_link_libraries(${target} execinfo)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||||
|
target_link_libraries(${target} execinfo)
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -163,6 +163,7 @@ void segfault_handler(int signo) {
|
||||||
|
|
||||||
fprintf(stderr, "Error: caught signal %d:\n", signo);
|
fprintf(stderr, "Error: caught signal %d:\n", signo);
|
||||||
|
|
||||||
|
#ifndef __OpenBSD__
|
||||||
size = backtrace(array, 128);
|
size = backtrace(array, 128);
|
||||||
if (size) {
|
if (size) {
|
||||||
char** list = backtrace_symbols(array, size);
|
char** list = backtrace_symbols(array, size);
|
||||||
|
@ -199,6 +200,7 @@ void segfault_handler(int signo) {
|
||||||
free(fname);
|
free(fname);
|
||||||
free(list);
|
free(list);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,10 @@ extern bool global_crashRptEnabled;
|
||||||
#include <GUI/QtLauncher.hxx>
|
#include <GUI/QtLauncher.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace flightgear;
|
using namespace flightgear;
|
||||||
|
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
|
@ -532,7 +536,7 @@ int fgMainInit( int argc, char **argv )
|
||||||
// level once startup is done.
|
// level once startup is done.
|
||||||
sglog().setLogLevels( SG_ALL, SG_INFO );
|
sglog().setLogLevels( SG_ALL, SG_INFO );
|
||||||
sglog().setStartupLoggingEnabled(true);
|
sglog().setStartupLoggingEnabled(true);
|
||||||
|
|
||||||
globals = new FGGlobals;
|
globals = new FGGlobals;
|
||||||
if (!fgInitHome()) {
|
if (!fgInitHome()) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -555,6 +559,29 @@ int fgMainInit( int argc, char **argv )
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Minimum supported OpenScenegraph is V3.4.1 - currently using " << osgGetVersion() << " This can cause fatal OSG 'final reference count' errors at runtime");
|
SG_LOG(SG_GENERAL, SG_ALERT, "Minimum supported OpenScenegraph is V3.4.1 - currently using " << osgGetVersion() << " This can cause fatal OSG 'final reference count' errors at runtime");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
{
|
||||||
|
/* OpenBSD defaults to a small maximum data segment, which can cause
|
||||||
|
flightgear to crash with SIGBUS, so output a warning if this is likely.
|
||||||
|
*/
|
||||||
|
struct rlimit rlimit;
|
||||||
|
int e = getrlimit(RLIMIT_DATA, &rlimit);
|
||||||
|
if (e) {
|
||||||
|
SG_LOG( SG_GENERAL, SG_INFO, "This is OpenBSD; getrlimit() failed: " << strerror(errno));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
long long required = 4LL * (1LL<<30);
|
||||||
|
if (rlimit.rlim_cur < required) {
|
||||||
|
SG_LOG( SG_GENERAL, SG_POPUP, ""
|
||||||
|
<< "Max data segment (" << rlimit.rlim_cur << "bytes) too small.\n"
|
||||||
|
<< "This can cause Flightgear to crash due to SIGBUS.\n"
|
||||||
|
<< "E.g. increase with 'ulimit -d " << required/1024 << "'."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// seed the random number generator
|
// seed the random number generator
|
||||||
sg_srandom_time();
|
sg_srandom_time();
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ using namespace std;
|
||||||
using namespace simgear;
|
using namespace simgear;
|
||||||
|
|
||||||
// text color
|
// text color
|
||||||
#if defined(__linux__) || defined(__sun) || defined(__CYGWIN__) || defined( __FreeBSD__ ) || defined ( sgi )
|
#if defined(__linux__) || defined(__sun) || defined(__CYGWIN__) || defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined ( sgi )
|
||||||
# define R "\033[31;1m" // red
|
# define R "\033[31;1m" // red
|
||||||
# define G "\033[32;1m" // green
|
# define G "\033[32;1m" // green
|
||||||
# define Y "\033[33;1m" // yellow
|
# define Y "\033[33;1m" // yellow
|
||||||
|
|
Loading…
Add table
Reference in a new issue