summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-11-29 19:17:33 +0100
committerLudovic Courtès <ludo@gnu.org>2015-11-29 19:17:33 +0100
commitcb7bd0cff5e8ea1c01ba835a4ebba6c9abae7e16 (patch)
tree10a7c6a85be03c3cba14320658d43bba329152a1 /gnu
parent25d188ce12e4e192e4167d03728a8ff69fe0bb35 (diff)
downloadguix-cb7bd0cff5e8ea1c01ba835a4ebba6c9abae7e16.tar.gz
gnu: weechat: Dynamically link against libpython2.7.so.
* gnu/packages/patches/weechat-python.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/weechat.scm (weechat)[source]: Use it.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/patches/weechat-python.patch40
-rw-r--r--gnu/packages/weechat.scm5
2 files changed, 44 insertions, 1 deletions
diff --git a/gnu/packages/patches/weechat-python.patch b/gnu/packages/patches/weechat-python.patch
new file mode 100644
index 0000000000..8182636ecb
--- /dev/null
+++ b/gnu/packages/patches/weechat-python.patch
@@ -0,0 +1,40 @@
+Get Python LDFLAGS from 'pkg-config'.
+
+The other approach is more complex and gets it wrong: it returns
+"-L/path/to/python/lib/python-2.7.10/lib/python2.7/config -lpython -lwhatever";
+since that config/ sub-directory contains libpython2.7.a, we end up
+statically linking Python in Weechat's python.so, which we do not want.
+
+--- weechat-1.3/configure.ac	2015-08-16 08:27:07.000000000 +0200
++++ weechat-1.3/configure.ac	2015-11-29 18:18:52.975197048 +0100
+@@ -535,29 +535,7 @@ if test "x$enable_python" = "xyes" ; the
+             if test -r "$PYTHON_INCLUDE/Python.h"; then
+                 PYTHON_CFLAGS="-I$PYTHON_INCLUDE"
+                 AC_MSG_RESULT(found)
+-                PYTHON_LIB=`$PYTHON -c "import sys, distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_config_var('LIBPL'))"`
+-                PYTHON_LFLAGS="-lpython$PYTHON_VERSION "`$PYTHON -c "import sys, distutils.sysconfig; sys.stdout.write(distutils.sysconfig.get_config_var('LIBS')+' '+distutils.sysconfig.get_config_var('SYSLIBS')+' '+distutils.sysconfig.get_config_var('LINKFORSHARED'))"`
+-                AC_MSG_CHECKING(for Python library)
+-                if test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.so"; then
+-                   PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
+-                   AC_MSG_RESULT(found)
+-                elif test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.a"; then
+-                   PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
+-                   AC_MSG_RESULT(found)
+-                elif test -r "$PYTHON_LIB/libpython$PYTHON_VERSION.dll.a"; then
+-                   PYTHON_LFLAGS="-L$PYTHON_LIB $PYTHON_LFLAGS"
+-                   AC_MSG_RESULT(found)
+-                elif test -r "$PYTHON_SYSPREFIX/lib/libpython$PYTHON_VERSION.so"; then
+-                   PYTHON_LFLAGS="-L$PYTHON_SYSPREFIX/lib/ $PYTHON_LFLAGS"
+-                   AC_MSG_RESULT(found)
+-                else
+-                    AC_MSG_WARN([
+-*** Python library couldn't be found on your system.
+-*** Try to install it with your software package manager.
+-*** WeeChat will be built without Python support.])
+-                    enable_python="no"
+-                    not_found="$not_found python"
+-                fi
++                PYTHON_LFLAGS=`pkg-config python2 --libs`
+             else
+                 AC_MSG_WARN([
+ *** Python header files couldn't be found on your system.
diff --git a/gnu/packages/weechat.scm b/gnu/packages/weechat.scm
index 27349ec60d..2142f5638e 100644
--- a/gnu/packages/weechat.scm
+++ b/gnu/packages/weechat.scm
@@ -20,6 +20,7 @@
 ;; TODO: Add ruby
 
 (define-module (gnu packages weechat)
+  #:use-module (gnu packages)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages base)
   #:use-module (gnu packages gettext)
@@ -52,7 +53,9 @@
               (uri (string-append "http://weechat.org/files/src/weechat-"
                                   version ".tar.gz"))
               (sha256
-               (base32 "13b7dfs3sn71c51fi0bli5rzlsppil6gg1lzik3k8l43yhhqyv2w"))))
+               (base32
+                "13b7dfs3sn71c51fi0bli5rzlsppil6gg1lzik3k8l43yhhqyv2w"))
+              (patches (list (search-patch "weechat-python.patch")))))
     (build-system gnu-build-system)
     (native-inputs `(("autoconf" ,autoconf)
                      ("pkg-config" ,pkg-config)