3
0
Fork 0
forked from mirrors/nixpkgs

mudlet: Fix build on darwin (#281657)

* mudlet: Fix build on darwin

* mudlet: refactor installPhase

* mudlet: use upstream patch

* mudlet: fix build on x86_64-darwin

---------

Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
This commit is contained in:
Felix Albrigtsen 2024-01-21 04:45:08 +00:00 committed by GitHub
parent fae8b9b9fc
commit 5e9d51cecb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 9 deletions

View file

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, git
, pkg-config
@ -20,6 +21,7 @@
, qtmultimedia
, discord-rpc
, yajl
, AppKit
}:
let
@ -64,6 +66,14 @@ stdenv.mkDerivation rec {
hash = "sha256-K75frptePKfHeGQNXaX4lKsLwO6Rs6AAka6hvP8MA+k=";
};
patches = [
(fetchpatch {
name = "darwin-AppKit.patch";
url = "https://github.com/Mudlet/Mudlet/commit/68cdd404f81a6d16c80068c45fe0f10802f08d9e.patch";
hash = "sha256-74FtcjOR/lu9ohtcoup0+gUfCQRznO48zMmb97INhdY=";
})
];
nativeBuildInputs = [
cmake
git
@ -87,6 +97,8 @@ stdenv.mkDerivation rec {
qtmultimedia
yajl
discord-rpc
] ++ lib.optional stdenv.isDarwin [
AppKit
];
cmakeFlags = [
@ -101,34 +113,46 @@ stdenv.mkDerivation rec {
runHook preInstall
mkdir -pv $out/lib
cp 3rdparty/edbee-lib/edbee-lib/qslog/lib/libQsLog.so $out/lib
mkdir -pv $out/bin
cp src/mudlet $out
cp 3rdparty/edbee-lib/edbee-lib/qslog/lib/libQsLog${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib
mkdir -pv $out/share/mudlet
cp -r ../src/mudlet-lua/lua $out/share/mudlet/
mkdir -pv $out/share/applications
cp ../mudlet.desktop $out/share/applications/
mkdir -pv $out/share/pixmaps
cp -r ../mudlet.png $out/share/pixmaps/
cp -r ../translations $out/share/
makeQtWrapper $out/mudlet $out/bin/mudlet \
'' + lib.optionalString stdenv.isDarwin ''
mkdir -p $out/Applications
cp -r src/mudlet.app/ $out/Applications/mudlet.app
mv $out/Applications/mudlet.app/Contents/MacOS/mudlet $out/Applications/mudlet.app/Contents/MacOS/mudlet-unwrapped
makeQtWrapper $out/Applications/Mudlet.app/Contents/MacOS/mudlet-unwrapped $out/Applications/Mudlet.app/Contents/MacOS/mudlet \
--set LUA_CPATH "${luaEnv}/lib/lua/${lua.luaversion}/?.so" \
--prefix LUA_PATH : "$NIX_LUA_PATH" \
--prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsForQt5.qtkeychain discord-rpc ]}:$out/lib" \
--chdir "$out";
'' + lib.optionalString (!stdenv.isDarwin) ''
mkdir -pv $out/bin
cp src/mudlet $out/bin/mudlet-unwrapped
makeQtWrapper $out/bin/mudlet-unwrapped $out/bin/mudlet \
--set LUA_CPATH "${luaEnv}/lib/lua/${lua.luaversion}/?.so" \
--prefix LUA_PATH : "$NIX_LUA_PATH" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libsForQt5.qtkeychain discord-rpc ]}" \
--chdir "$out";
mkdir -pv $out/share/applications
cp ../mudlet.desktop $out/share/applications/
'' + ''
runHook postInstall
'';
meta = with lib; {
description = "Crossplatform mud client";
homepage = "https://www.mudlet.org/";
maintainers = with maintainers; [ wyvie pstn cpu ];
platforms = platforms.linux;
maintainers = with maintainers; [ wyvie pstn cpu felixalbrigtsen ];
platforms = platforms.linux ++ platforms.darwin;
license = licenses.gpl2Plus;
mainProgram = "mudlet";
};

View file

@ -37950,6 +37950,8 @@ with pkgs;
mudlet = libsForQt5.callPackage ../games/mudlet {
lua = lua5_1;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
inherit (darwin.apple_sdk_11_0.frameworks) AppKit;
};
blightmud = callPackage ../games/blightmud { };