From 30df88e4e0eb82e2a8d03c50ba712cd02bf7615e Mon Sep 17 00:00:00 2001 From: Nikolay Korotkiy Date: Mon, 13 Jan 2025 03:29:54 +0400 Subject: [PATCH] librecad: enable on darwin --- pkgs/by-name/li/librecad/package.nix | 34 ++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/li/librecad/package.nix b/pkgs/by-name/li/librecad/package.nix index 0271f26f7a611..d8ca362ee8e66 100644 --- a/pkgs/by-name/li/librecad/package.nix +++ b/pkgs/by-name/li/librecad/package.nix @@ -43,21 +43,36 @@ stdenv.mkDerivation (finalAttrs: { postPatch = '' substituteInPlace librecad/src/main/qc_applicationwindow.cpp \ --replace-warn __DATE__ 0 + + substituteInPlace librecad/src/src.pro \ + --replace-warn '$$[QT_INSTALL_BINS]' '${lib.getDev qt5.qttools}/bin' + substituteInPlace librecad/src/muparser.pri \ + --replace-warn "macx|" "" ''; installPhase = '' runHook preInstall - install -Dm555 -t $out/bin unix/{librecad,ttf2lff} - install -Dm444 -t $out/share/applications desktop/librecad.desktop - install -Dm644 -t $out/share/pixmaps librecad/res/main/librecad.png - install -Dm444 desktop/librecad.sharedmimeinfo $out/share/mime/packages/librecad.xml - install -Dm444 desktop/graphics_icons_and_splash/Icon\ LibreCAD/Icon_Librecad.svg \ - $out/share/icons/hicolor/scalable/apps/librecad.svg + ${lib.optionalString stdenv.hostPlatform.isDarwin '' + mkdir -p $out/{Applications,bin} + mv LibreCAD.app $out/Applications + ln -s $out/Applications/LibreCAD.app/Contents/MacOS/LibreCAD $out/bin/librecad + # Prevent wrapping, otherwise plugins will not be loaded + chmod -x $out/Applications/LibreCAD.app/Contents/Resources/plugins/*.dylib + ''} + + ${lib.optionalString (!stdenv.hostPlatform.isDarwin) '' + install -Dm555 -t $out/bin unix/{librecad,ttf2lff} + install -Dm444 -t $out/share/applications desktop/librecad.desktop + install -Dm644 -t $out/share/pixmaps librecad/res/main/librecad.png + install -Dm444 desktop/librecad.sharedmimeinfo $out/share/mime/packages/librecad.xml + install -Dm444 desktop/graphics_icons_and_splash/Icon\ LibreCAD/Icon_Librecad.svg \ + $out/share/icons/hicolor/scalable/apps/librecad.svg - installManPage desktop/librecad.? + installManPage desktop/librecad.? - cp -R unix/resources $out/share/librecad + cp -R unix/resources $out/share/librecad + ''} runHook postInstall ''; @@ -67,6 +82,7 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://librecad.org"; license = lib.licenses.gpl2Only; maintainers = with lib.maintainers; [ sikmir ]; - platforms = lib.platforms.linux; + platforms = lib.platforms.unix; + mainProgram = "librecad"; }; })