unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Kristian Lein-Mathisen <kristianlein@gmail.com>
To: 57361@debbugs.gnu.org
Subject: [bug#57361] [PATCH] gnu: Add solvespace.
Date: Mon, 5 Sep 2022 21:57:56 +0200	[thread overview]
Message-ID: <CAAGQtHywqnr7nAkWg8NA=b1DcSuciFaHiH+r+qhehV6zQOTZoQ@mail.gmail.com> (raw)
In-Reply-To: <CAAGQtHxL16Txa48unq1MbeOG1D51H0WNH6vHNDL9ABjibGoETA@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2570 bytes --]

Hi,

And thanks for your feedback, Liliana. Here's another attempt!

> > +(define mimalloc-for-solvespace
> Given that this is the upstream mimalloc, there's no reason to make
> this private or only for solvespace. Note that you should separate
> this into one patch per package.
> > + (let ((commit "f2712f4a8f038a7fb4df2790f4c3b7e3ed9e219b")
> > + (version "2.0.6"))
> This is the release commit, no reason to use git-version etc. here

Done! I wasn't sure where to place this public mimalloc. I asked
on #guix but go no replies, so I kept it right there in engineering.scm.

> > + (synopsis "Compact general purpose allocator with excellent
> > performance")
> Don't bloat the synopsis with marketing terms; "General purpose
> allocator" should probably suffice.

Ah, of course. Fixed.

> > + (define-public solvespace
> > + (let ((commit "70bde63cb32a7f049fa56cbdf924e2695fcb2916")
> > + (version "3.1")
> I haven't checked, but is this the release commit? If so, no need for
> all this verbosity.

Unfortunately, the verbosity is needed. I need to reference the commit hash
before the configure phase below.

> > + (libdxfrw-sources (origin
> > + (method git-fetch)
> > + (uri (git-reference (url
> > + "https://github.com/solvespace/libdxfrw")
> > + (commit
> > +   "0b7b7b709d9299565db603f878214656ef5e9ddf")))
> > + (sha256 (base32
> > +  "0d2wjq81466m3hb5cffiy99vhx0irwwy47yfxp318k2q4cvd5z2a")))))
> This should be its own variable. Unlike with mimalloc, since it's just
> an origin, you can use the same patch as solvespace.

Done, but here I'm curious - why does this deserve it's own top-level
variable? It shouldn't to be referenced by anything other than inside
SolveSpace.
Could I have used a nested define inside solvespace instead?

> > + (package (name "solvespace")
> > + (version (git-version version "1" commit))
> > + (source (origin
> > + (method git-fetch)
> > + (uri (git-reference
> > + (url "https://github.com/solvespace/solvespace")
> > + (commit commit)))
> > +   (file-name (git-file-name name version))
> > +   (sha256
> > +   (base32
> > +    "1hbdln44k00a6vlklv2mq2c9zda3i9d5x0f7ks85w4v6zskhqnra"))))
> > + (build-system cmake-build-system)
> > + (native-inputs (list pkg-config gettext-minimal))
> > + (arguments
> > + (list #:build-type "Release"
> > + #:phases #~(modify-phases %standard-phases
> `guix style' is not yet perfect when it comes to trade-offs between
> horizontal and vertical space. Prefer
> (list
> #:build-type "Release"
> #:phases
> #~(modify-phases ...

Indentation fixed (by Emacs this time, not guix style).

K.

[-- Attachment #1.2: Type: text/html, Size: 3375 bytes --]

[-- Attachment #2: 0002-gnu-Add-solvespace.patch --]
[-- Type: text/x-patch, Size: 5045 bytes --]

From 7a916808cb4985935f46ea4d1dfd10ea0effc388 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <kristianlein@gmail.com>
Date: Mon, 5 Sep 2022 21:49:28 +0200
Subject: [PATCH 2/2] gnu: Add solvespace.

* gnu/packages/engineering.scm (solvespace): New variable.
---
 gnu/packages/engineering.scm | 90 ++++++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 5f5ef158a2..71d9a736f1 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2917,6 +2917,96 @@ (define-public mimalloc
     (home-page "https://microsoft.github.io/mimalloc/")
     (license license:expat)))
 
+;; libdxfrw has no readme, no version release, no tags.  Initial commit says
+;; "libdxfrw-0.6.3 import", but it shares no git history with "upstream"
+;; https://github.com/codelibs/libdxfrw.  Both are difficult to package
+;; separately as they don't install properly.  Copying in-tree instead of
+;; #:recursive #t to avoid downloading the other bigger dependencies which
+;; aren't needed.
+(define libdxfrw-sources
+  (origin
+    (method git-fetch)
+    (uri (git-reference (url
+                         "https://github.com/solvespace/libdxfrw")
+                        (commit
+                         "0b7b7b709d9299565db603f878214656ef5e9ddf")))
+    (sha256 (base32
+             "0d2wjq81466m3hb5cffiy99vhx0irwwy47yfxp318k2q4cvd5z2a"))))
+
+(define-public solvespace
+  (let ((commit "70bde63cb32a7f049fa56cbdf924e2695fcb2916")
+        (version "3.1"))
+    (package
+      (name "solvespace")
+      (version version)
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/solvespace/solvespace")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1hbdln44k00a6vlklv2mq2c9zda3i9d5x0f7ks85w4v6zskhqnra"))))
+      (build-system cmake-build-system)
+      (native-inputs (list pkg-config gettext-minimal))
+      (arguments
+       (list
+        #:build-type "Release"
+        #:phases #~(modify-phases %standard-phases
+                     (add-after 'unpack 'unpack-libdxfrw
+                       (lambda _
+                         (copy-recursively #$libdxfrw-sources
+                                           "extlib/libdxfrw")))
+                     (add-before 'configure 'embed-git-commit-hash
+                       (lambda _
+                         ;; `git describe` doesn't work here, so embed
+                         ;; the commit hash directly in CMakeLists.txt as
+                         ;; described instead.
+                         (substitute* "CMakeLists.txt"
+                           (("include\\(GetGitCommitHash\\)")
+                            (string-append "set(GIT_COMMIT_HASH "
+                                           #$commit ")")))))
+                     (add-before 'configure 'use-packaged-mimalloc
+                       (lambda _
+                         (substitute* "CMakeLists.txt"
+                           (("message\\(STATUS \"Using in-tree mimalloc\"\\)")
+                            "message(STATUS \"Using guix packaged mimalloc\")")
+                           (("add_subdirectory\\(extlib/mimalloc EXCLUDE_FROM_ALL\\)")
+                            "find_package(mimalloc REQUIRED)")))))))
+      (inputs (list cairo
+                    eigen
+                    freetype
+                    gtkmm-3
+                    json-c
+                    libpng
+                    libspnav            ;spaceware
+                    mimalloc
+                    mesa
+                    zlib))
+      (synopsis "Parametric 2D/3D CAD")
+      (description
+       "SOLVESPACE is a parametric 3D @acronym{CAD,
+Computer Aided Design} tool.  Applications include:
+
+@itemize
+@item modeling 3d parts — draw with extrudes, revolves, helixes and
+      Boolean (union / difference / intersection) operations
+@item modeling 2d parts — draw the part as a single section,
+      and export DXF, PDF, SVG; use 3d assembly to verify fit
+@item 3d-printed parts — export the STL or other triangle mesh
+      expected by most 3d printers
+@item preparing CAM data — export 2d vector art for a waterjet
+      machine or laser cutter; or generate STEP or STL, for import into
+      third-party CAM software for machining
+@item mechanism design — use the constraint solver to simulate planar
+      or spatial linkages, with pin, ball, or slide joints
+@item plane and solid geometry — replace hand-solved trigonometry and spreadsheets
+      with a live dimensioned drawing
+@end itemize")
+      (home-page "https://solvespace.com/")
+      (license license:gpl3+))))
+
 (define-public syscall-intercept
   ;; Upstream provides no tag. Also, last version update is 4 years old.
   (let ((commit "304404581c57d43478438d175099d20260bae74e")
-- 
2.37.2


[-- Attachment #3: 0001-gnu-Add-mimalloc.patch --]
[-- Type: text/x-patch, Size: 1763 bytes --]

From 7602c8d01e7fce26551037304fa2c65f29e5c892 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <kristianlein@gmail.com>
Date: Mon, 5 Sep 2022 21:49:03 +0200
Subject: [PATCH 1/2] gnu: Add mimalloc.

* gnu/packages/engineering.scm (mimalloc): New variable.
---
 gnu/packages/engineering.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index f195179413..5f5ef158a2 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2895,6 +2895,28 @@ (define-public pcb2gcode
 dynamic calibration of the milling depth.")
      (license license:gpl3+))))
 
+;; Note there is another mimalloc used in rust-mimalloc (version 1.6.4).
+(define-public mimalloc
+  (package
+    (name "mimalloc")
+    (version "2.0.6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/microsoft/mimalloc")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "05x2dl3zimflfj91ns3vrphmzpdlyyr230p9adqgfds101f16qmv"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:build-type "Release"))
+    (synopsis "General purpose memory allocator")
+    (description "@code{mimalloc} is a drop-in replacement for @code{malloc}.")
+    (home-page "https://microsoft.github.io/mimalloc/")
+    (license license:expat)))
+
 (define-public syscall-intercept
   ;; Upstream provides no tag. Also, last version update is 4 years old.
   (let ((commit "304404581c57d43478438d175099d20260bae74e")

base-commit: c4504dfb1da78f2f21fc5139a2fd5e82ed0ef21c
-- 
2.37.2


  parent reply	other threads:[~2022-09-05 19:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 12:08 [bug#57361] [PATCH] gnu: Add solvespace Kristian Lein-Mathisen
2022-08-31 18:51 ` [bug#57361] Solvespace package re-done Kristian Lein-Mathisen
2022-09-01 17:18   ` Liliana Marie Prikler
2022-09-01 17:20     ` Liliana Marie Prikler
2022-09-05 19:57 ` Kristian Lein-Mathisen [this message]
2022-09-06  8:30 ` [bug#57361] [PATCH] gnu: Add solvespace Kristian Lein-Mathisen
2022-09-06  8:33 ` Kristian Lein-Mathisen
2022-09-08 13:14   ` Ludovic Courtès
2022-09-10 15:27     ` Liliana Marie Prikler
2022-09-11 14:13       ` bug#57361: " Ludovic Courtès
2022-09-10  7:55 ` [bug#57361] " ( via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAGQtHywqnr7nAkWg8NA=b1DcSuciFaHiH+r+qhehV6zQOTZoQ@mail.gmail.com' \
    --to=kristianlein@gmail.com \
    --cc=57361@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).