void-packages/srcpkgs/python/template

83 lines
2.3 KiB
Plaintext

# Template build file for 'python'.
pkgname=python
version=2.7.6
revision=2
wrksrc="Python-${version}"
short_desc="Interpreted, interactive, object-oriented programming language"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.python.org"
license="PSF"
distfiles="http://www.python.org/ftp/python/$version/Python-$version.tar.xz"
checksum=1fd68e81f8bf7386ff239b7faee9ba387129d2cf34eab13350bd8503a0bff6a1
hostmakedepends="pkg-config"
makedepends="libffi-devel readline-devel gdbm-devel openssl-devel
expat-devel sqlite-devel bzip2-devel zlib-devel"
configure_args="
--with-threads --enable-ipv6 --with-signal-module --enable-shared
--with-system-ffi --enable-unicode=ucs4 --with-system-expat
--with-wctype-functions ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
ac_cv_have_long_long_format=yes"
pre_configure() {
# Ensure that internal copies of expat, libffi and zlib are not used.
rm -r Modules/expat
rm -r Modules/_ctypes/libffi*
rm -r Modules/zlib
}
do_configure() {
if [ "$CROSS_BUILD" ]; then
env CC=gcc LD=gcc AR=ar AS=as RANLIB=ranlib \
CFLAGS=-Os LDFLAGS= ./configure
make python
mkdir hostpython
mv python hostpython
make distclean
patch -Np0 -i ${FILESDIR}/Python-${version}-xcompile.patch
fi
./configure --build=${XBPS_MACHINE}-unknown-linux-gnu ${configure_args}
}
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} altinstall
}
post_install() {
chmod 755 ${DESTDIR}/usr/lib/libpython*.so*
install -Dm644 LICENSE ${DESTDIR}/usr/share/licenses/python/LICENSE
# Remove test module.
rm -rf ${DESTDIR}/usr/lib/python2.7/test
}
python_package() {
pycompile_dirs="usr/lib/python2.7"
pkg_install() {
vmove all
ln -sf /usr/bin/python2.7 ${PKGDESTDIR}/usr/bin/python2
ln -sf /usr/bin/python2.7 ${PKGDESTDIR}/usr/bin/python
}
}
python-devel_package() {
depends="python>=${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove "usr/bin/python*-config"
vmove usr/lib/pkgconfig
vmove usr/include
mkdir -p ${DESTDIR}/usr/include/python2.7
mv ${PKGDESTDIR}/usr/include/python2.7/pyconfig.h \
${DESTDIR}/usr/include/python2.7
}
}