python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / applications / misc / librecad / default.nix
blob54ed6c10f42a70387d5a96021e214688943ce09a
1 { lib
2 , boost
3 , fetchFromGitHub
4 , fetchpatch
5 , installShellFiles
6 , mkDerivation
7 , muparser
8 , pkg-config
9 , qmake
10 , qtbase
11 , qtsvg
12 , qttools
13 , runtimeShell
16 mkDerivation rec {
17   pname = "librecad";
18   version = "2.2.0-rc2";
20   src = fetchFromGitHub {
21     owner = "LibreCAD";
22     repo = "LibreCAD";
23     rev = version;
24     sha256 = "sha256-RNg7ioMriH4A7V65+4mh8NhsUHs/8IbTt38nVkYilCE=";
25   };
27   patches = [
28     (fetchpatch {
29       url = "https://github.com/LibreCAD/LibreCAD/pull/1465/commits/4edcbe72679f95cb60979c77a348c1522a20b0f4.patch";
30       sha256 = "sha256-P0G2O5sL7Ip860ByxFQ87TfV/lq06wCQnzPxADGqFPs=";
31       name = "CVE-2021-45342.patch";
32     })
33   ];
35   postPatch = ''
36     substituteInPlace scripts/postprocess-unix.sh \
37       --replace /bin/sh ${runtimeShell}
39     substituteInPlace librecad/src/lib/engine/rs_system.cpp \
40       --replace /usr/share $out/share
42     substituteInPlace librecad/src/main/qc_applicationwindow.cpp \
43       --replace __DATE__ 0
44   '';
46   qmakeFlags = [
47     "MUPARSER_DIR=${muparser}"
48     "BOOST_DIR=${boost.dev}"
49   ];
51   installPhase = ''
52     runHook preInstall
54     install -Dm555 -t $out/bin                unix/{librecad,ttf2lff}
55     install -Dm444 -t $out/share/applications desktop/librecad.desktop
56     install -Dm644 -t $out/share/pixmaps      librecad/res/main/librecad.png
57     install -Dm444 desktop/librecad.sharedmimeinfo $out/share/mime/packages/librecad.xml
58     install -Dm444 desktop/graphics_icons_and_splash/Icon\ LibreCAD/Icon_Librecad.svg \
59       $out/share/icons/hicolor/scalable/apps/librecad.svg
61     installManPage desktop/librecad.?
63     cp -R unix/resources $out/share/librecad
65     runHook postInstall
66   '';
68   buildInputs = [
69     boost
70     muparser
71     qtbase
72     qtsvg
73   ];
75   nativeBuildInputs = [
76     installShellFiles
77     pkg-config
78     qmake
79     qttools
80   ];
82   meta = with lib; {
83     description = "2D CAD package based on Qt";
84     homepage = "https://librecad.org";
85     license = licenses.gpl2Only;
86     maintainers = with maintainers; [ kiwi viric ];
87     platforms = platforms.linux;
88   };