2025-02-08 22:51:42 -05:00

101 lines
2.9 KiB
Bash

# Template file for 'python3-tkinter'
#
# THIS PACKAGE MUST BE SYNCHRONIZED WITH "srcpkgs/python3"
#
# IT IS SPLIT TO AVOID A CYCLIC DEPENDENCY:
# python3 -> tk -> libX11 -> libxcb -> xcb-proto -> python3
_desc="Python programming language"
pkgname=python3-tkinter
version=3.13.2
revision=1
build_style="gnu-configure"
configure_args="--enable-shared --enable-ipv6
--enable-loadable-sqlite-extensions --with-computed-gotos
--with-dbmliborder=gdbm:ndbm --with-system-expat --with-system-ffi
--without-ensurepip"
pycompile_dirs="${py3_lib}/tkinter ${py3_lib}/turtledemo ${py3_lib}/turtle.py"
hostmakedepends="pkg-config"
makedepends="libffi-devel readline-devel gdbm-devel openssl-devel
expat-devel sqlite-devel bzip2-devel zlib-devel liblzma-devel tk-devel"
depends="python3"
short_desc="${_desc} - GUI toolkit for Python3"
maintainer="Andrew J. Hesford <ajh@sideband.org>"
homepage="https://www.python.org"
license="Python-2.0"
distfiles="https://www.python.org/ftp/python/${version%rc*}/Python-${version}.tar.xz"
checksum=d984bcc57cd67caab26f7def42e523b1c015bbc5dc07836cf4f0b63fa159eb56
if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
makedepends+=" libxcrypt-devel"
fi
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" python3"
configure_args+=" --with-build-python=python${py3_ver}"
else
configure_args+=" --enable-optimizations"
fi
post_extract() {
# Ensure that the internal copy of expat is not used
rm -r Modules/expat
}
post_patch() {
if [ -n "$CROSS_BUILD" ]; then
patch -Np1 -i ${FILESDIR}/cross.patch
fi
}
do_configure() {
unset GCC CC CXX CPP LD AR AS RANLIB
./configure ${configure_args}
}
do_check() {
# The test_tk suite requires DISPLAY, so just test idle and tcl
make ${makejobs} EXTRATESTOPTS="test_tcl test_idle test_ttk_textonly" test
}
do_install() {
mkdir -p ${wrksrc}/tmp-destdir/usr/lib
ln -s lib ${wrksrc}/tmp-destdir/usr/lib${XBPS_TARGET_WORDSIZE}
make DESTDIR=${wrksrc}/tmp-destdir altinstall
vlicense LICENSE
# We only care for the idle and tkinter modules.
vmkdir usr/bin
vmkdir "${py3_lib}/lib-dynload"
local _idle="idle${version%.*}"
local _src_py_lib="${wrksrc}/tmp-destdir/${py3_lib}"
local _dst_py_lib="${DESTDIR}/${py3_lib}"
mv "${wrksrc}/tmp-destdir/usr/bin/${_idle}" "${DESTDIR}/usr/bin"
mv "${_src_py_lib}/lib-dynload"/_tkinter.*.so "${_dst_py_lib}/lib-dynload"
for lib in idlelib tkinter turtledemo turtle.py; do
mv "${_src_py_lib}/${lib}" "${DESTDIR}/${py3_lib}"
done
ln -sf "${_idle}" ${DESTDIR}/usr/bin/idle3
ln -sf "${_idle}" ${DESTDIR}/usr/bin/idle
}
idle-python3_package() {
short_desc="${_desc} - IDE for Python3 using Tkinter"
pycompile_dirs="${py3_lib}/idlelib"
depends="${sourcepkg}-${version}_${revision}"
conflicts="python<3.0.0_1 python2<=2.7.18.11_1 python3<=3.13.1_1"
pkg_install() {
vmove usr/bin/idle*
vmove "${py3_lib}/idlelib"
vinstall ${FILESDIR}/idle3.xpm 644 usr/share/pixmaps
vinstall ${FILESDIR}/idle3.desktop 644 usr/share/applications
}
}