void-packages/srcpkgs/python3-tkinter/template
2020-05-20 21:45:39 +02:00

90 lines
3 KiB
Bash

# Template file for 'python3-tkinter'
#
# THIS PKG MUST BE SYNCHRONIZED WITH "srcpkgs/python3"; IT IS SPLITTED TO AVOID
# A CYCLIC DEPENDENCY: python3 -> tk -> libX11 -> libxcb -> xcb-proto -> python3
#
_desc="Python programming language"
pkgname=python3-tkinter
version=3.8.3
revision=1
wrksrc="Python-${version}"
pycompile_dirs="
usr/lib/python${version%.*}/tkinter
usr/lib/python${version%.*}/turtledemo
usr/lib/python${version%.*}/turtle.py"
hostmakedepends="pkg-config"
makedepends="libffi-devel readline-devel gdbm-devel libressl-devel expat-devel
sqlite-devel bzip2-devel zlib-devel liblzma-devel tk-devel"
short_desc="${_desc} - GUI toolkit for Python3"
maintainer="Orphaned <orphan@voidlinux.org>"
homepage="https://www.python.org"
license="Python-2.0"
distfiles="https://www.python.org/ftp/python/${version}/Python-${version}.tar.xz"
checksum=dfab5ec723c218082fe3d5d7ae17ecbdebffa9a1aea4d64aa3a2ecdd2e795864
pre_configure() {
# Ensure that internal copies of expat and libffi are not used.
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 XBPS_ARCH=$XBPS_ARCH CFLAGS=-Os ../configure
env -i PATH=$PATH XBPS_ARCH=$XBPS_ARCH 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 --enable-loadable-sqlite-extensions \
--with-threads --with-computed-gotos --with-dbmliborder=gdbm:ndbm \
--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=${wrksrc}/${pkgname}-${version}-install altinstall
vlicense LICENSE
# We only care for the idle and tkinter modules.
vmkdir usr/bin
vmkdir usr/lib/python${version%.*}/lib-dynload
if [ -e ${wrksrc}/${pkgname}-${version}-install/usr/lib32 ]; then
_libdir=lib32
else
_libdir=lib
fi
mv ${wrksrc}/${pkgname}-${version}-install/usr/bin/idle${version%.*} \
${DESTDIR}/usr/bin/idle${version%.*}
for lib in idlelib tkinter turtledemo turtle.py; do
mv ${wrksrc}/${pkgname}-${version}-install/usr/lib/python${version%.*}/${lib} \
${DESTDIR}/usr/lib/python${version%.*}/
done
mv ${wrksrc}/${pkgname}-${version}-install/usr/${_libdir}/python${version%.*}/lib-dynload/_tkinter.cpython-*.so \
${DESTDIR}/usr/lib/python${version%.*}/lib-dynload/
ln -sf idle${version%.*} ${DESTDIR}/usr/bin/idle3
}
idle-python3_package() {
archs=noarch
short_desc="${_desc} - IDE for Python3 using Tkinter"
pycompile_dirs="usr/lib/python${version%.*}/idlelib"
depends="${sourcepkg}-${version}_${revision}"
pkg_install() {
vmove usr/bin/idle3*
vmove usr/lib/python${version%.*}/idlelib
vinstall ${FILESDIR}/idle3.xpm 644 usr/share/pixmaps
vinstall ${FILESDIR}/idle3.desktop 644 usr/share/applications
}
}