python3.4: added cross build support; moved static lib to -devel.

This commit is contained in:
Juan RP 2014-06-18 10:11:30 +02:00
parent e7bfb4234d
commit 8f5110fdd4
2 changed files with 112 additions and 20 deletions

View file

@ -0,0 +1,84 @@
--- setup.py.orig 2014-05-19 07:19:40.000000000 +0200
+++ setup.py 2014-06-18 09:50:55.950072020 +0200
@@ -17,7 +17,7 @@ from distutils.command.install_lib impor
from distutils.command.build_scripts import build_scripts
from distutils.spawn import find_executable
-cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
+cross_compiling = ("_PYTHON_HOST_PLATFORM" in os.environ) or ('PYTHONXCPREFIX' in os.environ)
def get_platform():
# cross build
@@ -486,7 +486,7 @@ class PyBuildExt(build_ext):
for directory in reversed(options.dirs):
add_dir_to_list(dir_list, directory)
- if os.path.normpath(sys.base_prefix) != '/usr' \
+ if os.path.normpath(sys.base_prefix) != '/usr' and not cross_compiling \
and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
# OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
# (PYTHONFRAMEWORK is set) to avoid # linking problems when
@@ -549,6 +549,11 @@ class PyBuildExt(build_ext):
if host_platform == 'darwin':
math_libs = []
+ # Insert libraries and headers from XBPS_CROSS_BASE
+ if 'XBPS_CROSS_BASE' in os.environ:
+ lib_dirs += [os.environ['XBPS_CROSS_BASE'] + '/usr/lib']
+ inc_dirs += [os.environ['XBPS_CROSS_BASE'] + '/usr/include']
+
# XXX Omitted modules: gl, pure, dl, SGI-specific modules
#
@@ -1852,8 +1857,13 @@ class PyBuildExt(build_ext):
# Pass empty CFLAGS because we'll just append the resulting
# CFLAGS to Python's; -g or -O2 is to be avoided.
- cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
- % (ffi_builddir, ffi_srcdir, " ".join(config_args))
+ if cross_compiling:
+ cmd = "cd %s && env CFLAGS='' '%s/configure' --host=%s --build=%s %s" \
+ % (ffi_builddir, ffi_srcdir, os.environ.get('HOSTARCH'),
+ os.environ.get('BUILDARCH'), " ".join(config_args))
+ else:
+ cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
+ % (ffi_builddir, ffi_srcdir, " ".join(config_args))
res = os.system(cmd)
if res or not os.path.exists(ffi_configfile):
--- Makefile.pre.in.orig 2014-05-19 07:19:39.000000000 +0200
+++ Makefile.pre.in 2014-06-18 10:03:34.112784225 +0200
@@ -976,8 +976,6 @@ install: @FRAMEWORKINSTALLFIRST@ commoni
upgrade) ensurepip="--upgrade" ;; \
install|*) ensurepip="" ;; \
esac; \
- $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
- $$ensurepip --root=$(DESTDIR)/ ; \
fi
altinstall: commoninstall
@@ -986,8 +984,6 @@ altinstall: commoninstall
upgrade) ensurepip="--altinstall --upgrade" ;; \
install|*) ensurepip="--altinstall" ;; \
esac; \
- $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
- $$ensurepip --root=$(DESTDIR)/ ; \
fi
commoninstall: @FRAMEWORKALTINSTALLFIRST@ \
@@ -1352,11 +1348,12 @@ libainstall: all python-config
# Install the dynamically loadable modules
# This goes into $(exec_prefix)
sharedinstall: sharedmods
+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
$(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
--prefix=$(prefix) \
- --install-scripts=$(BINDIR) \
- --install-platlib=$(DESTSHARED) \
- --root=$(DESTDIR)/
+ --install-scripts=$(DESTDIR)$(BINDIR) \
+ --install-platlib=$(DESTDIR)$(DESTSHARED) \
+ --root=/
-rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py
-rm -r $(DESTDIR)$(DESTSHARED)/__pycache__

View file

@ -1,8 +1,7 @@
# Template file for 'python3.4'
pkgname=python3.4
version=3.4.1
_pybasever=3.4
revision=1
revision=2
wrksrc="Python-${version}"
short_desc="Interpreted, interactive, object-oriented programming language (${version%.*} series)"
maintainer="Juan RP <xtraeme@gmail.com>"
@ -22,34 +21,42 @@ pre_configure() {
rm -r Modules/_ctypes/{darwin,libffi}*
}
if [ "$CROSS_BUILD" ]; then
msg_red "${pkgname}-${version} cannot be cross compiled right now.\n"
exit 0
fi
# Native build
do_configure() {
unset LD CC AR AS RANLIB
./configure ${configure_args} --with-threads --enable-ipv6 \
--with-signal-module --enable-shared --with-system-ffi \
--with-computed-gotos --with-system-expat \
--with-dbmliborder=gdbm:ndbm --without-ensurepip \
ac_cv_posix_semaphores_enabled=yes
unset GCC CC CXX CPP LD AR AS RANLIB
if [ "$CROSS_BUILD" ]; then
mkdir -p host-build
cd host-build
env -i PATH=$PATH CFLAGS=-Os ../configure
env -i PATH=$PATH make ${makejobs} python
mkdir -p ../hostpython
mv python ../hostpython
cd ..
patch -Np0 -i ${FILESDIR}/cross.patch
fi
./configure ${configure_args} --build=${XBPS_MACHINE}-unknown-linux-gnu \
--with-threads --enable-ipv6 --with-signal-module \
--with-system-ffi --enable-unicode=ucs4 --with-system-expat \
--with-wctype-functions --enable-shared \
ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes \
ac_cv_have_long_long_format=yes
}
do_build() {
# Avoid invoking pgen for cross-compiles.
touch Include/graminit.h Python/graminit.c
export PATH="$PATH:$wrksrc/hostpython"
make ${makejobs}
}
do_install() {
export PATH="$PATH:$wrksrc/hostpython"
make DESTDIR=${DESTDIR} install maninstall
install -Dm644 LICENSE ${DESTDIR}/usr/share/licenses/${pkgname}/LICENSE
rm -f ${DESTDIR}/usr/bin/2to3{,-3.4}
ln -sf ../../libpython${_pybasever}m.so \
${DESTDIR}/usr/lib/python${_pybasever}/config-${_pybasever}m/libpython${_pybasever}m.so
ln -sf ../../libpython${version%.*}m.so \
${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}m/libpython${version%.*}m.so
}
python3.4-devel_package() {
@ -59,8 +66,9 @@ python3.4-devel_package() {
vmove "usr/bin/python*-config"
vmove usr/lib/pkgconfig
vmove usr/include
mkdir -p ${DESTDIR}/usr/include/python${_pybasever}m
mv ${PKGDESTDIR}/usr/include/python${_pybasever}m/pyconfig.h \
${DESTDIR}/usr/include/python${_pybasever}m
vmove usr/lib/python${version%.*}/config-${version%.*}m/libpython${version%.*}m.a
mkdir -p ${DESTDIR}/usr/include/python${version%.*}m
mv ${PKGDESTDIR}/usr/include/python${version%.*}m/pyconfig.h \
${DESTDIR}/usr/include/python${version%.*}m
}
}