about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/libraries/irrlicht/default.nix2
-rw-r--r--pkgs/development/libraries/irrlicht/mac.nix50
-rw-r--r--pkgs/development/libraries/irrlicht/mac_device.patch20
-rw-r--r--pkgs/games/minetest/default.nix8
-rw-r--r--pkgs/games/minetest/disable_fixup.patch10
-rw-r--r--pkgs/games/minetest/fix_wordsize_confusion.patch10
-rw-r--r--pkgs/top-level/all-packages.nix11
7 files changed, 106 insertions, 5 deletions
diff --git a/pkgs/development/libraries/irrlicht/default.nix b/pkgs/development/libraries/irrlicht/default.nix
index 788772888c6d..65b3ce028afe 100644
--- a/pkgs/development/libraries/irrlicht/default.nix
+++ b/pkgs/development/libraries/irrlicht/default.nix
@@ -29,6 +29,6 @@ stdenv.mkDerivation rec {
     homepage = http://irrlicht.sourceforge.net/;
     license = stdenv.lib.licenses.zlib;
     description = "Open source high performance realtime 3D engine written in C++";
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/irrlicht/mac.nix b/pkgs/development/libraries/irrlicht/mac.nix
new file mode 100644
index 000000000000..00300d87582d
--- /dev/null
+++ b/pkgs/development/libraries/irrlicht/mac.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchzip, libGLU, libGL, unzip, fetchFromGitHub, cmake, Cocoa, OpenGL, IOKit }:
+
+let
+  version = "1.8.4";
+
+  irrlichtZip = fetchzip {
+    name = "irrlichtZip";
+    url = "mirror://sourceforge/irrlicht/irrlicht-${version}.zip";
+    sha256 = "02sq067fn4xpf0lcyb4vqxmm43qg2nxx770bgrl799yymqbvih5f";
+  };
+
+in
+
+stdenv.mkDerivation rec {
+  pname = "irrlicht-mac";
+  inherit version;
+
+  src = fetchFromGitHub {
+		owner = "quiark";
+		repo = "IrrlichtCMake";
+		rev = "523a5e6ef84be67c3014f7b822b97acfced536ce";
+		sha256 = "10ahnry2zl64wphs233gxhvs6c0345pyf5nwa29mc6yn49x7bidi";
+  };
+
+  postUnpack = ''
+    cp -r ${irrlichtZip}/* $sourceRoot/
+    chmod -R 777 $sourceRoot
+	'';
+
+  patches = [ ./mac_device.patch ];
+  dontFixCmake = true;
+
+  cmakeFlags = [
+    "-DIRRLICHT_STATIC_LIBRARY=ON"
+    "-DIRRLICHT_BUILD_EXAMPLES=OFF"
+    "-DIRRLICHT_INSTALL_MEDIA_FILES=OFF"
+    "-DIRRLICHT_ENABLE_X11_SUPPORT=OFF"
+    "-DIRRLICHT_BUILD_TOOLS=OFF"
+  ];
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ unzip OpenGL Cocoa IOKit ];
+
+  meta = {
+    homepage = http://irrlicht.sourceforge.net/;
+    license = stdenv.lib.licenses.zlib;
+    description = "Open source high performance realtime 3D engine written in C++";
+    platforms = stdenv.lib.platforms.darwin;
+  };
+}
diff --git a/pkgs/development/libraries/irrlicht/mac_device.patch b/pkgs/development/libraries/irrlicht/mac_device.patch
new file mode 100644
index 000000000000..dc68c509975c
--- /dev/null
+++ b/pkgs/development/libraries/irrlicht/mac_device.patch
@@ -0,0 +1,20 @@
+--- a/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm
++++ b/source/Irrlicht/MacOSX/CIrrDeviceMacOSX.mm
+@@ -39,7 +39,7 @@
+ #include <IOKit/hidsystem/IOHIDUsageTables.h>

+ #else

+ /* The header was moved here in Mac OS X 10.1 */

+-#include <Kernel/IOKit/hidsystem/IOHIDUsageTables.h>

++#include <IOKit/hid/IOHIDUsageTables.h>

+ #endif

+ #include <IOKit/hid/IOHIDLib.h>

+ #include <IOKit/hid/IOHIDKeys.h>

+@@ -496,7 +496,7 @@
+ 		{

+ 			[[NSAutoreleasePool alloc] init];

+ 			[NSApplication sharedApplication];

+-			[NSApp setDelegate:(id<NSFileManagerDelegate>)[[[AppDelegate alloc] initWithDevice:this] autorelease]];

++			[NSApp setDelegate:(id<NSApplicationDelegate>)[[[AppDelegate alloc] initWithDevice:this] autorelease]];

+ 			[NSBundle loadNibNamed:@"MainMenu" owner:[NSApp delegate]];

+ 			[NSApp finishLaunching];

+ 		}

diff --git a/pkgs/games/minetest/default.nix b/pkgs/games/minetest/default.nix
index 02a53d065067..77a88a2319f2 100644
--- a/pkgs/games/minetest/default.nix
+++ b/pkgs/games/minetest/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub, cmake, irrlicht, libpng, bzip2, curl, libogg, jsoncpp
 , libjpeg, libXxf86vm, libGLU, libGL, openal, libvorbis, sqlite, luajit
 , freetype, gettext, doxygen, ncurses, graphviz, xorg, gmp, libspatialindex
-, leveldb, postgresql, hiredis
+, leveldb, postgresql, hiredis, libiconv, OpenGL, OpenAL ? openal, Carbon, Cocoa
 }:
 
 with stdenv.lib;
@@ -39,6 +39,8 @@ let
     ] ++ optionals buildClient [
       "-DOpenGL_GL_PREFERENCE=GLVND"
     ];
+    
+    patches = [ ./fix_wordsize_confusion.patch ];
 
     NIX_CFLAGS_COMPILE = "-DluaL_reg=luaL_Reg"; # needed since luajit-2.1.0-beta3
 
@@ -47,6 +49,8 @@ let
     buildInputs = [
       irrlicht luajit jsoncpp gettext freetype sqlite curl bzip2 ncurses
       gmp libspatialindex
+    ] ++ optionals stdenv.isDarwin [ 
+      libiconv OpenGL OpenAL Carbon Cocoa
     ] ++ optionals buildClient [
       libpng libjpeg libGLU libGL openal libogg libvorbis xorg.libX11 libXxf86vm
     ] ++ optionals buildServer [
@@ -62,7 +66,7 @@ let
       homepage = http://minetest.net/;
       description = "Infinite-world block sandbox game";
       license = licenses.lgpl21Plus;
-      platforms = platforms.linux;
+      platforms = platforms.linux ++ platforms.darwin;
       maintainers = with maintainers; [ pyrolagus fpletz ];
     };
   };
diff --git a/pkgs/games/minetest/disable_fixup.patch b/pkgs/games/minetest/disable_fixup.patch
new file mode 100644
index 000000000000..1c378d7f83fc
--- /dev/null
+++ b/pkgs/games/minetest/disable_fixup.patch
@@ -0,0 +1,10 @@
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -802,7 +802,6 @@
+ 		install(CODE "
+ 			set(BU_CHMOD_BUNDLE_ITEMS ON)
+ 			include(BundleUtilities)
+-			fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${BUNDLE_PATH}\" \"\" \"\${CMAKE_INSTALL_PREFIX}/${BINDIR}\")
+ 		" COMPONENT Runtime)
+ 	endif()
+ 
diff --git a/pkgs/games/minetest/fix_wordsize_confusion.patch b/pkgs/games/minetest/fix_wordsize_confusion.patch
new file mode 100644
index 000000000000..9540a434dafe
--- /dev/null
+++ b/pkgs/games/minetest/fix_wordsize_confusion.patch
@@ -0,0 +1,10 @@
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -17,6 +17,7 @@
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+ 
++#include <cstdint>
+ #include "irrlicht.h" // createDevice
+ #include "irrlichttypes_extrabloated.h"
+ #include "chat_interface.h"
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1d8b08c97b03..e94c64551407 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -12075,7 +12075,11 @@ in
 
   ip2location-c = callPackage ../development/libraries/ip2location-c { };
 
-  irrlicht = callPackage ../development/libraries/irrlicht { };
+  irrlicht = if !stdenv.isDarwin then
+    callPackage ../development/libraries/irrlicht { }
+  else callPackage ../development/libraries/irrlicht/mac.nix {
+    inherit (darwin.apple_sdk.frameworks) Cocoa OpenGL IOKit;
+  };
 
   isocodes = callPackage ../development/libraries/iso-codes { };
 
@@ -23266,7 +23270,10 @@ in
 
   multimc = libsForQt5.callPackage ../games/multimc { };
 
-  inherit (callPackages ../games/minetest { })
+  inherit (callPackages ../games/minetest {
+	inherit (darwin) libiconv;
+    inherit (darwin.apple_sdk.frameworks) OpenGL OpenAL Carbon Cocoa;
+  })
     minetestclient_4 minetestserver_4
     minetestclient_5 minetestserver_5;