From 95461df035e3867364495f065e5e805bf629b2d7 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 26 Oct 2021 00:10:07 +0100 Subject: gentoo resync : 25.10.2021 --- eclass/Manifest.gz | Bin 36182 -> 36357 bytes eclass/linux-mod.eclass | 2 +- eclass/meson.eclass | 10 +++- eclass/tree-sitter-grammar.eclass | 96 ++++++++++++++++++++++++++++++++++++++ eclass/xorg-3.eclass | 15 ++++-- 5 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 eclass/tree-sitter-grammar.eclass (limited to 'eclass') diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz index b5be586d1c5d..3c35c3bf3106 100644 Binary files a/eclass/Manifest.gz and b/eclass/Manifest.gz differ diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass index 943efa5cd9be..9f4ae64f6b55 100644 --- a/eclass/linux-mod.eclass +++ b/eclass/linux-mod.eclass @@ -726,7 +726,7 @@ linux-mod_src_compile() { # @FUNCTION: linux-mod_src_install # @DESCRIPTION: -# It install the modules specified in MODULES_NAME. The modules should be inside the ${objdir} +# It install the modules specified in MODULE_NAMES. The modules should be inside the ${objdir} # directory and they are installed inside /lib/modules/${KV_FULL}/${libdir}. # # The modprobe.d configuration file is automatically generated if the diff --git a/eclass/meson.eclass b/eclass/meson.eclass index 4ba364924e40..5fab2f8df6be 100644 --- a/eclass/meson.eclass +++ b/eclass/meson.eclass @@ -64,6 +64,11 @@ fi # Build directory, location where all generated files should be placed. # If this isn't set, it defaults to ${WORKDIR}/${P}-build. +# @ECLASS-VARIABLE: EMESON_BUILDTYPE +# @DESCRIPTION: +# The buildtype value to pass to meson setup. +: ${EMESON_BUILDTYPE=plain} + # @ECLASS-VARIABLE: EMESON_SOURCE # @DEFAULT_UNSET # @DESCRIPTION: @@ -310,7 +315,6 @@ meson_src_configure() { local mesonargs=( meson setup - --buildtype plain --libdir "$(get_libdir)" --localstatedir "${EPREFIX}/var/lib" --prefix "${EPREFIX}/usr" @@ -321,6 +325,10 @@ meson_src_configure() { --native-file "$(_meson_create_native_file)" ) + if [[ -n ${EMESON_BUILDTYPE} ]]; then + mesonargs+=( --buildtype "${EMESON_BUILDTYPE}" ) + fi + if tc-is-cross-compiler; then mesonargs+=( --cross-file "$(_meson_create_cross_file)" ) fi diff --git a/eclass/tree-sitter-grammar.eclass b/eclass/tree-sitter-grammar.eclass new file mode 100644 index 000000000000..46573027f96f --- /dev/null +++ b/eclass/tree-sitter-grammar.eclass @@ -0,0 +1,96 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: tree-sitter-grammar.eclass +# @MAINTAINER: +# Matthew Smith +# Nick Sarnie +# @AUTHOR: +# Matthew Smith +# @SUPPORTED_EAPIS: 8 +# @BLURB: Common functions and variables for Tree Sitter grammars + +if [[ -z ${_TREE_SITTER_GRAMMAR_ECLASS} ]]; then +_TREE_SITTER_GRAMMAR_ECLASS=1 + +case ${EAPI} in + 8) ;; + *) die "EAPI=${EAPI:-0} is not supported" ;; +esac + +inherit multilib toolchain-funcs + +SRC_URI="https://github.com/tree-sitter/${PN}/archive/${TS_PV:-v${PV}}.tar.gz + -> ${P}.tar.gz" +S="${WORKDIR}"/${PN}-${TS_PV:-${PV}}/src + +# Needed for tree_sitter/parser.h +DEPEND="dev-libs/tree-sitter" + +EXPORT_FUNCTIONS src_compile src_install + +# @ECLASS-VARIABLE: TS_PV +# @PRE_INHERIT +# @DEFAULT_UNSET +# @DESCRIPTION: +# Used to override upstream tag name if tagged differently, e.g. most releases +# are v${PV} but some are tagged as rust-${PV}. + +# @FUNCTION: _get_tsg_abi_ver +# @INTERNAL +# @DESCRIPTION: +# This internal function determines the ABI version of a grammar library based +# on the package version. +_get_tsg_abi_ver() { + if ver_test -gt 0.21; then + die "Grammar too new; unknown ABI version" + elif ver_test -ge 0.19.0; then + echo 13 + else + die "Grammar too old; unknown ABI version" + fi +} + +# @FUNCTION: tree-sitter-grammar_src_compile +# @DESCRIPTION: +# Compiles the Tree Sitter parser as a shared library. +tree-sitter-grammar_src_compile() { + debug-print-function ${FUNCNAME} "${@}" + + # Grammars always contain parser.c, and sometimes a scanner.c, + # or scanner.cc. + + tc-export CC CXX + export CFLAGS="${CFLAGS} -fPIC" + export CXXFLAGS="${CXXFLAGS} -fPIC" + + local objects=( parser.o ) + if [[ -f "${S}"/scanner.c || -f "${S}"/scanner.cc ]]; then + objects+=( scanner.o ) + fi + emake "${objects[@]}" + + local link="$(tc-getCC) ${CFLAGS}" + if [[ -f "${S}/scanner.cc" ]]; then + link="$(tc-getCXX) ${CXXFLAGS}" + fi + + local soname=lib${PN}$(get_libname $(_get_tsg_abi_ver)) + ${link} ${LDFLAGS} \ + -shared \ + *.o \ + -Wl,-soname ${soname} \ + -o "${WORKDIR}"/${soname} || die +} + +# @FUNCTION: tree-sitter-grammar_src_install +# @DESCRIPTION: +# Installs the Tree Sitter parser library. +tree-sitter-grammar_src_install() { + debug-print-function ${FUNCNAME} "${@}" + + dolib.so "${WORKDIR}"/lib${PN}$(get_libname $(_get_tsg_abi_ver)) + dosym lib${PN}$(get_libname $(_get_tsg_abi_ver)) \ + /usr/$(get_libdir)/lib${PN}$(get_libname) +} +fi diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass index cfa679b766ce..41732e289b94 100644 --- a/eclass/xorg-3.eclass +++ b/eclass/xorg-3.eclass @@ -275,7 +275,7 @@ xorg-3_src_unpack() { unpack ${A} fi - [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}" + [[ -n ${FONT} ]] && einfo "Detected font directory: ${FONT_DIR}" } # @FUNCTION: xorg-3_reconf_source @@ -317,13 +317,17 @@ xorg-3_src_prepare() { xorg-3_font_configure() { debug-print-function ${FUNCNAME} "$@" + # Pass --with-fontrootdir to override pkgconf SYSROOT behavior. + # https://bugs.gentoo.org/815520 + if grep -q -s "with-fontrootdir" "${ECONF_SOURCE:-.}"/configure; then + FONT_OPTIONS+=( --with-fontrootdir="${EPREFIX}"/usr/share/fonts ) + fi + if has nls ${IUSE//+} && ! use nls; then if ! grep -q -s "disable-all-encodings" ${ECONF_SOURCE:-.}/configure; then die "--disable-all-encodings option not available in configure" fi - FONT_OPTIONS+=" - --disable-all-encodings - --enable-iso8859-1" + FONT_OPTIONS+=( --disable-all-encodings --enable-iso8859-1 ) fi } @@ -365,6 +369,7 @@ xorg-3_src_configure() { # @DEFAULT_UNSET local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}") + local FONT_OPTIONS=() [[ -n "${FONT}" ]] && xorg-3_font_configure # Check if package supports disabling of dep tracking @@ -388,7 +393,7 @@ xorg-3_src_configure() { ${dep_track} ${selective_werror} ${no_static} - ${FONT_OPTIONS} + "${FONT_OPTIONS[@]}" "${xorgconfadd[@]}" ) -- cgit v1.2.3