From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: Re: Stuck on KiCad dependency wxPython Date: Thu, 22 Sep 2016 10:27:54 +0200 Message-ID: <20160922102754.75e436f8@scratchpost.org> References: <20160215084046.62d5307a@scratchpost.org> <20160523041319.GA10803@jasmine> <20160707002228.GA16818@jasmine> <20160707063120.GB17506@debian-netbook> <20160708005116.GA8415@jasmine> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/CEkYF8oGtwqDLposb2gDaGX" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmzMU-0000Or-SA for guix-devel@gnu.org; Thu, 22 Sep 2016 04:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmzMP-0002by-DN for guix-devel@gnu.org; Thu, 22 Sep 2016 04:28:05 -0400 Received: from dd1012.kasserver.com ([85.13.128.8]:42002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmzMP-0002bN-2E for guix-devel@gnu.org; Thu, 22 Sep 2016 04:28:01 -0400 In-Reply-To: <20160708005116.GA8415@jasmine> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Leo Famulari Cc: guix-devel@gnu.org --MP_/CEkYF8oGtwqDLposb2gDaGX Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. --MP_/CEkYF8oGtwqDLposb2gDaGX Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=wxpython.patch 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 --MP_/CEkYF8oGtwqDLposb2gDaGX--