Patchwork [v3,3/3] gnu: Add kicad.

login
register
mail settings
Submitter Theodoros Foradis
Date Oct. 25, 2016, 5 p.m.
Message ID <20161025170001.2717-4-theodoros.for@openmailbox.org>
Download mbox | patch
Permalink /patch/16809/
State New
Headers show

Comments

Theodoros Foradis - Oct. 25, 2016, 5 p.m.
* gnu/packages/engineering.scm (kicad): New variable.
---
 gnu/packages/engineering.scm | 90 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)
Leo Famulari - Oct. 30, 2016, 12:18 a.m.
On Tue, Oct 25, 2016 at 08:00:01PM +0300, Theodoros Foradis wrote:
> * gnu/packages/engineering.scm (kicad): New variable.

Looks pretty good to me. Below are some things I would investigate and
potentially fix on my own before pushing to Savannah; no need to send a
new patch.

Now we are just waiting to learn more about python2-wxpython...

> +;; We use kicad from a git commit, because support for boost 1.61.0
> +;; has been recently added.
> +(define-public kicad
> +  (let ((commit "4ee344e150bfaf3a6f3f7bf935fb96ae07c423fa")
> +        (revision "1"))
> +    (package
> +      (name "kicad")
> +      (version (string-append "4.0-" revision "."
> +                              (string-take commit 7)))
> +      (source
> +       (origin
> +         (method git-fetch)
> +         (uri (git-reference
> +               (url "https://git.launchpad.net/kicad.git")

Please use the correct URL here :)

> +         #:configure-flags
> +           (list "-DKICAD_STABLE_VERSION=ON"
> +                 "-DKICAD_REPO_NAME=stable"
> +                 "-DKICAD_BUILD_VERSION=4.0"

If possible, we should use our package's version string here. We aren't
really packaging KiCad 4.0, but rather 4.0 plus some extra Git commits,
right?

> +                 "-DCMAKE_BUILD_TYPE=Release"
> +                 "-DKICAD_SKIP_BOOST=ON"; Use our system's boost library
> +                 "-DKICAD_SCRIPTING=ON"
> +                 "-DKICAD_SCRIPTING_MODULES=ON"
> +                 "-DKICAD_SCRIPTING_WXPYTHON=ON"
> +                 ;; Has to be set explicitely, as we don't have the wxPython
> +                 ;; headers in the wxwidgets store item, but in wxPython.
> +                 (string-append "-DCMAKE_CXX_FLAGS=-I"
> +                                (assoc-ref %build-inputs "wxpython")
> +                                "/include/wx-3.0")
> +                 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
> +                 "-DBUILD_GITHUB_PLUGIN=OFF")

I would try building with this on. Does it require some unpackaged
dependencies?
Theodoros Foradis - Nov. 2, 2016, 3:42 p.m.
Leo Famulari writes:

> On Tue, Oct 25, 2016 at 08:00:01PM +0300, Theodoros Foradis wrote:
>> * gnu/packages/engineering.scm (kicad): New variable.
>
> Looks pretty good to me. Below are some things I would investigate and
> potentially fix on my own before pushing to Savannah; no need to send a
> new patch.
>
> Now we are just waiting to learn more about python2-wxpython...
>
>> +;; We use kicad from a git commit, because support for boost 1.61.0
>> +;; has been recently added.
>> +(define-public kicad
>> +  (let ((commit "4ee344e150bfaf3a6f3f7bf935fb96ae07c423fa")
>> +        (revision "1"))
>> +    (package
>> +      (name "kicad")
>> +      (version (string-append "4.0-" revision "."
>> +                              (string-take commit 7)))
>> +      (source
>> +       (origin
>> +         (method git-fetch)
>> +         (uri (git-reference
>> +               (url "https://git.launchpad.net/kicad.git")
>
> Please use the correct URL here :)
>

Right. Is it normal that the url is not checked again, after having the
source in store? 

>> +         #:configure-flags
>> +           (list "-DKICAD_STABLE_VERSION=ON"
>> +                 "-DKICAD_REPO_NAME=stable"
>> +                 "-DKICAD_BUILD_VERSION=4.0"
>
> If possible, we should use our package's version string here. We aren't
> really packaging KiCad 4.0, but rather 4.0 plus some extra Git commits,
> right?
>

Right.

>> +                 "-DCMAKE_BUILD_TYPE=Release"
>> +                 "-DKICAD_SKIP_BOOST=ON"; Use our system's boost library
>> +                 "-DKICAD_SCRIPTING=ON"
>> +                 "-DKICAD_SCRIPTING_MODULES=ON"
>> +                 "-DKICAD_SCRIPTING_WXPYTHON=ON"
>> +                 ;; Has to be set explicitely, as we don't have the wxPython
>> +                 ;; headers in the wxwidgets store item, but in wxPython.
>> +                 (string-append "-DCMAKE_CXX_FLAGS=-I"
>> +                                (assoc-ref %build-inputs "wxpython")
>> +                                "/include/wx-3.0")
>> +                 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
>> +                 "-DBUILD_GITHUB_PLUGIN=OFF")
>
> I would try building with this on. Does it require some unpackaged
> dependencies?

It builds with this on, without extra dependencies, but the plugin
doesn't work due to CA certificates errors:

Reason: 'IO_ERROR: curl_easy_perform()=60: Peer certificate cannot be
authenticated with given CA certificates from kicad_curl_easy.cpp :
Perform() line:92'

I tried setting the SSL_CERT_FILE environment variable, but still
doesn't work.

This plugin will most likely be unneeded anyway, after I package the
libraries and footprint for guix, which should not take long. Feedback
is most welcome.

Regards,
Leo Famulari - Nov. 5, 2016, 6:41 p.m.
On Wed, Nov 02, 2016 at 05:42:01PM +0200, Theodoros Foradis wrote:
> Right. Is it normal that the url is not checked again, after having the
> source in store? 

Yes, Guix finds the file named by the source hash in /gnu/store and so
it doesn't try downloading it. You can check for this mistake with `guix
build foo -S --check --no-substitutes`.

> >> +                 "-DBUILD_GITHUB_PLUGIN=OFF")
> >
> > I would try building with this on. Does it require some unpackaged
> > dependencies?
> 
> It builds with this on, without extra dependencies, but the plugin
> doesn't work due to CA certificates errors:
> 
> Reason: 'IO_ERROR: curl_easy_perform()=60: Peer certificate cannot be
> authenticated with given CA certificates from kicad_curl_easy.cpp :
> Perform() line:92'
> 
> I tried setting the SSL_CERT_FILE environment variable, but still
> doesn't work.

I've had trouble with other packages that use curl not being able to
find the CA certificates. Let's mark this as TODO :)

Can you send an updated patch series addressing the most recent (and I
hope final) round of comments?
Ricardo Wurmus - Nov. 7, 2016, 9:04 p.m.
Leo Famulari <leo@famulari.name> writes:

> On Wed, Nov 02, 2016 at 05:42:01PM +0200, Theodoros Foradis wrote:
>> Right. Is it normal that the url is not checked again, after having the
>> source in store? 
>
> Yes, Guix finds the file named by the source hash in /gnu/store and so
> it doesn't try downloading it. You can check for this mistake with `guix
> build foo -S --check --no-substitutes`.
>
>> >> +                 "-DBUILD_GITHUB_PLUGIN=OFF")
>> >
>> > I would try building with this on. Does it require some unpackaged
>> > dependencies?
>> 
>> It builds with this on, without extra dependencies, but the plugin
>> doesn't work due to CA certificates errors:
>> 
>> Reason: 'IO_ERROR: curl_easy_perform()=60: Peer certificate cannot be
>> authenticated with given CA certificates from kicad_curl_easy.cpp :
>> Perform() line:92'
>> 
>> I tried setting the SSL_CERT_FILE environment variable, but still
>> doesn't work.
>
> I've had trouble with other packages that use curl not being able to
> find the CA certificates. Let's mark this as TODO :)
>
> Can you send an updated patch series addressing the most recent (and I
> hope final) round of comments?

This requires a patch to libcurl, which I hope to send for the next
core-updates cycle.

~~ Ricardo

Patch

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 829ceb0..7ecd64e 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -4,6 +4,7 @@ 
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016 Theodoros Foradis <theodoros.for@openmailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,6 +30,7 @@ 
   #: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 cmake)
   #:use-module (gnu packages)
@@ -39,6 +41,7 @@ 
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages curl)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gd)
@@ -55,9 +58,14 @@ 
   #:use-module (gnu packages maths)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages swig)
   #:use-module (gnu packages tcl)
+  #:use-module (gnu packages tls)
   #:use-module (gnu packages tex)
+  #:use-module (gnu packages wxwidgets)
+  #:use-module (gnu packages xorg)
   #:use-module (srfi srfi-1))
 
 (define-public librecad
@@ -562,3 +570,85 @@  fundamental, primitive shapes are represented as code in the user-level
 language.")
       (license (list license:lgpl2.1+             ;library
                      license:gpl2+)))))           ;Guile bindings
+
+;; We use kicad from a git commit, because support for boost 1.61.0
+;; has been recently added.
+(define-public kicad
+  (let ((commit "4ee344e150bfaf3a6f3f7bf935fb96ae07c423fa")
+        (revision "1"))
+    (package
+      (name "kicad")
+      (version (string-append "4.0-" revision "."
+                              (string-take commit 7)))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://git.launchpad.net/kicad.git")
+               (commit commit)))
+         (sha256
+          (base32 "0kf6r92nps0658i9n3p9vp5dzbssmc22lvjv5flyvnlf83l63s4n"))
+         (file-name (string-append name "-" version "-checkout"))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:out-of-source? #t
+         #:tests? #f ; no tests
+         #:configure-flags
+           (list "-DKICAD_STABLE_VERSION=ON"
+                 "-DKICAD_REPO_NAME=stable"
+                 "-DKICAD_BUILD_VERSION=4.0"
+                 "-DCMAKE_BUILD_TYPE=Release"
+                 "-DKICAD_SKIP_BOOST=ON"; Use our system's boost library
+                 "-DKICAD_SCRIPTING=ON"
+                 "-DKICAD_SCRIPTING_MODULES=ON"
+                 "-DKICAD_SCRIPTING_WXPYTHON=ON"
+                 ;; Has to be set explicitely, as we don't have the wxPython
+                 ;; headers in the wxwidgets store item, but in wxPython.
+                 (string-append "-DCMAKE_CXX_FLAGS=-I"
+                                (assoc-ref %build-inputs "wxpython")
+                                "/include/wx-3.0")
+                 "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE"
+                 "-DBUILD_GITHUB_PLUGIN=OFF")
+           #:phases
+             (modify-phases %standard-phases
+               (add-after 'install 'wrap-program ;;Ensure correct python at runtime
+                          (lambda* (#:key inputs outputs #:allow-other-keys)
+                            (let* ((out (assoc-ref outputs "out"))
+                                   (python (assoc-ref inputs "python"))
+                                   (file (string-append out "/bin/kicad"))
+                                   (path (string-append
+                                          out
+                                          "/lib/python2.7/site-packages:"
+                                          (getenv "PYTHONPATH"))))
+                              (wrap-program file
+                                `("PYTHONPATH" ":" prefix (,path))
+                                `("PATH" ":" prefix
+                                  (,(string-append python "/bin:")))))
+                            #t)))))
+      (native-inputs
+       `(("boost" ,boost)
+         ("gettext" ,gnu-gettext)
+         ("pkg-config" ,pkg-config)
+         ("swig" ,swig)
+         ("zlib" ,zlib)))
+      (inputs
+       `(("cairo" ,cairo)
+         ("curl" ,curl)
+         ("desktop-file-utils" ,desktop-file-utils)
+         ("glew" ,glew)
+         ("glm" ,glm)
+         ("hicolor-icon-theme" ,hicolor-icon-theme)
+         ("libsm" ,libsm)
+         ("mesa" ,mesa)
+         ("openssl" ,openssl)
+         ("python" ,python-2)
+         ("wxwidgets" ,wxwidgets-gtk2)
+         ("wxpython" ,python2-wxpython)))
+      (home-page "http://http://kicad-pcb.org/")
+      (synopsis "Electronics Design Automation Suite")
+      (description
+       "Kicad is created for the formation of printed circuit boards and electrical circuits.
+ The software has a number of programs that perform specific functions, for example,
+ pcbnew (Editing PCB), eeschema (editing electrical diagrams), gerbview (viewing Gerber
+ files) and others. ")
+      (license license:gpl3+))))