@@ -43,21 +43,36 @@ stdenv.mkDerivation (finalAttrs: {
4343 postPatch = ''
4444 substituteInPlace librecad/src/main/qc_applicationwindow.cpp \
4545 --replace-warn __DATE__ 0
46+
47+ substituteInPlace librecad/src/src.pro \
48+ --replace-warn '$$[QT_INSTALL_BINS]' '${ lib . getDev qt5 . qttools } /bin'
49+ substituteInPlace librecad/src/muparser.pri \
50+ --replace-warn "macx|" ""
4651 '' ;
4752
4853 installPhase = ''
4954 runHook preInstall
5055
51- install -Dm555 -t $out/bin unix/{librecad,ttf2lff}
52- install -Dm444 -t $out/share/applications desktop/librecad.desktop
53- install -Dm644 -t $out/share/pixmaps librecad/res/main/librecad.png
54- install -Dm444 desktop/librecad.sharedmimeinfo $out/share/mime/packages/librecad.xml
55- install -Dm444 desktop/graphics_icons_and_splash/Icon\ LibreCAD/Icon_Librecad.svg \
56- $out/share/icons/hicolor/scalable/apps/librecad.svg
56+ ${ lib . optionalString stdenv . hostPlatform . isDarwin ''
57+ mkdir -p $out/{Applications,bin}
58+ mv LibreCAD.app $out/Applications
59+ ln -s $out/Applications/LibreCAD.app/Contents/MacOS/LibreCAD $out/bin/librecad
60+ # Prevent wrapping, otherwise plugins will not be loaded
61+ chmod -x $out/Applications/LibreCAD.app/Contents/Resources/plugins/*.dylib
62+ '' }
63+
64+ ${ lib . optionalString ( ! stdenv . hostPlatform . isDarwin ) ''
65+ install -Dm555 -t $out/bin unix/{librecad,ttf2lff}
66+ install -Dm444 -t $out/share/applications desktop/librecad.desktop
67+ install -Dm644 -t $out/share/pixmaps librecad/res/main/librecad.png
68+ install -Dm444 desktop/librecad.sharedmimeinfo $out/share/mime/packages/librecad.xml
69+ install -Dm444 desktop/graphics_icons_and_splash/Icon\ LibreCAD/Icon_Librecad.svg \
70+ $out/share/icons/hicolor/scalable/apps/librecad.svg
5771
58- installManPage desktop/librecad.?
72+ installManPage desktop/librecad.?
5973
60- cp -R unix/resources $out/share/librecad
74+ cp -R unix/resources $out/share/librecad
75+ '' }
6176
6277 runHook postInstall
6378 '' ;
@@ -67,6 +82,7 @@ stdenv.mkDerivation (finalAttrs: {
6782 homepage = "https://librecad.org" ;
6883 license = lib . licenses . gpl2Only ;
6984 maintainers = with lib . maintainers ; [ sikmir ] ;
70- platforms = lib . platforms . linux ;
85+ platforms = lib . platforms . unix ;
86+ mainProgram = "librecad" ;
7187 } ;
7288} )
0 commit comments