all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: add kicad
@ 2016-02-15  7:40 Danny Milosavljevic
  2016-02-15 11:35 ` Ben Woodcroft
  2016-05-23  4:13 ` Leo Famulari
  0 siblings, 2 replies; 17+ messages in thread
From: Danny Milosavljevic @ 2016-02-15  7:40 UTC (permalink / raw)
  To: guix-devel

Hi,

this patch adds kicad, an electronics design automation tool, to "engineering.scm".

What do I do with the optional stuff like scripting etc? Is there something like Gentoo USE flags?

Also, for this to work, wxwidgets.scm needs a 4 character patch. Do I add this here as well?
 
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index ba11f52..5c3440c 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -27,6 +27,7 @@
   #:use-module (guix utils)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system cmake)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
@@ -48,8 +49,10 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages tcl)
   #:use-module (gnu packages texlive)
+  #:use-module (gnu packages tls)
   #:use-module (srfi srfi-1))
 
 (define-public librecad
@@ -106,6 +109,53 @@
 plans and designs.")
     (license license:gpl2)))
 
+(define-public kicad
+ (package
+   (name "kicad")
+   (version "4.0.2")
+   (source (origin
+              (method url-fetch)
+              (uri (string-append
+                   "https://launchpad.net/kicad/4.0/kicad-"
+                   version
+                   "/+download/kicad-"
+                   version
+                   ".tar.xz"))
+              (sha256
+               (base32
+                "1fcf91fmxj6ha3mm6gzdb0px50j58m80p8wrncm8ca9shj36kbif"))))
+   (build-system cmake-build-system)
+   (arguments
+    '(#:tests? #f ; TODO re-enable
+      #:configure-flags
+     (list "-DKICAD_SKIP_BOOST=ON" ; use system boost; otherwise, it tries to download one and fails.
+     ; TODO -DCMAKE_BUILD_TYPE=Release
+     ; TODO -DOPENSSL_ROOT_DIR=...
+     ; TODO -DCMAKE_PREFIX_PATH=...
+     ; TODO -DCMAKE_INSTALL_PREFIX=...
+     ; TODO -DDEFAULT_INSTALL_PATH=...
+     ; TODO -DKICAD_SCRIPTING=ON
+     ; TODO -DKICAD_SCRIPTING_MODULES=ON
+     ; TODO -DKICAD_SCRIPTING_WXPYTHON=ON
+     )))
+   ; TODO optional doxygen for source docs
+   (native-inputs
+     `())
+   (inputs
+     `(("wxwidgets" ,wxwidgets)
+       ("mesa" ,mesa)
+       ("glew" ,glew)
+       ("cairo" ,cairo)
+       ("libressl" ,libressl)
+       ("boost" ,boost)))
+   (home-page "http://kicad-pcb.org/")
+   (synopsis "Electronics Design Automation Suite")
+   (description "Electronics Design Automation Suite")
+   (license license:gpl3+)))
+
+; TODO extra options for Python (which) and for version.
+; TODO kicad-doc, kicad-library, kicad-footprints
+
 (define-public geda-gaf
   (package
     (name "geda-gaf")

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] gnu: add kicad
  2016-02-15  7:40 [PATCH] gnu: add kicad Danny Milosavljevic
@ 2016-02-15 11:35 ` Ben Woodcroft
  2016-05-23  4:13 ` Leo Famulari
  1 sibling, 0 replies; 17+ messages in thread
From: Ben Woodcroft @ 2016-02-15 11:35 UTC (permalink / raw)
  To: Danny Milosavljevic, guix-devel

Hi,

Thanks for the patch. New contributors are most welcome.

On 15/02/16 17:40, Danny Milosavljevic wrote:
> this patch adds kicad, an electronics design automation tool, to "engineering.scm".
>
> What do I do with the optional stuff like scripting etc? Is there something like Gentoo USE flags?

That depends on the situation. Sometimes 'extra' scripts form part of 
the regular distribution and included as normal, sometimes they are 
included as separate outputs if they are large in size (or as separate 
packages), and sometimes they are simply not included. It really depends 
on what you'd like to see packaged (and maintained).

> Also, for this to work, wxwidgets.scm needs a 4 character patch. Do I add this here as well?

Yes please. It isn't quite clear to me at this stage, but I would 
imagine a separate patch would be required.

[...]

Thanks.
ben

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] gnu: add kicad
  2016-02-15  7:40 [PATCH] gnu: add kicad Danny Milosavljevic
  2016-02-15 11:35 ` Ben Woodcroft
@ 2016-05-23  4:13 ` Leo Famulari
  2016-07-07  0:22   ` Stuck on KiCad dependency wxPython Leo Famulari
  2016-08-03 23:54   ` [PATCH] gnu: add kicad Danny Milosavljevic
  1 sibling, 2 replies; 17+ messages in thread
From: Leo Famulari @ 2016-05-23  4:13 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

On Mon, Feb 15, 2016 at 08:40:46AM +0100, Danny Milosavljevic wrote:
> this patch adds kicad, an electronics design automation tool, to "engineering.scm".

Cool, I would really like to offer KiCad in Guix. This fell through the
cracks but I'd like to resurrect it!

Danny, are you still interested in working on it? Here are some
comments...

> +(define-public kicad

> +              (uri (string-append
> +                   "https://launchpad.net/kicad/4.0/kicad-"
> +                   version
> +                   "/+download/kicad-"
> +                   version
> +                   ".tar.xz"))

It seems they changed the URL format. This works for me now:
https://launchpad.net/kicad/4.0/4.0.2/+download/kicad-4.0.2.tar.xz

Also, the quoted URL string should start on the same line as
string-append.

> +   (arguments
> +    '(#:tests? #f ; TODO re-enable

Do you remember the state of the tests? Was it just a few that failed?

> +      #:configure-flags

I noticed on the KiCad download page [0] some instructions to set the
version string, and other useful build-time configurations. Do you think
it would be appropriate to apply them?

------
For the moment you are supposed to use the following options to set the
version string:

-DKICAD_REPO_NAME=stable -DKICAD_BUILD_VERSION=4.0.2

And you encouraged to enable the python scripting, even though it is not
enabled by default with the following additional Cmake options.

-DKICAD_SCRIPTING=ON -DKICAD_SCRIPTING_MODULES=ON -DKICAD_SCRIPTING_WXPYTHON=ON
------

> +     (list "-DKICAD_SKIP_BOOST=ON" ; use system boost; otherwise, it tries to download one and fails.
> +     ; TODO -DCMAKE_BUILD_TYPE=Release
> +     ; TODO -DOPENSSL_ROOT_DIR=...
> +     ; TODO -DCMAKE_PREFIX_PATH=...
> +     ; TODO -DCMAKE_INSTALL_PREFIX=...
> +     ; TODO -DDEFAULT_INSTALL_PATH=...
> +     ; TODO -DKICAD_SCRIPTING=ON
> +     ; TODO -DKICAD_SCRIPTING_MODULES=ON
> +     ; TODO -DKICAD_SCRIPTING_WXPYTHON=ON

What features are missing without them? What is OpenSSL / TLS support
used for?

> +   ; TODO optional doxygen for source docs

Do we just need to add doxygen to native-inputs?

> +   (inputs
[...]
> +       ("libressl" ,libressl)

Unusual choice but I don't object to it. This would be the first package
to refer to libressl in our tree.

> +   (description "Electronics Design Automation Suite")

This should be more descriptive in the final patch.

> +; TODO extra options for Python (which) and for version.

Ah, I see you noticed the text on the download page :)

> +; TODO kicad-doc, kicad-library, kicad-footprints

Do we need to add the library and footprints at the same time as KiCad
itself, or can they come later?

We should try to offer the docs from the start.

[0]
http://kicad-pcb.org/download/source/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Stuck on KiCad dependency wxPython
  2016-05-23  4:13 ` Leo Famulari
@ 2016-07-07  0:22   ` Leo Famulari
  2016-07-07  6:31     ` Efraim Flashner
  2016-08-03 23:54   ` [PATCH] gnu: add kicad Danny Milosavljevic
  1 sibling, 1 reply; 17+ messages in thread
From: Leo Famulari @ 2016-07-07  0:22 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3104 bytes --]

On Mon, May 23, 2016 at 12:13:19AM -0400, Leo Famulari wrote:
> On Mon, Feb 15, 2016 at 08:40:46AM +0100, Danny Milosavljevic wrote:
> > this patch adds kicad, an electronics design automation tool, to "engineering.scm".
> 
> Cool, I would really like to offer KiCad in Guix. This fell through the
> cracks but I'd like to resurrect it!

KiCad recommends we build with support for scripting with wxPython [0],
so I'm packaging that, but I'm stuck.

It's a complicated package. It ./configures with Autotools, but builds
and installs with Python setuptools. I've attached my rough WIP patch.

Parts of the package definition are cribbed from Debian [1], Nix [2],
and Arch [3].

It fails to find the wx headers, as below. I've tried adding them to
C_INCLUDE_PATH or setting -I/gnu/store/...-wxwidgets... in #:make-flags.

Any advice?

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DSWIG_PYTHON_SILENT_MEMLEAK -DWXP_USE_THREAD=1 -UNDEBUG -Iinclude -Isrc -I/gnu/store/2kf45v7w0iypnbcyk53ghihdqqlphay4-gtk+-2.24.30/include/gtk-2.0 -I/gnu/store/2kf45v7w0iypnbcyk53ghihdqqlphay4-gtk+-2.24.30/lib/gtk-2.0/include -I/gnu/store/pmqssiwi3sdpgyxfiyv9g5w1dmhzg662-libpng-1.5.26/include/libpng15 -I/gnu/store/1qsvhrcgji1bgzq16cg96n8ahd2yhb7d-pango-1.40.1/include/pango-1.0 -I/gnu/store/fqnr5fllihp95kan3a6cwg28b9fnqjd5-gdk-pixbuf+svg-2.34.0/include/gdk-pixbuf-2.0 -I/gnu/store/qizy1vd86sxvn7dgwafi1c8vqhnq8nrr-atk-2.20.0/include/atk-1.0 -I/gnu/store/vl3fs2xf64mgy4rw69fhddgh5zx3vwbf-harfbuzz-1.2.4/include/harfbuzz -I/gnu/store/7hkzdkd6svcmc76hxqzlj5s7im01791r-cairo-1.14.6/include/cairo -I/gnu/store/6m4xdh1rj3np9w2fikf8wlq6lka1hmsg-glib-2.48.0/include/glib-2.0 -I/gnu/store/6m4xdh1rj3np9w2fikf8wlq6lka1hmsg-glib-2.48.0/lib/glib-2.0/include -I/gnu/store/8ifqb1iyyz2vgaap51izb2d306kfpqv4-pixman-0.34.0/include/pixman-1 -I/gnu/store/fcxz8rsfkwvjmwc5xrx446ndl0hrc702-freetype-2.6.3/include/freetype2 -I/gnu/store/pmqssiwi3sdpgyxfiyv9g5w1dmhzg662-libpng-1.5.26/include/libpng15 -I/gnu/store/jd5qm8r971dyh4h7dnfc07kmpfifspsb-python-2.7.10/include/python2.7 -c src/helpers.cpp -o build/temp.linux-x86_64-2.7/src/helpers.o -O3 -pthread
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from src/helpers.cpp:17:0:
include/wx/wxPython/wxPython_int.h:35:19: fatal error: wx/wx.h: No such file or directory
 #include <wx/wx.h>
                   ^
compilation terminated.
error: command 'gcc' failed with exit status 1
phase `build' failed after 0.7 seconds
builder for `/gnu/store/lnvf3rz9nggjybrb7kx1pxca57qqmxbn-python-wxpython-3.0.2.0.drv' failed with exit code 1

[0]
http://kicad-pcb.org/download/source/

[1]
https://anonscm.debian.org/cgit/freewx/wx.git/tree/debian/repack.sh?id=refs/heads/wxpy3.0-debian

[2]
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/wxPython/3.0.nix

[3]
https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/wxpython

[-- Attachment #2: 0001-Non-working-WIP-wxPython.-Asking-for-help.patch --]
[-- Type: text/x-diff, Size: 3641 bytes --]

From 7ebb17757b0d39c92b54719a814faeb639a6af00 Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
Date: Wed, 6 Jul 2016 20:21:27 -0400
Subject: [PATCH] Non-working WIP wxPython. Asking for help.

---
 gnu/packages/wxwidgets.scm | 69 +++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/wxwidgets.scm b/gnu/packages/wxwidgets.scm
index 3231e3d..c3ab368 100644
--- a/gnu/packages/wxwidgets.scm
+++ b/gnu/packages/wxwidgets.scm
@@ -22,6 +22,8 @@
   #:use-module (guix download)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix build-system glib-or-gtk)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module (guix build utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
@@ -31,9 +33,12 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages webkit)
-  #:use-module (gnu packages xorg))
+  #:use-module (gnu packages xorg)
+  #:use-module (gnu packages xml)
+  )
 
 (define-public wxwidgets
   (package
@@ -107,3 +112,65 @@ and many other languages.")
                             (assoc-ref %outputs "out") "/lib"))
        ;; No 'check' target.
        #:tests? #f))))
+
+(define-public python-wxpython
+  (package
+    (name "python-wxpython")
+    (version "3.0.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
+                                  version "/wxPython-src-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; TODO Audit fully
+                  (delete-file-recursively "src/expat")
+                  (delete-file-recursively "src/jpeg")
+                  (delete-file-recursively "src/png")
+                  (delete-file-recursively "src/tiff")
+                  (delete-file-recursively "src/zlib")
+
+
+                  (delete-file-recursively "src/msw")
+                  (delete-file-recursively "src/osx")
+                  ))))
+    (build-system gnu-build-system)
+    (arguments
+     `(
+       #:tests? #f
+       #:configure-flags
+       (list "--enable-unicode" ; any effect?
+             "--disable-precomp-headers"
+             "--with-regex=sys")
+       #:make-flags
+       (list (string-append "LDFLAGS=-Wl,-rpath="
+                            (assoc-ref %outputs "out") "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'chdir
+           (lambda _ (chdir "wxPython")))
+         (replace 'build
+           (lambda _
+             (zero?
+               (system* "python" "setup.py" "WXPORT=gtk2" "UNICODE=1" "build")))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python2-setuptools" ,python2-setuptools)))
+    (inputs
+     `(("expat" ,expat)
+       ("gtk+" ,gtk+-2)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libtiff" ,libtiff)
+       ("libx11" ,libx11)
+       ("python-2" ,python-2)
+       ("wxwidgets" ,wxwidgets)
+       ("zlib" ,zlib)))
+    (synopsis "Hello, GNU world: An example GNU package")
+    (description "Guess what GNU Hello prints!")
+    (home-page "http://www.gnu.org/software/hello/")
+    (license l:fsf-free))) ; TODO Audit
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: Stuck on KiCad dependency wxPython
  2016-07-07  0:22   ` Stuck on KiCad dependency wxPython Leo Famulari
@ 2016-07-07  6:31     ` Efraim Flashner
  2016-07-08  0:51       ` Leo Famulari
  0 siblings, 1 reply; 17+ messages in thread
From: Efraim Flashner @ 2016-07-07  6:31 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3678 bytes --]

On Wed, Jul 06, 2016 at 08:22:28PM -0400, Leo Famulari wrote:
> On Mon, May 23, 2016 at 12:13:19AM -0400, Leo Famulari wrote:
> > On Mon, Feb 15, 2016 at 08:40:46AM +0100, Danny Milosavljevic wrote:
> > > this patch adds kicad, an electronics design automation tool, to "engineering.scm".
> > 
> > Cool, I would really like to offer KiCad in Guix. This fell through the
> > cracks but I'd like to resurrect it!
> 
> KiCad recommends we build with support for scripting with wxPython [0],
> so I'm packaging that, but I'm stuck.
> 
> It's a complicated package. It ./configures with Autotools, but builds
> and installs with Python setuptools. I've attached my rough WIP patch.
> 
> Parts of the package definition are cribbed from Debian [1], Nix [2],
> and Arch [3].
> 
> It fails to find the wx headers, as below. I've tried adding them to
> C_INCLUDE_PATH or setting -I/gnu/store/...-wxwidgets... in #:make-flags.
> 
> Any advice?
> 
> gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSWIG_TYPE_TABLE=_wxPython_table -DSWIG_PYTHON_OUTPUT_TUPLE -DSWIG_PYTHON_SILENT_MEMLEAK -DWXP_USE_THREAD=1 -UNDEBUG -Iinclude -Isrc -I/gnu/store/2kf45v7w0iypnbcyk53ghihdqqlphay4-gtk+-2.24.30/include/gtk-2.0 -I/gnu/store/2kf45v7w0iypnbcyk53ghihdqqlphay4-gtk+-2.24.30/lib/gtk-2.0/include -I/gnu/store/pmqssiwi3sdpgyxfiyv9g5w1dmhzg662-libpng-1.5.26/include/libpng15 -I/gnu/store/1qsvhrcgji1bgzq16cg96n8ahd2yhb7d-pango-1.40.1/include/pango-1.0 -I/gnu/store/fqnr5fllihp95kan3a6cwg28b9fnqjd5-gdk-pixbuf+svg-2.34.0/include/gdk-pixbuf-2.0 -I/gnu/store/qizy1vd86sxvn7dgwafi1c8vqhnq8nrr-atk-2.20.0/include/atk-1.0 -I/gnu/store/vl3fs2xf64mgy4rw69fhddgh5zx3vwbf-harfbuzz-1.2.4/include/harfbuzz -I/gnu/store/7hkzdkd6svcmc76hxqzlj5s7im01791r-cairo-1.14.6/include/cairo -I/gnu/store/6m4xdh1rj3np9w2fikf8wlq6lka1hmsg-glib-2.48.0/include/glib-2.0 -I/gnu/store/6m4xdh1rj3np9w2fikf8wlq6lka1hmsg-glib-2.48.0/lib/glib-2.0/include -I/gnu/store/8ifqb1iyyz2vgaap51izb2d306kfpqv4-pixman-0.34.0/include/pixman-1 -I/gnu/store/fcxz8rsfkwvjmwc5xrx446ndl0hrc702-freetype-2.6.3/include/freetype2 -I/gnu/store/pmqssiwi3sdpgyxfiyv9g5w1dmhzg662-libpng-1.5.26/include/libpng15 -I/gnu/store/jd5qm8r971dyh4h7dnfc07kmpfifspsb-python-2.7.10/include/python2.7 -c src/helpers.cpp -o build/temp.linux-x86_64-2.7/src/helpers.o -O3 -pthread
> cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
> In file included from src/helpers.cpp:17:0:
> include/wx/wxPython/wxPython_int.h:35:19: fatal error: wx/wx.h: No such file or directory
>  #include <wx/wx.h>
>                    ^
> compilation terminated.
> error: command 'gcc' failed with exit status 1
> phase `build' failed after 0.7 seconds
> builder for `/gnu/store/lnvf3rz9nggjybrb7kx1pxca57qqmxbn-python-wxpython-3.0.2.0.drv' failed with exit code 1
> 
> [0]
> http://kicad-pcb.org/download/source/
> 
> [1]
> https://anonscm.debian.org/cgit/freewx/wx.git/tree/debian/repack.sh?id=refs/heads/wxpy3.0-debian
> 
> [2]
> https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/wxPython/3.0.nix
> 
> [3]
> https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/wxpython


/gnu/store/h38zwyj2a64dpai99gavv3anhk303xyp-wxwidgets-3.0.2/include/wx-3.0/wx/wx.h

looks like you'll need (string-append "-I" (assoc-ref %build-inputs
"wxwidgets") "/include/wx-3.0") as a configure flag

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Stuck on KiCad dependency wxPython
  2016-07-07  6:31     ` Efraim Flashner
@ 2016-07-08  0:51       ` Leo Famulari
  2016-07-08 10:15         ` Ricardo Wurmus
  2016-09-22  8:27         ` Danny Milosavljevic
  0 siblings, 2 replies; 17+ messages in thread
From: Leo Famulari @ 2016-07-08  0:51 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: guix-devel

On Thu, Jul 07, 2016 at 09:31:20AM +0300, Efraim Flashner wrote:
> /gnu/store/h38zwyj2a64dpai99gavv3anhk303xyp-wxwidgets-3.0.2/include/wx-3.0/wx/wx.h
> 
> looks like you'll need (string-append "-I" (assoc-ref %build-inputs
> "wxwidgets") "/include/wx-3.0") as a configure flag

Unfortunately, it has no effect as #:make-flag.

./configure exits with an error, as it doesn't recognize the option.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Stuck on KiCad dependency wxPython
  2016-07-08  0:51       ` Leo Famulari
@ 2016-07-08 10:15         ` Ricardo Wurmus
  2016-07-12  9:24           ` Ludovic Courtès
  2016-09-22  8:27         ` Danny Milosavljevic
  1 sibling, 1 reply; 17+ messages in thread
From: Ricardo Wurmus @ 2016-07-08 10:15 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel


Leo Famulari <leo@famulari.name> writes:

> On Thu, Jul 07, 2016 at 09:31:20AM +0300, Efraim Flashner wrote:
>> /gnu/store/h38zwyj2a64dpai99gavv3anhk303xyp-wxwidgets-3.0.2/include/wx-3.0/wx/wx.h
>> 
>> looks like you'll need (string-append "-I" (assoc-ref %build-inputs
>> "wxwidgets") "/include/wx-3.0") as a configure flag
>
> Unfortunately, it has no effect as #:make-flag.

Do you mean “#:configure-flags”?

> ./configure exits with an error, as it doesn't recognize the option.

In these cases I normally augment the CPATH environment variable.

~~ Ricardo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Stuck on KiCad dependency wxPython
  2016-07-08 10:15         ` Ricardo Wurmus
@ 2016-07-12  9:24           ` Ludovic Courtès
  0 siblings, 0 replies; 17+ messages in thread
From: Ludovic Courtès @ 2016-07-12  9:24 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> Leo Famulari <leo@famulari.name> writes:
>
>> On Thu, Jul 07, 2016 at 09:31:20AM +0300, Efraim Flashner wrote:
>>> /gnu/store/h38zwyj2a64dpai99gavv3anhk303xyp-wxwidgets-3.0.2/include/wx-3.0/wx/wx.h
>>> 
>>> looks like you'll need (string-append "-I" (assoc-ref %build-inputs
>>> "wxwidgets") "/include/wx-3.0") as a configure flag
>>
>> Unfortunately, it has no effect as #:make-flag.
>
> Do you mean “#:configure-flags”?
>
>> ./configure exits with an error, as it doesn't recognize the option.
>
> In these cases I normally augment the CPATH environment variable.

Or you can do:

  ./configure CPPFLAGS=-I/foo/bar

Perhaps that’s what Efraim meant.

Ludo’.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] gnu: add kicad
  2016-05-23  4:13 ` Leo Famulari
  2016-07-07  0:22   ` Stuck on KiCad dependency wxPython Leo Famulari
@ 2016-08-03 23:54   ` Danny Milosavljevic
  2016-08-04  8:31     ` Andreas Enge
  1 sibling, 1 reply; 17+ messages in thread
From: Danny Milosavljevic @ 2016-08-03 23:54 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

Hi Leo,

On Mon, 23 May 2016 00:13:19 -0400
Leo Famulari <leo@famulari.name> wrote:

> Danny, are you still interested in working on it? 

Yeah. 

> I noticed on the KiCad download page [0] some instructions to set the
> version string, and other useful build-time configurations. Do you think
> it would be appropriate to apply them?

Yes.

> -DKICAD_SCRIPTING=ON -DKICAD_SCRIPTING_MODULES=ON -DKICAD_SCRIPTING_WXPYTHON=ON
> ------
> 
[...skipped...]
> > +     ; TODO -DKICAD_SCRIPTING=ON
> > +     ; TODO -DKICAD_SCRIPTING_MODULES=ON
> > +     ; TODO -DKICAD_SCRIPTING_WXPYTHON=ON  
> 
> What features are missing without them? 

These are recommended for scripting in Kicad.

>What is OpenSSL / TLS support used for?

Good question - I'll try to find out.

> > +   ; TODO optional doxygen for source docs  
> 
> Do we just need to add doxygen to native-inputs?

Yeah.

> > +   (inputs  
> [...]
> > +       ("libressl" ,libressl)  
> 
> Unusual choice but I don't object to it. This would be the first package
> to refer to libressl in our tree.

We can also use openssl, I don't have a strong preference, really. Both projects seem to merge each other's security patches so we can also use openssl.

> > +   (description "Electronics Design Automation Suite")  
> 
> This should be more descriptive in the final patch.

Yeah, what about "KiCad is an Electronics Design Automation Suite. It allows you to edit schematics, edit printed circuit boards, generate Gerbers and calculate track widths." ?

> > +; TODO extra options for Python (which) and for version.  
> 
> Ah, I see you noticed the text on the download page :)

:)

> > +; TODO kicad-doc, kicad-library, kicad-footprints  
> 
> Do we need to add the library and footprints at the same time as KiCad
> itself, or can they come later?

You can create your own footprints and schematic library in KiCad, so they are not vital. However, it would be a liiittle bit annoying to use.

The footprints contain different physical sizes and layouts of electronic components.

The library contains model numbers (and sometimes vendors) for a given function. You can ask something like "What AC/DC converters are there and what can they do?"; 

also: What are the functions of the pins on this one" etc.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] gnu: add kicad
  2016-08-03 23:54   ` [PATCH] gnu: add kicad Danny Milosavljevic
@ 2016-08-04  8:31     ` Andreas Enge
  0 siblings, 0 replies; 17+ messages in thread
From: Andreas Enge @ 2016-08-04  8:31 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Hello,

On Thu, Aug 04, 2016 at 01:54:45AM +0200, Danny Milosavljevic wrote:
> > Unusual choice but I don't object to it. This would be the first package
> > to refer to libressl in our tree.
> We can also use openssl, I don't have a strong preference, really. Both projects seem to merge each other's security patches so we can also use openssl.

why not use libressl? We considered switching to it completely at some
point in time, but so far did not try it out. It would require an almost
complete rebuild in a testing branch, so maybe we should keep it in mind
and wait until the new machine is ready. So having one package that uses
it and builds with it could be a start.

This is independent of the question whether TLS support is actually needed
for this package :-)

Andreas

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Stuck on KiCad dependency wxPython
  2016-07-08  0:51       ` Leo Famulari
  2016-07-08 10:15         ` Ricardo Wurmus
@ 2016-09-22  8:27         ` Danny Milosavljevic
  2016-09-22  8:45           ` Danny Milosavljevic
  2016-09-22  9:10           ` Stuck on KiCad dependency wxPython Danny Milosavljevic
  1 sibling, 2 replies; 17+ messages in thread
From: Danny Milosavljevic @ 2016-09-22  8:27 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 530 bytes --]

Hi Leo,

the part that is failing is Python distutils build_ext. It uses Python*/Lib/distutils/sysconfig.py in order to find out the flags. And that does 

distutils/sysconfig.py:            cpp = cpp + ' ' + os.environ['CPPFLAGS']
                                                     ^^^^^^^^^^^^^^^^^^^^^^

So we should set an environment variable :)

See attached (dirty) patch...

Best would be to set it to what wxwidgets' wx-config program reports (i.e. CPPFLAGS=`wx-config --cflags`) - but I don't know how to do that yet.

[-- Attachment #2: wxpython.patch --]
[-- Type: text/x-patch, Size: 4470 bytes --]

diff --git a/gnu/packages/wxwidgets.scm b/gnu/packages/wxwidgets.scm
index 31da2a9..9fbb8ed 100644
--- a/gnu/packages/wxwidgets.scm
+++ b/gnu/packages/wxwidgets.scm
@@ -22,6 +22,7 @@
   #:use-module (guix download)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix build-system glib-or-gtk)
+  #:use-module (guix build-system python)
   #:use-module (guix build utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
@@ -31,6 +32,7 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages webkit)
   #:use-module (gnu packages xorg))
@@ -109,3 +111,83 @@ and many other languages.")
                             (assoc-ref %outputs "out") "/lib"))
        ;; No 'check' target.
        #:tests? #f))))
+
+(define-public python2-wxpython
+  (package
+    (name "python-wxpython")
+    (version "3.0.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
+                                  version "/wxPython-src-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; TODO Audit fully
+                  (delete-file-recursively "src/expat")
+                  (delete-file-recursively "src/jpeg")
+                  (delete-file-recursively "src/png")
+                  (delete-file-recursively "src/tiff")
+                  (delete-file-recursively "src/zlib")
+
+
+                  (delete-file-recursively "src/msw")
+                  (delete-file-recursively "src/osx")
+                  (substitute* '("wxPython/setup.py")
+                    ;; setup.py tries to keep its own license the same as wxwidget's license (which it expects under $WXWIN/docs).
+                    (("'preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt'") ""))
+                  ))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2
+       #:tests? #f
+       #:configure-flags
+       (list "--enable-unicode" ; any effect?
+             "--disable-precomp-headers"
+             "--with-regex=sys")
+       ;#:make-flags ;; there seems to be a --rpath option available already
+       ;(list (string-append "LDFLAGS=-Wl,-rpath="
+       ;                     (assoc-ref %outputs "out") "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'chdir
+           (lambda _
+             (chdir "wxPython")))
+         (add-before 'build 'setenv
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
+             ; FIXME better: just call wx-config --cppflags and set that (how?)
+             (setenv "CPPFLAGS" (string-append "-I"
+                                               (assoc-ref inputs "wxwidgets")
+                                               "/lib/wx/include/gtk3-unicode-3.0"
+                                               " -I"
+                                               (assoc-ref inputs "wxwidgets")
+                                               "/include/wx-3.0"
+                                               " -D_FILE_OFFSET_BITS=64"
+                                               " -DWXUSINGDLL"
+                                               " -D__WXGTK__"))))
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (zero?
+               (system* "python" "setup.py" "WXPORT=gtk3" "UNICODE=1" "build")))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config) ; FIXME remove
+       ("python2-setuptools" ,python2-setuptools)))
+    (inputs
+     `(("expat" ,expat)
+       ("gtk+" ,gtk+) ;; FIXME shouldn't that be automatically there?
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libtiff" ,libtiff)
+       ("libsm" ,libsm)
+       ("libx11" ,libx11)
+       ("wxwidgets" ,wxwidgets)
+       ; FIXME add opengl
+       ("zlib" ,zlib)))
+    (synopsis "Python2 Bindings for wxWidgets")
+    (description "@code{wxpython} are Python2 bindings for wxWidgets.")
+    (home-page "http://wxpython.org/")
+    (license l:fsf-free))) ; TODO Audit

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: Stuck on KiCad dependency wxPython
  2016-09-22  8:27         ` Danny Milosavljevic
@ 2016-09-22  8:45           ` Danny Milosavljevic
  2016-09-22  9:26             ` python-build-system: Allow build flags Danny Milosavljevic
  2016-09-22 10:43             ` [PATCH] guix: python-build-system: Honor configure-flags also when building Danny Milosavljevic
  2016-09-22  9:10           ` Stuck on KiCad dependency wxPython Danny Milosavljevic
  1 sibling, 2 replies; 17+ messages in thread
From: Danny Milosavljevic @ 2016-09-22  8:45 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

I just checked - the python-build-system doesn't allow passing flags when invoking setup.py . That's the only reason the custom build phase is there...

Also, I think we should adapt wxwidgets to add propagated-inputs.

Because the wxwidgets header files include opengl and gtk header files, a client using wxwidgets really requires gtk. However, the entire point of wx* is to have platform independent API - I don't think that the client package should include gtk or mesa for example. It should just include wxwidgets and that's it.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Stuck on KiCad dependency wxPython
  2016-09-22  8:27         ` Danny Milosavljevic
  2016-09-22  8:45           ` Danny Milosavljevic
@ 2016-09-22  9:10           ` Danny Milosavljevic
  2016-09-30  0:51             ` Theodoros Foradis
  1 sibling, 1 reply; 17+ messages in thread
From: Danny Milosavljevic @ 2016-09-22  9:10 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

Or maybe the attached patch captures the goal of wxwidgets better (which they IMO don't succeed at).

I added gtk, opengl etc as native inputs instead of regular inputs because from the point of view of Python they are not direct inputs.

wxPython only requires gtk while building the extension because wxwidgets does #include <gtk/gtk.h> in their exported API (why...) - but after it's done it will not require it directly anymore and actually just require wxwidgets.

Of course, the gtk version of wxwidgets will still require gtk by itself.

That said, I still think it would be nicer if wxwidgets propagated gtk - since when you use wxwidgets, you also need to have gtk as well if wxwidgets was compiled for gtk - and the one deciding what wxwidgets is compiled for is the wxwidgets package. So it should go there...

What do you think?

[-- Attachment #2: wxpython.patch --]
[-- Type: text/x-patch, Size: 4606 bytes --]

diff --git a/gnu/packages/wxwidgets.scm b/gnu/packages/wxwidgets.scm
index 31da2a9..4841a39 100644
--- a/gnu/packages/wxwidgets.scm
+++ b/gnu/packages/wxwidgets.scm
@@ -22,6 +22,7 @@
   #:use-module (guix download)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix build-system glib-or-gtk)
+  #:use-module (guix build-system python)
   #:use-module (guix build utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
@@ -31,8 +32,10 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages webkit)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
 (define-public wxwidgets
@@ -109,3 +112,85 @@ and many other languages.")
                             (assoc-ref %outputs "out") "/lib"))
        ;; No 'check' target.
        #:tests? #f))))
+
+(define-public python2-wxpython
+  (package
+    (name "python2-wxpython")
+    (version "3.0.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
+                                  version "/wxPython-src-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; TODO Audit fully
+                  (delete-file-recursively "src/expat")
+                  (delete-file-recursively "src/jpeg")
+                  (delete-file-recursively "src/png")
+                  (delete-file-recursively "src/tiff")
+                  (delete-file-recursively "src/zlib")
+
+
+                  (delete-file-recursively "src/msw")
+                  (delete-file-recursively "src/osx")
+                  (substitute* '("wxPython/setup.py")
+                    ;; setup.py tries to keep its own license the same as wxwidget's license (which it expects under $WXWIN/docs).
+                    (("'preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt'") ""))
+                  ))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2
+       #:tests? #f ; FIXME re-enable
+       #:configure-flags
+       (list "--enable-unicode" ; any effect?
+             "--disable-precomp-headers"
+             "--with-regex=sys")
+       ;#:make-flags ;; there seems to be a --rpath option available already
+       ;(list (string-append "LDFLAGS=-Wl,-rpath="
+       ;                     (assoc-ref %outputs "out") "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'chdir
+           (lambda _
+             (chdir "wxPython")))
+         (add-before 'build 'setenv
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
+             ;; FIXME better: just call wx-config --cppflags and set that (how?)
+             (setenv "CPPFLAGS" (string-append "-I"
+                                               (assoc-ref inputs "wxwidgets")
+                                               "/lib/wx/include/gtk3-unicode-3.0"
+                                               " -I"
+                                               (assoc-ref inputs "wxwidgets")
+                                               "/include/wx-3.0"
+                                               " -D_FILE_OFFSET_BITS=64"
+                                               " -DWXUSINGDLL"
+                                               " -D__WXGTK__"))))
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (zero?
+               (system* "python" "setup.py" "WXPORT=gtk3" "UNICODE=1" "build")))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config) ; for gtk
+       ("expat" ,expat)
+       ("gtk+" ,gtk+)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libtiff" ,libtiff)
+       ("libsm" ,libsm)
+       ("libx11" ,libx11)
+       ("mesa" ,mesa)
+       ("zlib" ,zlib)
+       ("python2-setuptools" ,python2-setuptools)))
+    (inputs
+     `(("wxwidgets" ,wxwidgets)))
+    (synopsis "Python2 Bindings for wxWidgets")
+    (description "@code{wxpython} are Python2 bindings for wxWidgets.")
+    (home-page "http://wxpython.org/")
+    (license l:fsf-free))) ; TODO Audit
+
+; Note: there's a Python 3 port https://wxpython.org/Phoenix/snapshot-builds/README.txt (no releases yet)

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* python-build-system: Allow build flags
  2016-09-22  8:45           ` Danny Milosavljevic
@ 2016-09-22  9:26             ` Danny Milosavljevic
  2016-09-22 10:43             ` [PATCH] guix: python-build-system: Honor configure-flags also when building Danny Milosavljevic
  1 sibling, 0 replies; 17+ messages in thread
From: Danny Milosavljevic @ 2016-09-22  9:26 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

> I just checked - the python-build-system doesn't allow passing flags when invoking setup.py . That's the only reason the custom build phase is there...

We could adapt python-build-system like that:

diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 9109fb4..6304f0c 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -44,9 +44,9 @@
          (zero? (apply system* "python" "setup.py" command params)))
       (error "no setup.py found")))
 
-(define* (build #:rest empty)
+(define* (build #:key (build-flags '()) #:allow-other-keys)
   "Build a given Python package."
-  (call-setuppy "build" '()))
+  (call-setuppy "build" build-flags))
 
 (define* (check #:key tests? test-target #:allow-other-keys)
   "Run the test suite of a given Python package."

How can I check which rebuilds that would cause? Seems to rebuild quite a bit on my local machine when I try to install python2-wxpython now.

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH] guix: python-build-system: Honor configure-flags also when building
  2016-09-22  8:45           ` Danny Milosavljevic
  2016-09-22  9:26             ` python-build-system: Allow build flags Danny Milosavljevic
@ 2016-09-22 10:43             ` Danny Milosavljevic
  1 sibling, 0 replies; 17+ messages in thread
From: Danny Milosavljevic @ 2016-09-22 10:43 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 275 bytes --]


While there was already a #:configure-flags for the "install" target,
it was not used when building. Use it.

* guix/build/python-build-system.scm (build): Modified.
---
 guix/build/python-build-system.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-guix-python-build-system-Honor-configure-flags-also-.patch --]
[-- Type: text/x-patch; name="0001-guix-python-build-system-Honor-configure-flags-also-.patch", Size: 660 bytes --]

diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 9109fb4..65824a3 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -44,9 +44,9 @@
          (zero? (apply system* "python" "setup.py" command params)))
       (error "no setup.py found")))
 
-(define* (build #:rest empty)
+(define* (build #:key (configure-flags '()) #:allow-other-keys)
   "Build a given Python package."
-  (call-setuppy "build" '()))
+  (call-setuppy "build" configure-flags))
 
 (define* (check #:key tests? test-target #:allow-other-keys)
   "Run the test suite of a given Python package."

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: Stuck on KiCad dependency wxPython
  2016-09-22  9:10           ` Stuck on KiCad dependency wxPython Danny Milosavljevic
@ 2016-09-30  0:51             ` Theodoros Foradis
  2016-09-30  7:09               ` Danny Milosavljevic
  0 siblings, 1 reply; 17+ messages in thread
From: Theodoros Foradis @ 2016-09-30  0:51 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2508 bytes --]


Danny Milosavljevic writes:

> Or maybe the attached patch captures the goal of wxwidgets better (which they IMO don't succeed at).
>
> I added gtk, opengl etc as native inputs instead of regular inputs because from the point of view of Python they are not direct inputs.
>
> wxPython only requires gtk while building the extension because wxwidgets does #include <gtk/gtk.h> in their exported API (why...) - but after it's done it will not require it directly anymore and actually just require wxwidgets.
>
> Of course, the gtk version of wxwidgets will still require gtk by itself.
>
> That said, I still think it would be nicer if wxwidgets propagated gtk - since when you use wxwidgets, you also need to have gtk as well if wxwidgets was compiled for gtk - and the one deciding what wxwidgets is compiled for is the wxwidgets package. So it should go there...
>
> What do you think?

Hello,

I worked on your wxpython patch, and got wxpython to build, with kicad on top
of it. Quite a lot of problems exist in the packages as of now.

Regarding kicad, the built binary has the following issues:
-In eeschema, the screen does not get redrawn automatically, leaving
mouse traces. I found somewhere some suggestions, that building
wxwidgets3.0 with gtk2 solves the issue, but I tried that and it does
not.
-When pcbnew is fired up, there is a "pcbnewInitPythonScripting() failed."
message. Trying again, it opens normally (and effectively shows
drawn pcb layouts), but with ui resizing issues. The ui resizing issues
exist everywhere.
-I have not added the kicad-libraries(components and footprints) in the package yet.

On the build side of things, first of all, the update to boost 1.61.0
breaks the build of kicad, with a header missing error. I have reverted
the latest changes in boost (to 1.60.1), in the patch, for development purposes.

The wxpython package tries to install the wxPython headers in
gnu/store/...-wxwidgets-3.0.2/include by default. I force set WXPREFIX
in config.py to get around that. In turn, in the kicad package, the
include path has to be set with a cmake flag, to find the wxPython
headers. I am sure there is a better way to handle this, but this is how I got it
to build for now.

The phase that replaces 'install in wxpython, can be obviously ommitted, if
your patch to honor configure-flags in python build phase is accepted.

I think you are correct, in that wxwidgets should propagate gtk.

I am waiting for some feedback on the patch.

Greetings
-- 
Theodoros Foradis

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-wxpython-kicad.patch --]
[-- Type: text/x-diff, Size: 10303 bytes --]

 gnu/packages/boost.scm       |  8 ++--
 gnu/packages/engineering.scm | 63 +++++++++++++++++++++++++++++
 gnu/packages/wxwidgets.scm   | 94 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 160 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm
index ab31fa8..8fe8c8e 100644
--- a/gnu/packages/boost.scm
+++ b/gnu/packages/boost.scm
@@ -34,7 +34,7 @@
 (define-public boost
   (package
     (name "boost")
-    (version "1.61.0")
+    (version "1.60.0")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -43,7 +43,7 @@
                     ".tar.bz2"))
               (sha256
                (base32
-                "0h5nk7pgxf7xsvvshj9qfpsfp9wx6gq9r78n3nx736pxq83bsix5"))))
+                "0fzx6dwqbrkd4bcd8pjv0fpapwmrxxwr8yx9g67lihlsk3zzysk8"))))
     (build-system gnu-build-system)
     (inputs `(("zlib" ,zlib)))
     (native-inputs
@@ -90,9 +90,7 @@
          (replace
              'build
            (lambda* (#:key outputs make-flags #:allow-other-keys)
-             (zero? (apply system* "./b2"
-                           (format #f "-j~a" (parallel-job-count))
-                           make-flags))))
+             (zero? (apply system* "./b2" make-flags))))
          (replace
              'install
            (lambda* (#:key outputs make-flags #:allow-other-keys)
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index dad38e0..d222bda 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -28,6 +28,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 (gnu packages)
   #:use-module (gnu packages autotools)
@@ -50,9 +51,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
@@ -460,3 +466,60 @@ you load several files on top of each other, do measurements on the displayed
 image, etc.  Besides viewing Gerbers, you may also view Excellon drill files
 as well as pick-place files.")
     (license license:gpl2+)))
+
+(define-public kicad
+  (package
+    (name "kicad")
+    (version "4.0.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://launchpad.net/kicad/4.0/"
+                                  version "/+download/kicad-" version ".tar.xz"))
+              (sha256
+               (base32
+                "006sgv446wwm0apvb5l52q9dfi8v85abkr7ms2scbab3pkvx79bd"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:out-of-source? #t
+       ;; #:parallel-build? #f
+       #:tests? #f
+       #:configure-flags (list "-DKICAD_STABLE_VERSION=ON"
+                               "-DKICAD_REPO_NAME=stable"
+                               "-DKICAD_BUILD_VERSION=4.0.4"
+                               "-DCMAKE_BUILD_TYPE=Release"
+                               "-DKICAD_SKIP_BOOST=ON"
+                               "-DKICAD_SCRIPTING=ON"
+                               "-DKICAD_SCRIPTING_MODULES=ON"
+                               "-DKICAD_SCRIPTING_WXPYTHON=ON"
+                               ;; Has to be set explicitely, because 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")
+                               ;; "-DBUILD_GITHUB_PLUGIN=ON"
+                               )))
+    (native-inputs
+     `(("boost" ,boost)
+       ("gettext" ,gnu-gettext)
+       ("mesa" ,mesa)
+       ("pkg-config" ,pkg-config)
+       ("swig" ,swig)
+       ("zlib" ,zlib)))
+    (inputs
+     `(("cairo" ,cairo)
+       ("desktop-file-utils" ,desktop-file-utils)
+       ("glew" ,glew)
+       ("hicolor-icon-theme" ,hicolor-icon-theme)
+       ("libsm" ,libsm)
+       ("openssl" ,openssl)
+       ("python" ,python-2)
+       ("wxwidgets" ,wxwidgets)
+       ("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+)))
diff --git a/gnu/packages/wxwidgets.scm b/gnu/packages/wxwidgets.scm
index 31da2a9..69ab115 100644
--- a/gnu/packages/wxwidgets.scm
+++ b/gnu/packages/wxwidgets.scm
@@ -22,6 +22,7 @@
   #:use-module (guix download)
   #:use-module ((guix licenses) #:prefix l:)
   #:use-module (guix build-system glib-or-gtk)
+  #:use-module (guix build-system python)
   #:use-module (guix build utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
@@ -31,8 +32,10 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages webkit)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
 (define-public wxwidgets
@@ -109,3 +112,94 @@ and many other languages.")
                             (assoc-ref %outputs "out") "/lib"))
        ;; No 'check' target.
        #:tests? #f))))
+
+(define-public python2-wxpython
+  (package
+    (name "python2-wxpython")
+    (version "3.0.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/wxpython/wxPython/"
+                                  version "/wxPython-src-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0qfzx3sqx4mwxv99sfybhsij4b5pc03ricl73h4vhkzazgjjjhfm"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; TODO Audit fully
+                  (delete-file-recursively "src/expat")
+                  (delete-file-recursively "src/jpeg")
+                  (delete-file-recursively "src/png")
+                  (delete-file-recursively "src/tiff")
+                  (delete-file-recursively "src/zlib")
+
+
+                  (delete-file-recursively "src/msw")
+                  (delete-file-recursively "src/osx")
+                  (substitute* '("wxPython/setup.py")
+                    ;; setup.py tries to keep its own license the same as wxwidget's license (which it expects under $WXWIN/docs).
+                    (("'preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt'") ""))
+                  ))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2
+       #:tests? #f ; FIXME re-enable
+       #:configure-flags
+       (list "WXPORT=gtk3"
+             "UNICODE=1")
+       #:modules ((guix build python-build-system)
+                  ((guix build gnu-build-system) #:prefix gnu:)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'chdir
+           (lambda _
+             (chdir "wxPython")))
+         (add-after 'chdir 'set-wx-out-dir
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; By default, install phase tries to copy the wxPython headers in
+             ;; gnu/store/...-wxwidgets-3.0.2 , which it can't, so they are redirected
+             ;; the output directory by setting WXPREFIX.
+             (substitute* "config.py"
+               (("= getWxConfigValue\\('--prefix'\\)") (string-append "= '" (assoc-ref outputs "out") "'")))
+             (substitute* "wx/build/config.py"
+               (("= getWxConfigValue\\('--prefix'\\)") (string-append "= '" (assoc-ref outputs "out") "'")))))
+         (add-after 'set-wx-out-dir 'setenv
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (setenv "WXWIN" (assoc-ref inputs "wxwidgets"))
+             ;; FIXME better: just call wx-config --cppflags and set that (how?)
+             (setenv "CPPFLAGS" (string-append "-I"
+                                               (assoc-ref inputs "wxwidgets")
+                                               "/lib/wx/include/gtk3-unicode-3.0"
+                                               " -I"
+                                               (assoc-ref inputs "wxwidgets")
+                                               "/include/wx-3.0"
+                                               " -D_FILE_OFFSET_BITS=64"
+                                               " -DWXUSINGDLL"
+                                               " -D__WXGTK__"))))
+         ;; Can be removed with [PATCH] guix: python-build-system: Honor configure-flags
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (zero?
+              (system* "python" "setup.py" "WXPORT=gtk3" "UNICODE=1" "build")))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config) ; for gtk
+       ("expat" ,expat)
+       ("gtk+" ,gtk+)
+       ("libjpeg" ,libjpeg)
+       ("libpng" ,libpng)
+       ("libtiff" ,libtiff)
+       ("libsm" ,libsm)
+       ("libx11" ,libx11)
+       ("mesa" ,mesa)
+       ("zlib" ,zlib)
+       ("python2-setuptools" ,python2-setuptools)))
+    (inputs
+     `(("wxwidgets" ,wxwidgets)))
+    (synopsis "Python2 Bindings for wxWidgets")
+    (description "@code{wxpython} are Python2 bindings for wxWidgets.")
+    (home-page "http://wxpython.org/")
+    (license l:fsf-free))) ; TODO Audit
+
+; Note: there's a Python 3 port https://wxpython.org/Phoenix/snapshot-builds/README.txt (no releases yet)
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: Stuck on KiCad dependency wxPython
  2016-09-30  0:51             ` Theodoros Foradis
@ 2016-09-30  7:09               ` Danny Milosavljevic
  0 siblings, 0 replies; 17+ messages in thread
From: Danny Milosavljevic @ 2016-09-30  7:09 UTC (permalink / raw)
  To: Theodoros Foradis; +Cc: guix-devel

Hi,

your patch looks good. But I'd rather not downgrade boost and neither do I want to carry a second boost on my system.

> On the build side of things, first of all, the update to boost 1.61.0
> breaks the build of kicad, with a header missing error. I have reverted
> the latest changes in boost (to 1.60.1), in the patch, for development purposes.

Boost 1.61.0 can be used in KiCad after applying <https://github.com/KiCad/kicad-source-mirror/commit/06d4894fdbeb00727cdcc667b8899ad73d8eb1c2> (which has been applied upstream). That is a mirror site - I'm just using it because of the nice syntax highlighting so you can read it better.

I also have the redrawing and resizing problems with the patch - I thought it was a general KiCad bug.

I think that it would be good to use git-download in the package definition and see whether all the problems vanish. If not we should notify them of the problems (the redrawing, resizing etc). 

The git-download would be:

...
  #:use-module (guix git-download)
...
      (source
        (origin
          (method git-fetch)
          (uri (git-reference
                 (url "https://git.launchpad.net/kicad")
                 (commit commit))) ; FIXME find a good commit
          (sha256
            (base32
              "0cm47s5pvijfs3v2k7hmpxv3mvp4n5la0ihnsczk5ym3iq166jil")) ;  FIXME update
          (file-name (string-append name "-" version "-checkout"))))


> -I have not added the kicad-libraries(components and footprints) in the package yet.

We should add components and footprints in an extra package - because many people use external footprint repos (tuned for their manufacturing tolerances) and don't need the "official" ones at all.

> The wxpython package tries to install the wxPython headers in
> gnu/store/...-wxwidgets-3.0.2/include by default. I force set WXPREFIX
> in config.py to get around that. 

Good :)

>In turn, in the kicad package, the
> include path has to be set with a cmake flag, to find the wxPython
> headers. 

The discovery of wxpython in kicad works via CMakeLists.txt :

        set( PYTHON_DEST ${LIBWXPYTHON_ROOT}/wxPython/lib/python2.6/site-packages )

So it might be enough to

    (setenv "LIBWXPYTHON_ROOT" (assoc-ref inputs "python2-wxpython"))

after we make python2-wxpython install to $out/wxPython . Or we could patch CMakeLists.txt to s/wxPython// and do the latter.

I'm not sure whether either would be an improvement, though.

> The phase that replaces 'install in wxpython, can be obviously ommitted, if
> your patch to honor configure-flags in python build phase is accepted.

'build - yes. It's interesting that few packages seem to be affected by missing build flags without the patch. Either that or they broke silently :P

> I think you are correct, in that wxwidgets should propagate gtk.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2016-09-30  7:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-15  7:40 [PATCH] gnu: add kicad Danny Milosavljevic
2016-02-15 11:35 ` Ben Woodcroft
2016-05-23  4:13 ` Leo Famulari
2016-07-07  0:22   ` Stuck on KiCad dependency wxPython Leo Famulari
2016-07-07  6:31     ` Efraim Flashner
2016-07-08  0:51       ` Leo Famulari
2016-07-08 10:15         ` Ricardo Wurmus
2016-07-12  9:24           ` Ludovic Courtès
2016-09-22  8:27         ` Danny Milosavljevic
2016-09-22  8:45           ` Danny Milosavljevic
2016-09-22  9:26             ` python-build-system: Allow build flags Danny Milosavljevic
2016-09-22 10:43             ` [PATCH] guix: python-build-system: Honor configure-flags also when building Danny Milosavljevic
2016-09-22  9:10           ` Stuck on KiCad dependency wxPython Danny Milosavljevic
2016-09-30  0:51             ` Theodoros Foradis
2016-09-30  7:09               ` Danny Milosavljevic
2016-08-03 23:54   ` [PATCH] gnu: add kicad Danny Milosavljevic
2016-08-04  8:31     ` Andreas Enge

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.