Fix the whole python building process to do proper crosscompiling for all python
[openwrt/svn-archive/archive.git] / lang / pygtk / Makefile
index 1906aef..d63c687 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 \
-))