commit:     0c349b95e730918fb9af59fffd8e09489b27faf2
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 26 23:28:08 2021 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Wed Nov  3 06:36:51 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c349b95

x11-terms/kitty: revamp ebuild

* EAPI-8
* enable py3.10
* make glfw-x11.so optional with IUSE=+X wrt bug #713702
* move most glfw dlopen() deps to DEPEND-only, they are not
  essential at runtime for kitty save for libglvnd
* add wayland-scanner BDEPEND (if missing it silently skips
  glfw-wayland.so despite USE=wayland)
* export PKGCONFIG_EXE to use right pkg-config
* disable LTO, same reason was already stripping -O3 (if wanted,
  should be set by users in CFLAGS -- there is no custom LTO paths)
* use intended --ignore-compiler-warnings to disable -Werror and
  simplify -flags.patch to hopefully need less rebasing
* replace -tests.patch used to find bin/kitty by setting PATH
* drop terminfo patch, let kitty install its own /usr/lib64/kitty
  terminfo and only skip /usr/share/terminfo from kitty-terminfo
* pin kitty-terminfo to match, the >-r0 check will be removable next
  version and is there to avoid collisions (pinning not always
  /essential/, but on a same system they originate from the same
  package and should match)
* add test dep on dev-python/pillow used by 1 test
* remove unnessary fix shebang (these don't have executable bits and
  are used through kitty's linked libpython)
* make libcanberra an optfeature wrt bug #775266
* for imagemagick optfeature, don't use the virtual so it's not noisy
  if users have *magick installed but not the virtual
* change HOMEPAGE to actual homepage, github is shown from remote-id

Closes: https://bugs.gentoo.org/713702
Closes: https://bugs.gentoo.org/775266
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 x11-terms/kitty/files/kitty-0.23.1-flags.patch |  17 ++++
 x11-terms/kitty/kitty-0.23.1-r1.ebuild         | 118 +++++++++++++++++++++++++
 2 files changed, 135 insertions(+)

diff --git a/x11-terms/kitty/files/kitty-0.23.1-flags.patch 
b/x11-terms/kitty/files/kitty-0.23.1-flags.patch
new file mode 100644
index 00000000000..8f23393f8a0
--- /dev/null
+++ b/x11-terms/kitty/files/kitty-0.23.1-flags.patch
@@ -0,0 +1,17 @@
+--- a/setup.py
++++ b/setup.py
+@@ -295,3 +295,3 @@
+     fortify_source = '' if sanitize and is_macos else '-D_FORTIFY_SOURCE=2'
+-    optimize = df if debug or sanitize else '-O3'
++    optimize = ''
+     sanitize_args = get_sanitize_args(cc, ccver) if sanitize else set()
+@@ -319,3 +319,3 @@
+         'OVERRIDE_LDFLAGS',
+-        '-Wall ' + ' '.join(sanitize_args) + ('' if debug else ' -O3')
++        '-Wall ' + ' '.join(sanitize_args)
+     )
+@@ -807,4 +807,2 @@
+             libs.append('-lprofiler')
+-    else:
+-        cflags.append('-O3')
+     if bundle_type.endswith('-freeze'):

diff --git a/x11-terms/kitty/kitty-0.23.1-r1.ebuild 
b/x11-terms/kitty/kitty-0.23.1-r1.ebuild
new file mode 100644
index 00000000000..2a7084b9f1c
--- /dev/null
+++ b/x11-terms/kitty/kitty-0.23.1-r1.ebuild
@@ -0,0 +1,118 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit optfeature python-single-r1 toolchain-funcs xdg
+
+if [[ ${PV} == 9999 ]] ; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/kovidgoyal/kitty.git";
+else
+       
SRC_URI="https://github.com/kovidgoyal/kitty/releases/download/v${PV}/${P}.tar.xz";
+       KEYWORDS="~amd64 ~x86"
+fi
+
+DESCRIPTION="Fast, feature-rich, GPU-based terminal"
+HOMEPAGE="https://sw.kovidgoyal.net/kitty/";
+
+LICENSE="GPL-3"
+SLOT="0"
+IUSE="+X debug test wayland"
+REQUIRED_USE="
+       || ( X wayland )
+       ${PYTHON_REQUIRED_USE}"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       ${PYTHON_DEPS}
+       media-libs/fontconfig
+       media-libs/freetype:2
+       media-libs/harfbuzz:=
+       media-libs/lcms:2
+       media-libs/libglvnd[X?]
+       media-libs/libpng:=
+       sys-apps/dbus
+       sys-libs/zlib:=
+       x11-libs/libxkbcommon[X?]
+       x11-misc/xkeyboard-config
+       ~x11-terms/kitty-terminfo-${PV}
+       >x11-terms/kitty-terminfo-0.23.1-r0
+       X? ( x11-libs/libX11 )
+       wayland? ( dev-libs/wayland )"
+DEPEND="
+       ${RDEPEND}
+       X? (
+               x11-base/xorg-proto
+               x11-libs/libXcursor
+               x11-libs/libXi
+               x11-libs/libXinerama
+               x11-libs/libXrandr
+       )
+       wayland? ( dev-libs/wayland-protocols )"
+BDEPEND="
+       ${PYTHON_DEPS}
+       sys-libs/ncurses
+       virtual/pkgconfig
+       test? ( $(python_gen_cond_dep 'dev-python/pillow[${PYTHON_USEDEP}]') )
+       wayland? ( dev-util/wayland-scanner )"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.23.1-flags.patch
+)
+
+src_prepare() {
+       default
+
+       sed "s/'x11 wayland'/'$(usev X x11) $(usev wayland)'/" -i setup.py || 
die
+       sed "s/else linux_backends/else [$(usev X "'x11',")$(usev wayland 
"'wayland'")]/" \
+               -i kitty_tests/check_build.py || die
+       use X || sed "/glfw_path('x11')/s/x11/wayland/" -i kitty_tests/glfw.py 
|| die
+
+       # skip docs for live version
+       [[ ${PV} != 9999 ]] || sed -i '/exists.*_build/,/docs(ddir)/d' setup.py 
|| die
+}
+
+src_compile() {
+       tc-export CC
+       export PKGCONFIG_EXE=$(tc-getPKG_CONFIG)
+
+       local setup=(
+               ${EPYTHON} setup.py
+               --disable-link-time-optimization
+               --ignore-compiler-warnings
+               --libdir-name=$(get_libdir)
+               --update-check-interval=0
+               --verbose
+               $(usev debug --debug)
+               linux-package
+       )
+
+       echo "${setup[*]}"
+       "${setup[@]}" || die "setup.py failed to compile ${PN}"
+
+       [[ ${PV} == 9999 ]] || mv linux-package/share/doc/{${PN},${PF}} || die
+       rm -r linux-package/share/terminfo || die
+}
+
+src_test() {
+       PATH=linux-package/bin:${PATH} KITTY_CONFIG_DIRECTORY=${T} \
+               ${EPYTHON} test.py || die
+}
+
+src_install() {
+       insinto /usr
+       doins -r linux-package/.
+
+       fperms +x /usr/bin/kitty
+}
+
+pkg_postinst() {
+       xdg_icon_cache_update
+
+       optfeature "displaying images in the terminal" \
+               media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick]
+
+       optfeature "audio-based terminal bell support" media-libs/libcanberra
+}

Reply via email to