[Build-common-hackers] Bug#606217: Subject: cdbs: Python cross building not supported
Peter Pearse
peter.pearse at linaro.org
Tue Dec 7 14:25:03 UTC 2010
Subject: cdbs: Python cross building not supported
Package: cdbs
Version: 0.4.83ubuntu2
Severity: wishlist
When python is called to build C/C++ extensions whilst cross building a
package, it needs to be set up to use the cross toolchain, rather than the
default build host toolchain.
The patch below indicates how this might be done by adding an environment
variable to be set in the Makefile.
---
--- /usr/share/cdbs/1/class/python-sugar.mk 2010-09-03
09:39:47.000000000 +0100
+++ 1/class/python-sugar.mk 2010-11-24 09:01:08.000000000 +0000
@@ -67,11 +67,16 @@ pre-build clean::
pre-build::
mkdir -p debian/stamps-configure
+# LINARO_PYTHON_SET_ENV, defined in /usr/share/cdbs/1/class/python-
distutils.mk,
+# allows e.g. cross tools to be set for use during setup.py
$(patsubst %,build/%,$(DEB_PYTHON_SUGAR_PACKAGES)) :: build/%:
[ ! -e $(cdbs_cursrcdir)/MANIFEST ] || [ -e
$(cdbs_cursrcdir)/MANIFEST.upstream ] || mv $(cdbs_cursrcdir)/MANIFEST
$(cdbs_cursrcdir)/MANIFEST.upstream
[ ! -e $(cdbs_cursrcdir)/MANIFEST.upstream ] || egrep -v
'^locale/.*/(.*\.mo|activity\.linfo)$$' $(cdbs_cursrcdir)/MANIFEST.upstream >
$(cdbs_cursrcdir)/MANIFEST
+ @echo "$@ in modified /usr/share/cdbs/1/class/python-sugar.mk"
set -e; for buildver in $(cdbs_python_build_versions); do \
+ $(LINARO_PYTHON_SET_ENV);\
$(call cdbs_python_binary,python$$buildver)
$(cdbs_cursrcdir)/setup.py build; \
+ touch /home/chroot-user/python_run ;\
done
[ ! -e $(cdbs_cursrcdir)/MANIFEST.upstream ] || IFS="`printf '\n'`"
find "$(cdbs_cursrcdir)/locale" -type f \( -name '*.mo' -or -name
'activity.linfo' \) | while read path; do \
echo "$$path" | sed 's!^$(cdbs_cursrcdir)/!!' >>
$(cdbs_cursrcdir)/MANIFEST; \
--- /usr/share/cdbs/1/class/python-distutils.mk 2010-09-03
09:39:47.000000000 +0100
+++ 1/class/python-distutils.mk 2010-11-24 09:11:51.000000000 +0000
@@ -61,13 +61,30 @@ common-build-arch common-build-indep:: $
$(patsubst %,build/%,$(cdbs_python_indep_packages)
$(cdbs_python_arch_packages)) :: build/% : debian/python-module-stampdir/%
+# These are the tool defaults used during setup.py
+LINARO_PYTHON_SET_ENV = \
+ export CC=gcc ;\
+ export CXX=g++ ;\
+ export LDSHARED='gcc -shared' ;\
+ export CPP=cpp ;\
+ export LDFLAGS='-L /usr/lib -L /lib' ;\
+ export BASECFLAGS=-DBASECFLAGS ;\
+ export OPT=-DOPT ;\
+ export CFLAGS='-I/usr/include -I/include';\
+ export CPPFLAGS=-DCPPFLAGS
+
$(patsubst %,debian/python-module-stampdir/%,$(cdbs_python_indep_packages)) ::
debian/python-module-stampdir/%:
- cd $(DEB_SRCDIR) && python$(cdbs_python_nondefault_version)
$(DEB_PYTHON_SETUP_CMD) build $(DEB_PYTHON_BUILD_ARGS)
+ @echo "$@ in modified /usr/share/cdbs/1/class/python-distutils.mk"
+ $(LINARO_PYTHON_SET_ENV) && \
+ cd $(DEB_SRCDIR) && python$(cdbs_python_nondefault_version)
$(DEB_PYTHON_SETUP_CMD) build $(DEB_PYTHON_BUILD_ARGS)
touch $@
$(patsubst %,debian/python-module-stampdir/%,$(cdbs_python_arch_packages)) ::
debian/python-module-stampdir/%:
+ @echo "$@ in modified /usr/share/cdbs/1/class/python-distutils.mk"
set -e; for buildver in $(cdbs_python_build_versions); do \
- cd $(CURDIR) && cd $(DEB_SRCDIR) && $(call
cdbs_python_binary,python$$buildver) $(DEB_PYTHON_SETUP_CMD) build
$(DEB_PYTHON_BUILD_ARGS); \
+ $(LINARO_PYTHON_SET_ENV) && \
+ cd $(CURDIR) && cd $(DEB_SRCDIR) && $(call
cdbs_python_binary,python$$buildver) $(DEB_PYTHON_SETUP_CMD) \
+ build $(DEB_PYTHON_BUILD_ARGS); \
done
touch $@
-------
-- System Information:
Debian Release: squeeze/sid
APT prefers maverick-updates
APT policy: (500, 'maverick-updates'), (500, 'maverick-security'), (500,
'maverick-proposed'), (500, 'maverick-backports'), (500, 'maverick')
Architecture: i386 (i686)
Kernel: Linux 2.6.35-22-generic-pae (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages cdbs depends on:
ii debhelper 8.0.0ubuntu1 helper programs for debian/rules
ii fdupes 1.50-PR2-3 identifies duplicate files within
ii intltool 0.41.1-1 Utility scripts for internationali
Versions of packages cdbs recommends:
ii autotools-dev 20100122.1 Update infrastructure for config.{
Versions of packages cdbs suggests:
ii devscripts 2.10.67ubuntu1 scripts to make the life of a Debi
ii doc-base 0.9.5 utilities to manage online documen
More information about the Build-common-hackers
mailing list