File PATCH-FIX-OPENSUSE-cmake.patch of Package stepmania

diff -Nur stepmania-5.1.0-b2/CMake/DefineOptions.cmake new/CMake/DefineOptions.cmake
--- stepmania-5.1.0-b2/CMake/DefineOptions.cmake	2018-07-24 00:59:51.000000000 +0200
+++ new/CMake/DefineOptions.cmake	2019-05-19 08:46:35.092403428 +0200
@@ -62,6 +62,9 @@
     option(WITH_SYSTEM_FFMPEG "Build with the system's FFMPEG, disabled build with bundled's FFMPEG" OFF)
     option(WITH_CRYSTALHD_DISABLED "Build FFMPEG without Crystal HD support." OFF)
     option(WITH_MINIMAID "Build with Minimaid Lights Support." ON)
+    option(WITH_SYSTEM_LUA "Build with the system's lua library" OFF)
+    option(WITH_SYSTEM_JSONCPP "Build with the system's jsoncpp library" OFF)
+    option(WITH_SYSTEM_GLEW "Build with the system's glew library" OFF)
     option(WITH_TTY "Build with Linux TTY Input Support." OFF)
     option(WITH_PROFILING "Build with Profiling Support." OFF)
     option(WITH_GLES2 "Build with OpenGL ES 2.0 Support." ON)
diff -Nur stepmania-5.1.0-b2/CMake/Modules/FindGLEW.cmake new/CMake/Modules/FindGLEW.cmake
--- stepmania-5.1.0-b2/CMake/Modules/FindGLEW.cmake	1970-01-01 01:00:00.000000000 +0100
+++ new/CMake/Modules/FindGLEW.cmake	2019-05-19 08:09:01.000000000 +0200
@@ -0,0 +1,30 @@
+# - Try to find GLEW
+# and define
+#
+#  GLEW_FOUND          - System has GLEW
+#  GLEW_INCLUDE_DIR    - The GLEW include directories
+#  GLEW_LIBRARIES      - The GLEW libraries
+
+find_path(GLEW_INCLUDE_DIR NAMES GL/glew.h)
+
+# glew32d glew32sd 
+find_library(GLEW_LIBRARY 
+  NAMES GLEW glew32 glew32s 
+  PATHS ${GLEW_INCLUDE_DIR}/../lib lib
+)
+
+# get GLEW version from glew.h
+if(GLEW_INCLUDE_DIR AND EXISTS "${GLEW_INCLUDE_DIR}/GL/glew.h")
+  file(STRINGS "${GLEW_INCLUDE_DIR}/GL/glew.h" GLEW_VERSION_LINE REGEX "^VERSION [0-9].[0-9].[0-9]+$")        
+  string(REPLACE "VERSION " "" GLEW_VERSION "${GLEW_VERSION_LINE}")
+  unset(GLEW_VERSION_LINE)
+endif()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(GLEW 
+  REQUIRED_VARS GLEW_LIBRARY GLEW_INCLUDE_DIR
+  VERSION_VAR GLEW_VERSION
+)
+
+mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)
\ No newline at end of file
diff -Nur stepmania-5.1.0-b2/CMake/Modules/Findjsoncpp.cmake new/CMake/Modules/Findjsoncpp.cmake
--- stepmania-5.1.0-b2/CMake/Modules/Findjsoncpp.cmake	1970-01-01 01:00:00.000000000 +0100
+++ new/CMake/Modules/Findjsoncpp.cmake	2019-05-17 20:58:20.000000000 +0200
@@ -0,0 +1,50 @@
+# -*- cmake -*-
+# - Find JSONCpp
+# Find the JSONCpp includes and library
+# This module defines
+#  jsoncpp_INCLUDE_DIRS, where to find json.h, etc.
+#  jsoncpp_LIBRARIES, the libraries needed to use jsoncpp.
+#  jsoncpp_FOUND, If false, do not try to use jsoncpp.
+#  also defined, but not for general use are
+#  jsoncpp_LIBRARIES, where to find the jsoncpp library.
+
+FIND_PATH(jsoncpp_INCLUDE_DIRS json.h
+  /usr/include
+  /usr/local/include
+  PATH_SUFFIXES
+  jsoncpp/json jsoncpp json
+)
+
+FIND_LIBRARY(jsoncpp_LIBRARIES NAMES
+  jsoncpp
+  HINTS
+  /usr/lib /usr/lib64 /usr/local/lib
+)
+ message("libs: ${jsoncpp_LIBRARIES} inc ${jsoncpp_INCLUDE_DIRS}")
+IF (jsoncpp_LIBRARIES AND jsoncpp_INCLUDE_DIRS)
+  SET(jsoncpp_LIBRARIES ${jsoncpp_LIBRARIES})
+  SET(jsoncpp_FOUND TRUE)
+ELSE (jsoncpp_LIBRARIES AND jsoncpp_INCLUDE_DIRS)
+  SET(jsoncpp_FOUND FALSE)
+ENDIF (jsoncpp_LIBRARIES AND jsoncpp_INCLUDE_DIRS)
+
+
+IF (jsoncpp_FOUND)
+   IF (NOT jsoncpp_FIND_QUIETLY)
+      MESSAGE(STATUS "Found JSONCpp: ${jsoncpp_LIBRARIES}")
+   ENDIF (NOT jsoncpp_FIND_QUIETLY)
+ELSE (jsoncpp_FOUND)
+   IF (jsoncpp_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "Could not find JSONCPP library include: ${jsoncpp_INCLUDE_DIRS}, lib: ${jsoncpp_LIBRARIES}")
+   ENDIF (jsoncpp_FIND_REQUIRED)
+ENDIF (jsoncpp_FOUND)
+
+# Deprecated declarations.
+SET (NATIVE_jsoncpp_INCLUDE_PATH ${jsoncpp_INCLUDE_DIRS} )
+GET_FILENAME_COMPONENT (NATIVE_jsoncpp_LIB_PATH ${jsoncpp_LIBRARIES} PATH)
+
+MARK_AS_ADVANCED(
+  jsoncpp_FOUND
+  jsoncpp_LIBRARIES
+  jsoncpp_INCLUDE_DIRS
+)
diff -Nur stepmania-5.1.0-b2/CMake/SMDefs.cmake new/CMake/SMDefs.cmake
--- stepmania-5.1.0-b2/CMake/SMDefs.cmake	2018-07-24 00:59:51.000000000 +0200
+++ new/CMake/SMDefs.cmake	2019-05-19 09:46:26.255751291 +0200
@@ -11,12 +11,6 @@
   OUTPUT_STRIP_TRAILING_WHITESPACE
 )
 
-if(NOT (ret STREQUAL "0"))
-  message(WARNING "git was not found on your path. If you collect bug reports, please add git to your path and rerun cmake.")
-  set(SM_VERSION_GIT_HASH "UNKNOWN")
-  set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-${SM_VERSION_GIT_HASH}")
-  set(SM_VERSION_GIT "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-${SM_VERSION_GIT_HASH}")
-else()
   if (WITH_FULL_RELEASE)
     set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}.${SM_VERSION_PATCH}-b2")
     set(SM_VERSION_GIT "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}.${SM_VERSION_PATCH}-b2")
@@ -24,7 +18,6 @@
     set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-git-${SM_VERSION_GIT_HASH}")
     set(SM_VERSION_GIT "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-git-${SM_VERSION_GIT_HASH}")
   endif()
-endif()
 
 if (CMAKE_MAJOR_VERSION STREQUAL "3")
   # Use the CMake 3 approach whenever possible.
diff -Nur stepmania-5.1.0-b2/extern/CMakeLists.txt new/extern/CMakeLists.txt
--- stepmania-5.1.0-b2/extern/CMakeLists.txt	2018-07-24 00:59:51.000000000 +0200
+++ new/extern/CMakeLists.txt	2019-05-19 08:48:02.019751375 +0200
@@ -1,6 +1,12 @@
-include(CMakeProject-lua.cmake)
-include(CMakeProject-glew.cmake)
-include(CMakeProject-json.cmake)
+if(NOT WITH_SYSTEM_LUA)
+  include(CMakeProject-lua.cmake)
+endif()
+if(NOT WITH_SYSTEM_JSONCPP)
+  include(CMakeProject-json.cmake)
+endif()
+if (NOT WITH_SYSTEM_GLEW)
+  include(CMakeProject-glew.cmake)
+endif()
 if (APPLE OR MSVC)
   include(CMakeProject-mad.cmake)
   include(CMakeProject-zlib.cmake)
@@ -16,5 +22,6 @@
 endif()
 include(CMakeProject-tomcrypt.cmake)
 include(CMakeProject-tommath.cmake)
-include(CMakeProject-png.cmake)
-
+if(NOT PNG_FOUND)
+  include(CMakeProject-png.cmake)
+endif()
diff -Nur stepmania-5.1.0-b2/src/arch/ArchHooks/ArchHooks_Unix.cpp new/src/arch/ArchHooks/ArchHooks_Unix.cpp
--- stepmania-5.1.0-b2/src/arch/ArchHooks/ArchHooks_Unix.cpp	2018-07-24 00:59:51.000000000 +0200
+++ new/src/arch/ArchHooks/ArchHooks_Unix.cpp	2019-05-19 13:14:46.172290262 +0200
@@ -368,7 +368,7 @@
 #include <sys/stat.h>
 
 static LocalizedString COULDNT_FIND_SONGS( "ArchHooks_Unix", "Couldn't find 'Songs'" );
-void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
+void ArchHooks::MountInitialFilesystems( const RString &sDataPath )
 {
 #if defined(UNIX)
 	/* Mount the root filesystem, so we can read files in /proc, /etc, and so on.
@@ -382,12 +382,10 @@
 
 	RString Root;
 	struct stat st;
-	if( !stat(sDirOfExecutable + "/Packages", &st) && st.st_mode&S_IFDIR )
-		Root = sDirOfExecutable;
-	else if( !stat(sDirOfExecutable + "/Songs", &st) && st.st_mode&S_IFDIR )
-		Root = sDirOfExecutable;
-	else if( !stat(RageFileManagerUtil::sInitialWorkingDirectory + "/Songs", &st) && st.st_mode&S_IFDIR )
-		Root = RageFileManagerUtil::sInitialWorkingDirectory;
+	if( !stat(sDataPath + "/Packages", &st) && st.st_mode&S_IFDIR )
+		Root = sDataPath;
+	else if( !stat(sDataPath + "/Songs", &st) && st.st_mode&S_IFDIR )
+		Root = sDataPath;
 	else
 		RageException::Throw( "%s", COULDNT_FIND_SONGS.GetValue().c_str() );
 
diff -Nur stepmania-5.1.0-b2/src/arch/LoadingWindow/LoadingWindow_Gtk.cpp new/src/arch/LoadingWindow/LoadingWindow_Gtk.cpp
--- stepmania-5.1.0-b2/src/arch/LoadingWindow/LoadingWindow_Gtk.cpp	2018-07-24 00:59:51.000000000 +0200
+++ new/src/arch/LoadingWindow/LoadingWindow_Gtk.cpp	2019-05-19 13:16:02.671681418 +0200
@@ -29,7 +29,7 @@
 {
 	ASSERT( Handle == NULL );
 
-	Handle = dlopen( RageFileManagerUtil::sDirOfExecutable + "/" + "GtkModule.so", RTLD_NOW );
+	Handle = dlopen( "stepmania-GtkModule.so", RTLD_NOW );
 	if( Handle == NULL )
 		return ssprintf( "dlopen(): %s", dlerror() );
 
diff -Nur stepmania-5.1.0-b2/src/CMakeLists.txt new/src/CMakeLists.txt
--- stepmania-5.1.0-b2/src/CMakeLists.txt	2018-07-24 00:59:51.000000000 +0200
+++ new/src/CMakeLists.txt	2019-05-19 09:11:48.464545474 +0200
@@ -343,8 +343,8 @@
   "zlib"
   "jsoncpp"
   "png"
-  "glew"
   "jpeg"
+  "GLEW"
 )
 include(../extern/CMakeProject-mmmagic.cmake)
 
@@ -536,12 +536,29 @@
   ${CMAKE_CURRENT_SOURCE_DIR}
   "${SM_SRC_DIR}/generated"
 )
+if(WITH_SYSTEM_LUA)
+  list(APPEND SM_INCLUDE_DIRS
+    ${LUA_INCLUDE_DIR}
+  )
+else()
+  list(APPEND SM_INCLUDE_DIRS
+    "${SM_EXTERN_DIR}/lua-5.1/src"
+  )
+endif()
 if(NOT APPLE)
   list(APPEND SM_INCLUDE_DIRS
     "${SM_EXTERN_DIR}/glew-1.5.8/include"
-    "${SM_EXTERN_DIR}/jsoncpp/include"
     "${SM_EXTERN_DIR}/zlib"
   )
+if(WITH_SYSTEM_JSONCPP)
+    list(APPEND SM_INCLUDE_DIRS
+      ${jsoncpp_INCLUDE_DIRS}
+    )
+else()
+    list(APPEND SM_INCLUDE_DIRS
+      "${SM_EXTERN_DIR}/jsoncpp/include"
+    )
+endif()
   if(MSVC)
     if (WITH_OGG)
       list(APPEND SM_INCLUDE_DIRS
diff -Nur stepmania-5.1.0-b2/src/EnumHelper.h new/src/EnumHelper.h
--- stepmania-5.1.0-b2/src/EnumHelper.h	2018-07-24 00:59:51.000000000 +0200
+++ new/src/EnumHelper.h	2019-05-17 21:04:58.000000000 +0200
@@ -7,7 +7,7 @@
 
 extern "C"
 {
-#include "../extern/lua-5.1/src/lua.h"
+#include "lua.h"
 }
 
 /** @brief A general foreach loop for enumerators, going up to a max value. */
diff -Nur stepmania-5.1.0-b2/src/global.h new/src/global.h
--- stepmania-5.1.0-b2/src/global.h	2018-07-24 00:59:51.000000000 +0200
+++ new/src/global.h	2019-05-19 13:17:20.991058120 +0200
@@ -1,6 +1,8 @@
 #ifndef GLOBAL_H
 #define GLOBAL_H
 
+#define ZIPS_DIR "/usr/share/stepmania/Packages"
+
 #if defined(CMAKE_POWERED)
 #include "config.hpp"
 #elif defined(HAVE_CONFIG_H)
diff -Nur stepmania-5.1.0-b2/src/LuaManager.h new/src/LuaManager.h
--- stepmania-5.1.0-b2/src/LuaManager.h	2018-07-24 00:59:51.000000000 +0200
+++ new/src/LuaManager.h	2019-05-17 21:06:02.000000000 +0200
@@ -10,9 +10,9 @@
 
 extern "C"
 {
-#include "../extern/lua-5.1/src/lua.h"
-#include "../extern/lua-5.1/src/lualib.h"
-#include "../extern/lua-5.1/src/lauxlib.h"
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
 }
 
 // For Dialog::Result
diff -Nur stepmania-5.1.0-b2/src/ProductInfo.inc new/src/ProductInfo.inc
--- stepmania-5.1.0-b2/src/ProductInfo.inc	2018-07-24 00:59:51.000000000 +0200
+++ new/src/ProductInfo.inc	2019-05-19 08:45:39.768815401 +0200
@@ -8,7 +8,7 @@
 ; when they install StepMania 5. (not recommended)
 !define PRODUCT_ID "StepMania 5.1"
 ; TODO: This needs to be updated with the git rev hash
-!define PRODUCT_VER "5.1-UNKNOWN"
+!define PRODUCT_VER "5.1.0-b2"
 !define PRODUCT_DISPLAY "${PRODUCT_FAMILY} ${PRODUCT_VER}"
 !define PRODUCT_BITMAP "sm5"
 
diff -Nur stepmania-5.1.0-b2/src/RageFileManager.cpp new/src/RageFileManager.cpp
--- stepmania-5.1.0-b2/src/RageFileManager.cpp	2018-07-24 00:59:51.000000000 +0200
+++ new/src/RageFileManager.cpp	2019-05-19 13:36:46.649779973 +0200
@@ -302,7 +302,6 @@
 RageFileManager::RageFileManager( const RString &argv0 )
 {
 	CHECKPOINT_M( argv0 );
-	ChangeToDirOfExecutable( argv0 );
 	
 	g_Mutex = new RageEvent("RageFileManager");
 
@@ -328,7 +327,7 @@
 
 void RageFileManager::MountInitialFilesystems()
 {
-	HOOKS->MountInitialFilesystems( RageFileManagerUtil::sDirOfExecutable );
+	HOOKS->MountInitialFilesystems( "/usr/share/stepmania" );
 }
 
 void RageFileManager::MountUserFilesystems()
diff -Nur stepmania-5.1.0-b2/src/RageFileManager.h new/src/RageFileManager.h
--- stepmania-5.1.0-b2/src/RageFileManager.h	2018-07-24 00:59:51.000000000 +0200
+++ new/src/RageFileManager.h	2019-05-19 13:41:21.455581274 +0200
@@ -1,12 +1,13 @@
 #ifndef RAGE_FILE_MANAGER_H
 #define RAGE_FILE_MANAGER_H
-/** @brief Constants for working with the RageFileManager. */
+
 namespace RageFileManagerUtil
 {
 	extern RString sInitialWorkingDirectory;
 	extern RString sDirOfExecutable;
 }
 
+/** @brief Constants for working with the RageFileManager. */
 class RageFileDriver;
 class RageFileBasic;
 struct lua_State;
diff -Nur stepmania-5.1.0-b2/src/ScreenPackages.cpp new/src/ScreenPackages.cpp
--- stepmania-5.1.0-b2/src/ScreenPackages.cpp	2018-07-24 00:59:51.000000000 +0200
+++ new/src/ScreenPackages.cpp	2019-05-19 13:21:32.121059236 +0200
@@ -306,9 +306,8 @@
 
 void ScreenPackages::RefreshPackages()
 {
-	GetDirListing( "Packages/*.zip", m_Packages, false, false );
-	GetDirListing( "Packages/*.smzip", m_Packages, false, false );
-
+	GetDirListing( ZIPS_DIR "/*.zip", m_Packages, false, false );
+	GetDirListing( ZIPS_DIR "/*.smzip", m_Packages, false, false );
 	if ( m_iPackagesPos < 0 )
 		m_iPackagesPos = 0;
 
diff -Nur stepmania-5.1.0-b2/src/SongManager.cpp new/src/SongManager.cpp
--- stepmania-5.1.0-b2/src/SongManager.cpp	2018-07-24 00:59:51.000000000 +0200
+++ new/src/SongManager.cpp	2019-05-19 13:23:21.148191412 +0200
@@ -40,9 +40,9 @@
 
 SongManager*	SONGMAN = NULL;	// global and accessible from anywhere in our program
 
-const RString ADDITIONAL_SONGS_DIR	= "/AdditionalSongs/";
-const RString ADDITIONAL_COURSES_DIR	= "/AdditionalCourses/";
-const RString EDIT_SUBDIR		= "Edits/";
+const RString ADDITIONAL_SONGS_DIR	= "/usr/share/stepmania/AdditionalSongs/";
+const RString ADDITIONAL_COURSES_DIR	= "/usr/share/stepmania/AdditionalCourses/";
+const RString EDIT_SUBDIR		= "/usr/share/stepmania/Edits/";
 
 /** @brief The file that contains various random attacks. */
 const RString ATTACK_FILE		= "/Data/RandomAttacks.txt";
diff -Nur stepmania-5.1.0-b2/StepmaniaCore.cmake new/StepmaniaCore.cmake
--- stepmania-5.1.0-b2/StepmaniaCore.cmake	2018-07-24 00:59:51.000000000 +0200
+++ new/StepmaniaCore.cmake	2019-05-17 21:07:38.000000000 +0200
@@ -432,6 +432,22 @@
     message(FATAL_ERROR "GLEW required to compile StepMania.")
   endif()
 
+ if(WITH_SYSTEM_LUA)
+    find_package(Lua51)
+    if(NOT LUA51_FOUND)
+      message(FATAL_ERROR "System lua library not found! Either install it or remove argument.")
+    endif()
+ endif()
+
+ if(WITH_SYSTEM_JSONCPP)
+    find_package(jsoncpp)
+    if(NOT jsoncpp_FOUND)
+      message(FATAL_ERROR "System jsoncpp library not found! Either install it or remove argument.")
+    endif()
+ endif()
+
+ find_package(PNG)
+
 endif()
 
 configure_file("${SM_SRC_DIR}/config.in.hpp" "${SM_SRC_DIR}/generated/config.hpp")
openSUSE Build Service is sponsored by