minetest: update to 5.1.0 and build on Darwin

This commit is contained in:
Roman Plášil 2019-10-22 15:48:02 +08:00 committed by Profpatsch
parent 24720dd250
commit fb285f2153
7 changed files with 106 additions and 5 deletions

View File

@ -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;
};
}

View File

@ -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;
};
}

View File

@ -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];
}

View File

@ -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;
@ -40,6 +40,8 @@ let
"-DOpenGL_GL_PREFERENCE=GLVND"
];
patches = [ ./fix_wordsize_confusion.patch ];
NIX_CFLAGS_COMPILE = "-DluaL_reg=luaL_Reg"; # needed since luajit-2.1.0-beta3
nativeBuildInputs = [ cmake doxygen graphviz ];
@ -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 ];
};
};

View File

@ -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()

View File

@ -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"

View File

@ -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;