From 40b128abcc00f1729dc5057b97f09ee09b5a06dc Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 13 Feb 2022 08:55:25 +0000 Subject: [PATCH] solaris based systems port. V-Sync operation unsupported by the driver and pretty rudimentary grep. mostly linkage fixes otherwise. --- Resources/downloadpak.sh | 4 ++-- Sources/AngelScript/addons/scriptbuilder.cpp | 2 +- Sources/CMakeLists.txt | 7 +++++-- Sources/Core/VersionInfo.cpp | 2 ++ Sources/Gui/SDLRunner.cpp | 2 ++ Sources/Gui/StartupScreenHelper.cpp | 2 ++ Sources/Imports/OpenGL.h | 4 ++++ cmake/FindGLEW2.cmake | 4 ++-- 8 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Resources/downloadpak.sh b/Resources/downloadpak.sh index 2d19b455e..e180c37f5 100755 --- a/Resources/downloadpak.sh +++ b/Resources/downloadpak.sh @@ -13,11 +13,11 @@ OS_BASE="`uname`" SRC_DIR="`dirname "$0"`" # no color, not -m flag for OpenBSD -if [[ "$OS_BASE" != 'OpenBSD' ]]; then +if [[ "$OS_BASE" != 'OpenBSD' ]] && [[ "$OS_BASE" != 'SunOS' ]]; then PAK_URL=$(grep --max-count=1 --no-filename --context=0 --color=never \ "OpenSpadesDevPackage" "$SRC_DIR/PakLocation.txt") else - PAK_URL=$(grep --no-filename \ + PAK_URL=$(grep -h \ "OpenSpadesDevPackage" "$SRC_DIR/PakLocation.txt" | head -n1) fi echo "BASEURL ************ $PAK_URL" diff --git a/Sources/AngelScript/addons/scriptbuilder.cpp b/Sources/AngelScript/addons/scriptbuilder.cpp index 0de22dd09..c883dbaaa 100755 --- a/Sources/AngelScript/addons/scriptbuilder.cpp +++ b/Sources/AngelScript/addons/scriptbuilder.cpp @@ -1015,7 +1015,7 @@ string GetCurrentDir() #else return _getcwd(buffer, (int)1024); #endif // _MSC_VER -#elif defined(__APPLE__) || defined(__linux__) +#elif defined(__APPLE__) || defined(__linux__) || defined(__sun) return getcwd(buffer, 1024); #else return ""; diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index e702dda80..3483553df 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -144,9 +144,12 @@ elseif(UNIX AND NOT APPLE) endif() if(UNIX) - if(NOT(CMAKE_SYSTEM_NAME MATCHES "BSD" OR APPLE)) - if (NOT CMAKE_SYSTEM_NAME MATCHES "Haiku") + if(NOT(${CMAKE_SYSTEM_NAME} MATCHES "BSD" OR APPLE)) + if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Haiku") target_link_libraries(OpenSpades rt) + if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + target_link_libraries(OpenSpades socket nsl ogg vorbis vorbisfile opus) + endif() else() target_link_libraries(OpenSpades network) endif() diff --git a/Sources/Core/VersionInfo.cpp b/Sources/Core/VersionInfo.cpp index 856cf9b39..07a8aa825 100644 --- a/Sources/Core/VersionInfo.cpp +++ b/Sources/Core/VersionInfo.cpp @@ -50,6 +50,8 @@ std::string VersionInfo::GetVersionInfo() { return std::string("OpenBSD"); #elif defined(__NetBSD__) return std::string("NetBSD"); +#elif defined(__sun) + return std::string("Solaris / Illumos"); #elif defined(__HAIKU__) return std::string("Haiku"); #else diff --git a/Sources/Gui/SDLRunner.cpp b/Sources/Gui/SDLRunner.cpp index c55511d44..fa54d035b 100644 --- a/Sources/Gui/SDLRunner.cpp +++ b/Sources/Gui/SDLRunner.cpp @@ -519,11 +519,13 @@ namespace spades { Handle audio(CreateAudioDevice(), false); +#ifndef __sun if (rtype == RendererType::GL) { if (SDL_GL_SetSwapInterval(r_vsync) != 0) { SPRaise("SDL_GL_SetSwapInterval failed: %s", SDL_GetError()); } } +#endif RunClientLoop(renderer.GetPointerOrNull(), audio.GetPointerOrNull()); diff --git a/Sources/Gui/StartupScreenHelper.cpp b/Sources/Gui/StartupScreenHelper.cpp index e5ef12f58..a25068ccb 100644 --- a/Sources/Gui/StartupScreenHelper.cpp +++ b/Sources/Gui/StartupScreenHelper.cpp @@ -680,6 +680,8 @@ namespace spades { return "DragonFlyBSD"; #elif defined(__OpenBSD__) return "OpenBSD"; +#elif defined(__sun) + return "Solaris"; #elif defined(__HAIKU__) return "Haiku"; #else diff --git a/Sources/Imports/OpenGL.h b/Sources/Imports/OpenGL.h index cffcbacef..967bd57df 100644 --- a/Sources/Imports/OpenGL.h +++ b/Sources/Imports/OpenGL.h @@ -14,7 +14,11 @@ #include #include #else +#ifndef __sun #include +#else +#include +#endif // v3.3 / GL_ARB_occlusion_query2 #ifndef GL_ANY_SAMPLES_PASSED diff --git a/cmake/FindGLEW2.cmake b/cmake/FindGLEW2.cmake index 53047f007..36a3abe86 100644 --- a/cmake/FindGLEW2.cmake +++ b/cmake/FindGLEW2.cmake @@ -20,7 +20,7 @@ IF (WIN32) ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib DOC "The GLEW library") ELSE (WIN32) - FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h + FIND_PATH( GLEW_INCLUDE_DIR NAMES GL/glew.h glew.h /usr/include /usr/local/include /sw/include @@ -44,4 +44,4 @@ ELSE (GLEW_INCLUDE_DIR) SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise") ENDIF (GLEW_INCLUDE_DIR) -MARK_AS_ADVANCED( GLEW_FOUND ) \ No newline at end of file +MARK_AS_ADVANCED( GLEW_FOUND )