Fixup python-sip and pyqt4 to use the internal host-python.

git-svn-id: svn://svn.openwrt.org/openwrt/packages@23667 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
mb
2010-10-27 13:38:05 +00:00
parent 83b35d28c8
commit 59cb70ac2c
4 changed files with 239 additions and 97 deletions

View File

@ -20,6 +20,9 @@ HOST_BUILD_PARALLEL:=1
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/sip-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/sip-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=python
HOST_BUILD_DEPENDS:=python
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
$(call include_mk, python-package.mk)
@ -41,25 +44,33 @@ EXTRA_CFLAGS:=\
$(FPIC)
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)"; \
export PYTHONDONTWRITEBYTECODE=1; \
python -E ./configure.py \
$(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)
$(call HostPython, \
cd "$(PKG_BUILD_DIR)"; \
, \
./configure.py \
--crosscompile \
--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)" \
--py-site-dir=$(STAGING_DIR)/$(PYTHON_PKG_DIR) \
--py-inc-dir=$(PYTHON_INC_DIR) \
--py-conf-inc-dir=$(PKG_BUILD_DIR) \
--py-lib-dir=$(PYTHON_LIB_DIR) \
--py-bin-dir=$(PYTHON_BIN_DIR) \
--py-sip-dir=$(STAGING_DIR)/usr/share/sip \
)
endef
@ -73,8 +84,9 @@ define Build/Compile
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/mk
$(INSTALL_DIR) $(1)/mk $(1)/$(PYTHON_PKG_DIR)
$(INSTALL_DATA) ./files/python-sip-package.mk $(1)/mk/
$(CP) $(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR)/* $(1)/$(PYTHON_PKG_DIR)
endef
define Build/Install
@ -97,10 +109,15 @@ endef
# ===> HOST <===
HOST_CFLAGS+= \
$(HOST_FPIC) \
-I$(STAGING_DIR_HOST)/include/python$(PYTHON_VERSION)
define Host/Configure
( cd "$(HOST_BUILD_DIR)"; \
export PYTHONDONTWRITEBYTECODE=1; \
python -E ./configure.py \
$(call HostPython, \
cd "$(HOST_BUILD_DIR)"; \
, \
./configure.py \
--bindir=$(STAGING_DIR_HOST)/usr/bin \
--destdir=$(STAGING_DIR_HOST)/$(PYTHON_PKG_DIR) \
--incdir=$(STAGING_DIR_HOST)/usr/include \
@ -108,8 +125,6 @@ define Host/Configure
)
endef
HOST_CFLAGS+=$(HOST_FPIC)
define Host/Compile
$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
CC="$(HOSTCC)" \
@ -129,20 +144,5 @@ define Host/Install
install
endef
define Require/python2-dev
[ -e /usr/include/Python.h ] || \
[ -e /usr/include/python/Python.h ] || \
[ -e /usr/include/python2.5/Python.h ] || \
[ -e /usr/include/python2.6/Python.h ]
endef
#$(eval $(call Require,python2-dev, \
# Please install Python 2.x headers (python-dev) \
#))
$(eval $(call RequireCommand,python, \
Please install Python 2.x \
))
$(eval $(call HostBuild))
$(eval $(call BuildPackage,python-sip))

View File

@ -2,9 +2,79 @@
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():
Index: sip-4.10.5/configure.py
===================================================================
--- sip-4.10.5.orig/configure.py 2010-07-16 16:15:08.000000000 +0200
+++ sip-4.10.5/configure.py 2010-10-26 16:07:37.000000000 +0200
@@ -19,7 +19,6 @@
import os
import glob
import optparse
-from distutils import sysconfig
import siputils
@@ -193,21 +192,45 @@
global plat_py_site_dir, plat_py_inc_dir, plat_py_conf_inc_dir
global plat_bin_dir, plat_py_lib_dir, plat_sip_dir
- # We trust distutils for some stuff.
- plat_py_site_dir = sysconfig.get_python_lib(plat_specific=1)
- plat_py_inc_dir = sysconfig.get_python_inc()
- plat_py_conf_inc_dir = os.path.dirname(sysconfig.get_config_h_filename())
-
- if sys.platform == "win32":
- plat_py_lib_dir = sys.prefix + "\\libs"
- plat_bin_dir = sys.exec_prefix
- plat_sip_dir = sys.prefix + "\\sip"
- else:
- lib_dir = sysconfig.get_python_lib(plat_specific=1, standard_lib=1)
+ if not opts.crosscompile:
+ # We trust distutils for some stuff.
+ from distutils import sysconfig
+ plat_py_site_dir = sysconfig.get_python_lib(plat_specific=1)
+ plat_py_inc_dir = sysconfig.get_python_inc()
+ plat_py_conf_inc_dir = os.path.dirname(sysconfig.get_config_h_filename())
+
+ if sys.platform == "win32":
+ plat_py_lib_dir = sys.prefix + "\\libs"
+ plat_bin_dir = sys.exec_prefix
+ plat_sip_dir = sys.prefix + "\\sip"
+ else:
+ lib_dir = sysconfig.get_python_lib(plat_specific=1, standard_lib=1)
- plat_py_lib_dir = lib_dir + "/config"
- plat_bin_dir = sys.exec_prefix + "/bin"
- plat_sip_dir = sys.prefix + "/share/sip"
+ plat_py_lib_dir = lib_dir + "/config"
+ plat_bin_dir = sys.exec_prefix + "/bin"
+ plat_sip_dir = sys.prefix + "/share/sip"
+
+ count = 0
+ if opts.py_site_dir:
+ plat_py_site_dir = opts.py_site_dir
+ count += 1
+ if opts.py_inc_dir:
+ plat_py_inc_dir = opts.py_inc_dir
+ count += 1
+ if opts.py_conf_inc_dir:
+ plat_py_conf_inc_dir = opts.py_conf_inc_dir
+ count += 1
+ if opts.py_lib_dir:
+ plat_py_lib_dir = opts.py_lib_dir
+ count += 1
+ if opts.py_bin_dir:
+ plat_py_bin_dir = opts.py_bin_dir
+ count += 1
+ if opts.py_sip_dir:
+ plat_sip_dir = opts.py_sip_dir
+ count += 1
+ if count != 6 and opts.crosscompile:
+ siputils.error("Need to specify all --py-... options for crosscompile.")
def create_config(module, template, macros):
@@ -302,6 +325,11 @@
def store_abspath(option, opt_str, value, parser):
setattr(parser.values, option.dest, os.path.abspath(value))
@ -16,7 +86,7 @@
p = optparse.OptionParser(usage="python %prog [opts] [macro=value] "
"[macro+=value]", version=sip_version_str)
@@ -369,9 +374,38 @@ def create_optparser():
@@ -369,9 +397,62 @@
"are normally installed [default: %s]" % default_sipsipdir)
p.add_option_group(g)
@ -29,6 +99,30 @@
+ default=None, dest="sipconfig_macros", type="string",
+ callback=store_abspath_file,
+ help="Path to a file containing sipconfig macros")
+ g.add_option("--py-site-dir", action="callback",
+ default=None, dest="py_site_dir", type="string",
+ callback=store_abspath,
+ help="Python site directory")
+ g.add_option("--py-inc-dir", action="callback",
+ default=None, dest="py_inc_dir", type="string",
+ callback=store_abspath,
+ help="Python include directory")
+ g.add_option("--py-conf-inc-dir", action="callback",
+ default=None, dest="py_conf_inc_dir", type="string",
+ callback=store_abspath,
+ help="Python config include directory")
+ g.add_option("--py-lib-dir", action="callback",
+ default=None, dest="py_lib_dir", type="string",
+ callback=store_abspath,
+ help="Python library directory")
+ g.add_option("--py-bin-dir", action="callback",
+ default=None, dest="py_bin_dir", type="string",
+ callback=store_abspath,
+ help="Python binary directory")
+ g.add_option("--py-sip-dir", action="callback",
+ default=None, dest="py_sip_dir", type="string",
+ callback=store_abspath,
+ help="Python SIP directory")
+ p.add_option_group(g)
+
return p
@ -55,7 +149,27 @@
def main(argv):
"""Create the configuration module module.
@@ -434,14 +468,16 @@ def main(argv):
@@ -382,9 +463,6 @@
if py_version < 0x020300:
siputils.error("This version of SIP requires Python v2.3 or later.")
- # Basic initialisation.
- set_platform_directories()
-
# Build up the list of valid specs.
for s in os.listdir(os.path.join(src_dir, "specs")):
platform_specs.append(s)
@@ -396,6 +474,9 @@
p = create_optparser()
opts, args = p.parse_args()
+ # Basic initialisation.
+ set_platform_directories()
+
# Make sure MacOS specific options get initialised.
if sys.platform != 'darwin':
opts.universal = ''
@@ -434,14 +515,16 @@
else:
opts.universal = ''
@ -80,3 +194,19 @@
# Tell the user what's been found.
inform_user()
Index: sip-4.10.5/siputils.py
===================================================================
--- sip-4.10.5.orig/siputils.py 2010-07-16 16:07:33.000000000 +0200
+++ sip-4.10.5/siputils.py 2010-10-26 16:02:14.000000000 +0200
@@ -1026,9 +1026,11 @@
for f in self.optional_list("DEFINES"):
cppflags.append("-D" + f)
+ print "CPPFLAGS: Adding -D", f
for f in self.optional_list("INCDIR"):
cppflags.append("-I" + _quote(f))
+ print "CPPFLAGS: Adding -I", _quote(f)
libs = []