Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minetest: update to 5.1.0 and build on Darwin #77967

Merged
merged 3 commits into from Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkgs/development/libraries/irrlicht/common.nix
@@ -0,0 +1,11 @@
{ fetchzip }:

rec {
pname = "irrlicht";
version = "1.8.4";

src = fetchzip {
url = "mirror://sourceforge/irrlicht/${pname}-${version}.zip";
sha256 = "02sq067fn4xpf0lcyb4vqxmm43qg2nxx770bgrl799yymqbvih5f";
};
}
14 changes: 7 additions & 7 deletions pkgs/development/libraries/irrlicht/default.nix
@@ -1,14 +1,14 @@
{ stdenv, fetchzip, libGLU, libGL, unzip, libXrandr, libX11, libXxf86vm }:

let
common = import ./common.nix { inherit fetchzip; };
in

stdenv.mkDerivation rec {
pname = "irrlicht";
version = "1.8.4";
pname = common.pname;
version = common.version;

src = fetchzip {
url = "mirror://sourceforge/irrlicht/${pname}-${version}.zip";
sha256 = "02sq067fn4xpf0lcyb4vqxmm43qg2nxx770bgrl799yymqbvih5f";
};
src = common.src;

preConfigure = ''
cd source/Irrlicht
Expand All @@ -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;
};
}
43 changes: 43 additions & 0 deletions pkgs/development/libraries/irrlicht/mac.nix
@@ -0,0 +1,43 @@
{ stdenv, fetchzip, libGLU, libGL, unzip, fetchFromGitHub, cmake, Cocoa, OpenGL, IOKit }:

let
common = import ./common.nix { inherit fetchzip; };
in

stdenv.mkDerivation rec {
pname = "irrlicht-mac";
version = common.version;

src = fetchFromGitHub {
owner = "quiark";
repo = "IrrlichtCMake";
rev = "523a5e6ef84be67c3014f7b822b97acfced536ce";
sha256 = "10ahnry2zl64wphs233gxhvs6c0345pyf5nwa29mc6yn49x7bidi";
};

postUnpack = ''
cp -r ${common.src}/* $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;
};
}
20 changes: 20 additions & 0 deletions 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];
}
12 changes: 5 additions & 7 deletions pkgs/development/libraries/leveldb/default.nix
@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub }:
{ stdenv, fetchFromGitHub, fixDarwinDylibNames }:

stdenv.mkDerivation rec {
pname = "leveldb";
Expand All @@ -11,16 +11,14 @@ stdenv.mkDerivation rec {
sha256 = "01kxga1hv4wp94agx5vl3ybxfw5klqrdsrb6p6ywvnjmjxm8322y";
};

nativeBuildInputs = []
++ stdenv.lib.optional stdenv.isDarwin [ fixDarwinDylibNames ];

buildPhase = ''
make all
'';

installPhase = (stdenv.lib.optionalString stdenv.isDarwin ''
for file in out-shared/*.dylib*; do
install_name_tool -id $out/lib/$file $file
done
'') + # XXX consider removing above after transition to cmake in the next release
"
installPhase = "
mkdir -p $out/{bin,lib,include}

cp -r include $out
Expand Down
8 changes: 5 additions & 3 deletions 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;
Expand Down Expand Up @@ -39,14 +39,16 @@ let
] ++ optionals buildClient [
"-DOpenGL_GL_PREFERENCE=GLVND"
];

NIX_CFLAGS_COMPILE = "-DluaL_reg=luaL_Reg"; # needed since luajit-2.1.0-beta3

nativeBuildInputs = [ cmake doxygen graphviz ];

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 [
Expand All @@ -62,7 +64,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 ];
};
};
Expand Down
10 changes: 10 additions & 0 deletions 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()

10 changes: 10 additions & 0 deletions 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"
11 changes: 9 additions & 2 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -12047,7 +12047,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 { };

Expand Down Expand Up @@ -23210,7 +23214,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;

Expand Down