python: cross build support.
This commit is contained in:
parent
f2a10abe0b
commit
4f0b60fb52
2 changed files with 63 additions and 41 deletions
|
@ -1,18 +1,14 @@
|
||||||
# Template file for 'python-devel'.
|
# Template file for 'python-devel'.
|
||||||
#
|
#
|
||||||
depends="libffi-devel zlib-devel readline-devel bzip2-devel gdbm-devel openssl-devel expat-devel db-devel ncurses-devel sqlite-devel python>=2.7.3"
|
depends="libffi-devel zlib-devel readline-devel bzip2-devel gdbm-devel
|
||||||
|
openssl-devel expat-devel db-devel ncurses-devel sqlite-devel
|
||||||
|
python>=${version}"
|
||||||
short_desc="Python development files"
|
short_desc="Python development files"
|
||||||
long_desc="${long_desc}
|
|
||||||
|
|
||||||
This package contains files for development, headers, static libs, etc."
|
|
||||||
|
|
||||||
|
|
||||||
do_install() {
|
do_install() {
|
||||||
vmkdir usr/include/python2.7
|
|
||||||
vmove "usr/bin/python*-config" usr/bin
|
vmove "usr/bin/python*-config" usr/bin
|
||||||
vmove usr/lib/pkgconfig usr/lib
|
vmove usr/lib/pkgconfig usr/lib
|
||||||
mv ${SRCPKGDESTDIR}/usr/include/python2.7/* \
|
vmove "usr/include/python2.7/*" usr/include/python2.7
|
||||||
${DESTDIR}/usr/include/python2.7
|
|
||||||
mv ${DESTDIR}/usr/include/python2.7/pyconfig.h \
|
mv ${DESTDIR}/usr/include/python2.7/pyconfig.h \
|
||||||
${SRCPKGDESTDIR}/usr/include/python2.7
|
${SRCPKGDESTDIR}/usr/include/python2.7
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,77 @@
|
||||||
# Template build file for 'python'.
|
# Template build file for 'python'.
|
||||||
pkgname=python
|
pkgname=python
|
||||||
version=2.7.3
|
version=2.7.3
|
||||||
revision=2
|
revision=3
|
||||||
wrksrc="Python-$version"
|
wrksrc="Python-${version}"
|
||||||
distfiles="http://www.python.org/ftp/python/$version/Python-$version.tar.xz"
|
|
||||||
makedepends="libffi-devel readline-devel gdbm-devel openssl-devel
|
|
||||||
expat-devel db-devel sqlite-devel"
|
|
||||||
short_desc="Interpreted, interactive, object-oriented programming language"
|
short_desc="Interpreted, interactive, object-oriented programming language"
|
||||||
maintainer="Juan RP <xtraeme@gmail.com>"
|
maintainer="Juan RP <xtraeme@gmail.com>"
|
||||||
homepage="http://www.python.org"
|
homepage="http://www.python.org"
|
||||||
license="PSF"
|
license="PSF"
|
||||||
|
distfiles="http://www.python.org/ftp/python/$version/Python-$version.tar.xz"
|
||||||
checksum=61d36be58e9e9c733c49d7b76858d5c08e2c63a84f2066b29d35d3521057c985
|
checksum=61d36be58e9e9c733c49d7b76858d5c08e2c63a84f2066b29d35d3521057c985
|
||||||
long_desc="
|
|
||||||
Python is an interpreted, interactive, object-oriented programming language
|
|
||||||
that combines remarkable power with very clear syntax. For an introduction
|
|
||||||
to programming in Python you are referred to the Python Tutorial. The Python
|
|
||||||
Library Reference documents built-in and standard types, constants, functions
|
|
||||||
and modules. Finally, the Python Reference Manual describes the syntax and
|
|
||||||
and semantics of the core language in (perhaps too) much detail.
|
|
||||||
|
|
||||||
Python's basic power can be extended with your own modules written in C or
|
|
||||||
C++. On most systems such modules may be dynamically loaded. Python is also
|
|
||||||
adaptable as an extension language for existing applications."
|
|
||||||
|
|
||||||
pycompile_dirs="usr/lib/python2.7"
|
pycompile_dirs="usr/lib/python2.7"
|
||||||
subpackages="$pkgname-devel"
|
subpackages="${pkgname}-devel"
|
||||||
|
|
||||||
do_configure() {
|
makedepends="libffi-devel readline-devel gdbm-devel openssl-devel
|
||||||
# Enable built-in SQLite3 module to load extensions (Arch fix FS#22122)
|
expat-devel db-devel sqlite-devel bzip2-devel"
|
||||||
sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
|
crossmakedepends="${makedepends}"
|
||||||
|
|
||||||
# Force posix semaphores by default, sem_open requires /dev/shm and
|
# Force posix semaphores by default; sem_open requires /dev/shm and
|
||||||
# it's not mounted in chroot.
|
# it's not mounted in chroot.
|
||||||
export OPT="${XBPS_CFLAGS}"
|
_confargs="--with-threads --enable-ipv6 --with-signal-module --enable-shared
|
||||||
./configure ${CONFIGURE_SHARED_ARGS} --with-threads \
|
--with-system-ffi --enable-unicode=ucs4 --with-system-expat
|
||||||
--enable-ipv6 --with-signal-module --enable-shared \
|
--with-wctype-functions ac_cv_posix_semaphores_enabled=yes"
|
||||||
--with-system-ffi --enable-unicode=ucs4 --with-system-expat \
|
|
||||||
--with-wctype-functions ac_cv_posix_semaphores_enabled=yes
|
|
||||||
}
|
|
||||||
|
|
||||||
do_build() {
|
if [ -n "$XBPS_CROSS_TRIPLET" ]; then
|
||||||
make ${makejobs}
|
# Don't need host makedepends.
|
||||||
}
|
unset makedepends
|
||||||
|
|
||||||
do_install() {
|
# cross build; have to build it in 2 stages: native and host.
|
||||||
make DESTDIR=${DESTDIR} install
|
do_build() {
|
||||||
|
# Native build
|
||||||
|
env CC=gcc LD=ld AS=as RANLIB=ranlib CFLAGS= LDFLAGS= OPT="-Os" \
|
||||||
|
./configure && make ${makejobs} python Parser/pgen || return 1
|
||||||
|
mv python hostpython
|
||||||
|
mv Parser/pgen Parser/hostpgen
|
||||||
|
make distclean
|
||||||
|
|
||||||
|
# Cross build
|
||||||
|
patch -Np1 -i ${FILESDIR}/Python-2.7.3-xcompile.patch
|
||||||
|
sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
|
||||||
|
CFLAGS="$CFLAGS -I/usr/$XBPS_CROSS_TRIPLET/include" \
|
||||||
|
LDFLAGS="$LDFLAGS -L/usr/$XBPS_CROSS_TRIPLET/lib" \
|
||||||
|
./configure ${CONFIGURE_SHARED_ARGS} \
|
||||||
|
${_confargs} ac_cv_buggy_getaddrinfo=no || return 1
|
||||||
|
make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen \
|
||||||
|
BLDSHARED="${XBPS_CROSS_TRIPLET}-gcc -shared" \
|
||||||
|
CROSS_COMPILE=$XBPS_CROSS_TARGET CROSS_COMPILE_TARGET=yes \
|
||||||
|
HOSTARCH=$XBPS_CROSS_TRIPLET BUILDARCH=$XBPS_MACHINE-unknown-linux-gnu \
|
||||||
|
PYTHON_XCOMPILE_DEPENDENCIES_PREFIX="/usr/$XBPS_CROSS_TRIPLET" \
|
||||||
|
${makejobs} || return 1
|
||||||
|
}
|
||||||
|
do_install() {
|
||||||
|
# cross install
|
||||||
|
make DESTDIR=${DESTDIR} HOSTPYTHON=./hostpython \
|
||||||
|
CROSS_COMPILE=$XBPS_CROSS_TARGET \
|
||||||
|
CROSS_COMPILE_TARGET=yes install
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# Native build
|
||||||
|
do_configure() {
|
||||||
|
# Enable built-in SQLite3 module to load extensions (Arch fix FS#22122)
|
||||||
|
sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
|
||||||
|
./configure ${CONFIGURE_SHARED_ARGS} ${_confargs}
|
||||||
|
}
|
||||||
|
do_build() {
|
||||||
|
make ${makejobs}
|
||||||
|
}
|
||||||
|
do_install() {
|
||||||
|
make DESTDIR=${DESTDIR} install
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
post_install() {
|
||||||
chmod 755 ${DESTDIR}/usr/lib/libpython*.so*
|
chmod 755 ${DESTDIR}/usr/lib/libpython*.so*
|
||||||
install -Dm644 LICENSE ${DESTDIR}/usr/share/licenses/python/LICENSE
|
install -Dm644 LICENSE ${DESTDIR}/usr/share/licenses/python/LICENSE
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue