--- /dev/null
+#
+# Copyright (C) 2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=python-sip
+PKG_VERSION:=4.10.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=sip-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.riverbankcomputing.co.uk/static/Downloads/sip4
+PKG_MD5SUM:=0a591ef6e59aa16e56822d3eb9fe21b8
+PKG_INSTALL:=1
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/sip-$(PKG_VERSION)
+PKG_BUILD_DIR:=$(BUILD_DIR)/sip-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+-include $(if $(DUMP),,./files/python-sip-package.mk)
+
+define Package/python-sip
+ SECTION:=devel
+ CATEGORY:=Development
+ TITLE:=Python SIP
+ URL:=http://www.riverbankcomputing.co.uk/software/sip/download
+endef
+
+define Build/Configure
+ $(INSTALL_DIR) "$(PYTHON_SIP_CONFIG_TEMPLATE_DIR)"; \
+ $(CP) ./files/sipconfig.macros.template "$(PYTHON_SIP_CONFIG_TEMPLATE)"; \
+ echo "CC $(TARGET_CROSS)gcc" >> $(PYTHON_SIP_CONFIG_TEMPLATE); \
+ echo "CFLAGS $(TARGET_CFLAGS) $(EXTRA_CFLAGS)" >> $(PYTHON_SIP_CONFIG_TEMPLATE); \
+ echo "CXX $(TARGET_CROSS)g++" >> $(PYTHON_SIP_CONFIG_TEMPLATE); \
+ echo "CXXFLAGS $(TARGET_CFLAGS) $(EXTRA_CFLAGS)" >> $(PYTHON_SIP_CONFIG_TEMPLATE); \
+ echo "LINK $(TARGET_CROSS)g++" >> $(PYTHON_SIP_CONFIG_TEMPLATE); \
+ echo "LINK_SHLIB $(TARGET_CROSS)g++" >> $(PYTHON_SIP_CONFIG_TEMPLATE); \
+ echo "LFLAGS $(TARGET_LDFLAGS) $(EXTRA_LDFLAGS)" >> $(PYTHON_SIP_CONFIG_TEMPLATE); \
+ echo "AR $(TARGET_CROSS)ar cqs" >> $(PYTHON_SIP_CONFIG_TEMPLATE); \
+ echo "STRIP $(STRIP)" >> $(PYTHON_SIP_CONFIG_TEMPLATE); \
+ ( cd "$(PKG_BUILD_DIR)"; \
+ python -E -B ./configure.py \
+ --bindir=$(PKG_INSTALL_DIR)/usr/bin \
+ --destdir=$(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR) \
+ --incdir=$(PKG_INSTALL_DIR)/usr/include \
+ --sipdir=$(PKG_INSTALL_DIR)/usr/share/sip \
+ --sipconfig-macros="$(PYTHON_SIP_CONFIG_TEMPLATE)" \
+ )
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CROSS)gcc" \
+ CXX="$(TARGET_CROSS)g++" \
+ LINK="$(TARGET_CROSS)g++" \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ CXXFLAGS="$(TARGET_CFLAGS)"
+endef
+
+define Build/InstallDev
+ $(INSTALL_DIR) $(1)/mk
+ $(INSTALL_DATA) ./files/python-sip-package.mk $(1)/mk/
+endef
+
+define Build/Install
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ CC="$(TARGET_CROSS)gcc" \
+ CXX="$(TARGET_CROSS)g++" \
+ LINK="$(TARGET_CROSS)g++" \
+ CFLAGS="$(TARGET_CFLAGS)" \
+ CXXFLAGS="$(TARGET_CFLAGS)" \
+ DESTDIR="" \
+ install
+endef
+
+define Package/python-sip/install
+ # We only install the python module for now...
+ $(INSTALL_DIR) $(1)/$(PYTHON_PKG_DIR)
+ $(CP) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)/* $(1)/$(PYTHON_PKG_DIR)
+endef
+
+define Host/Configure
+ ( cd "$(HOST_BUILD_DIR)"; \
+ python -E -B ./configure.py \
+ --bindir=$(STAGING_DIR_HOST)/usr/bin \
+ --destdir=$(STAGING_DIR_HOST)/$(PYTHON_PKG_DIR) \
+ --incdir=$(STAGING_DIR_HOST)/usr/include \
+ --sipdir=$(STAGING_DIR_HOST)/usr/share/sip \
+ )
+endef
+
+define Host/Compile
+ $(MAKE) -C $(HOST_BUILD_DIR) \
+ CC="$(HOSTCC)" \
+ CXX="g++" \
+ LINK="g++" \
+ CFLAGS="$(HOST_CFLAGS)" \
+ CXXFLAGS="$(HOST_CFLAGS)"
+endef
+
+define Host/Install
+ $(MAKE) -C $(HOST_BUILD_DIR) \
+ CC="$(HOSTCC)" \
+ CXX="g++" \
+ LINK="g++" \
+ CFLAGS="$(HOST_CFLAGS)" \
+ CXXFLAGS="$(HOST_CFLAGS)" \
+ install
+endef
+
+#TODO check for host python-dev headers.
+
+$(eval $(call RequireCommand,python, \
+ Please install Python 2.x \
+))
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,python-sip))
--- /dev/null
+#
+# Copyright (C) 2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+PYTHON_SIP_CONFIG_TEMPLATE_DIR:=$(STAGING_DIR)/usr/share/python-sip
+PYTHON_SIP_CONFIG_TEMPLATE:=$(PYTHON_SIP_CONFIG_TEMPLATE_DIR)/sipconfig.template
+
--- /dev/null
+AIX_SHLIB
+AR ar cqs
+CC gcc
+CFLAGS -pipe
+CFLAGS_CONSOLE
+CFLAGS_DEBUG
+CFLAGS_EXCEPTIONS_OFF
+CFLAGS_EXCEPTIONS_ON
+CFLAGS_MT
+CFLAGS_MT_DBG
+CFLAGS_MT_DLL
+CFLAGS_MT_DLLDBG
+CFLAGS_RELEASE
+CFLAGS_RTTI_OFF
+CFLAGS_RTTI_ON
+CFLAGS_SHLIB -fPIC
+CFLAGS_STL_OFF
+CFLAGS_STL_ON
+CFLAGS_THREAD -D_REENTRANT
+CFLAGS_WARN_OFF -w
+CFLAGS_WARN_ON -Wall -W
+CHK_DIR_EXISTS test -d
+CONFIG qt warn_on release incremental link_prl
+COPY cp -f
+CXX g++
+CXXFLAGS -pipe
+CXXFLAGS_CONSOLE
+CXXFLAGS_DEBUG
+CXXFLAGS_EXCEPTIONS_OFF
+CXXFLAGS_EXCEPTIONS_ON
+CXXFLAGS_MT
+CXXFLAGS_MT_DBG
+CXXFLAGS_MT_DLL
+CXXFLAGS_MT_DLLDBG
+CXXFLAGS_RELEASE
+CXXFLAGS_RTTI_OFF
+CXXFLAGS_RTTI_ON
+CXXFLAGS_SHLIB -fPIC
+CXXFLAGS_STL_OFF
+CXXFLAGS_STL_ON
+CXXFLAGS_THREAD -D_REENTRANT
+CXXFLAGS_WARN_OFF -w
+CXXFLAGS_WARN_ON -Wall -W
+DEFINES
+DEL_FILE rm -f
+EXTENSION_PLUGIN
+EXTENSION_SHLIB
+INCDIR
+INCDIR_OPENGL /usr/X11R6/include
+INCDIR_X11 /usr/X11R6/include
+LFLAGS
+LFLAGS_CONSOLE
+LFLAGS_CONSOLE_DLL
+LFLAGS_DEBUG
+LFLAGS_DLL
+LFLAGS_OPENGL
+LFLAGS_PLUGIN -shared
+LFLAGS_RELEASE
+LFLAGS_SHLIB -shared
+LFLAGS_SONAME -Wl,-soname,
+LFLAGS_THREAD
+LFLAGS_WINDOWS
+LFLAGS_WINDOWS_DLL
+LIB
+LIBDIR
+LIBDIR_OPENGL /usr/X11R6/lib
+LIBDIR_X11 /usr/X11R6/lib
+LIBS
+LIBS_CONSOLE
+LIBS_CORE
+LIBS_GUI
+LIBS_NETWORK
+LIBS_OPENGL -lGLU -lGL
+LIBS_RT
+LIBS_RTMT
+LIBS_THREAD -lpthread
+LIBS_WEBKIT
+LIBS_WINDOWS
+LIBS_X11 -lXext -lX11 -lm
+LINK g++
+LINK_SHLIB g++
+LINK_SHLIB_CMD
+MAKEFILE_GENERATOR UNIX
+MKDIR mkdir -p
+RANLIB
+RPATH -Wl,-rpath,
+STRIP strip
--- /dev/null
+---
+ configure.py | 52 ++++++++++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 44 insertions(+), 8 deletions(-)
+
+--- sip-4.10.5.orig/configure.py
++++ sip-4.10.5/configure.py
+@@ -302,6 +302,11 @@ def create_optparser():
+ def store_abspath(option, opt_str, value, parser):
+ setattr(parser.values, option.dest, os.path.abspath(value))
+
++ def store_abspath_file(option, opt_str, value, parser):
++ if not os.path.isfile(value):
++ raise optparse.OptionValueError("'%s' is not a file" % value)
++ setattr(parser.values, option.dest, os.path.abspath(value))
++
+ p = optparse.OptionParser(usage="python %prog [opts] [macro=value] "
+ "[macro+=value]", version=sip_version_str)
+
+@@ -369,9 +374,38 @@ def create_optparser():
+ "are normally installed [default: %s]" % default_sipsipdir)
+ p.add_option_group(g)
+
++ # Crosscompilation
++ g = optparse.OptionGroup(p, title="Crosscompilation")
++ g.add_option("--crosscompile", action="store_true",
++ default=False, dest="crosscompile",
++ help="Set, if cross-compiling")
++ g.add_option("--sipconfig-macros", action="callback", metavar="FILE",
++ default=None, dest="sipconfig_macros", type="string",
++ callback=store_abspath_file,
++ help="Path to a file containing sipconfig macros")
++ p.add_option_group(g)
++
+ return p
+
+
++def load_sipconfig_macros(filename):
++ macros = {}
++ fd = file(filename, "r")
++ for line in fd.readlines():
++ line = line.split()
++ try:
++ key = line[0]
++ except IndexError:
++ sipconfig.error("Invalid sipconfig macros file format")
++ value = ""
++ try:
++ value = " ".join(line[1:])
++ except IndexError:
++ pass
++ macros[key] = value
++ return macros
++
++
+ def main(argv):
+ """Create the configuration module module.
+
+@@ -434,14 +468,16 @@ def main(argv):
+ else:
+ opts.universal = ''
+
+- # Get the platform specific macros for building.
+- macros = siputils.parse_build_macros(
+- os.path.join(src_dir, "specs", opts.platform), build_macro_names,
+- args)
+-
+- if macros is None:
+- p.print_help()
+- sys.exit(2)
++ if opts.sipconfig_macros:
++ macros = load_sipconfig_macros(opts.sipconfig_macros)
++ else:
++ # Get the platform specific macros for building.
++ macros = siputils.parse_build_macros(
++ os.path.join(src_dir, "specs", opts.platform), build_macro_names,
++ args)
++ if macros is None:
++ p.print_help()
++ sys.exit(2)
+
+ # Tell the user what's been found.
+ inform_user()