[qt4] do not depend von QT4_WS_X11 as it creates a recursive dependency and therewith...
[openwrt/svn-archive/archive.git] / lang / pyqt4 / Makefile
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=pyqt4
11 PKG_VERSION:=4.7.4
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=PyQt-x11-gpl-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4
16 PKG_MD5SUM:=88e9f1bc467cccf424d2032e3470982c
17 PKG_BUILD_DIR:=$(BUILD_DIR)/PyQt-x11-gpl-$(PKG_VERSION)
18 PKG_INSTALL:=1
19 PKG_BUILD_PARALLEL:=1
20
21 PKG_BUILD_DEPENDS:=python-sip/host
22
23 include $(INCLUDE_DIR)/package.mk
24 $(call include_mk, python-package.mk)
25 $(call include_mk, python-sip-package.mk)
26
27 define Package/pyqt4
28 SECTION:=language-python
29 CATEGORY:=Languages
30 SUBMENU:=Python
31 TITLE:=Python QT4
32 MAINTAINER:=Michael Buesch <mb@bu3sch.de>
33 URL:=http://www.riverbankcomputing.co.uk/software/pyqt/download
34 DEPENDS:=+qt4 +dbus-python +python-sip
35 endef
36
37 define Package/pyqt4/Description
38 Python QT4 framework bindings.
39 endef
40
41 TARGET_INCDIRS+=$(STAGING_DIR)/include \
42 $(STAGING_DIR)/usr/include \
43 $(STAGING_DIR)/usr/include/Qt \
44 $(STAGING_DIR)/usr/include/Qt3Support \
45 $(STAGING_DIR)/usr/include/QtCore \
46 $(STAGING_DIR)/usr/include/QtDBus \
47 $(STAGING_DIR)/usr/include/QtGui \
48 $(STAGING_DIR)/usr/include/QtNetwork \
49 $(STAGING_DIR)/usr/include/QtSql \
50 $(STAGING_DIR)/usr/include/QtSvg \
51 $(STAGING_DIR)/usr/include/QtTest \
52 $(STAGING_DIR)/usr/include/QtXml \
53 $(STAGING_DIR)/usr/include/python$(PYTHON_VERSION) \
54 $(STAGING_DIR)/usr/lib/dbus-1.0/include \
55 $(TOOLCHAIN_DIR)/include \
56 $(TOOLCHAIN_DIR)/usr/include
57
58 TARGET_LIBDIRS+=$(STAGING_DIR)/lib \
59 $(STAGING_DIR)/usr/lib \
60 $(TOOLCHAIN_DIR)/lib \
61 $(TOOLCHAIN_DIR)/usr/lib
62
63 EXTRA_CFLAGS:=
64 EXTRA_LDFLAGS:=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
65 -Wl,-rpath=/usr/lib/
66
67 QTDIRSFILE:=$(PKG_BUILD_DIR)/qtdirs.out
68 SIPCFGFILE:=$(PKG_BUILD_DIR)/sipconfig.macros
69
70 QT_VERSION:=./files/qt_versioning.sh version "$(STAGING_DIR)/usr/include" "$(PKG_BUILD_DIR)/qtver.tmp"
71 QT_EDITION:=./files/qt_versioning.sh edition "$(STAGING_DIR)/usr/include" "$(PKG_BUILD_DIR)/qtver.tmp"
72
73 # Welcome to cross compilation hell. Dinner is served!
74
75 define Build/Configure
76 echo "$(STAGING_DIR)/usr" > $(QTDIRSFILE); \
77 echo "$(STAGING_DIR)/usr/include" >> $(QTDIRSFILE); \
78 echo "$(STAGING_DIR)/usr/lib" >> $(QTDIRSFILE); \
79 echo "$(STAGING_DIR)/usr/bin" >> $(QTDIRSFILE); \
80 echo "$(STAGING_DIR)/usr/share" >> $(QTDIRSFILE); \
81 echo "$(STAGING_DIR)/usr/lib/Qt/plugins" >> $(QTDIRSFILE); \
82 $(QT_VERSION) >> $(QTDIRSFILE); \
83 $(QT_EDITION) >> $(QTDIRSFILE); \
84 echo "Open Source" >> $(QTDIRSFILE); \
85 echo "shared" >> $(QTDIRSFILE); \
86 \
87 $(CP) "$(PYTHON_SIP_CONFIG_TEMPLATE)" "$(SIPCFGFILE)"; \
88 echo "INCDIR_QT $(STAGING_DIR)/usr/include" >> $(SIPCFGFILE); \
89 echo "LIBDIR_QT $(STAGING_DIR)/usr/lib" >> $(SIPCFGFILE); \
90 echo "MOC $(STAGING_DIR_HOST)/bin/moc" >> $(SIPCFGFILE); \
91 echo "QT_INSTALL_BINS $(STAGING_DIR)/usr/bin" >> $(SIPCFGFILE); \
92 echo "QT_INSTALL_HEADERS $(STAGING_DIR)/usr/include" >> $(SIPCFGFILE); \
93 echo "QT_INSTALL_LIBS $(STAGING_DIR)/usr/lib" >> $(SIPCFGFILE); \
94 echo "INCDIR $(TARGET_INCDIRS)" >> $(SIPCFGFILE); \
95 echo "INCDIR_OPENGL $(TARGET_INCDIRS)" >> $(SIPCFGFILE); \
96 echo "INCDIR_X11 $(TARGET_INCDIRS)" >> $(SIPCFGFILE); \
97 echo "LIBDIR $(TARGET_LIBDIRS)" >> $(SIPCFGFILE); \
98 echo "LIBDIR_OPENGL $(TARGET_LIBDIRS)" >> $(SIPCFGFILE); \
99 echo "LIBDIR_X11 $(TARGET_LIBDIRS)" >> $(SIPCFGFILE); \
100 ( \
101 export PYTHONPATH="$(STAGING_DIR_HOST)/$(PYTHON_PKG_DIR)"; \
102 cd "$(PKG_BUILD_DIR)"; \
103 python -B ./configure.py \
104 --use-arch="$(ARCH)" \
105 --qmake="$(STAGING_DIR_HOST)/bin/qmake" \
106 --qmake-spec="$(STAGING_DIR)/usr/share/mkspecs/linux-openwrt-g++" \
107 --qmake-prefix='TARGET_CC="$(TARGET_CROSS)gcc"' \
108 --qmake-prefix='TARGET_CXX="$(TARGET_CROSS)g++"' \
109 --qmake-prefix='TARGET_AR="$(TARGET_CROSS)ar cqs"' \
110 --qmake-prefix='TARGET_OBJCOPY="$(TARGET_CROSS)objcopy"' \
111 --qmake-prefix='TARGET_RANLIB="$(TARGET_CROSS)ranlib"' \
112 --qmake-prefix='TARGET_CFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)"' \
113 --qmake-prefix='TARGET_CXXFLAGS="$(TARGET_CFLAGS) $(EXTRA_CFLAGS)"' \
114 --qmake-prefix='TARGET_LDFLAGS="$(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)"' \
115 --qmake-prefix='TARGET_INCDIRS="$(TARGET_INCDIRS)"' \
116 --qmake-prefix='TARGET_LIBDIRS="$(TARGET_LIBDIRS)"' \
117 --qmake-prefix='STAGING_DIR_HOST="$(STAGING_DIR)/../host"' \
118 --qtdirs-file="$(QTDIRSFILE)" \
119 --sipconfig-macros="$(SIPCFGFILE)" \
120 --dbus="$(STAGING_DIR)/usr/include/dbus-1.0" \
121 --bindir="$(PKG_INSTALL_DIR)/usr/bin" \
122 --destdir="$(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)" \
123 --plugin-destdir="$(PKG_INSTALL_DIR)/usr/lib/Qt/plugins" \
124 --pydbus-installdir="$(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)" \
125 --sipdir="$(PKG_INSTALL_DIR)/usr/share/sip" \
126 --protected-is-public \
127 --crosscompile \
128 --no-designer-plugin \
129 --no-qsci-api \
130 --confirm-license \
131 --verbose \
132 ); \
133 ./files/fixup.sh "$(PKG_BUILD_DIR)"
134 endef
135
136 #FIXME: Something still puts the host Python include path into the CFLAGS.
137 # I'm currently unsure who does this. Most likely SIP. arghh..
138
139 define Build/Compile
140 $(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
141 endef
142
143 define Build/Install
144 $(MAKE_VARS) DESTDIR="" $(MAKE) -C $(PKG_BUILD_DIR) install
145 endef
146
147 define Package/pyqt4/install
148 $(INSTALL_DIR) $(1)/usr/bin
149 $(INSTALL_DIR) $(1)/$(PYTHON_PKG_DIR)/PyQt4
150 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{pylupdate4,pyrcc4,pyuic4} $(1)/usr/bin
151 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)/qt.so $(1)/$(PYTHON_PKG_DIR)
152 $(CP) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)/PyQt4 $(1)/$(PYTHON_PKG_DIR)
153 endef
154
155 $(eval $(call RequireCommand,python, \
156 Please install Python 2.x \
157 ))
158
159 $(eval $(call BuildPackage,pyqt4))