diff --git a/pkgs/by-name/pl/plib/darwin-ssgloadflt-uint.patch b/pkgs/by-name/pl/plib/darwin-ssgloadflt-uint.patch new file mode 100644 index 000000000000..cb9898000d9b --- /dev/null +++ b/pkgs/by-name/pl/plib/darwin-ssgloadflt-uint.patch @@ -0,0 +1,14 @@ +diff --git a/src/ssg/ssgLoadFLT.cxx b/src/ssg/ssgLoadFLT.cxx +--- a/src/ssg/ssgLoadFLT.cxx ++++ b/src/ssg/ssgLoadFLT.cxx +@@ -112,6 +112,10 @@ + # include + # include + #endif ++#if defined(__APPLE__) ++typedef unsigned int uint; ++typedef unsigned short ushort; ++#endif + #ifdef UL_MSVC + # include + #endif diff --git a/pkgs/by-name/pl/plib/package.nix b/pkgs/by-name/pl/plib/package.nix index 50c113b5466e..2471a673c5c6 100644 --- a/pkgs/by-name/pl/plib/package.nix +++ b/pkgs/by-name/pl/plib/package.nix @@ -37,9 +37,15 @@ stdenv.mkDerivation rec { url = "https://sources.debian.org/data/main/p/plib/1.8.5-13/debian/patches/08_CVE-2021-38714.patch"; sha256 = "sha256-3f1wZn0QqK/hPWCg1KEzbB95IGoxBjLZoCOFlW98t5w="; }) + ./darwin-ssgloadflt-uint.patch ]; - propagatedBuildInputs = [ + configureFlags = lib.optionals stdenv.hostPlatform.isDarwin [ + "--disable-sl" + "--disable-pw" + ]; + + propagatedBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ libGLU libGL libglut @@ -70,6 +76,6 @@ stdenv.mkDerivation rec { license = lib.licenses.lgpl2Plus; homepage = "https://plib.sourceforge.net/"; - platforms = lib.platforms.linux; + platforms = lib.platforms.unix; }; } diff --git a/pkgs/by-name/sp/speed-dreams/darwin-gl-compat.patch b/pkgs/by-name/sp/speed-dreams/darwin-gl-compat.patch new file mode 100644 index 000000000000..1df97e96d8a0 --- /dev/null +++ b/pkgs/by-name/sp/speed-dreams/darwin-gl-compat.patch @@ -0,0 +1,16 @@ +diff --git a/src/libs/tgfclient/guiscreen.cpp b/src/libs/tgfclient/guiscreen.cpp +--- a/src/libs/tgfclient/guiscreen.cpp ++++ b/src/libs/tgfclient/guiscreen.cpp +@@ -426,9 +426,9 @@ bool GfScrInitSDL2(int nWinWidth, int nWinHeight, int nFullScreen) + + #ifdef __APPLE__ + // Version d'OpenGL +- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); +- SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); +- SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); ++ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); ++ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); ++ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY); + #else + // Version d'OpenGL + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); diff --git a/pkgs/by-name/sp/speed-dreams/package.nix b/pkgs/by-name/sp/speed-dreams/package.nix index f1c20be16c8b..366ddbeafe90 100644 --- a/pkgs/by-name/sp/speed-dreams/package.nix +++ b/pkgs/by-name/sp/speed-dreams/package.nix @@ -29,15 +29,52 @@ cmake, pkg-config, libvorbis, - runtimeShell, curl, fetchgit, cjson, minizip, rhash, copyDesktopItems, + makeWrapper, }: +let + glLibs = lib.optionals stdenv.isLinux [ + libGL + libGLU + libglut + ]; + runtimeLibs = glLibs ++ [ + libX11 + plib + openal + freealut + libXrandr + libXext + libSM + libICE + libXi + libXt + libXrender + libXxf86vm + openscenegraph + expat + libpng12 + zlib + SDL2 + SDL2_mixer + enet + libjpeg + libvorbis + curl + cjson + minizip + rhash + stdenv.cc.cc.lib + ]; + runtimeLibPath = lib.makeLibraryPath runtimeLibs; + libPathVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"; +in stdenv.mkDerivation rec { version = "2.4.2"; pname = "speed-dreams"; @@ -50,58 +87,29 @@ stdenv.mkDerivation rec { }; NIX_CFLAGS_COMPILE = "-I${src}/src/libs/tgf -I${src}/src/libs/tgfdata -I${src}/src/interfaces -I${src}/src/libs/math -I${src}/src/libs/portability"; - postInstall = '' - mkdir -p "$out/bin" - # Wrapper for main executable - cat > "$out/bin/speed-dreams" <