Fix the whole python building process to do proper crosscompiling for all python
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 2 Oct 2008 15:33:26 +0000 (15:33 +0000)
committerLars-Peter Clausen <lars@metafoo.de>
Thu, 2 Oct 2008 15:33:26 +0000 (15:33 +0000)
modules in openwrt. Thanks to ryd for helping to make this possible.
(Only numpy is completly broken now because it has dependencies which
where pervioulsy taken from the build system)

SVN-Revision: 12821

23 files changed:
XOrg/lib/hippo-canvas/Makefile
XOrg/lib/hippo-canvas/patches/010-use-python-config [new file with mode: 0644]
lang/gst-python/Makefile
lang/ipython/Makefile
lang/numpy/Makefile
lang/numpy/patches/100-compile.patch
lang/psycopg/Makefile
lang/pycairo/Makefile
lang/pycairo/patches/010-fix-pycairo-pc-includedir.patch [new file with mode: 0644]
lang/pygobject/Makefile
lang/pygtk/Makefile
lang/pygtk/patches/010-dont-override-python-include-dir.patch [new file with mode: 0644]
lang/pygtk/patches/100-compile.patch [deleted file]
lang/pysqlite/Makefile
lang/pysqlite/files/setup.cfg.in [new file with mode: 0644]
lang/python-dbus/Makefile
lang/python-gnome-desktop2/Makefile
lang/python/Makefile
lang/python/files/python-package.mk [new file with mode: 0644]
lang/python/patches/050-add_signal_set_wakeup_fd.patch [new file with mode: 0644]
lang/python/python-package.mk [deleted file]
lang/telepathy-python/Makefile
lang/xapian-bindings/Makefile

index 7ea35c9898402a813ea0bb0c22189f43d5451a60..f2b93c73722c6c96fb328d7a9f4d3ed5ee7914da 100644 (file)
@@ -25,7 +25,6 @@ PKG_INSTALL:=1
 EXTRA_CFLAGS += \
        -I$(STAGING_DIR)/usr/lib/libintl/include \
        -I$(STAGING_DIR)/usr/include/libcroco-0.6 \
-       $(if $(CONFIG_PACKAGE_python-hippo-canvas),-I$(STAGING_DIR)/usr/include/pycairo,)
 
 STAMP_CONFIGURED:=$(STAMP_CONFIGURED)_$(call confvar,CONFIG_PACKAGE_hippo-canvas CONFIG_PACKAGE_python-hippo-canvas)
 
diff --git a/XOrg/lib/hippo-canvas/patches/010-use-python-config b/XOrg/lib/hippo-canvas/patches/010-use-python-config
new file mode 100644 (file)
index 0000000..26ad36f
--- /dev/null
@@ -0,0 +1,17 @@
+--- hippo-canvas-0.3.0.orig/configure  2008-09-30 22:18:23.000000000 +0200
++++ hippo-canvas-0.3.0/configure       2008-09-30 22:41:16.000000000 +0200
+@@ -20486,10 +20486,14 @@
+ echo $ECHO_N "checking for headers required to compile python extensions... $ECHO_C" >&6; }
+ py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+ py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
++if test -x "$PYTHON-config"; then
++PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
++else
+ PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+ if test "$py_prefix" != "$py_exec_prefix"; then
+   PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
+ fi
++fi
+ save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
index 5a840ae03bd9ab165c5fc4f35875184820f09fbb..7529178a85bee6641efd9542549c995865057d8d 100644 (file)
@@ -4,6 +4,7 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+# $Id$
 
 include $(TOPDIR)/rules.mk
 
@@ -16,30 +17,32 @@ PKG_FIXUP:=libtool
 PKG_MD5SUM:=2c633a06c140024dd0d59db1e87e6945
 
 include $(INCLUDE_DIR)/package.mk
+-include $(if $(DUMP),,$(STAGING_DIR)/mk/python-package.mk)
 
 PKG_INSTALL=1
 
 TARGET_CFLAGS += $(FPIC) \
        -I$(STAGING_DIR)/usr/lib/libintl/include \
-       -I$(STAGING_DIR)/usr/lib/libiconv/include
+       -I$(STAGING_DIR)/usr/lib/libiconv/include \
+       -I$(STAGING_DIR)/usr/include/gstreamer-0.10
 
 TARGET_LDFLAGS += \
        -L$(STAGING_DIR)/usr/lib/libintl/lib \
        -L$(STAGING_DIR)/usr/lib/libiconv/lib
 
-CONFIGURE_VARS += PYTHON=/usr/bin/python
+CONFIGURE_VARS += PYTHON=$(HOST_PYTHON)
 
 define Package/gst-python
   SUBMENU:=Python
   SECTION:=lang
   CATEGORY:=Languages
-  TITLE:=python bindings for dbus
+  TITLE:=python bindings for gstreamer
   URL:=http://gstreamer.freedesktop.org/
   DEPENDS:=+gstreamer +gst-plugins-base +python-gtk
 endef
 
 define Package/gst-python/description
-  python bindings for dbus 
+  python bindings for gstreamer
 endef
 
 define Build/InstallDev
index ab264d983818a91dd274e2fbf506efe1968b721f..f71f1e59c3ddc0f41d4bf58e6d630726f0b16103 100644 (file)
@@ -21,7 +21,7 @@ define Package/ipython
   SUBMENU:=Python
   SECTION:=lang
   CATEGORY:=Languages
-  TITLE:=python bindings for dbus
+  TITLE:=ipython
   URL:=http://ipython.scipy.org/dist/
 endef
 
index 76239e4be729ccc2d6bad0b6cc1635da86ee7063..4cec5ad6a87d0a22dd3114dd74d61e9243f215d7 100644 (file)
@@ -15,6 +15,7 @@ PKG_SOURCE_URL:=http://downloads.sourceforge.net/numpy/
 PKG_MD5SUM:=8f011e9d7697da570efaac61c51725e0
 
 include $(INCLUDE_DIR)/package.mk
+-include $(if $(DUMP),,$(STAGING_DIR)/mk/python-package.mk)
 
 define Package/numpy
   SUBMENU:=Python
@@ -22,7 +23,7 @@ define Package/numpy
   CATEGORY:=Languages
   TITLE:=numpy
   URL:=http://numpy.sf.net
-  DEPENDS:=python-core @TARGET_x86||TARGET_olpc||TARGET_uml
+  DEPENDS:=python-core @TARGET_x86||TARGET_olpc||TARGET_uml @BROKEN
 endef
 
 define Package/numpy/description
@@ -31,7 +32,6 @@ endef
 
 define Build/Compile
        cd $(PKG_BUILD_DIR) ; $(CONFIGURE_VARS) $(MAKE_VARS) python2.5 ./setup.py install --prefix="$(PKG_INSTALL_DIR)/usr"
-       sed -i "s/UCS4/UCS2/g" $(PKG_INSTALL_DIR)/usr/lib/python2.5/site-packages/numpy/core/multiarray.so
 endef
 
 define Package/numpy/install
index df81fb00abcc8c3c7f95048727682b947f83b34d..632e40943f60fd103b39aeacc833e409b64a9785 100644 (file)
@@ -44,7 +44,7 @@ diff -urN numpy-1.0.4/numpy/core/setup.py numpy-1.0.4.patched/numpy/core/setup.p
 diff -urN numpy-1.0.4/numpy/distutils/unixccompiler.py numpy-1.0.4.patched/numpy/distutils/unixccompiler.py
 --- numpy-1.0.4/numpy/distutils/unixccompiler.py       2007-11-07 22:05:15.000000000 +0000
 +++ numpy-1.0.4.patched/numpy/distutils/unixccompiler.py       2008-05-25 11:07:14.000000000 +0100
-@@ -9,11 +9,35 @@
+@@ -9,11 +9,36 @@
  from numpy.distutils.ccompiler import replace_method
  
  import log
@@ -62,6 +62,7 @@ diff -urN numpy-1.0.4/numpy/distutils/unixccompiler.py numpy-1.0.4.patched/numpy
 +              if output_progname == "_configtest":
 +                      self.spawn(['gcc', '-lm', '-o',output_progname]+objects, display = "")
 +              else:
++                      print "#### Running " + str(CCompiler.EXECUTABLE)
 +                      self.link(CCompiler.EXECUTABLE, objects,
 +                  self.executable_filename(output_progname), output_dir,
 +                  libraries, library_dirs, runtime_library_dirs, None,
index f4060568f6f642833b80fbdbf752edd4753491cc..10a9905cd886cfb96994f12141166c76451aea3b 100644 (file)
@@ -40,6 +40,8 @@ CONFIGURE_ARGS += \
        --with-postgres-libraries="$(STAGING_DIR)/usr/lib" \
        --with-postgres-includes="$(STAGING_DIR)/usr/include" \
        --with-mxdatetime-includes="$(STAGING_DIR)$(PYTHON_PKG_DIR)/mx/DateTime/mxDateTime" \
+       --with-python-prefix=$(STAGING_DIR)/usr
+       --with-python-exec-prefix=$(STAGING_DIR)/usr
 
 define Build/Compile
        $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
index 3c731e7246e74d3f96885d30f1bc4604b7d97e0a..62fa4d9fbe18558081cd57cece87c58f99fe3f3a 100644 (file)
@@ -4,6 +4,7 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+# $Id$
 
 include $(TOPDIR)/rules.mk
 
@@ -17,6 +18,7 @@ PKG_MD5SUM:=2c3aa21e6e610321498f9f81f7b625df
 PKG_FIXUP:=libtool
 
 include $(INCLUDE_DIR)/package.mk
+-include $(if $(DUMP),,$(STAGING_DIR)/mk/python-package.mk)
 
 PKG_INSTALL=1
 
@@ -35,17 +37,20 @@ endef
 
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/usr/include/pycairo
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/pycairo/* \
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/pycairo/* \
                $(1)/usr/include/pycairo
        $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
                $(1)/usr/lib/pkgconfig/
 endef
 
 define Package/pycairo/install
-       $(INSTALL_DIR) $(1)/usr/lib/python2.5/site-packages/cairo/
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/python2.5/site-packages/cairo/*.{py,so,a} \
-               $(1)/usr/lib/python2.5/site-packages/cairo/
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/cairo/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/cairo/*.{py,so,a} \
+               $(1)$(PYTHON_PKG_DIR)/cairo/
 endef
 
 $(eval $(call BuildPackage,pycairo))
diff --git a/lang/pycairo/patches/010-fix-pycairo-pc-includedir.patch b/lang/pycairo/patches/010-fix-pycairo-pc-includedir.patch
new file mode 100644 (file)
index 0000000..dd21016
--- /dev/null
@@ -0,0 +1,13 @@
+--- pycairo-1.6.4/pycairo.pc.in.orig   2008-09-30 16:55:10.000000000 +0200
++++ pycairo-1.6.4/pycairo.pc.in        2008-09-30 16:55:44.000000000 +0200
+@@ -1,8 +1,9 @@
+ prefix=@prefix@
++includedir=@includedir@
+ Name: Pycairo
+ Description: Python bindings for cairo
+ Version: @VERSION@
+ Requires: cairo
+-Cflags: -I@includedir@/pycairo
++Cflags: -I${includedir}/pycairo
+ Libs:
index cb649d4acedf854590e23b95d576d487b2869cb8..a8e1bff72dacbfea05e65fcd14cc1d3f4ea400ca 100644 (file)
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+# $Id$
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pygobject
-PKG_VERSION:=2.14.0
-PKG_RELEASE:=1
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.14
-PKG_MD5SUM:=ed4d9e653ea4ed2b68ceb28341894779
-PKG_BUILD_DEP:=python
-
-EXTRA_LDFLAGS=-L$(STAGING_DIR)/usr/lib/libintl/lib/ -L$(STAGING_DIR)/usr/lib/libiconv/lib/
+PKG_VERSION:=2.15.1
+PKG_RELEASE:=2
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNOME/$(PKG_NAME)/2.15
+PKG_MD5SUM:=05bf0487c885a1ef6df615e02cac5ea6
 
 include $(INCLUDE_DIR)/package.mk
+-include $(if $(DUMP),,$(STAGING_DIR)/mk/python-package.mk)
+
+TARGET_LDFLAGS+=-I/home/lars/Projects/openwrt-olpc/staging_dir/i386/usr/include/python2.5
+
+EXTRA_LDFLAGS+= \
+       -L$(STAGING_DIR)/usr/lib/libintl/lib/ \
+       -L$(STAGING_DIR)/usr/lib/libiconv/lib/
 
 define Package/python-gobject
   SUBMENU:=Python
   SECTION:=lang
   CATEGORY:=Languages
-  TITLE:=python gobjects
+  TITLE:=GLib bindings for python
   URL:=http://www.pygtk.org/
   DEPENDS:=python-core +glib2
 endef
 
 define Package/python-gobject/description
-  API to GTK and glade library from python
-endef
-
-define Build/Configure
-       (cd $(PKG_BUILD_DIR); \
-               if [ -x $(CONFIGURE_CMD) ]; then \
-                       $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/ && \
-                       $(CONFIGURE_VARS) \
-                       $(CONFIGURE_CMD) \
-                       $(CONFIGURE_ARGS) ;\
-               fi \
-       )
+  GLib bindings for python
 endef
 
 define Build/Compile
-       cd $(PKG_BUILD_DIR)/gobject ; gcc -I$(STAGING_DIR)/usr/lib/glib-2.0/include/ -I$(STAGING_DIR)/usr/include/glib-2.0/ generate-constants.c -o generate-constants
-       cd $(PKG_BUILD_DIR) ; DESTDIR=$(PKG_INSTALL_DIR) $(MAKE) all install
+       (cd $(PKG_BUILD_DIR)/gobject; \
+        $(HOSTCC) -I$(STAGING_DIR)/usr/lib/glib-2.0/include/ \
+                  -I$(STAGING_DIR)/usr/include/glib-2.0/ \
+                           generate-constants.c -o generate-constants);
+       $(call Build/Compile/Default)
+       $(call Build/Install/Default)
 endef
 
 define Build/InstallDev
-       mkdir -p $(1)
-       cp -r $(PKG_INSTALL_DIR)/* $(1)
+       $(INSTALL_DIR) $(1)/usr/include/pygtk-2.0/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/pygtk-2.0/* \
+               $(1)/usr/include/pygtk-2.0/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig/
+
+       $(SED) \
+               "s,^\(prefix\|exec_prefix\|datadir\)=,\1=$(STAGING_DIR),g" \
+               $(1)/usr/lib/pkgconfig/pygobject-2.0.pc
+
+       $(INSTALL_DIR) $(1)/usr/share/pygobject/2.0/codegen
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/pygobject/2.0/codegen/*.py \
+               $(1)/usr/share/pygobject/2.0/codegen
+
+       $(INSTALL_DIR) $(1)/usr/share/pygobject/2.0/defs
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/pygobject/2.0/defs/* \
+               $(1)/usr/share/pygobject/2.0/defs
+
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/* \
+               $(2)/bin
+
+       $(SED) \
+               "s,^\(prefix\|datadir\)=,\1=$(STAGING_DIR),g" \
+               $(2)/bin/pygobject-codegen-2.0
 endef
 
 define Package/python-gobject/install
-       mkdir -p $(1)
-       cp -r $(PKG_INSTALL_DIR)/* $(1)
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/*.{pth,py} \
+               $(1)$(PYTHON_PKG_DIR)/
+
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/gtk-2.0
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/gtk-2.0/*.py \
+               $(1)$(PYTHON_PKG_DIR)/gtk-2.0/
+
+       $(foreach d,gobject gio, \
+               $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/gtk-2.0/$(d); \
+               $(INSTALL_DATA) \
+                       $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/gtk-2.0/$(d)/*.{py,so} \
+                       $(1)$(PYTHON_PKG_DIR)/gtk-2.0/$(d); \
+       )
 endef
 
 $(eval $(call BuildPackage,python-gobject))
index 1906aef6bdb15838621c46e43589fd501c18341a..d63c68716d91f07b399d76f086dba34e2c4d509d 100644 (file)
@@ -4,59 +4,90 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+# $Id$
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pygtk
-PKG_VERSION:=2.10.6
-PKG_RELEASE:=1
+PKG_VERSION:=2.12.1
+PKG_RELEASE:=2
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=http://ftp.gnome.org/pub/GNOME/sources/pygtk/2.10/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@GNOME/$(PKG_NAME)/2.12/
+PKG_MD5SUM:=a816346d750d61e3fa67a200e4292694
 PKG_FIXUP:=libtool
-PKG_MD5SUM:=d033b7617b9074357f687326b52b6296
 
 include $(INCLUDE_DIR)/package.mk
+-include $(if $(DUMP),,$(STAGING_DIR)/mk/python-package.mk)
 
-EXTRA_CFLAGS:=-I$(STAGING_DIR)/usr/include/pycairo/ -I$(STAGING_DIR)/usr/lib/libintl/include/ -I$(STAGING_DIR)/usr/lib/libiconv/include/
-EXTRA_LDFLAGS:=-L$(STAGING_DIR)/usr/lib/libintl/lib -L$(STAGING_DIR)/usr/lib/libiconv/lib
+EXTRA_CFLAGS+= \
+       -I$(STAGING_DIR)/usr/lib/libintl/include/ \
+       -I$(STAGING_DIR)/usr/lib/libiconv/include/
+
+EXTRA_LDFLAGS+= \
+       -L$(STAGING_DIR)/usr/lib/libintl/lib \
+       -L$(STAGING_DIR)/usr/lib/libiconv/lib
 
 define Package/python-gtk
   SUBMENU:=Python
   SECTION:=lang
   CATEGORY:=Languages
-  TITLE:=GTK bindings to python
+  TITLE:=GTK bindings for python
   URL:=http://www.pygtk.org/
   DEPENDS:=python-core +python-gobject +gtk2 +pycairo
 endef
 
 define Package/python-gtk/description
-  API to GTK and glade library from python
+  API to GTK and glade library from python.
 endef
 
 define Build/Compile
-       PYTHON_HOST="python2.5" \
-       DESTDIR="$(PKG_INSTALL_DIR)" \
        $(MAKE) -C $(PKG_BUILD_DIR) \
                SUBDIRS="codegen . gtk" \
-               all install
-       sed -i "s/UCS4/UCS2/g" $(PKG_INSTALL_DIR)/usr/lib/python2.5/site-packages/gtk-2.0/gtk/_gtk.so
+               all install DESTDIR="$(PKG_INSTALL_DIR)"
 endef
 
 define Build/InstallDev
-       $(INSTALL_DIR) $(1)
-       $(CP) $(PKG_INSTALL_DIR)/* $(1)
+       $(INSTALL_DIR) $(1)/usr/include/pygtk-2.0/pygtk
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/pygtk-2.0/pygtk/* \
+               $(1)/usr/include/pygtk-2.0/pygtk
+
+       $(INSTALL_DIR) $(1)/usr/share/pygtk/2.0/codegen
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/pygtk/2.0/codegen/*.py \
+               $(1)/usr/share/pygtk/2.0/codegen/
+
+       $(INSTALL_DIR) $(1)/usr/share/pygtk/2.0/defs/
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/pygtk/2.0/defs/* \
+               $(1)/usr/share/pygtk/2.0/defs
+
+       $(INSTALL_DIR) $(2)/bin
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/* \
+               $(2)/bin
+
+       $(SED) 's,^\(datadir\|prefix\)=,\1=$(STAGING_DIR),g' $(2)/bin/pygtk-codegen-2.0
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig
+
+       $(SED) 's,^datadir=,datadir=$(STAGING_DIR),g' $(1)/usr/lib/pkgconfig/pygtk-2.0.pc
 endef
 
 define Package/python-gtk/install
-       $(INSTALL_DIR) $(1)
-       $(CP) $(PKG_INSTALL_DIR)/* $(1)
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/gtk-2.0
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/gtk-2.0/*.so \
+               $(1)$(PYTHON_PKG_DIR)/gtk-2.0
+
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/gtk-2.0/gtk
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/gtk-2.0/gtk/*.{py,so} \
+               $(1)$(PYTHON_PKG_DIR)/gtk-2.0/gtk
 endef
 
 $(eval $(call BuildPackage,python-gtk))
-$(eval $(call RequireCommand,pygtk-codegen-2.0, \
-       Please install the pygtk 2.0 development package \
-))
-$(eval $(call RequireCommand,python2.5, \
-       Please install Python 2.5 \
-))
diff --git a/lang/pygtk/patches/010-dont-override-python-include-dir.patch b/lang/pygtk/patches/010-dont-override-python-include-dir.patch
new file mode 100644 (file)
index 0000000..d12576f
--- /dev/null
@@ -0,0 +1,24 @@
+diff -urN pygtk-2.12.1.orig/configure pygtk-2.12.1/configure
+--- pygtk-2.12.1.orig/configure        2008-09-30 17:05:56.000000000 +0200
++++ pygtk-2.12.1/configure     2008-09-30 17:06:38.000000000 +0200
+@@ -10399,8 +10399,6 @@
+ { echo "$as_me:$LINENO: checking for PySignal_SetWakeupFd in Python.h" >&5
+ echo $ECHO_N "checking for PySignal_SetWakeupFd in Python.h... $ECHO_C" >&6; }
+-py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+-PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+ old_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="-Wall -Werror $PYTHON_INCLUDES"
+ cat >conftest.$ac_ext <<_ACEOF
+diff -urN pygtk-2.12.1.orig/configure.in pygtk-2.12.1/configure.in
+--- pygtk-2.12.1.orig/configure.in     2008-09-30 17:05:56.000000000 +0200
++++ pygtk-2.12.1/configure.in  2008-09-30 17:06:24.000000000 +0200
+@@ -78,8 +78,6 @@
+ AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
+ AC_MSG_CHECKING([for PySignal_SetWakeupFd in Python.h])
+-py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
+-PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
+ old_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="-Wall -Werror $PYTHON_INCLUDES"
+ AC_TRY_COMPILE([#include <Python.h>],
diff --git a/lang/pygtk/patches/100-compile.patch b/lang/pygtk/patches/100-compile.patch
deleted file mode 100644 (file)
index 87a357b..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-diff -urN pygtk-2.10.6.orig/Makefile.am pygtk-2.10.6/Makefile.am
---- pygtk-2.10.6.orig/Makefile.am      2008-05-24 15:18:49.000000000 +0100
-+++ pygtk-2.10.6/Makefile.am   2008-05-24 15:20:50.000000000 +0100
-@@ -105,7 +105,7 @@
- # code generator
- .defs.c:
-       (cd $(srcdir)\
--       && $(PYTHON) codegen/codegen.py \
-+       && $(PYTHON_HOST) codegen/codegen.py \
-           --py_ssize_t-clean \
-           --register pango-types.defs \
-           --register atk-types.defs \
-diff -urN pygtk-2.10.6.orig/Makefile.in pygtk-2.10.6/Makefile.in
---- pygtk-2.10.6.orig/Makefile.in      2008-05-24 15:18:49.000000000 +0100
-+++ pygtk-2.10.6/Makefile.in   2008-05-24 15:20:39.000000000 +0100
-@@ -1085,7 +1085,7 @@
- # code generator
- .defs.c:
-       (cd $(srcdir)\
--       && $(PYTHON) codegen/codegen.py \
-+       && $(PYTHON_HOST) codegen/codegen.py \
-           --py_ssize_t-clean \
-           --register pango-types.defs \
-           --register atk-types.defs \
-diff -urN pygtk-2.10.6.orig/gtk/Makefile.am pygtk-2.10.6/gtk/Makefile.am
---- pygtk-2.10.6.orig/gtk/Makefile.am  2008-05-24 15:18:49.000000000 +0100
-+++ pygtk-2.10.6/gtk/Makefile.am       2008-05-24 15:21:10.000000000 +0100
-@@ -170,7 +170,7 @@
- .defs.c: 
--      ($(PYTHON) $(top_srcdir)/codegen/codegen.py \
-+      ($(PYTHON_HOST) $(top_srcdir)/codegen/codegen.py \
-          $(PYGTK_CODEGEN_DEFINES) \
-           -I $(srcdir) \
-           --py_ssize_t-clean \
-diff -urN pygtk-2.10.6.orig/gtk/Makefile.in pygtk-2.10.6/gtk/Makefile.in
---- pygtk-2.10.6.orig/gtk/Makefile.in  2008-05-24 15:18:49.000000000 +0100
-+++ pygtk-2.10.6/gtk/Makefile.in       2008-05-24 15:21:20.000000000 +0100
-@@ -1056,7 +1056,7 @@
-       gtk-types.defs
- .defs.c: 
--      ($(PYTHON) $(top_srcdir)/codegen/codegen.py \
-+      ($(PYTHON_HOST) $(top_srcdir)/codegen/codegen.py \
-          $(PYGTK_CODEGEN_DEFINES) \
-           -I $(srcdir) \
-           --py_ssize_t-clean \
index b5896150faafa2461ba64d5cf72a773fc38d3842..1746bbf5de610a7414d2ed527a194023f56307e9 100644 (file)
@@ -40,6 +40,14 @@ define PyPackage/python-sqlite/filespec
 -|$(PYTHON_PKG_DIR)/pysqlite2/test
 endef
 
+define Build/Configure
+       cp ./files/setup.cfg.in $(PKG_BUILD_DIR)/setup.cfg
+       $(SED) \
+               's,@INCLUDE_DIRS@,$(STAGING_DIR)/usr/include,g' \
+               -e 's,@INCLUDE_DIRS@,$(STAGING_DIR)/usr/include,g' \
+               $(PKG_BUILD_DIR)/setup.cfg
+endef
+
 define Build/Compile
        $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
        $(call Build/Compile/PyMod,., \
@@ -49,7 +57,3 @@ endef
 
 $(eval $(call PyPackage,python-sqlite))
 $(eval $(call BuildPackage,python-sqlite))
-
-$(eval $(call RequireHeader,/usr/include/gnu/stubs-32.h, \
-       $(PKG_NAME) requires a 32-bits toolchain. \
-))
diff --git a/lang/pysqlite/files/setup.cfg.in b/lang/pysqlite/files/setup.cfg.in
new file mode 100644 (file)
index 0000000..50f04cd
--- /dev/null
@@ -0,0 +1,5 @@
+[build_ext]
+define=
+include_dirs=@INCLUDE_DIRS@
+library_dirs=@LIBRARY_DIRS@
+libraries=sqlite3
index c8773d7561f96731754532923ce49c5750938079..b7b4d64950e77decf6291efbaaf948a6ecebca7a 100644 (file)
@@ -4,6 +4,7 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+# $Id$
 
 include $(TOPDIR)/rules.mk
 
@@ -16,6 +17,7 @@ PKG_MD5SUM:=562c78876219bf458d79a041af18293d
 PKG_FIXUP:=libtool
 
 include $(INCLUDE_DIR)/package.mk
+-include $(if $(DUMP),,$(STAGING_DIR)/mk/python-package.mk)
 
 PKG_INSTALL=1
 
@@ -24,6 +26,7 @@ EXTRA_CFLAGS += \
        -I$(STAGING_DIR)/usr/lib/libiconv/include
 
 EXTRA_LDFLAGS += \
+       -Wl,-rpath=$(STAGING_DIR)/usr/lib \
        -L$(STAGING_DIR)/usr/lib/libintl/lib \
        -L$(STAGING_DIR)/usr/lib/libiconv/lib
 
@@ -41,23 +44,33 @@ define Package/dbus-python/description
 endef
 
 define Build/InstallDev
-       $(INSTALL_DIR) $(1)/usr/include/dbus-1.0/dbus/
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/dbus-1.0/dbus/* \
+       $(INSTALL_DIR) $(1)/usr/include/dbus-1.0/dbus
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/include/dbus-1.0/dbus/* \
                $(1)/usr/include/dbus-1.0/dbus/
-       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* \
+               $(1)/usr/lib/pkgconfig
 endef
 
 define Package/dbus-python/install
-       $(INSTALL_DIR) $(1)/usr/lib/python2.5/site-packages/
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/python2.5/site-packages/*.{py,so,a} \
-               $(1)/usr/lib/python2.5/site-packages/
-       $(INSTALL_DIR) $(1)/usr/lib/python2.5/site-packages/dbus/
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/python2.5/site-packages/dbus/*.py \
-               $(1)/usr/lib/python2.5/site-packages/dbus/
-       $(INSTALL_DIR) $(1)/usr/lib/python2.5/site-packages/dbus/mainloop/
-       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/python2.5/site-packages/dbus/mainloop/*.py \
-               $(1)/usr/lib/python2.5/site-packages/dbus/mainloop/
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/*.{py,so,a} \
+               $(1)$(PYTHON_PKG_DIR)
+
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/dbus
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/dbus/*.py \
+               $(1)$(PYTHON_PKG_DIR)/dbus
+
+       $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/dbus/mainloop
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/dbus/mainloop/*.py \
+               $(1)$(PYTHON_PKG_DIR)/dbus/mainloop
+
 endef
 
 $(eval $(call BuildPackage,dbus-python))
index 787d7a70f1ce6b31264441b8cfc9f60632867f1c..b02876cc63c6bbe1ca63ad9a7478c4a87837acce 100644 (file)
@@ -4,6 +4,7 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+# $Id$
 
 include $(TOPDIR)/rules.mk
 
@@ -23,11 +24,6 @@ PKG_INSTALL=1
 EXTRA_CFLAGS += \
        -I$(STAGING_DIR)/usr/lib/libintl/include \
        -I$(STAGING_DIR)/usr/lib/libiconv/include \
-       $(if CONFIG_PACKAGE_python-rsvg, \
-               -I$(STAGING_DIR)/usr/include/librsvg-2 \
-               -I$(STAGING_DIR)/usr/include/pycairo \
-       ,) \
-       $(if CONFIG_PACKAGE_python-wnck,-I$(STAGING_DIR)/usr/include/libwnck-1.0,)
 
 EXTRA_LDFLAGS += \
        -L$(STAGING_DIR)/usr/lib/libintl/lib \
index 7887857c7fa165b7818f112a2ecd186aa1e20db3..cc532278bce64eb8f534a43771f9cb5696b653ef 100644 (file)
@@ -14,14 +14,12 @@ PKG_RELEASE:=2
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION)/
-PKG_MD5SUM:=70084ffa561660f07de466c2c8c4842d
+#PKG_MD5SUM:=afb5451049eda91fbde10bd5a4b7fadc
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
 
-PKG_BUILD_DEPENDS:=python libexpat libopenssl zlib
-
 include $(INCLUDE_DIR)/package.mk
--include $(if $(DUMP),,./python-package.mk)
+-include $(if $(DUMP),,./files/python-package.mk)
 
 define Package/python/Default
   SUBMENU:=Python
@@ -32,19 +30,19 @@ define Package/python/Default
 endef
 
 define Package/python/Default/description
- Python is a dynamic object-oriented programming language that can be used 
- for many kinds of software development. It offers strong support for 
- integration with other languages and tools, comes with extensive standard 
- libraries, and can be learned in a few days. Many Python programmers 
- report substantial productivity gains and feel the language encourages 
+ Python is a dynamic object-oriented programming language that can be used
+ for many kinds of software development. It offers strong support for
+ integration with other languages and tools, comes with extensive standard
+ libraries, and can be learned in a few days. Many Python programmers
+ report substantial productivity gains and feel the language encourages
  the development of higher quality, more maintainable code.
 endef
 
 define Package/python
 $(call Package/python/Default)
- TITLE+= (full)
DEPENDS:= +libpthread +zlib
- PROVIDES:=python-core
 TITLE+= (full)
 DEPENDS:=+libpthread +zlib
 PROVIDES:=python-core
 endef
 
 define Package/python/description
@@ -55,27 +53,27 @@ endef
 
 define Package/python-mini
 $(call Package/python/Default)
- TITLE+= (minimal)
DEPENDS:= +libpthread +zlib
- PROVIDES:=python-core
 TITLE+= (minimal)
 DEPENDS:=+libpthread +zlib
 PROVIDES:=python-core
 endef
 
 define Package/python-mini/description
 $(call Package/python/Default/description)
- .
- This package contains only a minimal Python install.
 .
 This package contains only a minimal Python install.
 endef
 
 define Package/python-doc
 $(call Package/python/Default)
- TITLE:=Python interactive documentation
- DEPENDS+= python-core
 TITLE:=Python interactive documentation
 DEPENDS+= python-core
 endef
 
 define Package/python-expat
 $(call Package/python/Default)
- TITLE:=Python support for expat
- DEPENDS+= python-core +libexpat
 TITLE:=Python support for expat
 DEPENDS+= python-core +libexpat
 endef
 
 define Package/python-openssl
@@ -97,8 +95,8 @@ MAKE_OPTS:=\
        CFLAGS="$(TARGET_CFLAGS) -fno-inline" \
        LDFLAGS="$(TARGET_LDFLAGS)" \
        LD="$(TARGET_CC)" \
-       HOSTPYTHON=./hostpython \
-       HOSTPGEN=./hostpgen
+       HOSTPYTHON=$(PKG_INSTALL_DIR)/host/bin/python \
+       HOSTPGEN=./hostpgen \
 
 define Build/Configure
 endef
@@ -109,15 +107,16 @@ define Build/Compile
                rm -rf config.cache; \
                CONFIG_SITE= \
                OPT="$(HOST_CFLAGS)" \
-               ./configure --without-cxx-main --without-threads; \
-       );
-       $(MAKE) -C $(PKG_BUILD_DIR) python Parser/pgen
-       (cd $(PKG_BUILD_DIR); \
-               mv python ./hostpython; \
-               mv Parser/pgen ./hostpgen; \
+               ./configure --without-cxx-main --without-threads --prefix=$(PKG_INSTALL_DIR)/host; \
        );
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               python Parser/pgen
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               HOSTPYTHON=$(PKG_BUILD_DIR)/python \
+               sharedmods install
+       (cd $(PKG_BUILD_DIR);mv Parser/pgen hostpgen)
        $(MAKE) -C $(PKG_BUILD_DIR) distclean
-       #echo "readline readline.c -lreadline -lncurses" >> $(PKG_BUILD_DIR)/Modules/Setup.local
+
        $(call Build/Configure/Default, \
                --sysconfdir=/etc \
                --disable-shared \
@@ -125,8 +124,6 @@ define Build/Compile
                --without-cxx-main \
                --with-threads \
                ac_cv_lib_readline_readline=no \
-               HOSTPYTHON=./hostpython \
-               HOSTPGEN=./hostpgen \
                OPT="$(TARGET_CFLAGS)" \
        )
        $(MAKE) -C $(PKG_BUILD_DIR) \
@@ -137,18 +134,33 @@ endef
 
 define Build/InstallDev
        $(INSTALL_DIR) $(1)/mk $(2)/bin $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
-       $(INSTALL_DATA) ./python-package.mk $(1)/mk/
-       $(CP) $(PKG_BUILD_DIR)/hostpython $(1)/usr/bin/
-       ln -sf hostpython $(1)/usr/bin/python
-       ln -sf $(STAGING_DIR)/usr/bin/hostpython $(2)/bin/
-       ln -sf $(STAGING_DIR)/usr/bin/python $(2)/bin/
+       $(INSTALL_DATA) ./files/python-package.mk $(1)/mk/
        $(CP) \
                $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
                $(1)/usr/include/
        $(CP) \
-               $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION) \
+               $(PKG_INSTALL_DIR)/host/lib/python$(PYTHON_VERSION) \
                $(PKG_BUILD_DIR)/libpython$(PYTHON_VERSION).a \
                $(1)/usr/lib/
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
+               $(1)/usr/lib/python$(PYTHON_VERSION)/
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/host/bin/python \
+               $(1)/usr/bin/hostpython
+       (cd $(2)/bin; \
+       ln -sf ../../usr/bin/hostpython python$(PYTHON_VERSION); \
+       ln -sf python$(PYTHON_VERSION) python)
+
+       $(CP) \
+               $(PKG_INSTALL_DIR)/host/bin/python$(PYTHON_VERSION)-config \
+               $(2)/bin/
+       $(SED) 's,^#!.*,#!/usr/bin/env python2.5,g' $(2)/bin/python$(PYTHON_VERSION)-config
+
+       (cd $(2)/bin; \
+       ln -sf python$(PYTHON_VERSION)-config python-config;)
 endef
 
 define PyPackage/python/filespec
diff --git a/lang/python/files/python-package.mk b/lang/python/files/python-package.mk
new file mode 100644 (file)
index 0000000..a744c73
--- /dev/null
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+
+PYTHON_VERSION=2.5
+
+PYTHON_DIR:=$(STAGING_DIR)/usr
+PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
+PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
+PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
+
+PYTHON:=python$(PYTHON_VERSION)
+
+PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
+
+define PyPackage
+  $(call shexport,PyPackage/$(1)/filespec)
+
+  define Package/$(1)/install
+       @getvar $$(call shvar,PyPackage/$(1)/filespec) | ( \
+               IFS='|'; \
+               while read fop fspec fperm; do \
+                 if [ "$$$$$$$$fop" = "+" ]; then \
+                   dpath=`dirname "$$$$$$$$fspec"`; \
+                   if [ -n "$$$$$$$$fperm" ]; then \
+                     dperm="-m$$$$$$$$fperm"; \
+                   else \
+                     dperm=`stat -c "%a" $(PKG_INSTALL_DIR)$$$$$$$$dpath`; \
+                   fi; \
+                   mkdir -p $$$$$$$$$dperm $$(1)$$$$$$$$dpath; \
+                   echo "copying: '$$$$$$$$fspec'"; \
+                   cp -fpR $(PKG_INSTALL_DIR)$$$$$$$$fspec $$(1)$$$$$$$$dpath/; \
+                   if [ -n "$$$$$$$$fperm" ]; then \
+                     chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
+                   fi; \
+                 elif [ "$$$$$$$$fop" = "-" ]; then \
+                   echo "removing: '$$$$$$$$fspec'"; \
+                   rm -fR $$(1)$$$$$$$$fspec; \
+                 elif [ "$$$$$$$$fop" = "=" ]; then \
+                   echo "setting permissions: '$$$$$$$$fperm' on '$$$$$$$$fspec'"; \
+                   chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
+                 fi; \
+               done; \
+       )
+       $(call PyPackage/$(1)/install,$$(1))
+  endef
+endef
+
+define Build/Compile/PyMod
+       ( cd $(PKG_BUILD_DIR)/$(1); \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               $(3) \
+               $(PYTHON) ./setup.py $(2) \
+       );
+endef
diff --git a/lang/python/patches/050-add_signal_set_wakeup_fd.patch b/lang/python/patches/050-add_signal_set_wakeup_fd.patch
new file mode 100644 (file)
index 0000000..04a4f5c
--- /dev/null
@@ -0,0 +1,110 @@
+diff -urN Python-2.5.1.orig/Include/pyerrors.h Python-2.5.1/Include/pyerrors.h
+--- Python-2.5.1.orig/Include/pyerrors.h       2008-08-10 13:46:48.000000000 +0200
++++ Python-2.5.1/Include/pyerrors.h    2008-08-10 13:51:05.000000000 +0200
+@@ -239,6 +239,9 @@
+ PyAPI_FUNC(int) PyErr_CheckSignals(void);
+ PyAPI_FUNC(void) PyErr_SetInterrupt(void);
++/* In signalmodule.c */
++int PySignal_SetWakeupFd(int fd);
++
+ /* Support for adding program text to SyntaxErrors */
+ PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
+ PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int);
+diff -urN Python-2.5.1.orig/Modules/signalmodule.c Python-2.5.1/Modules/signalmodule.c
+--- Python-2.5.1.orig/Modules/signalmodule.c   2008-08-10 13:46:48.000000000 +0200
++++ Python-2.5.1/Modules/signalmodule.c        2008-08-10 13:50:02.000000000 +0200
+@@ -12,6 +12,8 @@
+ #include <signal.h>
++#include <sys/stat.h>
++
+ #ifndef SIG_ERR
+ #define SIG_ERR ((PyOS_sighandler_t)(-1))
+ #endif
+@@ -75,6 +77,8 @@
+         PyObject *func;
+ } Handlers[NSIG];
++static int wakeup_fd = -1;
++
+ static int is_tripped = 0; /* Speed up sigcheck() when none tripped */
+ static PyObject *DefaultHandler;
+@@ -112,6 +116,7 @@
+ static void
+ signal_handler(int sig_num)
+ {
++      const char dummy_byte = '\0';
+ #ifdef WITH_THREAD
+ #ifdef WITH_PTH
+       if (PyThread_get_thread_ident() != main_thread) {
+@@ -125,6 +130,8 @@
+               is_tripped++;
+               Handlers[sig_num].tripped = 1;
+               Py_AddPendingCall(checksignals_witharg, NULL);
++              if (wakeup_fd != -1)
++                      write(wakeup_fd, &dummy_byte, 1);
+ #ifdef WITH_THREAD
+       }
+ #endif
+@@ -264,6 +271,50 @@
+ anything else -- the callable Python object used as a handler");
++static PyObject *
++signal_set_wakeup_fd(PyObject *self, PyObject *args)
++{
++      struct stat buf;
++      int fd, old_fd;
++      if (!PyArg_ParseTuple(args, "i:set_wakeup_fd", &fd))
++              return NULL;
++#ifdef WITH_THREAD
++      if (PyThread_get_thread_ident() != main_thread) {
++              PyErr_SetString(PyExc_ValueError,
++                              "set_wakeup_fd only works in main thread");
++              return NULL;
++      }
++#endif
++      if (fd != -1 && fstat(fd, &buf) != 0) {
++              PyErr_SetString(PyExc_ValueError, "invalid fd");
++              return NULL;
++      }
++      old_fd = wakeup_fd;
++      wakeup_fd = fd;
++      return PyLong_FromLong(old_fd);
++}
++
++PyDoc_STRVAR(set_wakeup_fd_doc,
++"set_wakeup_fd(fd) -> fd\n\
++\n\
++Sets the fd to be written to (with '\\0') when a signal\n\
++comes in.  A library can use this to wakeup select or poll.\n\
++The previous fd is returned.\n\
++\n\
++The fd must be non-blocking.");
++
++/* C API for the same, without all the error checking */
++int
++PySignal_SetWakeupFd(int fd)
++{
++      int old_fd = wakeup_fd;
++      if (fd < 0)
++              fd = -1;
++      wakeup_fd = fd;
++      return old_fd;
++}
++
++
+ /* List of functions defined in the module */
+ static PyMethodDef signal_methods[] = {
+ #ifdef HAVE_ALARM
+@@ -271,6 +322,7 @@
+ #endif
+       {"signal",              signal_signal, METH_VARARGS, signal_doc},
+       {"getsignal",           signal_getsignal, METH_VARARGS, getsignal_doc},
++      {"set_wakeup_fd",       signal_set_wakeup_fd, METH_VARARGS, set_wakeup_fd_doc},
+ #ifdef HAVE_PAUSE
+       {"pause",               (PyCFunction)signal_pause,
+        METH_NOARGS,pause_doc},
diff --git a/lang/python/python-package.mk b/lang/python/python-package.mk
deleted file mode 100644 (file)
index 6ad1221..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-# $Id$
-
-PYTHON_VERSION=2.5
-
-PYTHON_DIR:=$(STAGING_DIR)/usr
-PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin
-PYTHON_INC_DIR:=$(PYTHON_DIR)/include/python$(PYTHON_VERSION)
-PYTHON_LIB_DIR:=$(PYTHON_DIR)/lib/python$(PYTHON_VERSION)
-
-PYTHON:=$(PYTHON_BIN_DIR)/python
-
-PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages
-
-define PyPackage
-  $(call shexport,PyPackage/$(1)/filespec)
-
-  define Package/$(1)/install
-       @getvar $$(call shvar,PyPackage/$(1)/filespec) | ( \
-               IFS='|'; \
-               while read fop fspec fperm; do \
-                 if [ "$$$$$$$$fop" = "+" ]; then \
-                   dpath=`dirname "$$$$$$$$fspec"`; \
-                   if [ -n "$$$$$$$$fperm" ]; then \
-                     dperm="-m$$$$$$$$fperm"; \
-                   else \
-                     dperm=`stat -c "%a" $(PKG_INSTALL_DIR)$$$$$$$$dpath`; \
-                   fi; \
-                   mkdir -p $$$$$$$$$dperm $$(1)$$$$$$$$dpath; \
-                   echo "copying: '$$$$$$$$fspec'"; \
-                   cp -fpR $(PKG_INSTALL_DIR)$$$$$$$$fspec $$(1)$$$$$$$$dpath/; \
-                   if [ -n "$$$$$$$$fperm" ]; then \
-                     chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
-                   fi; \
-                 elif [ "$$$$$$$$fop" = "-" ]; then \
-                   echo "removing: '$$$$$$$$fspec'"; \
-                   rm -fR $$(1)$$$$$$$$fspec; \
-                 elif [ "$$$$$$$$fop" = "=" ]; then \
-                   echo "setting permissions: '$$$$$$$$fperm' on '$$$$$$$$fspec'"; \
-                   chmod -R $$$$$$$$fperm $$(1)$$$$$$$$fspec; \
-                 fi; \
-               done; \
-       )
-       $(call PyPackage/$(1)/install,$$(1))
-  endef
-endef
-
-define Build/Compile/PyMod
-       ( cd $(PKG_BUILD_DIR)/$(1); \
-               CFLAGS="$(TARGET_CFLAGS)" \
-               CPPFLAGS="$(TARGET_CPPFLAGS)" \
-               LDFLAGS="$(TARGET_LDFLAGS)" \
-               $(3) \
-               $(PYTHON) ./setup.py $(2) \
-       );
-endef
index 25990054b2490d8d5f0786e0f8f6f39b1776e04e..d42d22e9271a8c60b972fb9319c689562bfb1167 100644 (file)
@@ -4,6 +4,7 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+# $Id$
 
 include $(TOPDIR)/rules.mk
 
@@ -15,6 +16,7 @@ PKG_SOURCE_URL:=http://telepathy.freedesktop.org/releases/telepathy-python/
 PKG_MD5SUM:=678a28e3b7d06f75940beec28130d9a5
 
 include $(INCLUDE_DIR)/package.mk
+-include $(if $(DUMP),,$(STAGING_DIR)/mk/python-package.mk)
 
 define Package/telepathy-python
   SUBMENU:=Python
@@ -26,14 +28,15 @@ define Package/telepathy-python
 endef
 
 define Package/telepathy-python/description
-  telepathy- python bingings
+  telepathy python bingings
 endef
 
 define Build/Compile
-       cd $(PKG_BUILD_DIR) ; $(CONFIGURE_VARS) $(MAKE_VARS) /usr/bin/python ./setup.py install --prefix="$(PKG_INSTALL_DIR)/usr"
+       $(call Build/Compile/PyMod,,install --prefix="$(PKG_INSTALL_DIR)/usr")
 endef
 
 define Package/telepathy-python/install
+       #FIXME: Only copy required files
        mkdir -p $(1)
        cp -r $(PKG_INSTALL_DIR)/* $(1)
 endef
index 42fb1aed99d5ca0f0435cfc3fd697ddd2781387f..a6c97a97262b4c8b85d968089bef96a7f6c85a32 100644 (file)
@@ -4,7 +4,7 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-# $Id:
+# $Id$
 
 include $(TOPDIR)/rules.mk
 
@@ -17,6 +17,7 @@ PKG_SOURCE_URL:=http://oligarchy.co.uk/xapian/$(PKG_VERSION)
 PKG_FIXUP:=libtool
 
 include $(INCLUDE_DIR)/package.mk
+-include $(if $(DUMP),,$(STAGING_DIR)/mk/python-package.mk)
 
 PKG_INSTALL=1