# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: lomiri.eclass # @MAINTAINER: renegart # @AUTHOR: renegart # @SUPPORTED_EAPIS: 8 # @BLURB: Provides phases for Lomiri desktop packages. # @DESCRIPTION: # Exports portage base functions used by ebuilds written for packages using # the gentoo-lomiri framework. case ${EAPI} in 8) ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac if [[ -z ${_LOMIRI_ECLASS} ]]; then _LOMIRI_ECLASS=1 inherit cmake xdg gnome2-utils # @ECLASS_VARIABLE: CMAKE_QUALITY_MIN_VER # @PRE_INHERIT # @DEFAULT_UNSET # @DESCRIPTION: # desired 'cmake_minimum_required' version to avoid cmake quality warnings/problems. : "${CMAKE_QUALITY_MIN_VER:=3.35}" # @ECLASS_VARIABLE: LOMIRI_PACKAGING_URI # @DESCRIPTION: # Lomiri package download URI. Mostly used by 'Ayatana' packages # Has to be added to 'SCR_URI' for download the package LOMIRI_PACKAGING_URI="https://gitlab.com/ubports/development/core/packaging/${CATEGORY}/${PN}/-/archive/${LOMIRI_PACKAGING_COMMIT}/${PN}-${LOMIRI_PACKAGING_COMMIT}.tar.gz \ -> ${PN}-lomiri-package-${PV}.tar.gz" # @ECLASS_VARIABLE: LOMIRI_PACKAGING_COMMIT # @PRE_INHERIT # @DEFAULT_UNSET # @DESCRIPTION: # Some packages are packed by Lomiri via meta packages with extra patch sets. # Setting this variable will try to patch everything in 'debian/patches/series' if [[ "${LOMIRI_PACKAGING_COMMIT}" ]]; then if [[ "${PV}" == "9999" ]]; then eerror "Patch live ebuild with debian patch series can cause problems." eerror "Please remove 'LOMIRI_PACKAGING_COMMIT' reference" fi DEBIAN_PATCHES_S="${WORKDIR}/${PN}-${LOMIRI_PACKAGING_COMMIT}" fi # @ECLASS_VARIABLE: DEBIAN_PACKAGING_URI # @DESCRIPTION: # Download URI of Debian version of Lomiri packages. # Used to get patches used to build Lomiri packages for Debian and/or Ubuntu. # Has to be added to 'SCR_URI' for download the package LOMIRI_PPA_URI="https://salsa.debian.org/ubports-team/${PN}/-/archive/debian/${LOMIRI_PPA_COMMIT}/${PN}-debian-${LOMIRI_PPA_COMMIT}.tar.gz \ -> ${PN}-debian-package-${PV}.tar.gz" # @ECLASS_VARIABLE: LOMIRI_PPA_COMMIT # @PRE_INHERIT # @DEFAULT_UNSET # @DESCRIPTION: # Some packages are packed for Lomiri with extra patch sets. # Setting this variable will try to patch everything in 'debian/patches/series' if [[ "${LOMIRI_PPA_COMMIT}" ]]; then if [[ "${PV}" == "9999" ]]; then eerror "Patching live ebuild with Debian patch series can cause problems." eerror "Please remove 'LOMIRI_PPA_COMMIT' reference." fi DEBIAN_PATCHES_S="${WORKDIR}/${PN}-debian-${LOMIRI_PPA_COMMIT}" fi # @ECLASS_VARIABLE: CMAKE_CHECK_ADDITIONAL_FILES # @PRE_INHERIT # @DEFAULT_UNSET # @DESCRIPTION: # Array of additional files which shall be checked and patched against '${CMAKE_QUALITY_MIN_VER}' if [[ ${CMAKE_CHECK_ADDITIONAL_FILES} ]]; then [[ ${CMAKE_CHECK_ADDITIONAL_FILES@a} == *a* ]] || die "CMAKE_CHECK_ADDITIONAL_FILES must be an array" fi # @FUNCTION: lomiri_patch_debian_series # @DESCRIPTION: # Apply patches provided by debian package via 'debian/patch/series'. lomiri_patch_debian_series() { debug-print-function ${FUNCNAME} "$@" if [[ -n "{$DEBIAN_PATCHES_S}" ]] && [[ -d ${DEBIAN_PATCHES_S} ]]; then # Apply debian patchset if one is present # local dpatch_dir="${DEBIAN_PATCHES_S}/debian/patches" local -a dpatches if [[ -f ${dpatch_dir}/series ]]; then for x in $(grep -v \# "${dpatch_dir}/series"); do dpatches+=( "${dpatch_dir}/${x}" ) done fi if [[ -n ${dpatches[@]} ]]; then einfo "Applying Debian patch set ..." eapply "${dpatches[@]}" einfo "Done applying patch set." fi fi } # @FUNCTION: lomiri_src_prepare # @DESCRIPTION: # Apply common src_prepare tasks such as patching CMakeList.txt if needed to avoid quality warnings. lomiri_src_prepare() { debug-print-function ${FUNCNAME} "$@" local check_files=("CMakeLists.txt") if [[ ${CMAKE_CHECK_ADDITIONAL_FILES} ]]; then check_files+=( "${CMAKE_CHECK_ADDITIONAL_FILES[@]}" ) fi einfo "Patching 'cmake_minimum_required'" for file in "${check_files[@]}" ; do if [ -f "${file}" ]; then local version=$(_cmake_minreqver-get ${file}) if ver_test "${version}" -lt "${CMAKE_QUALITY_MIN_VER}"; then ebegin "\t${version}-> ${CMAKE_QUALITY_MIN_VER}: ${file}" sed -i "/^cmake_minimum_required/ s/VERSION .*/VERSION ${CMAKE_QUALITY_MIN_VER})/" "${file}" || die eend "$?" fi fi done lomiri_patch_debian_series cmake_src_prepare } # @FUNCTION: lomiri_src_configure # @DESCRIPTION: # Apply common lomiri_src_configure tasks. lomiri_src_configure() { debug-print-function ${FUNCNAME} "$@" cmake_src_configure } # @FUNCTION: lomiri_src_install # @DESCRIPTION: # Apply common lomiri_src_install tasks. lomiri_src_install() { debug-print-function ${FUNCNAME} "$@" cmake_src_install } # @FUNCTION: lomiri_pkg_postinst # @DESCRIPTION: # Apply common lomiri_pkg_postinst tasks. lomiri_pkg_postinst() { debug-print-function ${FUNCNAME} "$@" xdg_pkg_postinst gnome2_schemas_update } # @FUNCTION: lomiri_pkg_postrm # @DESCRIPTION: # Apply common lomiri_pkg_postrm tasks. lomiri_pkg_postrm() { debug-print-function ${FUNCNAME} "$@" xdg_pkg_postrm gnome2_schemas_update } fi EXPORT_FUNCTIONS src_prepare src_configure src_install pkg_postinst pkg_postrm