diff --git a/CMakeLists.txt b/CMakeLists.txt index 45d8c413..e2e1f578 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME MATCHES "GNU|kFreeBSD set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-reorder -Wno-unused-but-set-variable -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-unused-function -Wno-format") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reorder -Wno-unused-but-set-variable -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-unused-function -Wno-format") endif() -if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") SET(FREEBSD TRUE) endif() if(APPLE) diff --git a/README.md b/README.md index c2838444..9a3fa2ba 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,49 @@ make -j4 make install ``` +### OpenBSD + +#### Install the required packages +``` +sudo pkg_add bison cmake git sdl2 libogg libvorbis nasm +``` +#### Setting up the repository + +``` +git clone https://github.com/tx00100xt/SeriousSamClassic.git +``` + +#### Copy official game data (optional) + +If you have access to a copy of the game (either by CD or through Steam), +you can copy the *.gro files from the game directory to the repository. +(SeriousSamClassic/SamTFE is the directory of the game Serious Sam Classic The First Encounter, SeriousSamClassic/SamTSE is the directory of the game Serious Sam Classic The Second Encounter) + +#### Building for amd64 (for SS:TFE and SS:TSE) + +Type this in your terminal: + +``` +cd SeriousSamClassic +mkdir build +cd build +cmake .. +make -j4 +make install +``` +#### Building for i386 (for SS:TFE and SS:TSE) + +Type this in your terminal: + +``` +cd SeriousSamClassic +mkdir build +cd build +cmake .. -DCMAKE_C_FLAGS=-mmmx -DCMAKE_CXX_FLAGS=-mmmx -DCMAKE_SHARED_LINKER_FLAGS='-Wl,-znotext' -DUSE_I386_NASM_ASM=TRUE +make -j4 +make install +``` + ### macOS #### Install dependes @@ -321,6 +364,7 @@ Supported OS ----------- * `Linux` * `FreeBSD` +* `OpenBSD` * `Windows` * `Raspberry PI OS` * `macOS` diff --git a/SamTFE/Sources/Engine/Base/Base.h b/SamTFE/Sources/Engine/Base/Base.h index 0f021cf0..64793342 100644 --- a/SamTFE/Sources/Engine/Base/Base.h +++ b/SamTFE/Sources/Engine/Base/Base.h @@ -64,6 +64,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #define PLATFORM_MACOSX 1 #elif (defined __FreeBSD__) #define PLATFORM_FREEBSD 1 +#elif (defined __OpenBSD__) + #define PLATFORM_OPENBSD 1 + #define PLATFORM_FREEBSD 1 #else #warning "UNKNOWN PLATFORM IDENTIFIED!!!!" #define PLATFORM_UNKNOWN 1 diff --git a/SamTFE/Sources/Engine/Base/ListIterator.inl b/SamTFE/Sources/Engine/Base/ListIterator.inl index 5c3f1b05..ec91cb15 100644 --- a/SamTFE/Sources/Engine/Base/ListIterator.inl +++ b/SamTFE/Sources/Engine/Base/ListIterator.inl @@ -79,6 +79,12 @@ public: iter##next=iter, iter##next.IsPastEnd() || (iter##next.MoveToNext(),1), !iter.IsPastEnd(); \ iter = iter##next) +#ifdef PLATFORM_OPENBSD +#ifdef LIST_HEAD + #undef LIST_HEAD +#endif +#endif + // get the pointer to the first element in the list #define LIST_HEAD(listhead, baseclass, member) \ ( (baseclass *) ( ((UBYTE *)(&(listhead).Head())) - _offsetof(baseclass, member) ) ) diff --git a/SamTFE/Sources/Engine/Engine.h b/SamTFE/Sources/Engine/Engine.h index 176bf06a..8307f703 100644 --- a/SamTFE/Sources/Engine/Engine.h +++ b/SamTFE/Sources/Engine/Engine.h @@ -32,8 +32,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #if (!defined __INTEL_COMPILER) && (!defined PLATFORM_MACOSX) +#ifdef PLATFORM_OPENBSD +#include +#else #include #endif +#endif #include #include #include diff --git a/SamTFE/Sources/Engine/Templates/LinearAllocator.cpp b/SamTFE/Sources/Engine/Templates/LinearAllocator.cpp index 418f53bb..f9b6b319 100644 --- a/SamTFE/Sources/Engine/Templates/LinearAllocator.cpp +++ b/SamTFE/Sources/Engine/Templates/LinearAllocator.cpp @@ -148,6 +148,15 @@ inline void CLinearAllocator::Reset(void) // do nothing return; +#ifdef PLATFORM_OPENBSD +#ifdef LIST_HEAD + #undef LIST_HEAD +#endif +// get the pointer to the first element in the list +#define LIST_HEAD(listhead, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(listhead).Head())) - _offsetof(baseclass, member) ) ) +#endif + // if there is only one block allocated } else if (&la_lhBlocks.Head()==&la_lhBlocks.Tail()) { // just restart at the beginning diff --git a/SamTFE/Sources/GameMP/Game.cpp b/SamTFE/Sources/GameMP/Game.cpp index 8b4cc7a5..a8f36228 100644 --- a/SamTFE/Sources/GameMP/Game.cpp +++ b/SamTFE/Sources/GameMP/Game.cpp @@ -18,7 +18,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "StdAfx.h" #include "GameMP/Game.h" +#ifndef PLATFORM_OPENBSD #include +#endif #include #include diff --git a/SamTFE/Sources/SeriousSam/Menu.cpp b/SamTFE/Sources/SeriousSam/Menu.cpp index 86bb9f32..7503287c 100644 --- a/SamTFE/Sources/SeriousSam/Menu.cpp +++ b/SamTFE/Sources/SeriousSam/Menu.cpp @@ -2,7 +2,9 @@ #include "SeriousSam/StdH.h" #include +#ifndef PLATFORM_OPENBSD #include +#endif #include #ifdef PLATFORM_WIN32 diff --git a/SamTSE/Sources/Engine/Base/Base.h b/SamTSE/Sources/Engine/Base/Base.h index 0f021cf0..64793342 100644 --- a/SamTSE/Sources/Engine/Base/Base.h +++ b/SamTSE/Sources/Engine/Base/Base.h @@ -64,6 +64,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #define PLATFORM_MACOSX 1 #elif (defined __FreeBSD__) #define PLATFORM_FREEBSD 1 +#elif (defined __OpenBSD__) + #define PLATFORM_OPENBSD 1 + #define PLATFORM_FREEBSD 1 #else #warning "UNKNOWN PLATFORM IDENTIFIED!!!!" #define PLATFORM_UNKNOWN 1 diff --git a/SamTSE/Sources/Engine/Base/ListIterator.inl b/SamTSE/Sources/Engine/Base/ListIterator.inl index 5c3f1b05..ec91cb15 100644 --- a/SamTSE/Sources/Engine/Base/ListIterator.inl +++ b/SamTSE/Sources/Engine/Base/ListIterator.inl @@ -79,6 +79,12 @@ public: iter##next=iter, iter##next.IsPastEnd() || (iter##next.MoveToNext(),1), !iter.IsPastEnd(); \ iter = iter##next) +#ifdef PLATFORM_OPENBSD +#ifdef LIST_HEAD + #undef LIST_HEAD +#endif +#endif + // get the pointer to the first element in the list #define LIST_HEAD(listhead, baseclass, member) \ ( (baseclass *) ( ((UBYTE *)(&(listhead).Head())) - _offsetof(baseclass, member) ) ) diff --git a/SamTSE/Sources/Engine/Engine.h b/SamTSE/Sources/Engine/Engine.h index 176bf06a..8307f703 100644 --- a/SamTSE/Sources/Engine/Engine.h +++ b/SamTSE/Sources/Engine/Engine.h @@ -32,8 +32,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #if (!defined __INTEL_COMPILER) && (!defined PLATFORM_MACOSX) +#ifdef PLATFORM_OPENBSD +#include +#else #include #endif +#endif #include #include #include diff --git a/SamTSE/Sources/Engine/Templates/LinearAllocator.cpp b/SamTSE/Sources/Engine/Templates/LinearAllocator.cpp index 418f53bb..f9b6b319 100644 --- a/SamTSE/Sources/Engine/Templates/LinearAllocator.cpp +++ b/SamTSE/Sources/Engine/Templates/LinearAllocator.cpp @@ -148,6 +148,15 @@ inline void CLinearAllocator::Reset(void) // do nothing return; +#ifdef PLATFORM_OPENBSD +#ifdef LIST_HEAD + #undef LIST_HEAD +#endif +// get the pointer to the first element in the list +#define LIST_HEAD(listhead, baseclass, member) \ + ( (baseclass *) ( ((UBYTE *)(&(listhead).Head())) - _offsetof(baseclass, member) ) ) +#endif + // if there is only one block allocated } else if (&la_lhBlocks.Head()==&la_lhBlocks.Tail()) { // just restart at the beginning diff --git a/SamTSE/Sources/GameMP/Game.cpp b/SamTSE/Sources/GameMP/Game.cpp index f5b0fcb6..e8b36c9d 100644 --- a/SamTSE/Sources/GameMP/Game.cpp +++ b/SamTSE/Sources/GameMP/Game.cpp @@ -18,7 +18,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "StdAfx.h" #include "GameMP/Game.h" +#ifndef PLATFORM_OPENBSD #include +#endif #include #include diff --git a/SamTSE/Sources/SeriousSam/Menu.cpp b/SamTSE/Sources/SeriousSam/Menu.cpp index 86bb9f32..7503287c 100644 --- a/SamTSE/Sources/SeriousSam/Menu.cpp +++ b/SamTSE/Sources/SeriousSam/Menu.cpp @@ -2,7 +2,9 @@ #include "SeriousSam/StdH.h" #include +#ifndef PLATFORM_OPENBSD #include +#endif #include #ifdef PLATFORM_WIN32