guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Freecad: Draft module fixes


From: Ekaitz Zarraga
Subject: Freecad: Draft module fixes
Date: Thu, 10 Dec 2020 16:46:15 +0000

Hi,

I sent a patch on freecad the other day but I realized freecad is not working 
totally.

The Draft module needed a python package called `pivy`, a binding library for 
`coin3D`. But `pivy` needs `soqt`, which is an old Qt GUI component library for 
coin3D.

Coin3D has some versioning issues (see it's current package) and the version 
guix provides is older than what "recent" `soqt` needs.

At the end, I managed to package everything, but most of the projects have 
"clever" CMake configurations that need to be patched and many of them just 
don't work with the stable versions. All this means I managed to make it work 
flawlessly but using non-tagged commits. I mostly followed what Nix does.

I've put all together in a file so you can see what I'm talking about.

My question are: is it ok for guix to do that? if we do it, what should I add 
in the `version` field of the packages?
Is it ok if I put all this packages in order and send some patches?


Thanks!

Here's what I got:




(define-module (freecad)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module (guix monads)
  #:use-module (guix store)
  #:use-module (guix utils)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system python)
  #:use-module (guix build-system qt)
  #:use-module (gnu packages)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bison)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages engineering)
  #:use-module (gnu packages cmake)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages graphics)
  #:use-module (gnu packages graphviz)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages image-processing)
  #:use-module (gnu packages maths)
  #:use-module (gnu packages mpi)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages swig)
  #:use-module (gnu packages tbb)
  #:use-module (gnu packages xml)
  #:use-module (gnu packages xorg))


(define-public soqt
  (let ((commit-ref "fb8f655632bb9c9c60e0ff9fa69a5ba22d3ff99d"))
    (package
    (name "soqt")
    (version "2020-12-05-unstable") ;1.6.0 should work IDK
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/coin3d/soqt";)
               ;(commit (string-append "SoQt-" version))
               (commit commit-ref)
               (recursive? #t)))
        (file-name (git-file-name name version))
        (sha256
          (base32 "16vikb3fy8rmk10sg5g0gy2c343hi3x7zccsga90ssnkzpq6m032"))))
    (build-system cmake-build-system)
    (arguments
      '(#:tests? #f))
    (native-inputs
      `(("pkg-config" ,pkg-config)
        ("cmake" ,cmake)))
    (inputs
      `(("qtbase" ,qtbase)
        ("coin3D-4" ,coin3D-4)))
    (home-page "https://github.com/coin3d/soqt";)
    (synopsis "Qt GUI component toolkit library for Coin")
    (description "")
    (license license:bsd-3))))


(define-public coin3D-4
    (package
    (name "coin3D-4")
    (version "4.0.0")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/coin3d/coin";)
               (commit (string-append "Coin-" version))
               (recursive? #t)))
        (file-name (git-file-name name version))
        (sha256
          (base32 "1ayg0hl8wanhadahm5xbghghxw1qjwqbrs3dl3ngnff027hsyf8p"))
        (modules '((guix build utils)))
        (snippet
          '(begin
             (for-each delete-file
                       '("cfg/csubst.exe"
                         "cfg/wrapmsvc.exe"))
             (substitute* "CMakeLists.txt"
               ((".*cpack.d.*") ""))
             #t))))
    (build-system cmake-build-system)
    (native-inputs
      `(("doxygen" ,doxygen)
        ("graphviz" ,graphviz)))
    (inputs
      `(("boost" ,boost)
        ("freeglut" ,freeglut)
        ("glew" ,glew)))
    (arguments
      `(#:configure-flags
        (list
          "-DCOIN_BUILD_DOCUMENTATION_MAN=ON"
          (string-append "-DBOOST_ROOT="
                         (assoc-ref %build-inputs "boost")))))
    (home-page "https://github.com/coin3d/coin";)
    (synopsis
      "High-level 3D visualization library with Open Inventor 2.1 API")
    (description
      "Coin is a 3D graphics library with an Application Programming Interface
      based on the Open Inventor 2.1 API.  For those who are not familiar with
      Open Inventor, it is a scene-graph based retain-mode rendering and model
      interaction library, written in C++, which has become the de facto
      standard graphics library for 3D visualization and visual simulation
      software in the scientific and engineering community.")
      (license license:bsd-3)))


(define-public python-pivy
  (package
    (name "python-pivy")
    (version "0.6.5")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/coin3d/pivy";)
               (commit version)))
        (file-name (git-file-name name version))
        (sha256
          (base32 "0vids7sxk8w5vr73xdnf8xdci71a7syl6cd35aiisppbqyyfmykx"))

        (modules '((guix build utils)))
        (snippet
          '(begin
             (substitute* "CMakeLists.txt" (("\\$\\{SoQt_INCLUDE_DIRS}")
                                            
"${Coin_INCLUDE_DIR};${SoQt_INCLUDE_DIRS}"))
             #t))))
    (build-system python-build-system)
    (arguments
      `(#:tests? #f))
    (native-inputs
      `(("cmake" ,cmake)
        ("swig" ,swig)))
    (inputs
      `(("python-wrapper" ,python-wrapper)
        ("qtbase" ,qtbase)
        ("libxi" ,libxi)
        ("libice" ,libice)
        ("soqt" ,soqt)
        ("glew" ,glew)
        ("coin3D-4" ,coin3D-4)))
    (home-page "https://github.com/coin3d/pivy";)
    (synopsis "Python bindings to Coin3D")
    (description
      "Pivy provides python bindings for Coin, a 3D graphics library with an
Application Programming Interface based on the Open Inventor 2.1 API.")
    (license license:isc)))

(define-public freecad-unstable
  (let ((commit-ref "7616153b3c31ace006169cdc2fdafab484498858"))
    (package
      (name "freecad-unstable")
      (version "0.18.5-unstable")
      (source
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://github.com/FreeCAD/FreeCAD";)
                 (commit commit-ref)))
          (file-name (git-file-name name version))
          (sha256
            (base32
              "16965yxnp2pq7nm8z3p0pjkzjdyq62vfrj8j3nk26bwc898czyn2"))))
    (build-system qt-build-system)
    (native-inputs
     `(("doxygen" ,doxygen)
       ("graphviz" ,graphviz)
       ("qttools" ,qttools)
       ("pkg-config" ,pkg-config)
       ("python-pyside-2-tools" ,python-pyside-2-tools)
       ("swig" ,swig)))
    (inputs
     `(("boost" ,boost)
       ("coin3D" ,coin3D)
       ("eigen" ,eigen)
       ("freetype" ,freetype)
       ("glew" ,glew)
       ("hdf5" ,hdf5-1.10)
       ("libarea" ,libarea)
       ("libmedfile" ,libmedfile)
       ("libspnav" ,libspnav)
       ("libxi" ,libxi)
       ("libxmu" ,libxmu)
       ("openmpi" ,openmpi)
       ("opencascade-occt" ,opencascade-occt)
       ("python-matplotlib" ,python-matplotlib)
       ("python-pyside-2" ,python-pyside-2)
       ("python-shiboken-2" ,python-shiboken-2)
       ("python-pivy" ,python-pivy)
       ("python-wrapper" ,python-wrapper)
       ("qtbase" ,qtbase)
       ("qtsvg" ,qtsvg)
       ("qtx11extras" ,qtx11extras)
       ("qtxmlpatterns" ,qtxmlpatterns)
       ("qtwebkit" ,qtwebkit)
       ("qtxmlpatterns" ,qtxmlpatterns)
       ("tbb" ,tbb)
       ("vtk" ,vtk)
       ("xerces-c" ,xerces-c)
       ("zlib" ,zlib)))
    (arguments
     `(#:tests? #f
       #:configure-flags
       (list
        "-DBUILD_QT5=ON"
        (string-append "-DCMAKE_INSTALL_LIBDIR=" (assoc-ref %outputs "out") 
"/lib")

        (string-append "-DPYSIDE2UICBINARY="
                       (assoc-ref %build-inputs "python-pyside-2-tools")
                       "/bin/uic")
        (string-append "-DPYSIDE2RCCBINARY="
                       (assoc-ref %build-inputs "python-pyside-2-tools")
                       "/bin/rcc")

        "-DPYSIDE_LIBRARY=PySide2::pyside2"
        (string-append
         "-DPYSIDE_INCLUDE_DIR="
         (assoc-ref %build-inputs "python-pyside-2") "/include;"
         (assoc-ref %build-inputs "python-pyside-2") "/include/PySide2;"
         (assoc-ref %build-inputs "python-pyside-2") "/include/PySide2/QtCore;"
         (assoc-ref %build-inputs "python-pyside-2") 
"/include/PySide2/QtWidgets;"
         (assoc-ref %build-inputs "python-pyside-2") "/include/PySide2/QtGui;")

        "-DSHIBOKEN_LIBRARY=Shiboken2::libshiboken"
        (string-append "-DSHIBOKEN_INCLUDE_DIR="
                       (assoc-ref %build-inputs "python-shiboken-2")
                       "/include/shiboken2"))
       #:phases
       (modify-phases %standard-phases
         (add-before 'configure 'restore-pythonpath
           (lambda _
             (substitute* "src/Main/MainGui.cpp"
               (("_?putenv\\(\"PYTHONPATH=\"\\);") ""))
             #t))
         (add-after 'install 'wrap-pythonpath
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
               (wrap-program (string-append out "/bin/FreeCAD")
                 (list "PYTHONPATH"
                       'prefix (list (getenv "PYTHONPATH")))))
             #t)))))
    (home-page "https://www.freecadweb.org/";)
    (synopsis "Your Own 3D Parametric Modeler")
    (description
     "FreeCAD is a general purpose feature-based, parametric 3D modeler for
CAD, MCAD, CAx, CAE and PLM, aimed directly at mechanical engineering and
product design but also fits a wider range of uses in engineering, such as
architecture or other engineering specialties.  It is 100% Open Source (LGPL2+
license) and extremely modular, allowing for very advanced extension and
customization.")
    (license
     (list
      license:lgpl2.1+
      license:lgpl2.0+
      license:gpl3+
      license:bsd-3)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]