Subject: [PATCH] gnu: Add opencascade-occt-7.6.1: Add separate package for version 7.6.1 as this is a hard requirement for the new version of prusa-slicer due to a bug in newer versions of opencascade-occt

From: nomike <[email-masked]>
Date: Tue, 20 May 2025 23:51:22 +0200

* gnu/packages/maths.scm (opencascade-occt-7.6.1): New variable

Change-Id: Id4f9e3cb31ebe247ff969cac752fcadfa6ad2109
---
Jus a small update to my patch to also use the better style of getting rid of the .bat files.

 gnu/packages/maths.scm | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 781162eca4..06412fd42e 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -3478,6 +3478,47 @@ (define-public opencascade-occt
                    ;; File src/NCollection/NCollection_StdAllocator.hxx:
                    license:public-domain))))
 
+(define-public opencascade-occt-7.6.1
+  ;; As of version 2.9.2 PrusaSlicer has a hard dependency on this version of OCCT
+  ;; "because newer versions are triangulating chamfers incorrectly.".
+  ;; See https://github.com/prusa3d/PrusaSlicer/commit/c6a02106fd1d3caa9a48a6b7c2bdd04546b24485
+  (package
+    (inherit opencascade-occt)
+    (name "opencascade-occt")
+    (version "7.6.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://git.dev.opencascade.org/repos/occt.git")
+             (commit (string-append "V"
+                                    (string-map (lambda (x)
+                                                  (if (eq? x #\.) #\_ x))
+                                                version)))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1cc7n4rs26lm1awwn2bijvjq9b3kz204ffnks02lrpgs7pf8yk8b"))
+       (modules '((guix build utils)))
+       (snippet '(begin
+                   ;; Remove files specific to non-free operating systems.
+                   (delete-file-recursively "samples/ios")
+                   (delete-file-recursively "samples/mfc")
+                   (delete-file-recursively "samples/qt/FuncDemo")
+                   (delete-file "genconf.bat")
+                   (delete-file "gendoc.bat")
+                   (delete-file "genproj.bat")
+                   (delete-file "upgrade.bat")
+                   ;; Remove references to deleted files.
+                   (substitute* "dox/FILES_HTML.txt"
+                     ((".*standard.*")
+                      "")
+                     ((".*UIKitSample.*")
+                      ""))
+                   #t))))
+    (inputs (modify-inputs (package-inputs opencascade-occt)
+              (replace "tbb" tbb-2020)
+              (delete rapidjson)))))
+
 (define-public fast-downward
   (package
     (name "fast-downward")
-- 
2.49.0