This commit is contained in:
2025-11-19 23:20:07 +01:00
parent 996f8b4303
commit 8b9fe46fc3
3 changed files with 186 additions and 0 deletions

View File

@@ -0,0 +1 @@
DIST gtksourceview-5.18.0.tar.xz 1266756 BLAKE2B b3de7db077e1c21a1fa5121b8a2546bb798e4b36de6f38098fcc4c4eda00a16019a5083fffff7ec3ecb1e7ee9ad189d8c3e4b480e2cc8957bdf6553099a6fe0d SHA512 7b182c23eeb3ef634804755267ab4fc68801450d65fbfb439d0351613bd4e364c8e4cb020564f8ba903bfb4908c673725df50e0ec3a2c7239a7114a5d32e1341

View File

@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
GtkSourceView syntax highlight for Gentoo-specific files
Originally written for gtksourceview-1.x by:
Leonardo Ferreira Fontenelle <leo.fontenelle@gmail.com>, 2006.
Rewritten for gtksourceview-2 by:
Rene 'Necoro' Neumann <necoro@necoro.net>, 2007
Distributed under the same license(s) as gtksourceview.
TODO:
- do not highlight "enable" in the configure options
- perhaps highlight portage variables and portage functions different
-->
<language name="gentoo" id="gentoo" version="2.0" _section="Scripts">
<metadata>
<property name="globs">*.ebuild;*.eclass</property>
<property name="line-comment-start">#</property>
</metadata>
<styles>
<style id="variable" _name="Portage variables" map-to="def:builtin" />
<style id="command" _name="Portage command" map-to="def:type" />
<style id="function" _name="Portage function" map-to="def:function" />
<style id="string" _name="String" map-to="def:string" />
</styles>
<definitions>
<!-- rewrite shell string to show highlighted variables -->
<context id="string" style-ref="def:string">
<start>"</start>
<end>"</end>
<include>
<context ref="def:escape"/>
<context ref="def:line-continue"/>
<context ref="sh:variable"/>
</include>
</context>
<context id="string-2" style-ref="def:string">
<start>'</start>
<end>'</end>
<include>
<context ref="def:escape"/>
<context ref="def:line-continue"/>
<context ref="sh:variable"/>
</include>
</context>
<!-- subprograms:
- $(..) is not supported currently in the normal sh.lang
- `...` is interpreted as string - I think the subshell behavior is more acurate -->
<context id="subprogram">
<start>\$\(</start>
<end>\)</end>
<include>
<context sub-pattern="0" where="start" style-ref="sh:keyword"/>
<context sub-pattern="0" where="end" style-ref="sh:keyword"/>
<context ref="gentoo"/>
</include>
</context>
<context id="subprogram-2">
<start>`</start>
<end>`</end>
<include>
<context sub-pattern="0" where="start" style-ref="sh:keyword"/>
<context sub-pattern="0" where="end" style-ref="sh:keyword"/>
<context ref="gentoo"/>
</include>
</context>
<!-- portage variables - currently unused -->
<context id="portvars" style-ref="variable">
<match>\b((ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|FILESDIR|WORKDIR|(P|R)?DEPEND|PROVIDE|DISTDIR|RESTRICT)|(S|D|T|PV|PF|P|PN|A)|C(XX)?FLAGS|LDFLAGS|C(HOST|TARGET|BUILD))\b</match>
</context>
<!-- portage functions - currently unused -->
<context id="portfuncs" style-ref="function">
<match>^(src_(unpack|compile|install|test)|pkg_(config|nofetch|setup|(pre|post)(inst|rm)))</match>
</context>
<!-- extra portage commands -->
<context id="portcmds" style-ref="command">
<match>\b(e(begin|end|conf|make|warn|infon?|error)|die|use(_(with|enable))?|inherit|has|(has|best)_version|unpack|(do|new)(ins|s?bin|doc|lib(\.so|\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)|do(python|dir|sym|jar|mo)|keepdir|(|doc|ins|exe)into|f(owners|perms)|(exe|ins|dir)opts)\b</match>
</context>
<context id="built-in-command">
<include> <!-- do not include "sh:built-in-command" as it is replaced down there - which would lead to an endless loop -->
<context ref="sh:reserved-word" />
<context ref="sh:let-command" />
<context ref="portcmds" />
</include>
</context>
<!-- gentoo is just a shell with the replacements -->
<replace id="sh:built-in-command" ref="built-in-command" />
<replace id="sh:backtick-subshell" ref="subprogram-2" />
<context id="gentoo">
<include>
<context ref="subprogram"/>
<context ref="sh:sh"/>
</include>
</context>
</definitions>
</language>

View File

@@ -0,0 +1,74 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit gnome.org meson vala virtualx xdg
DESCRIPTION="A text widget implementing syntax highlighting and other features"
HOMEPAGE="https://gitlab.gnome.org/GNOME/gtksourceview"
LICENSE="LGPL-2.1+"
SLOT="5"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
IUSE="gtk-doc +introspection sysprof +vala"
REQUIRED_USE="
gtk-doc? ( introspection )
vala? ( introspection )
"
RDEPEND="
>=dev-libs/glib-2.72:2
>=gui-libs/gtk-4.17:4[introspection?]
>=dev-libs/libxml2-2.6:2=
introspection? ( >=dev-libs/gobject-introspection-1.82.0-r2:= )
>=dev-libs/fribidi-0.19.7
media-libs/fontconfig
x11-libs/pango[introspection?]
>=dev-libs/libpcre2-10.21:=[-recursion-limit(-)]
sysprof? ( dev-util/sysprof-capture:4 )
"
DEPEND="${RDEPEND}"
BDEPEND="
dev-util/glib-utils
gtk-doc? ( dev-util/gi-docgen )
>=sys-devel/gettext-0.19.8
virtual/pkgconfig
vala? ( $(vala_depend) )
"
src_prepare() {
default
use vala && vala_setup
xdg_environment_reset
}
src_configure() {
local emesonargs=(
-Dinstall-tests=false
$(meson_feature introspection)
$(meson_use vala vapi)
$(meson_use gtk-doc documentation)
$(meson_use sysprof)
)
meson_src_configure
}
src_test() {
# Tests fail in test-regex with libpcre2[recursion-limit] - https://gitlab.gnome.org/GNOME/gtksourceview/-/issues/255
# Ensured OK via USE dep, as it would mean issues in real usage for syntax highlighting as well
virtx meson_src_test --timeout-multiplier=5
}
src_install() {
meson_src_install
insinto /usr/share/${PN}-5/language-specs
newins "${FILESDIR}"/5-gentoo.lang gentoo.lang
if use gtk-doc ; then
mkdir -p "${ED}"/usr/share/gtk-doc/html/ || die
mv "${ED}"/usr/share/doc/${PN}${SLOT} "${ED}"/usr/share/gtk-doc/html/ || die
fi
}