love2d: add Darwin platform support (#444969)
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
libGL,
|
||||
openal,
|
||||
luajit,
|
||||
lua5_1,
|
||||
freetype,
|
||||
physfs,
|
||||
libmodplug,
|
||||
@@ -40,11 +41,8 @@ stdenv.mkDerivation rec {
|
||||
];
|
||||
buildInputs = [
|
||||
SDL2
|
||||
xorg.libX11 # SDl2 optional depend, for SDL_syswm.h
|
||||
libGLU
|
||||
libGL
|
||||
openal
|
||||
luajit
|
||||
(if stdenv.isDarwin then lua5_1 else luajit)
|
||||
freetype
|
||||
physfs
|
||||
libmodplug
|
||||
@@ -54,22 +52,43 @@ stdenv.mkDerivation rec {
|
||||
libtheora
|
||||
which
|
||||
libtool
|
||||
]
|
||||
++ lib.optionals stdenv.isLinux [
|
||||
xorg.libX11 # SDL2 optional depend, for SDL_syswm.h
|
||||
libGLU
|
||||
libGL
|
||||
];
|
||||
|
||||
preConfigure = "$shell ./platform/unix/automagic";
|
||||
|
||||
configureFlags = [
|
||||
"--with-lua=luajit"
|
||||
(if stdenv.isDarwin then "--with-lua=lua" else "--with-lua=luajit")
|
||||
];
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = "-DluaL_reg=luaL_Reg"; # needed since luajit-2.1.0-beta3
|
||||
|
||||
# Fix Darwin bundle/dylib linking and macOS function calls
|
||||
preBuild = lib.optionalString stdenv.isDarwin ''
|
||||
# Fix libtool to use dynamiclib instead of bundle for Darwin
|
||||
substituteInPlace libtool \
|
||||
--replace "-bundle" "-dynamiclib" \
|
||||
--replace "-Wl,-bundle" "-Wl,-dynamiclib"
|
||||
|
||||
substituteInPlace src/love.cpp \
|
||||
--replace "love::macosx::checkDropEvents()" "std::string(\"\")" \
|
||||
--replace "love::macosx::getLoveInResources()" "std::string(\"\")"
|
||||
'';
|
||||
|
||||
postFixup = lib.optionalString stdenv.isDarwin ''
|
||||
install_name_tool -change ".libs/liblove-11.5.so" "$out/lib/liblove-11.5.so" "$out/bin/love"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://love2d.org";
|
||||
description = "Lua-based 2D game engine/scripting language";
|
||||
mainProgram = "love";
|
||||
license = lib.licenses.zlib;
|
||||
platforms = lib.platforms.linux;
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
maintainers = [ lib.maintainers.raskin ];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user