diff mbox series

[bug#66199,v3,2/2] gnu: librepcb: Update to 1.0.0.

Message ID 63835d7494871259399f0ad3f8248978102c2944.1695830708.git.pinoaffe@gmail.com
State New
Headers show
Series [bug#66199,v3,1/2] gnu: Add fontobene-qt5. | expand

Commit Message

pinoaffe Sept. 27, 2023, 4:14 p.m. UTC
* gnu/packages/engineering.scm (librepcb): Update to 1.0.0.
[inputs]: Add various dependencies (both new ones and old ones that are now
        debundled).
[arguments]: Remove overriding of configure phase. Replace test
        phase. Debundle various dependencies.
[build-system]: Use cmake-build-system.
[native-inputs]: Add googletest.
---
 gnu/packages/engineering.scm | 140 ++++++++++++++++++++++++++++-------
 1 file changed, 114 insertions(+), 26 deletions(-)

Comments

pinoaffe Sept. 27, 2023, 6:45 p.m. UTC | #1
whoops,  I didn't mean to include my commented-out attempts at packaging
dxflib in the patch - v4 incoming
diff mbox series

Patch

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index faba76161b..86e3407b4d 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -38,6 +38,7 @@ 
 ;;; Copyright © 2022, 2023 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2023 Theofilos Pechlivanis <theofilos.pechlivanis@gmail.com>
 ;;; Copyright © 2023 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2023 pinoaffe <pinoaffe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -123,7 +124,9 @@  (define-module (gnu packages engineering)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages markup)
   #:use-module (gnu packages maths)
+  #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
@@ -2322,36 +2325,126 @@  (define-public freehdl
     (license (list license:gpl2+
                    license:lgpl2.0+)))) ; freehdl's libraries
 
+;; (define-public dxflib
+;;   (package
+;;     (name "dxflib")
+;;     (version "3.26.4")
+;;     (source (origin
+;;               (method git-fetch)
+;;               (uri (git-reference
+;;                     (url "https://github.com/LibrePCB/dxflib")
+;;                     (commit "3b09713d9938b3d6e60a628124f460a1ce4efdd0")))
+;;               (file-name (git-file-name name version))
+;;               (sha256
+;;                (base32
+;;                 "0nli8f58gq91zkv82gw05zprr2xbin1zl0l32ihw31jvyr41zr40"))))
+;;     (build-system cmake-build-system)
+;;     (arguments
+;;      `(#:tests? #f)) ;; No tests
+;;     (inputs (list qtbase-5))
+;;     (native-inputs (list pkg-config))
+;;     (home-page "https://www.ribbonsoft.com/en/what-is-dxflib")
+;;     (synopsis "Parser for DXF files")
+;;     (description "dxflib is an open source C++ library mainly for parsing DXFTM files.  dxflib can also write DXF files, but you need to have good knowledge of the DXF format to produce valid output.")
+;;     (license license:gpl2+)))
+
+;; (define-public dxflib
+;;   (package
+;;     (name "dxflib")
+;;     (version "3.26.4")
+;;     (source (origin
+;;               (method url-fetch)
+;;               (uri (string-append "https://www.ribbonsoft.com/archives/dxflib/dxflib-" version "-src.tar.gz"))
+;;               (sha256
+;;                (base32
+;;                 "0pwic33mj6bp4axai5jiyn4xqf31y0xmb1i0pcf55b2h9fav8zah"))))
+;;     (build-system gnu-build-system)
+;;     (inputs (list qtbase-5))
+;;     (native-inputs (list pkg-config))
+;;     (arguments
+;;      `(#:phases
+;;        (modify-phases %standard-phases
+;;          (add-before 'configure 'add-install-prefix
+;;            (lambda _
+;;              (substitute* "dxflib.pro"
+;;                (("dxflib.rc")
+;;                 "dxflib.rc
+;; target.path = $${PREFIX}/bin
+;; share.path = $${PREFIX}
+;; INSTALLS += target share"))))
+;;          (replace 'configure
+;;            (lambda* (#:key outputs #:allow-other-keys)
+;;              (let ((out (assoc-ref outputs "out")))
+;;                (invoke "qmake"
+;;                        (string-append "PREFIX=" out))))))))
+;;     (home-page "https://www.ribbonsoft.com/en/what-is-dxflib")
+;;     (synopsis "Parser for DXF files")
+;;     (description "dxflib is an open source C++ library mainly for parsing DXFTM files.  dxflib can also write DXF files, but you need to have good knowledge of the DXF format to produce valid output.")
+;;     (license license:gpl2+)))
+
 (define-public librepcb
   (package
     (name "librepcb")
-    (version "0.1.5")
+    (version "1.0.0")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://download.librepcb.org/releases/"
                            version "/librepcb-" version "-source.zip"))
+       (modules `((guix build utils)))
+       (snippet
+        ;; Delete libraries that we already have or don't need.
+        ;; TODO: try to unbundle more (see lib/).
+        `(begin
+           (let ((third-parties '("fontobene-qt5"
+                                  "googletest"
+                                  "hoedown"
+                                  "muparser"
+                                  "polyclipping"
+                                  "quazip")))
+             (with-directory-excursion "libs"
+               (map (lambda (third-party)
+                      (delete-file-recursively third-party))
+                    third-parties)))
+           #t))
        (sha256
-        (base32 "0smp1p7wnrj0vh4rmz1cr2krfawc2lzx0pbzmgyay7xdp6jxympr"))))
-    (build-system gnu-build-system)
+        (base32 "02qfwyhdq1pklb5gkwn3rbsdhwvcgiksd21swaphz3kw6s4p9i8v"))))
+    (build-system cmake-build-system)
     (inputs
-     (list qtbase-5 qtsvg-5 zlib))
+     (list fontconfig
+           fontobene-qt5
+           glu
+           hoedown
+           muparser
+           opencascade-occt
+           clipper
+           qtbase-5
+           qtdeclarative-5
+           qtquickcontrols2-5
+           qtsvg-5
+           quazip
+           zlib))
     (native-inputs
-     (list qttools-5 ; for lrelease
+     (list googletest
+           pkg-config
+           qttools-5
            unzip))
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (replace 'configure
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (mkdir-p "build")
-             (chdir "build")
-             (let ((lrelease (search-input-file inputs "/bin/lrelease"))
-                   (out (assoc-ref outputs "out")))
-               (invoke "qmake"
-                       (string-append "QMAKE_LRELEASE=" lrelease)
-                       (string-append "PREFIX=" out)
-                       "../librepcb.pro")))))))
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (setenv "QT_QPA_PLATFORM" "offscreen")
+                        (setenv "QT_QUICK_BACKEND" "software")
+                        (display "Running unittests...\n")
+                        (invoke "./tests/unittests/librepcb-unittests" "--help")))))
+       #:configure-flags (list
+                          "-DUNBUNDLE_FONTOBENE_QT5=ON"
+                          "-DUNBUNDLE_GTEST=ON"
+                          "-DUNBUNDLE_HOEDOWN=ON"
+                          "-DUNBUNDLE_MUPARSER=ON"
+                          "-DUNBUNDLE_POLYCLIPPING=ON"
+                          "-DUNBUNDLE_QUAZIP=ON")))
     (home-page "https://librepcb.org/")
     (synopsis "Electronic Design Automation tool")
     (description "LibrePCB is @dfn{Electronic Design Automation} (EDA)
@@ -2359,17 +2452,12 @@  (define-public librepcb
 formats and complete project management with library, schematic and board
 editors.")
     (license (list license:gpl3+
-                   license:boost1.0 ; libs/clipper,
-                                    ; libs/optional/tests/catch.hpp,
-                                    ; libs/sexpresso/tests/catch.hpp
+                   license:boost1.0 ; libs/optional/tests/catch.hpp,
                    license:expat ; libs/delaunay-triangulation,
                                  ; libs/parseagle, libs/type_safe
-                   license:asl2.0 ; libs/fontobene, libs/googletest,
-                                  ; libs/parseagle
-                   license:isc ; libs/hoedown
-                   license:cc0 ; libs/optional, libs/sexpresso
-                   license:bsd-2 ; libs/optional/tests/catch.hpp
-                   license:lgpl2.1+)))) ; libs/quazip
+                   license:asl2.0 ; libs/parseagle
+                   license:cc0 ; libs/optional
+                   license:bsd-2)))) ; libs/optional/tests/catch.hpp
 
 (define-public gpx
   (package