ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / id / ideamaker / package.nix
blob20b894708736a9e5dc224c1441eeb09b13a81bda
2   stdenv,
3   autoPatchelfHook,
4   cacert,
5   common-updater-scripts,
6   curl,
7   dpkg,
8   fetchurl,
9   fetchzip,
10   lib,
11   libcork,
12   libGLU,
13   libsForQt5,
14   makeDesktopItem,
15   openssl,
16   shared-mime-info,
17   writeShellApplication,
19 stdenv.mkDerivation (finalAttrs: {
20   pname = "ideamaker";
21   version = "4.3.3.6560";
22   src =
23     let
24       semver = lib.strings.concatStringsSep "." (
25         lib.lists.init (builtins.splitVersion finalAttrs.version)
26       );
27     in
28     fetchurl {
29       url = "https://download.raise3d.com/ideamaker/release/${semver}/ideaMaker_${finalAttrs.version}-ubuntu_amd64.deb";
30       hash = "sha256-aTVWCTgnVKD16uhJUVz0vR7KPGJqCVj0xoL53Qi3IKM=";
31     };
33   nativeBuildInputs = [
34     autoPatchelfHook
35     dpkg
36     shared-mime-info
37     libsForQt5.wrapQtAppsHook
38   ];
40   buildInputs =
41     let
42       # we need curl 7.47.0, as the app segfaults on launch in 7.47.1 and beyond
43       # (tested with 7.47.1, 7.50.3, 7.62, 7.79.1, and 8.7.1)
44       curl_7_47_0 =
45         let
46           openssl_1_0_1u = openssl.overrideAttrs (previous: {
47             version = "1.0.1u";
48             src = fetchurl {
49               url = "https://www.openssl.org/source/openssl-1.0.1u.tar.gz";
50               hash = "sha256-QxK0yhIVtvLJcAdQPYDbgNUVf3b499P+u+a0xW/yZzk=";
51             };
52             patches = [ ];
53             withDocs = false;
54             outputs = lib.lists.remove "doc" previous.outputs;
55             meta.knownVulnerabilities = [
56               "OpenSSL 1.0.1 reached its end of life 2016-12-31, see https://endoflife.software/applications/security-libraries/openssl."
57               "CVE-2021-4044"
58               "CVE-2016-7056"
59             ];
60           });
61         in
62         (curl.override {
63           gnutlsSupport = true;
64           gssSupport = false;
65           http2Support = false;
66           # while we use openssl, the configureFlag has since changed, so we manually set it below
67           opensslSupport = false;
68           pslSupport = false;
69           scpSupport = false;
70         }).overrideAttrs
71           (previous: {
72             version = "7.47.0";
73             src = fetchzip {
74               url = "https://curl.se/download/curl-7.47.0.tar.lzma";
75               hash = "sha256-XlZk1nJbSmiQp7jMSE2QRCY4C9w2us8BgosBSzlD4dE=";
76             };
77             configureFlags = previous.configureFlags ++ [
78               "--with-ca-bundle=${cacert}/etc/ssl/certs/ca-bundle.crt"
79               "--with-ssl=${lib.getLib openssl_1_0_1u}"
80             ];
81             patches = [ ];
82             # curl https://curl.se/docs/vuln-7.74.0.json | jq -r '.[].id' | sed 's/^/"/;s/$/"/'
83             meta.knownVulnerabilities = [
84               "CURL-CVE-2024-2398"
85               "CURL-CVE-2023-46218"
86               "CURL-CVE-2023-38546"
87               "CURL-CVE-2023-38545"
88               "CURL-CVE-2023-28322"
89               "CURL-CVE-2023-28321"
90               "CURL-CVE-2023-28320"
91               "CURL-CVE-2023-27538"
92               "CURL-CVE-2023-27536"
93               "CURL-CVE-2023-27535"
94               "CURL-CVE-2023-27534"
95               "CURL-CVE-2023-27533"
96               "CURL-CVE-2023-23916"
97               "CURL-CVE-2022-43552"
98               "CURL-CVE-2022-32221"
99               "CURL-CVE-2022-35252"
100               "CURL-CVE-2022-32208"
101               "CURL-CVE-2022-32207"
102               "CURL-CVE-2022-32206"
103               "CURL-CVE-2022-32205"
104               "CURL-CVE-2022-27782"
105               "CURL-CVE-2022-27781"
106               "CURL-CVE-2022-27776"
107               "CURL-CVE-2022-27775"
108               "CURL-CVE-2022-27774"
109               "CURL-CVE-2022-22576"
110               "CURL-CVE-2021-22947"
111               "CURL-CVE-2021-22946"
112               "CURL-CVE-2021-22945"
113               "CURL-CVE-2021-22926"
114               "CURL-CVE-2021-22925"
115               "CURL-CVE-2021-22924"
116               "CURL-CVE-2021-22923"
117               "CURL-CVE-2021-22922"
118               "CURL-CVE-2021-22898"
119               "CURL-CVE-2021-22897"
120               "CURL-CVE-2021-22890"
121               "CURL-CVE-2021-22876"
122             ];
123           });
124     in
125     [
126       (lib.getLib curl_7_47_0)
127       libcork
128       libGLU
129       libsForQt5.qtbase
130       libsForQt5.qtserialport
131       libsForQt5.quazip
132     ];
134   installPhase = ''
135     runHook preInstall
137     install -D usr/lib/x86_64-linux-gnu/ideamaker/ideamaker \
138       $out/bin/${finalAttrs.pname}
140     patchelf --replace-needed libquazip.so.1 libquazip1-qt5.so \
141       $out/bin/${finalAttrs.pname}
143     mimetypeDir=$out/share/icons/hicolor/128x128/mimetypes
144     mkdir -p ''$mimetypeDir
145     for file in usr/share/ideamaker/icons/*.ico; do
146       mv $file ''$mimetypeDir/''$(basename ''${file%.ico}).png
147     done
148     install -D ${./mimetypes.xml} \
149       $out/share/mime/packages/${finalAttrs.pname}.xml
151     install -D usr/share/ideamaker/icons/ideamaker-icon.png \
152       $out/share/pixmaps/${finalAttrs.pname}.png
154     ln -s ${finalAttrs.desktopItem}/share/applications $out/share/
156     runHook postInstall
157   '';
159   desktopItem = makeDesktopItem {
160     name = finalAttrs.pname;
161     exec = finalAttrs.pname;
162     icon = finalAttrs.pname;
163     desktopName = "Ideamaker";
164     comment = "ideaMaker - www.raise3d.com";
165     categories = [
166       "Qt"
167       "Utility"
168       "3DGraphics"
169       "Viewer"
170       "Engineering"
171     ];
172     genericName = finalAttrs.meta.description;
173     mimeTypes = [
174       "application/x-ideamaker"
175       "model/3mf"
176       "model/obj"
177       "model/stl"
178       "text/x.gcode"
179     ];
180     noDisplay = false;
181     startupNotify = true;
182     terminal = false;
183     type = "Application";
184   };
186   passthru.updateScript = lib.getExe (writeShellApplication {
187     name = "ideamaker-update-script";
188     runtimeInputs = [
189       curl
190       common-updater-scripts
191     ];
192     text = ''
193       set -eu -o pipefail
195       release_page=$(mktemp)
196       curl -s https://www.raise3d.com/download/ideamaker-all-versions/ > "$release_page"
198       latest_stable_version=$(
199         sed -nE '/Beta|Alpha/! s/.*Version ([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' "$release_page" | \
200           head -n 1
201       )
203       latest_stable_build_number=$(
204         sed -nE "s/.*ideaMaker_$latest_stable_version\.([0-9]+).*/\1/p" "$release_page" | head -n 1
205       )
207       update-source-version ideamaker "$latest_stable_version.$latest_stable_build_number"
208     '';
209   });
211   meta = {
212     homepage = "https://www.raise3d.com/ideamaker/";
213     changelog = "https://www.raise3d.com/download/ideamaker-release-notes/";
214     description = "Raise3D's 3D slicer software";
215     sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
216     license = lib.licenses.unfree;
217     platforms = [ "x86_64-linux" ];
218     maintainers = with lib.maintainers; [ cjshearer ];
219   };