137 lines
4.9 KiB
Bash
137 lines
4.9 KiB
Bash
# Template file for 'python3'
|
|
pkgname=python3
|
|
version=3.5.3
|
|
revision=4
|
|
wrksrc="Python-${version}"
|
|
short_desc="Interpreted, interactive, object-oriented programming language (${version%.*} series)"
|
|
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
|
homepage="https://www.python.org"
|
|
license="PSF"
|
|
distfiles="https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz"
|
|
checksum=eefe2ad6575855423ab630f5b51a8ef6e5556f774584c06beab4926f930ddbb0
|
|
|
|
replaces="python3.4>=0 python3.5>=0"
|
|
pycompile_dirs="usr/lib/python3.5"
|
|
makedepends="libffi-devel readline-devel gdbm-devel libressl-devel expat-devel
|
|
sqlite-devel bzip2-devel zlib-devel liblzma-devel tcl-devel tk-devel libX11-devel"
|
|
depends="ca-certificates"
|
|
|
|
alternatives="
|
|
python:idle:/usr/bin/idle3.5
|
|
python:2to3:/usr/bin/2to3-3.5
|
|
python:pydoc:/usr/bin/pydoc3.5
|
|
python:python:/usr/bin/python3.5
|
|
python:python.1:/usr/share/man/man1/python3.5.1
|
|
python3:idle3:/usr/bin/idle3.5
|
|
python3:2to3:/usr/bin/2to3-3.5
|
|
python3:pydoc3:/usr/bin/pydoc3.5
|
|
python3:python3:/usr/bin/python3.5
|
|
python3:pyvenv3:/usr/bin/pyvenv-3.5
|
|
python3:python3-config:/usr/bin/python3.5-config
|
|
python3:libpython3.so:/usr/lib/libpython3.5m.so
|
|
python3:python3.pc:/usr/lib/pkgconfig/python-3.5.pc
|
|
python3:python3.1:/usr/share/man/man1/python3.5.1"
|
|
|
|
pre_configure() {
|
|
# Ensure that internal copies of zlib, expat and libffi are not used
|
|
rm -r Modules/zlib
|
|
rm -r Modules/expat
|
|
rm -r Modules/_ctypes/{darwin,libffi}*
|
|
}
|
|
do_configure() {
|
|
local _args
|
|
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
|
|
_args="--build=${XBPS_MACHINE%%-musl}"
|
|
fi
|
|
./configure ${configure_args} ${_args} \
|
|
--enable-shared --enable-ipv6 --with-threads --enable-unicode=ucs4 \
|
|
--with-computed-gotos --with-system-expat --with-system-ffi \
|
|
--without-ensurepip
|
|
}
|
|
do_build() {
|
|
export PATH="$PATH:$wrksrc/hostpython"
|
|
make ${makejobs}
|
|
}
|
|
do_install() {
|
|
export PATH="$PATH:$wrksrc/hostpython"
|
|
make DESTDIR=${DESTDIR} install maninstall
|
|
vlicense LICENSE
|
|
|
|
rm -f ${DESTDIR}/usr/bin/2to3
|
|
rm -f ${DESTDIR}/usr/bin/pyvenv
|
|
rm -f ${DESTDIR}/usr/bin/{idle,pydoc,python}3
|
|
rm -f ${DESTDIR}/usr/share/man/man1/python3.1
|
|
rm -f ${DESTDIR}/usr/bin/python3-config
|
|
rm -f ${DESTDIR}/usr/lib/libpython3.so
|
|
rm -f ${DESTDIR}/usr/lib/pkgconfig/python3.pc
|
|
|
|
ln -sf ../../libpython${version%.*}m.so \
|
|
${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}m/libpython${version%.*}m.so
|
|
|
|
# Remove test module and tests that fail to be byte-compiled.
|
|
rm -rf ${DESTDIR}/usr/lib/python${version%.*}/test
|
|
rm -rf ${DESTDIR}/usr/lib/python${version%.*}/lib2to3/tests
|
|
# Remove references to hardening -specs.
|
|
sed -e 's|\(-specs=.*hardened-ld\)||g' -e 's|\(-specs=.*hardened-cc1\)||g' -i \
|
|
${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata.py \
|
|
${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}m/Makefile \
|
|
${DESTDIR}/usr/bin/python${version%.*}*-config
|
|
# Remove references to the install(1) wrapper.
|
|
sed -e "s,${XBPS_WRAPPERDIR},/usr/bin,g" -i \
|
|
${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata.py \
|
|
${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}m/Makefile
|
|
if [ "$CROSS_BUILD" ]; then
|
|
# Remove references to cross toolchain.
|
|
sed -i "s/$XBPS_CROSS_TRIPLET-//g" \
|
|
${DESTDIR}/usr/lib/python${version%.*}/_sysconfigdata.py \
|
|
${DESTDIR}/usr/lib/python${version%.*}/config-${version%.*}m/Makefile
|
|
fi
|
|
}
|
|
|
|
python3-devel_package() {
|
|
replaces="python3.4-devel>=0 python3.5-devel>=0"
|
|
depends="${sourcepkg}-${version}_${revision}"
|
|
short_desc+=" - development files"
|
|
pkg_install() {
|
|
vmove usr/bin/python*-config
|
|
vmove usr/lib/pkgconfig
|
|
vmove usr/include
|
|
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
|
|
}
|
|
}
|
|
python3-tkinter_package() {
|
|
replaces="python3.4-tkinter>=0 python3.5-tkinter>=0"
|
|
pycompile_dirs="usr/lib/python3.5"
|
|
depends="${sourcepkg}-${version}_${revision}"
|
|
short_desc+=" - GUI toolkit for Python3"
|
|
pkg_install() {
|
|
vmove usr/lib/python${version%.*}/tkinter
|
|
vmove usr/lib/python${version%.*}/turtle.py
|
|
vmove usr/lib/python${version%.*}/turtledemo
|
|
vmove usr/lib/python${version%.*}/lib-dynload/_tkinter.cpython-*m*.so
|
|
}
|
|
}
|
|
idle-python3_package() {
|
|
replaces="idle-python3.4>=0 idle-python3.5>=0"
|
|
pycompile_dirs="usr/lib/python3.5/idlelib"
|
|
depends="${sourcepkg}-${version}_${revision} python3-tkinter"
|
|
short_desc+=" - IDE for Python3 using Tkinter"
|
|
pkg_install() {
|
|
vmove usr/bin/idle${version%.*}
|
|
vmove usr/lib/python${version%.*}/idlelib
|
|
vinstall ${FILESDIR}/idle3.xpm 644 usr/share/pixmaps
|
|
vinstall ${FILESDIR}/idle3.desktop 644 usr/share/applications
|
|
}
|
|
}
|