all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: Leo Famulari <leo@famulari.name>
Cc: guix-devel@gnu.org
Subject: Re: Stuck on KiCad dependency wxPython
Date: Thu, 22 Sep 2016 11:10:41 +0200	[thread overview]
Message-ID: <20160922111041.7de1d795@scratchpost.org> (raw)
In-Reply-To: <20160922102754.75e436f8@scratchpost.org>

[-- 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)

  parent reply	other threads:[~2016-09-22  9:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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           ` Danny Milosavljevic [this message]
2016-09-30  0:51             ` Stuck on KiCad dependency wxPython 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160922111041.7de1d795@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    --cc=leo@famulari.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.