diff mbox series

[bug#36440] Add FreeCAD

Message ID CAKf5CqXqHCTDEwisd6Y2R79bF5350pbpE4s_Hq00GSJ12s2-cg@mail.gmail.com
State Accepted
Headers show
Series [bug#36440] Add FreeCAD | expand

Commit Message

John Soo June 30, 2019, 2:39 a.m. UTC
Hi all,

I've done linting, and indentation checks.  There are still some issues
with licenses that I've marked and I don't know where to put the changes
that I've included in llvm.scm.  Also I discovered some non-determinism in
the build of freecad just now. I thought it would be good to share my work,
though. It's been long enough.

- John

Comments

Björn Höfling July 2, 2019, 7:06 a.m. UTC | #1
On Sun, 30 Jun 2019 02:39:52 +0000
John Soo <jsoo1@asu.edu> wrote:

> Hi all,
> 
> I've done linting, and indentation checks.  There are still some
> issues with licenses that I've marked and I don't know where to put
> the changes that I've included in llvm.scm.  Also I discovered some
> non-determinism in the build of freecad just now. I thought it would
> be good to share my work, though. It's been long enough.
> 
> - John

Hi John,

thank you very much for working on FreeCAD! And thanks for sharing this
work even if it is not 100% polished.

The first thing I noticed is that you packed everything into one
commit. Could you please split it up in one commit per added/modified
package? That's the usual way Guix expects commits, and it would make
the reviewing easier, you can concentrate on each package as a reviewer
and you better see the dependency structure right away.

Thanks,

Björn
John Soo July 8, 2019, 1:17 a.m. UTC | #2
Hi Bjorn,

Thanks for taking a look. Here are the patches with one package in each.

- John
Jonathan Brielmaier July 19, 2019, 8:40 p.m. UTC | #3
Is there a reason why you build every package from a commit of the
master branch instead of using the stable releases? I think at least
FreeCAD releases often enough, in the mean time the released version 0.18.3.

Do you have the patches also in some public git repo (Github, Gitlab etc.)?

~Jonathan
John Soo July 22, 2019, 1:41 p.m. UTC | #4
Hi Jonathon,

I have based freecad on the commit for the release tag for version 0.18.2
(0.18.3 was released after my patches were submitted).  I looked at the
commit for 0.18.3 and I don't see why I couldn't use that one. I just need
to find the time to do the work.  As for a working version you can see my
prior work in the channel at https://github.com/jsoo1/guix-channel on
commit 9fd2815ed08317d27e174ca460e0d0a2be058aa7.

Thanks for your review!

- John

9fd2815ed08317d27e174ca460e0d0a2be058aa7

9fd2815ed08317d27e174ca460e0d0a2be058aa7
Björn Höfling July 22, 2019, 2:11 p.m. UTC | #5
On Sun, 30 Jun 2019 02:39:52 +0000
John Soo <jsoo1@asu.edu> wrote:

> Hi all,
> 
> I've done linting, and indentation checks.  There are still some
> issues with licenses that I've marked and I don't know where to put
> the changes that I've included in llvm.scm.  Also I discovered some
> non-determinism in the build of freecad just now. I thought it would
> be good to share my work, though. It's been long enough.
> 
> - John

Hi John,

this is not a easy "guix import" package. Thanks for looking into this.

Here are some remarks from my side:

Commit-log: You have a summary line, but missing this:

* gnu/package/...scm (freecad): New variable.

This holds for all packages. See the manual
(https://guix.gnu.org/manual/en/guix.html#Submitting-Patches) and other
commits as reference. You might like to work with magit and yasnippets
to automate this.

Add a copyright line for yourself to all files you touched.

For the dependencies, you often used commits from the git/hg repository
instead of a released version. Was there specific reason for that? If
so, please add a comment on why you need this specific version.

For some (all), I found out that a proper release was only created
after you submitted/edited your patch. Maybe you can give it a try with
the released versions?

I wanted to give it a try for myself but failed: I could not build
qtwebkit locally, and no substitutes are available. I don't want to
hold back my comments any longer, so I postponed trying it out.

Also, I wanted to compare with the AppPack provided by FreeCAD, but I
wasn't able to extract it: I did not want to do it on my machine
directly, because you use the AppPack executable to extract it! And it
did not work in a Guix-VM, probably due to some "standard" library
paths being expected.

We should fix this package and then suggest them using Guix or at least
"guix pack" for really relocatable BLOBs :-)

coin3D:

There are two binaries in the source repository:


./cfg/csubst.exe
./cfg/wrapmsvc.exe

Also the .hg directory is included.

Could you please remove them with "snippets"?

You can search for "snippet" to find examples for that.

I did it like that:

+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           (delete-file-recursively ".hg")
+           (for-each delete-file
+                     '("cfg/csubst.exe"
+                       "cfg/wrapmsvc.exe"))
+           #t))))


soqt:

Same snippets apply here too.

soqt: There is a 1.6.0-package available since some hours.
Would you like to use this?

Also, they say it is superseeded by Quarter. Would it be possible/better
to use this one? Is there anything known from FreeCAD side?

llvm-toolchain-6: I haven't looked into that yet.

pyside2/shiboken:

There are two Qt-bindings for Python: PyQt and PySide2. As we have PyQt
already in 
gnu/packages/qt.scm, I think it would make sense to move Pyside2 and
its binding generator Shiboken into that package instead of
python-xyz.scm.


PySide2/Qt version:

We currently have 5.11.3 in Guix. 5.12 is the current LTS available and
5.13 is also out since June.

The PySide homepage (https://wiki.qt.io/Qt_for_Python) says:

<quote>
The module was released mid June 2018 as a Technical Preview
(supporting Qt 5.11), and it was officially released without the
Technical Preview tag, in December 2018 for Qt 5.12. 
</quote>

What does it mean if we use it still with 5.11? Or do we need to update
to 5.12 first?

I wonder if we need the dependency on qtwebkit or if we can get rid of this, but I haven't investigated yet.

medfile: Is there a specific reason you chose 3.x, instead of the
available 4.0.0? If you, could you add a comment of why?

License is GPLv3+

libarea: Also licensed under GPL v3 (files under "pocket" directory).

freecad: Can you use the releasted sources instead of the git-version?

Björn
Jonathan Brielmaier July 22, 2019, 5:57 p.m. UTC | #6
Thanks Björn for having a look here :)

On 7/22/19 4:11 PM, Björn Höfling wrote:> I wanted to give it a try for
myself but failed: I could not build
> qtwebkit locally, and no substitutes are available. I don't want to
> hold back my comments any longer, so I postponed trying it out.

qtwebkit seems to fail on master as well and it needs long to build, so
I can't do it locally on my laptop:
http://ci.guix.gnu.org/build/1488065/details

> I wonder if we need the dependency on qtwebkit or if we can get rid of this, but I haven't investigated yet.

I think we need it as openSUSE and Debian have a build require on
qtwebkit-devel and it's noted at their wiki:
https://www.freecadweb.org/wiki/CompileOnUnix#Getting_the_dependencies
Paul Garlick July 30, 2019, 12:24 p.m. UTC | #7
Hi John, Hi Guix,

Marvellous progress in packaging FreeCAD for Guix!

One of the dependencies is OpenCASCADE.  You may wish to switch the
opencascade-oce input to opencascade-occt, which is now available.  See
commit 37dc29200c44adc0474476b8df46ed44e8a1d41a.  The occt version is
more up-to-date than the oce version.

Best regards,

Paul.
Ludovic Courtès Sept. 2, 2019, 1:23 p.m. UTC | #8
Hi John & all,

Paul Garlick <pgarlick@tourbillion-technology.com> skribis:

> Marvellous progress in packaging FreeCAD for Guix!
>
> One of the dependencies is OpenCASCADE.  You may wish to switch the
> opencascade-oce input to opencascade-occt, which is now available.  See
> commit 37dc29200c44adc0474476b8df46ed44e8a1d41a.  The occt version is
> more up-to-date than the oce version.

John, did you have a chance to look into that?  We’d rather not let the
patch gather too much dust.  :-)

Thanks,
Ludo’.
John Soo Sept. 2, 2019, 1:33 p.m. UTC | #9
Hi!

Yes I’m sorry these patches are rather stale. I rebased them recently and addressed most of these issues. I got stuck working on the test questions. I will send what I have shortly. 

- John

> On Sep 2, 2019, at 6:23 AM, Ludovic Courtès <ludo@gnu.org> wrote:
> 
> Hi John & all,
> 
> Paul Garlick <pgarlick@tourbillion-technology.com> skribis:
> 
>> Marvellous progress in packaging FreeCAD for Guix!
>> 
>> One of the dependencies is OpenCASCADE.  You may wish to switch the
>> opencascade-oce input to opencascade-occt, which is now available.  See
>> commit 37dc29200c44adc0474476b8df46ed44e8a1d41a.  The occt version is
>> more up-to-date than the oce version.
> 
> John, did you have a chance to look into that?  We’d rather not let the
> patch gather too much dust.  :-)
> 
> Thanks,
> Ludo’.
diff mbox series

Patch

From 6c84c3a3f723d43145d9105f5c2929a3abeb978b Mon Sep 17 00:00:00 2001
From: John Soo <jsoo@panosoft.com>
Date: Wed, 19 Jun 2019 06:16:52 -0700
Subject: [PATCH] gnu: Add FreeCAD.

 - Dependencies: pyside 2 toolchain and llvm dependencies, Coin3D and soqt
---
 gnu/packages/engineering.scm | 197 +++++++++++++++++++++++++++++++++++
 gnu/packages/graphics.scm    |  80 ++++++++++++++
 gnu/packages/llvm.scm        | 105 +++++++++++++++++++
 gnu/packages/python-xyz.scm  | 151 +++++++++++++++++++++++++++
 4 files changed, 533 insertions(+)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 7d48414889..f000d7eeaa 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -48,9 +48,11 @@ 
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages commencement)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages fpga)
@@ -63,10 +65,13 @@ 
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gperf)
+  #:use-module (gnu packages graphics)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages image-processing)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages linux)               ;FIXME: for pcb
   #:use-module (gnu packages m4)
@@ -87,6 +92,7 @@ 
   #:use-module (gnu packages tex)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages wxwidgets)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
 (define-public librecad
@@ -2062,3 +2068,194 @@  purpose circuit simulator and can perform DC and transient analyses, fourier
 analysis and AC analysis.  The engine is designed to do true mixed-mode
 simulation.")
     (license license:gpl3+)))
+
+;; FreeCAD
+(define-public freecad
+  (let ((commit "dbb4cc6415bac848a294f03b80f65e888d531742")
+        (revision "1"))
+    (package
+      (name "freecad")
+      (version (git-version "0.18.2" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/FreeCAD/FreeCAD.git")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "01ay9wdacm1hymnaw67y8sg63pv0ar1n72ap77q12dv3qibmwz75"))))
+      (build-system cmake-build-system)
+      (native-inputs
+       `(("doxygen" ,doxygen)
+         ("graphviz" ,graphviz)
+         ("qttools" ,qttools)
+         ("pkg-config" ,pkg-config)
+         ("swig" ,swig)))
+      (inputs
+       `(("boost" ,boost)
+         ("coin3D" ,coin3D)
+         ("eigen" ,eigen)
+         ("freetype" ,freetype)
+         ("glew" ,glew)
+         ("hdf5" ,hdf5)
+         ("libarea" ,libarea)
+         ("libspnav" ,libspnav)
+         ("medfile" ,medfile)
+         ("openmpi" ,openmpi)
+         ("opencascade-oce" ,opencascade-oce)
+         ("python-matplotlib" ,python-matplotlib)
+         ("python-pyside-2" ,python-pyside-2)
+         ("python-pyside-2-tools" ,python-pyside-2-tools)
+         ("python-shiboken-2" ,python-shiboken-2)
+         ("python-wrapper" ,python-wrapper)
+         ("qtbase" ,qtbase)
+         ("qtsvg" ,qtsvg)
+         ("qtx11extras" ,qtx11extras)
+         ("qtxmlpatterns" ,qtxmlpatterns)
+         ("qtwebkit" ,qtwebkit)
+         ("soqt" ,soqt)
+         ("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"))
+         #: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.")
+      ;; Help!
+      (license license:lgpl2.1+))))
+
+(define medfile
+  (package
+    (name "medfile")
+    (version "3.3.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "http://files.salome-platform.org/Salome/other/med-"
+             version ".tar.gz"))
+       (sha256
+        (base32
+         "1215sal10xp6xirgggdszay2bmx0sxhn9pgh7x0wg2w32gw1wqyx"))))
+    (build-system cmake-build-system)
+    (inputs `(("hdf5" ,hdf5)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'remove-test-output
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (delete-file-recursively
+                (string-append out "/bin/testc"))
+               #t))))))
+    (home-page "https://www.salome-platform.org")
+    (synopsis "Library to read and write MED files")
+    (description "Library to read and write MED files")
+    (license license:lgpl2.1)))
+
+(define libarea
+  (let ((revision "1")
+        (commit "8f8bac811c10f1f01fda0d742a18591f61dd76ee"))
+    (package
+      (name "libarea")
+      (version (git-version "0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference (url "https://github.com/Heeks/libarea.git")
+                             (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0pvqz6cabxqdz5y26wnj6alkn8v5d7gkx0d3h8xmg4lvy9r3kh3g"))))
+      (build-system gnu-build-system)
+      (inputs `(("boost" ,boost)
+                ("python-wrapper" ,python-wrapper)))
+      (native-inputs
+       `(("cmake" ,cmake)))
+      (arguments
+       `(#:tests? #f
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'configure 'cmake-configure
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out"))
+                     (cmake (assoc-ref inputs "cmake")))
+                 (mkdir-p "build")
+                 (invoke "cmake"
+                         (string-append "-DCMAKE_INSTALL_PREFIX=" out)))))
+           (delete 'configure))))
+      (home-page "https://github.com/Heeks/libarea")
+      (synopsis
+       "Library and python module for pocketing and profiling operations")
+      (description
+       "Area is a CAM-related software for pocketing operation.
+
+This project provides library and associated python-module to compute pocket
+operations.")
+      (license license:bsd-3))))
+
+(define libspnav
+  (let ((commit "20961617eecc845b23fcf9e06acd1a6bb340b88b")
+        (revision "1"))
+    (package
+      (name "libspnav")
+      (version (git-version "0.2.3" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/FreeSpacenav/libspnav")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "1ib5jxcpz76lr90f69vb50yn2q9ss45axlgil29layh36dnyifac"))))
+      (build-system gnu-build-system)
+      (inputs
+       `(("libx11" ,libx11)))
+      (arguments `(#:tests? #f))
+      (home-page "http://spacenav.sourceforge.net/")
+      (synopsis
+       "Library for communicating with spacenavd or 3dxsrv")
+      (description
+       "The libspnav library is provided as a replacement of the magellan
+library.  It provides a cleaner, and more orthogonal interface.  libspnav
+supports both the original X11 protocol for communicating with the driver, and
+the new alternative non-X protocol.  Programs that choose to use the X11
+protocol, are automatically compatible with either the free spacenavd driver
+or the official 3dxserv, as if they were using the magellan SDK.
+
+Also, libspnav provides a magellan API wrapper on top of the new API.  So, any
+applications that were using the magellan library, can switch to libspnav
+without any changes.  And programmers that are familliar with the magellan API
+can continue using it with a free library without the restrictions of the
+official SDK.")
+      (license license:bsd-3))))
+;; End FreeCAD
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index f9baf49fe9..7f0b99476b 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -52,6 +52,7 @@ 
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages jemalloc)
+  #:use-module (gnu packages llvm)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
@@ -73,6 +74,7 @@ 
   #:use-module (guix build-system python)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix hg-download)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix utils))
@@ -961,3 +963,81 @@  your terminal.  It comes bundled with predefined styles:
 look.  The result can be uploaded on any web server without additional
 requirements.")
     (license license:gpl2+)))
+
+(define-public coin3D
+  (let ((changeset  "8d860d7ba112b22c4e9b289268fd8b3625ab81d3")
+        (revision "1"))
+    (package
+      (name "coin3D")
+      (version
+       (string-append "4.0.0a-" revision "." (string-take changeset 7)))
+      (source
+       (origin
+         (method hg-fetch)
+         (uri (hg-reference (url "https://bitbucket.org/Coin3D/coin")
+                            (changeset changeset)))
+         (sha256
+          (base32
+           "0kgg782j8lkd4bicd8x207mj66vali6kxh6idczjszcxq2iifsr0"))
+         (file-name (git-file-name "coin3D" version))))
+      (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://bitbucket.org/Coin3D/coin/wiki/Home")
+      (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 soqt
+  (let ((changeset "58b495aa6bed9e58542e60df28843f58e2ab8db4")
+        (revision "1"))
+    (package
+      (name "soqt")
+      (version
+       (string-append "1.6.0-" revision "." (string-take changeset 7)))
+      (source
+       (origin
+         (method hg-fetch)
+         (uri (hg-reference (url "https://bitbucket.org/Coin3d/soqt")
+                            (changeset changeset)))
+         (sha256
+          (base32
+           "023rhf8piwcmgi08d3xyqj1cj83v30z6l3zbd5qs1y1mkw9lqfpz"))
+         (file-name (git-file-name "soqt" version))))
+      (build-system cmake-build-system)
+      (native-inputs
+       `(("doxygen" ,doxygen)
+         ("graphviz" ,graphviz)))
+      (inputs
+       `(("coin3D" ,coin3D)
+         ("glew" ,glew)
+         ("libcxx" ,libcxx)
+         ("qtbase" ,qtbase)))
+      (arguments `(#:tests? #f))
+      (home-page "https://bitbucket.org/Coin3D/soqt")
+      (synopsis
+       "GUI component toolkit library for Coin")
+      (description
+       "SoQt is a Qt GUI component toolkit library for Coin.  It is also
+compatible with SGI and TGS Open Inventor, and the API is based on the API of
+the InventorXt GUI component toolkit.")
+      (license license:bsd-3))))
+
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 0315740bcd..4a044ce9f6 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -37,6 +37,7 @@ 
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system emacs)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages bootstrap)           ;glibc-dynamic-linker
@@ -667,3 +668,107 @@  C/C++/Obj-C code according to a set of style options, see
     (synopsis "Rename every occurrence of a symbol using clang-rename")
     (description "This package renames every occurrence of a symbol at point
 using @code{clang-rename}.")))
+
+;; PySide2 docs recommend using a bundled version of libclang
+;; See https://wiki.qt.io/Qt_for_Python/GettingStarted
+;; The source they recommend: https://download.qt.io/development_releases/prebuilt/libclang/
+(define-public llvm-toolchain-6
+  (package
+    (inherit llvm-6)
+    (name "llvm-toolchain")
+    (build-system trivial-build-system)
+    (inputs
+     `(("clang-6" ,clang-6)
+       ("llvm-6" ,llvm-6)))
+    (arguments
+     `(#:modules ((guix build union)
+                  (guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build union)
+                      (ice-9 match)
+                      (srfi srfi-1))
+         (union-build
+          (assoc-ref %outputs "out")
+          (filter-map
+           (match-lambda
+             ((name . dir)
+              (if (or (string=? name "clang-6")
+                      (string=? name "llvm-6"))
+                  dir
+                  #f)))
+           %build-inputs))
+         #t)))
+    (license license:ncsa)))
+
+;; See https://bugreports.qt.io/browse/PYSIDE-787
+;; STL headers are not parsed correctly, so only send in some headers
+(define-public python-pyside-2-libcxx-headers
+  (package
+    (inherit libcxx)
+    (name "python-pyside-2-libcxx-headers")
+    (version (package-version llvm-6))
+    (source
+     (origin
+       (inherit (package-source libcxx))
+       (uri (string-append "http://llvm.org/releases/"
+                           version "/libcxx-" version ".src.tar.xz"))
+       (sha256
+        (base32
+         "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
+    (native-inputs
+     `(("clang" ,clang-6)
+       ("llvm" ,llvm-6)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'use-only-required-headers
+           (lambda* (#:key outputs #:allow-other-keys)
+             (use-modules ((srfi srfi-1)))
+             (let ((out (assoc-ref outputs "out"))
+                   (required-headers
+                    '("type_traits"
+                      "__config"
+                      "cstddef"
+                      "__nullptr"
+                      "utility"
+                      "__tuple"
+                      "initializer_list"
+                      "cstring"
+                      "cstdint"
+                      "__debug")))
+               (for-each
+                delete-file
+                (filter
+                 (lambda (file)
+                   (not
+                    (fold
+                     (lambda (acc header)
+                       (or acc (string-contains file header)))
+                     #f
+                     required-headers)))
+                 (find-files (string-append out "/include/c++/v1"))))
+               (delete-file-recursively (string-append out "/include/c++/v1/ext"))
+               (delete-file-recursively (string-append out "/include/c++/v1/support"))
+               (delete-file-recursively (string-append out "/lib")))
+             #t)))))
+    (synopsis
+     "Libcxx files specifically used by PySide2.")
+    (description
+     "Libcxx files specifically used by PySide2.")))
+
+(define-public libcxx-6
+  (package
+    (inherit libcxx)
+    (version (package-version llvm-6))
+    (source
+     (origin
+       (inherit (package-source libcxx))
+       (uri (string-append "http://llvm.org/releases/"
+                           version "/libcxx-" version ".src.tar.xz"))
+       (sha256
+        (base32
+         "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
+    (native-inputs
+     `(("clang" ,clang-6)
+       ("llvm" ,llvm-6)))))
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 181899da36..315682294b 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -86,6 +86,7 @@ 
   #:use-module (gnu packages backup)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages databases)
@@ -15803,3 +15804,153 @@  hash, recno, and queue.  Complete support of Berkeley DB distributed
 transactions.  Complete support for Berkeley DB Replication Manager.
 Complete support for Berkeley DB Base Replication.  Support for RPC.")
     (license license:bsd-3)))
+
+(define-public python-pyside-2
+  (let ((revision "1")
+        (commit "4018787a3cc01d632fdca7891ac8aa9487110c26"))
+    (package
+      (name "python-pyside-2")
+      (version (git-version "v5.11.3" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://code.qt.io/pyside/pyside-setup")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0g8jacm2iqd7lw2m7f1dp1nnrsk38bl3m8pihm8zz9gxs8d31sf5"))))
+      (build-system cmake-build-system)
+      (inputs
+       `(("python-pyside-2-libcxx-headers" ,python-pyside-2-libcxx-headers)
+         ("libxml2" ,libxml2)
+         ("libxslt" ,libxslt)
+         ("llvm-toolchain-6" ,llvm-toolchain-6)
+         ("qtbase" ,qtbase)
+         ("qtdatavis3d" ,qtdatavis3d)
+         ("qtmultimedia" ,qtmultimedia)
+         ("qtquickcontrols" ,qtquickcontrols) ;; ??
+         ("qtscript" ,qtscript)
+         ("qtscxml" ,qtscxml)
+         ("qtsensors" ,qtsensors)
+         ("qtspeech" ,qtspeech)
+         ("qtsvg" ,qtsvg)
+         ("qtwebchannel" ,qtwebchannel)
+         ("qtwebsockets" ,qtwebsockets)
+         ("qtx11extras" ,qtx11extras)))
+      (native-inputs
+       `(("cmake" ,cmake)
+         ("git" ,git)
+         ("python-shiboken-2" ,python-shiboken-2)
+         ("python-wrapper" ,python-wrapper)
+         ("qttools" ,qttools)
+         ("which" ,which)))
+      (arguments
+       `(#:tests? #f
+         #:configure-flags '("-DBUILD_TESTS=off")
+         #:phases
+         (modify-phases
+             %standard-phases
+           (add-after 'unpack 'go-to-source-dir
+             (lambda _ (chdir "sources/pyside2") #t))
+           (add-before 'configure 'set-clang-dir
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((clang-dir (assoc-ref inputs "llvm-toolchain-6"))
+                     (libcxx-dir (assoc-ref inputs "python-pyside-2-libcxx-headers")))
+                 (setenv "CLANG_INSTALL_DIR" clang-dir)
+                 (substitute* "cmake/Macros/PySideModules.cmake"
+                   (("--include-paths=")
+                    (string-append "--include-paths=" libcxx-dir "/include/c++/v1:")))
+                 #t))))))
+      (home-page "https://wiki.qt.io/Qt_for_Python")
+      (synopsis
+       "The Qt for Python product enables the use of Qt5 APIs in Python applications.")
+      (description
+       "The Qt for Python product enables the use of Qt5 APIs in Python applications.  It lets Python developers utilize the full potential of Qt, using the PySide2 module.  The PySide2 module provides access to the individual Qt modules such as QtCore, QtGui, and so on.  Qt for Python also comes with the Shiboken2 CPython binding code generator, which can be used to generate Python bindings for your C or C++ code.")
+      ;; Help!
+      (license
+       `(,license:fdl1.3+
+         ,license:gpl2+
+         ,license:gpl3+
+         ;; https://code.qt.io/cgit/pyside/pyside-setup.git/tree/LICENSE.GPLv3-EXCEPT
+         ;; https://code.qt.io/cgit/pyside/pyside-setup.git/tree/LICENSE.COMMERCIAL
+         ,license:lgpl3)))))
+
+(define-public python-shiboken-2
+  (let ((revision "1")
+        (commit "4018787a3cc01d632fdca7891ac8aa9487110c26"))
+    (package
+      (name "python-shiboken-2")
+      (version (git-version "v5.11.3" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://code.qt.io/pyside/pyside-setup")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0g8jacm2iqd7lw2m7f1dp1nnrsk38bl3m8pihm8zz9gxs8d31sf5"))))
+      (build-system cmake-build-system)
+      (inputs
+       `(("llvm-toolchain-6" ,llvm-toolchain-6)
+         ("libxml2" ,libxml2)
+         ("libxslt" ,libxslt)
+         ("python-wrapper" ,python-wrapper)
+         ("qtbase" ,qtbase)
+         ("qtxmlpatterns" ,qtxmlpatterns)))
+      (arguments
+       `(#:tests? #f
+         #:configure-flags '("-DBUILD_TESTS=off")
+         #:phases
+         (modify-phases
+             %standard-phases
+           (add-after 'unpack 'use-shiboken-dir-only
+             (lambda _ (chdir "sources/shiboken2") #t))
+           (add-before 'configure 'set-build-env
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((llvm-toolchain-dir (assoc-ref inputs "llvm-toolchain-6")))
+                 (setenv "CLANG_INSTALL_DIR" llvm-toolchain-dir)
+                 #t))))))
+      (home-page "https://wiki.qt.io/Qt_for_Python")
+      (synopsis
+       "Shiboken generates bindings for C++ libraries using CPython source code")
+      (description
+       "Shiboken generates bindings for C++ libraries using CPython source code")
+      ;; Help!
+      (license `(,license:gpl2+
+                 ,license:llgpl)))))
+
+(define-public python-pyside-2-tools
+  (let ((revision "1")
+        (commit "f1b775537e7fbd718516749583b2abf1cb6adbce"))
+    (package
+      (name "python-pyside-2-tools")
+      (version (git-version "v5.11.2" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://code.qt.io/pyside/pyside-tools")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "1w2g5afvww9r89wmdm9jx8sz67x4bzy9difkh72n4c73ya1n91ry"))))
+      (build-system cmake-build-system)
+      (inputs
+       `(("python-pyside-2" ,python-pyside-2)
+         ("python-shiboken-2" ,python-shiboken-2)
+         ("qtbase" ,qtbase)))
+      (arguments
+       `(#:tests? #f
+         #:configure-flags '("-DBUILD_TESTS=off")))
+      (home-page "https://wiki.qt.io/Qt_for_Python")
+      (synopsis
+       "Contains lupdate, rcc and uic tools for PySide2")
+      (description
+       "Contains lupdate, rcc and uic tools for PySide2")
+      ;; Help! (This is from arch)
+      (license license:lgpl2.1+))))
-- 
2.22.0