diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-01-15 15:51:32 +0000 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-01-15 15:51:32 +0000 |
commit | 21435953e16cda318a82334ddbadb3b5c36d9ea7 (patch) | |
tree | e1810a4b135afce04b34862ef0fab2bfaeb8aeca /eclass | |
parent | 7bc9c63c9da678a7e6fceb095d56c634afd22c56 (diff) |
gentoo resync : 15.01.2020
Diffstat (limited to 'eclass')
41 files changed, 1700 insertions, 506 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz Binary files differindex 257db67d544b..0b040b97cfa9 100644 --- a/eclass/Manifest.gz +++ b/eclass/Manifest.gz diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index 13dd5c355fb3..79d8863017d1 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -12,16 +12,12 @@ if [[ -z ${_CARGO_ECLASS} ]]; then _CARGO_ECLASS=1 -if [[ ${PV} == *9999* ]]; then - # we need at least this for cargo vendor subommand - CARGO_DEPEND=">=virtual/cargo-1.37.0" -else - CARGO_DEPEND="virtual/cargo" -fi +# we need this for 'cargo vendor' subcommand and net.offline config knob +RUST_DEPEND=">=virtual/rust-1.37.0" case ${EAPI} in - 6) DEPEND="${CARGO_DEPEND}";; - 7) BDEPEND="${CARGO_DEPEND}";; + 6) DEPEND="${RUST_DEPEND}";; + 7) BDEPEND="${RUST_DEPEND}";; *) die "EAPI=${EAPI:-0} is not supported" ;; esac @@ -34,20 +30,22 @@ IUSE="${IUSE} debug" ECARGO_HOME="${WORKDIR}/cargo_home" ECARGO_VENDOR="${ECARGO_HOME}/gentoo" +# @ECLASS-VARIABLE: CARGO_INSTALL_PATH +# @DESCRIPTION: +# Allows overriding the default cwd to run cargo install from +: ${CARGO_INSTALL_PATH:=.} + # @FUNCTION: cargo_crate_uris # @DESCRIPTION: # Generates the URIs to put in SRC_URI to help fetch dependencies. cargo_crate_uris() { + local -r regex='^(.*)-([0-9]+\.[0-9]+\.[0-9]+.*)$' local crate for crate in "$@"; do - local name version url pretag - name="${crate%-*}" - version="${crate##*-}" - pretag="^[a-zA-Z]+" - if [[ $version =~ $pretag ]]; then - version="${name##*-}-${version}" - name="${name%-*}" - fi + local name version url + [[ $crate =~ $regex ]] || die "Could not parse name and version from crate: $crate" + name="${BASH_REMATCH[1]}" + version="${BASH_REMATCH[2]}" url="https://crates.io/api/v1/crates/${name}/${version}/download -> ${crate}.crate" echo "${url}" done @@ -124,7 +122,14 @@ cargo_live_src_unpack() { # @FUNCTION: cargo_gen_config # @DESCRIPTION: -# Generate the $CARGO_HOME/config necessary to use our local registry +# Generate the $CARGO_HOME/config necessary to use our local registry and settings. +# Cargo can also be configured through environment variables in addition to the TOML syntax below. +# For each configuration key below of the form foo.bar the environment variable CARGO_FOO_BAR +# can also be used to define the value. +# Environment variables will take precedent over TOML configuration, +# and currently only integer, boolean, and string keys are supported. +# For example the build.jobs key can also be defined by CARGO_BUILD_JOBS. +# Or setting CARGO_TERM_VERBOSE=false in make.conf will make build quieter. cargo_gen_config() { debug-print-function ${FUNCNAME} "$@" @@ -135,7 +140,18 @@ cargo_gen_config() { [source.crates-io] replace-with = "gentoo" local-registry = "/nonexistant" + + [net] + offline = true + + [build] + jobs = $(makeopts_jobs) + + [term] + verbose = true EOF + # honor NOCOLOR setting + [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo "color = 'never'" >> "${ECARGO_HOME}/config" } # @FUNCTION: cargo_src_compile @@ -146,7 +162,7 @@ cargo_src_compile() { export CARGO_HOME="${ECARGO_HOME}" - cargo build -vv -j $(makeopts_jobs) $(usex debug "" --release) "$@" \ + cargo build $(usex debug "" --release) "$@" \ || die "cargo build failed" } @@ -156,9 +172,11 @@ cargo_src_compile() { cargo_src_install() { debug-print-function ${FUNCNAME} "$@" - cargo install -vv -j $(makeopts_jobs) --root="${ED}/usr" $(usex debug --debug "") "$@" \ + cargo install --path ${CARGO_INSTALL_PATH} \ + --root="${ED}/usr" $(usex debug --debug "") "$@" \ || die "cargo install failed" rm -f "${ED}/usr/.crates.toml" + rm -f "${ED}/usr/.crates2.json" [ -d "${S}/man" ] && doman "${S}/man" || return 0 } @@ -169,7 +187,7 @@ cargo_src_install() { cargo_src_test() { debug-print-function ${FUNCNAME} "$@" - cargo test -vv -j $(makeopts_jobs) $(usex debug "" --release) "$@" \ + cargo test $(usex debug "" --release) "$@" \ || die "cargo test failed" } diff --git a/eclass/cmake-multilib.eclass b/eclass/cmake-multilib.eclass index 9d617900b736..2693d9c72e2b 100644 --- a/eclass/cmake-multilib.eclass +++ b/eclass/cmake-multilib.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: cmake-multilib.eclass @@ -19,6 +19,12 @@ # in multilib-minimal, yet they ought to call appropriate cmake-utils # phase rather than 'default'. +# @ECLASS-VARIABLE: CMAKE_ECLASS +# @DESCRIPTION: +# Default is "cmake-utils" for compatibility. Specify "cmake" for ebuilds +# that ported from cmake-utils.eclass to cmake.eclass already. +: ${CMAKE_ECLASS:=cmake-utils} + case ${EAPI:-0} in [67]) ;; *) die "EAPI=${EAPI} is not supported" ;; @@ -28,7 +34,15 @@ if [[ ${CMAKE_IN_SOURCE_BUILD} ]]; then die "${ECLASS}: multilib support requires out-of-source builds." fi -inherit cmake-utils multilib-minimal +case ${CMAKE_ECLASS} in + cmake-utils|cmake) ;; + *) + eerror "Unknown value for \${CMAKE_ECLASS}" + die "Value ${CMAKE_ECLASS} is not supported" + ;; +esac + +inherit ${CMAKE_ECLASS} multilib-minimal EXPORT_FUNCTIONS src_configure src_compile src_test src_install @@ -39,7 +53,7 @@ cmake-multilib_src_configure() { } multilib_src_configure() { - cmake-utils_src_configure "${_cmake_args[@]}" + ${CMAKE_ECLASS}_src_configure "${_cmake_args[@]}" } cmake-multilib_src_compile() { @@ -49,7 +63,7 @@ cmake-multilib_src_compile() { } multilib_src_compile() { - cmake-utils_src_compile "${_cmake_args[@]}" + ${CMAKE_ECLASS}_src_compile "${_cmake_args[@]}" } cmake-multilib_src_test() { @@ -59,7 +73,7 @@ cmake-multilib_src_test() { } multilib_src_test() { - cmake-utils_src_test "${_cmake_args[@]}" + ${CMAKE_ECLASS}_src_test "${_cmake_args[@]}" } cmake-multilib_src_install() { @@ -69,5 +83,5 @@ cmake-multilib_src_install() { } multilib_src_install() { - cmake-utils_src_install "${_cmake_args[@]}" + ${CMAKE_ECLASS}_src_install "${_cmake_args[@]}" } diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass new file mode 100644 index 000000000000..dfccbad1a786 --- /dev/null +++ b/eclass/cmake.eclass @@ -0,0 +1,646 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: cmake.eclass +# @MAINTAINER: +# kde@gentoo.org +# @AUTHOR: +# Tomáš Chvátal <scarabeus@gentoo.org> +# Maciej Mrozowski <reavertm@gentoo.org> +# (undisclosed contributors) +# Original author: Zephyrus (zephyrus@mirach.it) +# @SUPPORTED_EAPIS: 7 +# @BLURB: common ebuild functions for cmake-based packages +# @DESCRIPTION: +# The cmake eclass makes creating ebuilds for cmake-based packages much easier. +# It provides all inherited features (DOCS, HTML_DOCS, PATCHES) along with +# out-of-source builds (default), in-source builds and an implementation of the +# well-known use_enable function for CMake. + +if [[ -z ${_CMAKE_ECLASS} ]]; then +_CMAKE_ECLASS=1 + +# @ECLASS-VARIABLE: BUILD_DIR +# @DESCRIPTION: +# Build directory where all cmake processed files should be generated. +# For in-source build it's fixed to ${CMAKE_USE_DIR}. +# For out-of-source build it can be overridden, by default it uses +# ${WORKDIR}/${P}_build. +: ${BUILD_DIR:=${WORKDIR}/${P}_build} + +# @ECLASS-VARIABLE: CMAKE_BINARY +# @DESCRIPTION: +# Eclass can use different cmake binary than the one provided in by system. +: ${CMAKE_BINARY:=cmake} + +# @ECLASS-VARIABLE: CMAKE_BUILD_TYPE +# @DESCRIPTION: +# Set to override default CMAKE_BUILD_TYPE. Only useful for packages +# known to make use of "if (CMAKE_BUILD_TYPE MATCHES xxx)". +# If about to be set - needs to be set before invoking cmake_src_configure. +# You usually do *NOT* want nor need to set it as it pulls CMake default +# build-type specific compiler flags overriding make.conf. +: ${CMAKE_BUILD_TYPE:=Gentoo} + +# @ECLASS-VARIABLE: CMAKE_IN_SOURCE_BUILD +# @DEFAULT_UNSET +# @DESCRIPTION: +# Set to enable in-source build. + +# @ECLASS-VARIABLE: CMAKE_MAKEFILE_GENERATOR +# @DEFAULT_UNSET +# @DESCRIPTION: +# Specify a makefile generator to be used by cmake. +# At this point only "emake" and "ninja" are supported. +# The default is set to "ninja". +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} + +# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST +# @DESCRIPTION: +# Array of CMake modules that will be removed in $S during src_prepare, +# in order to force packages to use the system version. +# Set to "none" to disable removing modules entirely. +: ${CMAKE_REMOVE_MODULES_LIST:=FindBLAS FindLAPACK} + +# @ECLASS-VARIABLE: CMAKE_USE_DIR +# @DESCRIPTION: +# Sets the directory where we are working with cmake, for example when +# application uses autotools and only one plugin needs to be done by cmake. +# By default it uses ${S}. + +# @ECLASS-VARIABLE: CMAKE_VERBOSE +# @DESCRIPTION: +# Set to OFF to disable verbose messages during compilation +: ${CMAKE_VERBOSE:=ON} + +# @ECLASS-VARIABLE: CMAKE_WARN_UNUSED_CLI +# @DESCRIPTION: +# Warn about variables that are declared on the command line +# but not used. Might give false-positives. +# "no" to disable (default) or anything else to enable. +: ${CMAKE_WARN_UNUSED_CLI:=yes} + +# @ECLASS-VARIABLE: CMAKE_EXTRA_CACHE_FILE +# @DEFAULT_UNSET +# @DESCRIPTION: +# Specifies an extra cache file to pass to cmake. This is the analog of EXTRA_ECONF +# for econf and is needed to pass TRY_RUN results when cross-compiling. +# Should be set by user in a per-package basis in /etc/portage/package.env. + +# @ECLASS-VARIABLE: CMAKE_QA_SRC_DIR_READONLY +# @DEFAULT_UNSET +# @DESCRIPTION: +# After running cmake_src_prepare, sets ${S} to read-only. This is +# a user flag and should under _no circumstances_ be set in the ebuild. +# Helps in improving QA of build systems that write to source tree. + +case ${EAPI} in + 7) ;; + *) die "EAPI=${EAPI:-0} is not supported" ;; +esac + +inherit toolchain-funcs ninja-utils flag-o-matic multiprocessing xdg-utils + +EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install + +[[ ${CMAKE_MIN_VERSION} ]] && die "CMAKE_MIN_VERSION is banned; if necessary, set BDEPEND=\">=dev-util/cmake-${CMAKE_MIN_VERSION}\" directly" +[[ ${CMAKE_BUILD_DIR} ]] && die "The ebuild must be migrated to BUILD_DIR" +[[ ${CMAKE_REMOVE_MODULES} ]] && die "CMAKE_REMOVE_MODULES is banned, set CMAKE_REMOVE_MODULES_LIST=\"\" instead" +[[ ${CMAKE_UTILS_QA_SRC_DIR_READONLY} ]] && die "Use CMAKE_QA_SRC_DIR_READONLY instead" +[[ ${WANT_CMAKE} ]] && die "WANT_CMAKE has been removed and is a no-op" +[[ ${PREFIX} ]] && die "PREFIX has been removed and is a no-op" + +case ${CMAKE_MAKEFILE_GENERATOR} in + emake) + BDEPEND="sys-devel/make" + ;; + ninja) + BDEPEND="dev-util/ninja" + ;; + *) + eerror "Unknown value for \${CMAKE_MAKEFILE_GENERATOR}" + die "Value ${CMAKE_MAKEFILE_GENERATOR} is not supported" + ;; +esac + +if [[ ${PN} != cmake ]]; then + BDEPEND+=" dev-util/cmake" +fi + +# @FUNCTION: _cmake_banned_func +# @INTERNAL +# @DESCRIPTION: +# Banned functions are banned. +_cmake_banned_func() { + die "${FUNCNAME[1]} is banned. use -D$1<related_CMake_variable>=\"\$(usex $2)\" instead" +} + +# Determine using IN or OUT source build +_cmake_check_build_dir() { + : ${CMAKE_USE_DIR:=${S}} + if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then + # we build in source dir + BUILD_DIR="${CMAKE_USE_DIR}" + fi + + mkdir -p "${BUILD_DIR}" || die + einfo "Working in BUILD_DIR: \"$BUILD_DIR\"" +} + +# @FUNCTION: cmake_comment_add_subdirectory +# @USAGE: <subdirectory> +# @DESCRIPTION: +# Comment out one or more add_subdirectory calls in CMakeLists.txt in the current directory +cmake_comment_add_subdirectory() { + if [[ -z ${1} ]]; then + die "comment_add_subdirectory must be passed at least one directory name to comment" + fi + + if [[ -e "CMakeLists.txt" ]]; then + local d + for d in $@; do + sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${d//\//\\/}[[:space:]]*)/I s/^/#DONOTCOMPILE /" \ + -i CMakeLists.txt || die "failed to comment add_subdirectory(${d})" + done + fi +} + +# @FUNCTION: comment_add_subdirectory +# @INTERNAL +# @DESCRIPTION: +# Banned. Use cmake_comment_add_subdirectory instead. +comment_add_subdirectory() { + die "comment_add_subdirectory is banned. Use cmake_comment_add_subdirectory instead" +} + +# @FUNCTION: cmake-utils_use_with +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DWITH_FOO=$(usex foo) instead. +cmake-utils_use_with() { _cmake_banned_func WITH_ "$@" ; } + +# @FUNCTION: cmake-utils_use_enable +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DENABLE_FOO=$(usex foo) instead. +cmake-utils_use_enable() { _cmake_banned_func ENABLE_ "$@" ; } + +# @FUNCTION: cmake_use_find_package +# @USAGE: <USE flag> <package name> +# @DESCRIPTION: +# Based on use_enable. See ebuild(5). +# +# `cmake_use_find_package foo LibFoo` echoes -DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=OFF +# if foo is enabled and -DCMAKE_DISABLE_FIND_PACKAGE_LibFoo=ON if it is disabled. +# This can be used to make find_package optional. +cmake_use_find_package() { + debug-print-function ${FUNCNAME} "$@" + + if [[ "$#" != 2 || -z $1 ]] ; then + die "Usage: cmake_use_find_package <USE flag> <package name>" + fi + + echo "-DCMAKE_DISABLE_FIND_PACKAGE_$2=$(use $1 && echo OFF || echo ON)" +} + +# @FUNCTION: cmake-utils_use_disable +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DDISABLE_FOO=$(usex !foo) instead. +cmake-utils_use_disable() { _cmake_banned_func DISABLE_ "$@" ; } + +# @FUNCTION: cmake-utils_use_no +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DNO_FOO=$(usex !foo) instead. +cmake-utils_use_no() { _cmake_banned_func NO_ "$@" ; } + +# @FUNCTION: cmake-utils_use_want +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DWANT_FOO=$(usex foo) instead. +cmake-utils_use_want() { _cmake_banned_func WANT_ "$@" ; } + +# @FUNCTION: cmake-utils_use_build +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DBUILD_FOO=$(usex foo) instead. +cmake-utils_use_build() { _cmake_banned_func BUILD_ "$@" ; } + +# @FUNCTION: cmake-utils_use_has +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DHAVE_FOO=$(usex foo) instead. +cmake-utils_use_has() { _cmake_banned_func HAVE_ "$@" ; } + +# @FUNCTION: cmake-utils_use_use +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DUSE_FOO=$(usex foo) instead. +cmake-utils_use_use() { _cmake_banned_func USE_ "$@" ; } + +# @FUNCTION: cmake-utils_use +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DFOO=$(usex foo) instead. +cmake-utils_use() { _cmake_banned_func "" "$@" ; } + +# @FUNCTION: cmake-utils_useno +# @INTERNAL +# @DESCRIPTION: +# Banned. Use -DNOFOO=$(usex !foo) instead. +cmake-utils_useno() { _cmake_banned_func "" "$@" ; } + +# Internal function for modifying hardcoded definitions. +# Removes dangerous definitions that override Gentoo settings. +_cmake_modify-cmakelists() { + debug-print-function ${FUNCNAME} "$@" + + # Only edit the files once + grep -qs "<<< Gentoo configuration >>>" "${CMAKE_USE_DIR}"/CMakeLists.txt && return 0 + + # Comment out all set (<some_should_be_user_defined_variable> value) + find "${CMAKE_USE_DIR}" -name CMakeLists.txt -exec sed \ + -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_BUILD_TYPE\([[:space:]].*)\|)\)/I{s/^/#_cmake_modify_IGNORE /g}' \ + -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_COLOR_MAKEFILE[[:space:]].*)/I{s/^/#_cmake_modify_IGNORE /g}' \ + -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_INSTALL_PREFIX[[:space:]].*)/I{s/^/#_cmake_modify_IGNORE /g}' \ + -e '/^[[:space:]]*set[[:space:]]*([[:space:]]*CMAKE_VERBOSE_MAKEFILE[[:space:]].*)/I{s/^/#_cmake_modify_IGNORE /g}' \ + -i {} + || die "${LINENO}: failed to disable hardcoded settings" + local x + for x in $(find "${CMAKE_USE_DIR}" -name CMakeLists.txt -exec grep -l "^#_cmake_modify_IGNORE" {} +;); do + einfo "Hardcoded definition(s) removed in $(echo "${x}" | cut -c $((${#CMAKE_USE_DIR}+2))-):" + einfo "$(grep -se '^#_cmake_modify_IGNORE' ${x} | cut -c 22-99)" + done + + # NOTE Append some useful summary here + cat >> "${CMAKE_USE_DIR}"/CMakeLists.txt <<- _EOF_ || die + + MESSAGE(STATUS "<<< Gentoo configuration >>> + Build type \${CMAKE_BUILD_TYPE} + Install path \${CMAKE_INSTALL_PREFIX} + Compiler flags: + C \${CMAKE_C_FLAGS} + C++ \${CMAKE_CXX_FLAGS} + Linker flags: + Executable \${CMAKE_EXE_LINKER_FLAGS} + Module \${CMAKE_MODULE_LINKER_FLAGS} + Shared \${CMAKE_SHARED_LINKER_FLAGS}\n") + _EOF_ +} + +# @FUNCTION: cmake_src_prepare +# @DESCRIPTION: +# Apply ebuild and user patches. +cmake_src_prepare() { + debug-print-function ${FUNCNAME} "$@" + + # FIXME: workaround from cmake-utils; use current working directory instead, bug #704524 + # esp. test with 'special' pkgs like: app-arch/brotli, media-gfx/gmic, net-libs/quiche + pushd "${S}" > /dev/null || die + + default_src_prepare + _cmake_check_build_dir + + # check if CMakeLists.txt exist and if no then die + if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then + eerror "Unable to locate CMakeLists.txt under:" + eerror "\"${CMAKE_USE_DIR}/CMakeLists.txt\"" + eerror "Consider not inheriting the cmake eclass." + die "FATAL: Unable to find CMakeLists.txt" + fi + + # if ninja is enabled but not installed, the build could fail + # this could happen if ninja is manually enabled (eg. make.conf) but not installed + if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]] && ! has_version -b dev-util/ninja; then + eerror "CMAKE_MAKEFILE_GENERATOR is set to ninja, but ninja is not installed." + die "Please install dev-util/ninja or unset CMAKE_MAKEFILE_GENERATOR." + fi + + local modules_list + if [[ $(declare -p CMAKE_REMOVE_MODULES_LIST) == "declare -a"* ]]; then + modules_list=( "${CMAKE_REMOVE_MODULES_LIST[@]}" ) + else + modules_list=( ${CMAKE_REMOVE_MODULES_LIST} ) + fi + + local name + for name in "${modules_list[@]}" ; do + find "${S}" -name ${name}.cmake -exec rm -v {} + || die + done + + # Remove dangerous things. + _cmake_modify-cmakelists + + popd > /dev/null || die + + # make ${S} read-only in order to detect broken build-systems + if [[ ${CMAKE_QA_SRC_DIR_READONLY} && ! ${CMAKE_IN_SOURCE_BUILD} ]]; then + chmod -R a-w "${S}" + fi + + _CMAKE_SRC_PREPARE_HAS_RUN=1 +} + +# @VARIABLE: mycmakeargs +# @DEFAULT_UNSET +# @DESCRIPTION: +# Optional cmake defines as a bash array. Should be defined before calling +# src_configure. +# @CODE +# src_configure() { +# local mycmakeargs=( +# $(cmake_use_with openconnect) +# ) +# +# cmake_src_configure +# } +# @CODE + +# @FUNCTION: cmake_src_configure +# @DESCRIPTION: +# General function for configuring with cmake. Default behaviour is to start an +# out-of-source build. +cmake_src_configure() { + debug-print-function ${FUNCNAME} "$@" + + [[ ${_CMAKE_SRC_PREPARE_HAS_RUN} ]] || \ + die "FATAL: cmake_src_prepare has not been run" + + _cmake_check_build_dir + + # Fix xdg collision with sandbox + xdg_environment_reset + + # @SEE CMAKE_BUILD_TYPE + if [[ ${CMAKE_BUILD_TYPE} = Gentoo ]]; then + # Handle release builds + if ! in_iuse debug || ! use debug; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags -DNDEBUG + fi + fi + + # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.) + local build_rules=${BUILD_DIR}/gentoo_rules.cmake + + cat > "${build_rules}" <<- _EOF_ || die + SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE) + SET (CMAKE_ASM-ATT_COMPILE_OBJECT "<CMAKE_ASM-ATT_COMPILER> <DEFINES> <INCLUDES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c -x assembler <SOURCE>" CACHE STRING "ASM-ATT compile command" FORCE) + SET (CMAKE_ASM-ATT_LINK_FLAGS "-nostdlib" CACHE STRING "ASM-ATT link flags" FORCE) + SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE) + SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES> ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) + SET (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE) + _EOF_ + + local myCC=$(tc-getCC) myCXX=$(tc-getCXX) myFC=$(tc-getFC) + + # !!! IMPORTANT NOTE !!! + # Single slash below is intentional. CMake is weird and wants the + # CMAKE_*_VARIABLES split into two elements: the first one with + # compiler path, and the second one with all command-line options, + # space separated. + local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake + cat > ${toolchain_file} <<- _EOF_ || die + SET (CMAKE_ASM_COMPILER "${myCC/ /;}") + SET (CMAKE_ASM-ATT_COMPILER "${myCC/ /;}") + SET (CMAKE_C_COMPILER "${myCC/ /;}") + SET (CMAKE_CXX_COMPILER "${myCXX/ /;}") + SET (CMAKE_Fortran_COMPILER "${myFC/ /;}") + SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE) + SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE) + SET (CMAKE_SYSTEM_PROCESSOR "${CHOST%%-*}") + _EOF_ + + # We are using the C compiler for assembly by default. + local -x ASMFLAGS=${CFLAGS} + local -x PKG_CONFIG=$(tc-getPKG_CONFIG) + + if tc-is-cross-compiler; then + local sysname + case "${KERNEL:-linux}" in + Cygwin) sysname="CYGWIN_NT-5.1" ;; + HPUX) sysname="HP-UX" ;; + linux) sysname="Linux" ;; + Winnt) + sysname="Windows" + cat >> "${toolchain_file}" <<- _EOF_ || die + SET (CMAKE_RC_COMPILER $(tc-getRC)) + _EOF_ + ;; + *) sysname="${KERNEL}" ;; + esac + + cat >> "${toolchain_file}" <<- _EOF_ || die + SET (CMAKE_SYSTEM_NAME "${sysname}") + _EOF_ + + if [ "${SYSROOT:-/}" != "/" ] ; then + # When cross-compiling with a sysroot (e.g. with crossdev's emerge wrappers) + # we need to tell cmake to use libs/headers from the sysroot but programs from / only. + cat >> "${toolchain_file}" <<- _EOF_ || die + SET (CMAKE_FIND_ROOT_PATH "${SYSROOT}") + SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + _EOF_ + fi + fi + + if use prefix-guest; then + cat >> "${build_rules}" <<- _EOF_ || die + # in Prefix we need rpath and must ensure cmake gets our default linker path + # right ... except for Darwin hosts + IF (NOT APPLE) + SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) + SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" + CACHE STRING "" FORCE) + + ELSE () + + SET (CMAKE_PREFIX_PATH "${EPREFIX}/usr" CACHE STRING "" FORCE) + SET (CMAKE_MACOSX_RPATH ON CACHE BOOL "" FORCE) + SET (CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE) + SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) + SET (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE) + + ENDIF (NOT APPLE) + _EOF_ + fi + + # Common configure parameters (invariants) + local common_config=${BUILD_DIR}/gentoo_common_config.cmake + local libdir=$(get_libdir) + cat > "${common_config}" <<- _EOF_ || die + SET (CMAKE_GENTOO_BUILD ON CACHE BOOL "Indicate Gentoo package build") + SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE) + SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries") + SET (CMAKE_INSTALL_INFODIR "${EPREFIX}/usr/share/info" CACHE PATH "") + SET (CMAKE_INSTALL_MANDIR "${EPREFIX}/usr/share/man" CACHE PATH "") + SET (CMAKE_USER_MAKE_RULES_OVERRIDE "${build_rules}" CACHE FILEPATH "Gentoo override rules") + SET (CMAKE_INSTALL_DOCDIR "${EPREFIX}/usr/share/doc/${PF}" CACHE PATH "") + SET (BUILD_SHARED_LIBS ON CACHE BOOL "") + _EOF_ + if [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]]; then + echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}" || die + fi + + # Wipe the default optimization flags out of CMake + if [[ ${CMAKE_BUILD_TYPE} != Gentoo ]]; then + cat >> ${common_config} <<- _EOF_ || die + SET (CMAKE_ASM_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + SET (CMAKE_ASM-ATT_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + SET (CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + SET (CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + SET (CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + SET (CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + SET (CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + SET (CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + SET (CMAKE_STATIC_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "") + _EOF_ + fi + + # Make the array a local variable since <=portage-2.1.6.x does not support + # global arrays (see bug #297255). But first make sure it is initialised. + [[ -z ${mycmakeargs} ]] && declare -a mycmakeargs=() + local mycmakeargstype=$(declare -p mycmakeargs 2>&-) + if [[ "${mycmakeargstype}" != "declare -a mycmakeargs="* ]]; then + die "mycmakeargs must be declared as array" + fi + + local mycmakeargs_local=( "${mycmakeargs[@]}" ) + + local warn_unused_cli="" + if [[ ${CMAKE_WARN_UNUSED_CLI} == no ]] ; then + warn_unused_cli="--no-warn-unused-cli" + fi + + local generator_name + case ${CMAKE_MAKEFILE_GENERATOR} in + ninja) generator_name="Ninja" ;; + emake) generator_name="Unix Makefiles" ;; + esac + + # Common configure parameters (overridable) + # NOTE CMAKE_BUILD_TYPE can be only overridden via CMAKE_BUILD_TYPE eclass variable + # No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect. + local cmakeargs=( + ${warn_unused_cli} + -C "${common_config}" + -G "${generator_name}" + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" + "${mycmakeargs_local[@]}" + -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" + -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" + "${MYCMAKEARGS}" + ) + + if [[ -n "${CMAKE_EXTRA_CACHE_FILE}" ]] ; then + cmakeargs+=( -C "${CMAKE_EXTRA_CACHE_FILE}" ) + fi + + pushd "${BUILD_DIR}" > /dev/null || die + debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is ${mycmakeargs_local[*]}" + echo "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" + "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" || die "cmake failed" + popd > /dev/null || die +} + +# @FUNCTION: cmake_src_compile +# @DESCRIPTION: +# General function for compiling with cmake. +# Automatically detects the build type. All arguments are passed to emake. +cmake_src_compile() { + debug-print-function ${FUNCNAME} "$@" + + cmake_build "$@" +} + +# @FUNCTION: cmake_build +# @DESCRIPTION: +# Function for building the package. Automatically detects the build type. +# All arguments are passed to emake. +cmake_build() { + debug-print-function ${FUNCNAME} "$@" + + _cmake_check_build_dir + pushd "${BUILD_DIR}" > /dev/null || die + + case ${CMAKE_MAKEFILE_GENERATOR} in + emake) + [[ -e Makefile ]] || die "Makefile not found. Error during configure stage." + case ${CMAKE_VERBOSE} in + OFF) emake "$@" ;; + *) emake VERBOSE=1 "$@" ;; + esac + ;; + ninja) + [[ -e build.ninja ]] || die "build.ninja not found. Error during configure stage." + eninja "$@" + ;; + esac + + popd > /dev/null || die +} + +# @FUNCTION: cmake-utils_src_make +# @INTERNAL +# @DESCRIPTION: +# Banned. Use cmake_build instead. +cmake-utils_src_make() { + die "cmake-utils_src_make is banned. Use cmake_build instead" +} + +# @FUNCTION: cmake_src_test +# @DESCRIPTION: +# Function for testing the package. Automatically detects the build type. +cmake_src_test() { + debug-print-function ${FUNCNAME} "$@" + + _cmake_check_build_dir + pushd "${BUILD_DIR}" > /dev/null || die + [[ -e CTestTestfile.cmake ]] || { echo "No tests found. Skipping."; return 0 ; } + + [[ -n ${TEST_VERBOSE} ]] && myctestargs+=( --extra-verbose --output-on-failure ) + + set -- ctest -j "$(makeopts_jobs)" --test-load "$(makeopts_loadavg)" "${myctestargs[@]}" "$@" + echo "$@" >&2 + if "$@" ; then + einfo "Tests succeeded." + popd > /dev/null || die + return 0 + else + if [[ -n "${CMAKE_YES_I_WANT_TO_SEE_THE_TEST_LOG}" ]] ; then + # on request from Diego + eerror "Tests failed. Test log ${BUILD_DIR}/Testing/Temporary/LastTest.log follows:" + eerror "--START TEST LOG--------------------------------------------------------------" + cat "${BUILD_DIR}/Testing/Temporary/LastTest.log" + eerror "--END TEST LOG----------------------------------------------------------------" + die "Tests failed." + else + die "Tests failed. When you file a bug, please attach the following file: \n\t${BUILD_DIR}/Testing/Temporary/LastTest.log" + fi + + # die might not die due to nonfatal + popd > /dev/null || die + return 1 + fi +} + +# @FUNCTION: cmake_src_install +# @DESCRIPTION: +# Function for installing the package. Automatically detects the build type. +cmake_src_install() { + debug-print-function ${FUNCNAME} "$@" + + _cmake_check_build_dir + pushd "${BUILD_DIR}" > /dev/null || die + DESTDIR="${D}" ${CMAKE_MAKEFILE_GENERATOR} install "$@" || + die "died running ${CMAKE_MAKEFILE_GENERATOR} install" + popd > /dev/null || die + + pushd "${S}" > /dev/null || die + einstalldocs + popd > /dev/null || die +} + +fi diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index fae25ea8a5ec..302651858352 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: distutils-r1.eclass @@ -86,6 +86,8 @@ esac # - no -- do not add the dependency (pure distutils package) # - bdepend -- add it to BDEPEND (the default) # - rdepend -- add it to BDEPEND+RDEPEND (when using entry_points) +# - manual -- do not add the depedency and suppress the checks +# (assumes you will take care of doing it correctly) # # This variable is effective only if DISTUTILS_OPTIONAL is disabled. # It needs to be set before the inherit line. @@ -116,7 +118,7 @@ _distutils_set_globals() { local bdep=${rdep} case ${DISTUTILS_USE_SETUPTOOLS} in - no) + no|manual) ;; bdepend) bdep+=" dev-python/setuptools[${PYTHON_USEDEP}]" @@ -436,6 +438,7 @@ distutils_enable_tests() { # incorrectly. _distutils_verify_use_setuptools() { [[ ${DISTUTILS_OPTIONAL} ]] && return + [[ ${DISTUTILS_USE_SETUPTOOLS} == manual ]] && return # ok, those are cheap greps. we can try toimprove them if we hit # false positives. @@ -444,7 +447,7 @@ _distutils_verify_use_setuptools() { # as a special case, setuptools provides itself ;-) : elif grep -E -q -s '(from|import)\s+setuptools' setup.py; then - if grep -E -q -s 'entry_points\s+=' setup.py; then + if grep -E -q -s 'entry_points\s*=' setup.py; then expected=rdepend else expected=bdepend diff --git a/eclass/dotnet.eclass b/eclass/dotnet.eclass index 3e834835b971..55e10645deb7 100644 --- a/eclass/dotnet.eclass +++ b/eclass/dotnet.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: dotnet.eclass @@ -12,19 +12,21 @@ # of dotnet packages. case ${EAPI:-0} in - 0) die "this eclass doesn't support EAPI 0" ;; - 1|2|3) ;; - *) ;; #if [[ ${USE_DOTNET} ]]; then REQUIRED_USE="|| (${USE_DOTNET})"; fi;; + 0) + die "this eclass doesn't support EAPI 0" ;; + [1-6]) + inherit eapi7-ver multilib + DEPEND="dev-lang/mono" ;; + *) + BDEPEND="dev-lang/mono" ;; esac -inherit eutils versionator mono-env +inherit mono-env # @ECLASS-VARIABLE: USE_DOTNET # @DESCRIPTION: # Use flags added to IUSE -DEPEND+=" dev-lang/mono" - # SET default use flags according on DOTNET_TARGETS for x in ${USE_DOTNET}; do case ${x} in @@ -51,7 +53,7 @@ dotnet_pkg_setup() { FRAMEWORK="${F}"; fi else - version_is_at_least "${F}" "${FRAMEWORK}" || FRAMEWORK="${F}" + ver_test "${F}" -le "${FRAMEWORK}" || FRAMEWORK="${F}" fi done if [[ -z ${FRAMEWORK} ]]; then diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass index 1616df9aab57..2892b0e0e942 100644 --- a/eclass/ecm.eclass +++ b/eclass/ecm.eclass @@ -13,7 +13,7 @@ # upstream release groups (Frameworks, Plasma, Applications) but also for any # other package that follows similar conventions. # -# This eclass unconditionally inherits cmake-utils.eclass and all its public +# This eclass unconditionally inherits cmake.eclass and all its public # variables and helper functions (not phase functions) may be considered as part # of this eclass's API. # @@ -49,7 +49,7 @@ if [[ ${CATEGORY} = kde-frameworks ]] ; then fi : ${ECM_NONGUI:=false} -inherit cmake-utils flag-o-matic toolchain-funcs virtualx +inherit cmake flag-o-matic toolchain-funcs virtualx if [[ ${ECM_NONGUI} = false ]] ; then inherit xdg @@ -74,7 +74,7 @@ EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_test pkg_preinst pkg_po # @ECLASS-VARIABLE: ECM_DEBUG # @DESCRIPTION: -# Add "debug" to IUSE. If !debug, add -DNDEBUG (via cmake-utils_src_configure) +# Add "debug" to IUSE. If !debug, add -DNDEBUG (via cmake_src_configure) # and -DQT_NO_DEBUG to CPPFLAGS. If set to "false", do nothing. : ${ECM_DEBUG:=true} @@ -310,6 +310,24 @@ DEPEND+=" ${COMMONDEPEND}" RDEPEND+=" ${COMMONDEPEND}" unset COMMONDEPEND +# @FUNCTION: _ecm_banned_var +# @INTERNAL +# @DESCRIPTION: +# Banned kde5*.eclass variables are banned. +_ecm_banned_var() { + die "$1 is banned. use $2 instead." +} + +if [[ -z ${_KDE5_ECLASS} ]] ; then + [[ -n ${KDE_DEBUG} ]] && _ecm_banned_var KDE_DEBUG ECM_DEBUG + [[ -n ${KDE_EXAMPLES} ]] && _ecm_banned_var KDE_EXAMPLES ECM_EXAMPLES + [[ -n ${KDE_HANDBOOK} ]] && _ecm_banned_var KDE_HANDBOOK ECM_HANDBOOK + [[ -n ${KDE_DOC_DIR} ]] && _ecm_banned_var KDE_DOC_DIR ECM_HANDBOOK_DIR + [[ -n ${KDE_PO_DIRS} ]] && _ecm_banned_var KDE_PO_DIRS ECM_PO_DIRS + [[ -n ${KDE_QTHELP} ]] && _ecm_banned_var KDE_QTHELP ECM_QTHELP + [[ -n ${KDE_TEST} ]] && _ecm_banned_var KDE_TEST ECM_TEST +fi + # @ECLASS-VARIABLE: KDE_GCC_MINIMAL # @DEFAULT_UNSET # @DESCRIPTION: @@ -418,12 +436,12 @@ ecm_pkg_setup() { # @FUNCTION: ecm_src_prepare # @DESCRIPTION: -# Wrapper for cmake-utils_src_prepare with lots of extra logic for magic +# Wrapper for cmake_src_prepare with lots of extra logic for magic # handling of linguas, tests, handbook etc. ecm_src_prepare() { debug-print-function ${FUNCNAME} "$@" - cmake-utils_src_prepare + cmake_src_prepare # only build examples when required if ! { in_iuse examples && use examples; } ; then @@ -499,12 +517,12 @@ ecm_src_prepare() { # @FUNCTION: ecm_src_configure # @DESCRIPTION: -# Wrapper for cmake-utils_src_configure with extra logic for magic handling of +# Wrapper for cmake_src_configure with extra logic for magic handling of # handbook, tests etc. ecm_src_configure() { debug-print-function ${FUNCNAME} "$@" - # we rely on cmake-utils.eclass to append -DNDEBUG too + # we rely on cmake.eclass to append -DNDEBUG too if in_iuse debug && ! use debug; then append-cppflags -DQT_NO_DEBUG fi @@ -548,22 +566,22 @@ ecm_src_configure() { # allow the ebuild to override what we set here mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}") - cmake-utils_src_configure + cmake_src_configure } # @FUNCTION: ecm_src_compile # @DESCRIPTION: -# Wrapper for cmake-utils_src_compile. Currently doesn't do anything extra, but +# Wrapper for cmake_src_compile. Currently doesn't do anything extra, but # is included as part of the API just in case it's needed in the future. ecm_src_compile() { debug-print-function ${FUNCNAME} "$@" - cmake-utils_src_compile "$@" + cmake_src_compile "$@" } # @FUNCTION: ecm_src_test # @DESCRIPTION: -# Wrapper for cmake-utils_src_test with extra logic for magic handling of dbus +# Wrapper for cmake_src_test with extra logic for magic handling of dbus # and virtualx. ecm_src_test() { debug-print-function ${FUNCNAME} "$@" @@ -573,7 +591,7 @@ ecm_src_test() { export $(dbus-launch) fi - cmake-utils_src_test + cmake_src_test } # When run as normal user during ebuild development with the ebuild command, @@ -595,12 +613,12 @@ ecm_src_test() { # @FUNCTION: ecm_src_install # @DESCRIPTION: -# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra, but +# Wrapper for cmake_src_install. Currently doesn't do anything extra, but # is included as part of the API just in case it's needed in the future. ecm_src_install() { debug-print-function ${FUNCNAME} "$@" - cmake-utils_src_install + cmake_src_install } # @FUNCTION: ecm_pkg_preinst diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass index 05b03f493957..b5ea21cb22bf 100644 --- a/eclass/elisp-common.eclass +++ b/eclass/elisp-common.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: elisp-common.eclass @@ -23,26 +23,25 @@ # When relying on the emacs USE flag, you need to add # # @CODE -# emacs? ( virtual/emacs ) +# emacs? ( >=app-editors/emacs-23.1:* ) # @CODE # # to your DEPEND/RDEPEND line and use the functions provided here to # bring the files to the correct locations. # -# If your package requires a minimum Emacs version, e.g. Emacs 24, then -# the dependency should be on >=virtual/emacs-24 instead. Because the -# user can select the Emacs executable with eselect, you should also -# make sure that the active Emacs version is sufficient. This can be -# tested with function elisp-need-emacs(), which would typically be -# called from pkg_setup(), as in the following example: +# If your package requires a minimum Emacs version, e.g. Emacs 26.1, +# then the dependency should be on >=app-editors/emacs-26.1:* instead. +# Because the user can select the Emacs executable with eselect, you +# should also make sure that the active Emacs version is sufficient. +# The eclass will automatically ensure this if you assign variable +# NEED_EMACS with the Emacs version, as in the following example: # # @CODE -# elisp-need-emacs 24 || die "Emacs version too low" +# NEED_EMACS=26.1 # @CODE # -# Please note that such tests should be limited to packages that are -# known to fail with lower Emacs versions; the standard case is to -# depend on virtual/emacs without version. +# Please note that this should be done only for packages that are known +# to fail with lower Emacs versions. # # @ROFF .SS # src_compile() usage: @@ -134,6 +133,23 @@ # the differing name as second argument. # # @ROFF .SS +# pkg_setup() usage: +# +# If your ebuild uses the elisp-compile eclass function to compile +# its elisp files (see above), then you don't need a pkg_setup phase, +# because elisp-compile and elisp-make-autoload-file do their own sanity +# checks. On the other hand, if the elisp files are compiled by the +# package's build system, then there is often no check for the Emacs +# version. In this case, you can add an explicit check in pkg_setup: +# +# @CODE +# elisp-check-emacs-version +# @CODE +# +# When having optional Emacs support, you should prepend "use emacs &&" +# to above call of elisp-check-emacs-version(). +# +# @ROFF .SS # pkg_postinst() / pkg_postrm() usage: # # After that you need to recreate the start-up file of Emacs after @@ -149,12 +165,14 @@ # } # @CODE # -# When having optional Emacs support, you should prepend "use emacs &&" +# Again, with optional Emacs support, you should prepend "use emacs &&" # to above calls of elisp-site-regen(). -# Don't use "has_version virtual/emacs"! When unmerging the state of -# the emacs USE flag is taken from the package database and not from the -# environment, so it is no problem when you unset USE=emacs between -# merge and unmerge of a package. + +case ${EAPI:-0} in + 4|5|6) inherit eapi7-ver ;; + 7) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac # @ECLASS-VARIABLE: SITELISP # @DESCRIPTION: @@ -182,6 +200,17 @@ EMACSFLAGS="-batch -q --no-site-file" # Emacs flags used for byte-compilation in elisp-compile(). BYTECOMPFLAGS="-L ." +# @ECLASS-VARIABLE: NEED_EMACS +# @DESCRIPTION: +# The minimum Emacs version required for the package. +: ${NEED_EMACS:=23.1} + +# @ECLASS-VARIABLE: _ELISP_EMACS_VERSION +# @INTERNAL +# @DESCRIPTION: +# Cached value of Emacs version detected in elisp-check-emacs-version(). +_ELISP_EMACS_VERSION="" + # @FUNCTION: elisp-emacs-version # @RETURN: exit status of Emacs # @DESCRIPTION: @@ -212,12 +241,39 @@ elisp-emacs-version() { echo "${version}" } -# @FUNCTION: elisp-need-emacs -# @USAGE: <version> -# @RETURN: 0 if true, 1 if false, 2 if trouble +# @FUNCTION: elisp-check-emacs-version +# @USAGE: [version] # @DESCRIPTION: +# Test if the eselected Emacs version is at least the version of +# GNU Emacs specified in the NEED_EMACS variable, or die otherwise. + +elisp-check-emacs-version() { + if [[ -z ${_ELISP_EMACS_VERSION} ]]; then + local have_emacs + have_emacs=$(elisp-emacs-version) \ + || die "Could not determine Emacs version" + einfo "Emacs version: ${have_emacs}" + if [[ ${have_emacs} =~ XEmacs|Lucid ]]; then + die "XEmacs detected. This package needs GNU Emacs." + fi + # GNU Emacs versions have only numeric components. + if ! [[ ${have_emacs} =~ ^[0-9]+(\.[0-9]+)*$ ]]; then + die "Malformed version string: ${have_emacs}" + fi + _ELISP_EMACS_VERSION=${have_emacs} + fi + + if ! ver_test "${_ELISP_EMACS_VERSION}" -ge "${NEED_EMACS}"; then + eerror "This package needs at least Emacs ${NEED_EMACS}." + eerror "Use \"eselect emacs\" to select the active version." + die "Emacs version too low" + fi +} + # Test if the eselected Emacs version is at least the major version # of GNU Emacs specified as argument. +# Return 0 if true, 1 if false, 2 if trouble. +# Deprecated, use elisp-check-emacs-version instead. elisp-need-emacs() { local need_emacs=$1 have_emacs @@ -249,6 +305,8 @@ elisp-need-emacs() { # in case they require or load one another. elisp-compile() { + elisp-check-emacs-version + ebegin "Compiling GNU Emacs Elisp files" ${EMACS} ${EMACSFLAGS} ${BYTECOMPFLAGS} -f batch-byte-compile "$@" eend $? "elisp-compile: batch-byte-compile failed" || die @@ -262,6 +320,8 @@ elisp-compile() { elisp-make-autoload-file() { local f="${1:-${PN}-autoloads.el}" null="" page=$'\f' shift + elisp-check-emacs-version + ebegin "Generating autoload file for GNU Emacs" cat >"${f}" <<-EOF @@ -397,7 +457,7 @@ elisp-site-regen() { # was actually no change. # A case is a remerge where we have doubled output. rm -f "${T}"/site-gentoo.el - eend + eend 0 einfo "... no changes." else mv "${T}"/site-gentoo.el "${sitelisp}"/site-gentoo.el diff --git a/eclass/elisp.eclass b/eclass/elisp.eclass index bcd80a9ee9ca..a411f602cf7c 100644 --- a/eclass/elisp.eclass +++ b/eclass/elisp.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2019 Gentoo Authors +# Copyright 2002-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: elisp.eclass @@ -30,8 +30,8 @@ # @DEFAULT_UNSET # @DESCRIPTION: # If you need anything different from Emacs 23, use the NEED_EMACS -# variable before inheriting elisp.eclass. Set it to the major version -# your package uses and the dependency will be adjusted. +# variable before inheriting elisp.eclass. Set it to the version your +# package uses and the dependency will be adjusted. # @ECLASS-VARIABLE: ELISP_PATCHES # @DEFAULT_UNSET @@ -70,24 +70,20 @@ esac EXPORT_FUNCTIONS src_{unpack,prepare,configure,compile,install} \ pkg_{setup,postinst,postrm} -RDEPEND=">=virtual/emacs-${NEED_EMACS:-23}" +RDEPEND=">=app-editors/emacs-${NEED_EMACS}:*" case ${EAPI} in - 4|5|6) DEPEND="${RDEPEND}" ;; + 4) RDEPEND="${RDEPEND%:*}"; DEPEND="${RDEPEND}" ;; + 5|6) DEPEND="${RDEPEND}" ;; *) BDEPEND="${RDEPEND}" ;; esac # @FUNCTION: elisp_pkg_setup # @DESCRIPTION: -# Test if the eselected Emacs version is sufficient to fulfil the major +# Test if the eselected Emacs version is sufficient to fulfil the # version requirement of the NEED_EMACS variable. elisp_pkg_setup() { - elisp-need-emacs "${NEED_EMACS:-23}" - case $? in - 0) ;; - 1) die "Emacs version too low" ;; - *) die "Could not determine Emacs version" ;; - esac + elisp-check-emacs-version } # @FUNCTION: elisp_src_unpack diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index f882b09d6219..0aec22c83f2c 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.eclass @@ -441,29 +441,63 @@ test-flag-PROG() { # 'type' needs a binary name type -p ${comp[0]} >/dev/null || return 1 + # Set up test file. + local in_src in_ext cmdline_extra=() + case "${lang}" in + # compiler/assembler only + c) + in_ext='.c' + in_src='int main(void) { return 0; }' + cmdline_extra+=(-xc -c) + ;; + c++) + in_ext='.cc' + in_src='int main(void) { return 0; }' + cmdline_extra+=(-xc++ -c) + ;; + f77) + in_ext='.f' + # fixed source form + in_src=' end' + cmdline_extra+=(-xf77 -c) + ;; + f95) + in_ext='.f90' + in_src='end' + cmdline_extra+=(-xf95 -c) + ;; + + # C compiler/assembler/linker + c+ld) + in_ext='.c' + in_src='int main(void) { return 0; }' + cmdline_extra+=(-xc) + ;; + esac + local test_in=${T}/test-flag-${comp}.${lang} + local test_out=${T}/test-flag-${comp}.exe + + printf "%s\n" "${in_src}" > "${test_in}" || return 1 + local cmdline=( "${comp[@]}" # Clang will warn about unknown gcc flags but exit 0. # Need -Werror to force it to exit non-zero. -Werror - # Use -c so we can test the assembler as well. - -c -o /dev/null + "$@" + # -x<lang> options need to go before first source file + "${cmdline_extra[@]}" + + "${test_in}" -o "${test_out}" ) - if "${cmdline[@]}" -x${lang} - </dev/null &>/dev/null ; then - cmdline+=( "$@" -x${lang} - ) - else - # XXX: what's the purpose of this? does it even work with - # any compiler? - cmdline+=( "$@" -c -o /dev/null /dev/null ) - fi - if ! "${cmdline[@]}" </dev/null &>/dev/null; then + if ! "${cmdline[@]}" &>/dev/null; then # -Werror makes clang bail out on unused arguments as well; # try to add -Qunused-arguments to work-around that # other compilers don't support it but then, it's failure like # any other cmdline+=( -Qunused-arguments ) - "${cmdline[@]}" </dev/null &>/dev/null + "${cmdline[@]}" &>/dev/null fi } @@ -491,6 +525,12 @@ test-flag-F77() { test-flag-PROG "F77" f77 "$@"; } # Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false. test-flag-FC() { test-flag-PROG "FC" f95 "$@"; } +# @FUNCTION: test-flag-CCLD +# @USAGE: <flag> +# @DESCRIPTION: +# Returns shell true if <flag> is supported by the C compiler and linker, else returns shell false. +test-flag-CCLD() { test-flag-PROG "CC" c+ld "$@"; } + test-flags-PROG() { local comp=$1 local flags=() @@ -548,6 +588,12 @@ test-flags-F77() { test-flags-PROG "F77" "$@"; } # Returns shell true if <flags> are supported by the Fortran 90 compiler, else returns shell false. test-flags-FC() { test-flags-PROG "FC" "$@"; } +# @FUNCTION: test-flags-CCLD +# @USAGE: <flags> +# @DESCRIPTION: +# Returns shell true if <flags> are supported by the C compiler and default linker, else returns shell false. +test-flags-CCLD() { test-flags-PROG "CCLD" "$@"; } + # @FUNCTION: test-flags # @USAGE: <flags> # @DESCRIPTION: @@ -576,9 +622,7 @@ strip-unsupported-flags() { export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS}) export FFLAGS=$(test-flags-F77 ${FFLAGS}) export FCFLAGS=$(test-flags-FC ${FCFLAGS}) - # note: this does not verify the linker flags but it is enough - # to strip invalid C flags which are much more likely, #621274 - export LDFLAGS=$(test-flags-CC ${LDFLAGS}) + export LDFLAGS=$(test-flags-CCLD ${LDFLAGS}) } # @FUNCTION: get-flag diff --git a/eclass/fortran-2.eclass b/eclass/fortran-2.eclass index b871d16e3e05..229689babf56 100644 --- a/eclass/fortran-2.eclass +++ b/eclass/fortran-2.eclass @@ -91,7 +91,6 @@ unset _f_use # @DESCRIPTION: # Return the Fortran compiler flag to enable 64 bit integers for # array indices -# @CODE fortran_int64_abi_fflags() { debug-print-function ${FUNCNAME} "${@}" diff --git a/eclass/fox.eclass b/eclass/fox.eclass index 529f5a258953..b40f8273d15c 100644 --- a/eclass/fox.eclass +++ b/eclass/fox.eclass @@ -1,6 +1,9 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +# @DEAD +# All consumers were last rited. Removal in 30 days. + # @ECLASS: fox.eclass # @MAINTAINER: # maintainer-needed@gentoo.org @@ -27,7 +30,7 @@ # # EAPI phase trickery borrowed from enlightenment.eclass -inherit autotools versionator +inherit autotools versionator desktop FOX_EXPF="src_unpack src_compile src_install pkg_postinst" diff --git a/eclass/git-2.eclass b/eclass/git-2.eclass index 917163291e63..ecc260d0e9b2 100644 --- a/eclass/git-2.eclass +++ b/eclass/git-2.eclass @@ -1,6 +1,9 @@ # Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +# @DEAD +# All consumers were last rited. Removal in 14 days. + # @ECLASS: git-2.eclass # @MAINTAINER: # maintainer-needed@gentoo.org diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass index e0d2bbb5edc0..663fd939b295 100644 --- a/eclass/git-r3.eclass +++ b/eclass/git-r3.eclass @@ -227,19 +227,19 @@ _git-r3_env_setup() { ;; single) if [[ ${EGIT_CLONE_TYPE} == shallow ]]; then - einfo "git-r3: ebuild needs to be cloned in '\e[1msingle\e[22m' mode, adjusting" + einfo "git-r3: ebuild needs to be cloned in 'single' mode, adjusting" EGIT_CLONE_TYPE=single fi ;; single+tags) if [[ ${EGIT_CLONE_TYPE} == shallow || ${EGIT_CLONE_TYPE} == single ]]; then - einfo "git-r3: ebuild needs to be cloned in '\e[1msingle+tags\e[22m' mode, adjusting" + einfo "git-r3: ebuild needs to be cloned in 'single+tags' mode, adjusting" EGIT_CLONE_TYPE=single+tags fi ;; mirror) if [[ ${EGIT_CLONE_TYPE} != mirror ]]; then - einfo "git-r3: ebuild needs to be cloned in '\e[1mmirror\e[22m' mode, adjusting" + einfo "git-r3: ebuild needs to be cloned in 'mirror' mode, adjusting" EGIT_CLONE_TYPE=mirror fi ;; @@ -401,16 +401,22 @@ _git-r3_set_gitdir() { } # @FUNCTION: _git-r3_set_submodules -# @USAGE: <file-contents> +# @USAGE: <parent-path> <file-contents> # @INTERNAL # @DESCRIPTION: # Parse .gitmodules contents passed as <file-contents> # as in "$(cat .gitmodules)"). Composes a 'submodules' array that # contains in order (name, URL, path) for each submodule. +# +# <parent-path> specifies path to current submodule (empty if top repo), +# and is used to support recursively specifying submodules. The path +# must include a trailing slash if it's not empty. _git-r3_set_submodules() { debug-print-function ${FUNCNAME} "$@" - local data=${1} + local parent_path=${1} + local data=${2} + [[ -z ${parent_path} || ${parent_path} == */ ]] || die # ( name url path ... ) submodules=() @@ -435,12 +441,14 @@ _git-r3_set_submodules() { l_res=1 fi - [[ ${subname} == ${p} ]] && res=${l_res} + [[ ${parent_path}${subname} == ${p} ]] && res=${l_res} done if [[ ! ${res} ]]; then - einfo "Skipping submodule \e[1m${subname}\e[22m" + einfo "Skipping submodule ${parent_path}${subname}" continue + else + einfo "Using submodule ${parent_path}${subname}" fi fi @@ -546,7 +554,7 @@ _git-r3_is_local_repo() { # This default should be fine unless you are fetching multiple trees # from the same repository in the same ebuild. # -# <commit-id> requests attempting to use repository state as of specific +# <commit-date> requests attempting to use repository state as of specific # date. For more details, see EGIT_COMMIT_DATE. # # The fetch operation will affect the EGIT_STORE only. It will not touch @@ -658,7 +666,7 @@ git-r3_fetch() { fi for r in "${repos[@]}"; do if [[ ! ${EVCS_OFFLINE} ]]; then - einfo "Fetching \e[1m${r}\e[22m ..." + einfo "Fetching ${r} ..." local fetch_command=( git fetch "${r}" ) local clone_type=${EGIT_CLONE_TYPE} @@ -817,7 +825,7 @@ git-r3_fetch() { # recursively fetch submodules if git cat-file -e "${local_ref}":.gitmodules &>/dev/null; then local submodules - _git-r3_set_submodules \ + _git-r3_set_submodules "${_GIT_SUBMODULE_PATH}" \ "$(git cat-file -p "${local_ref}":.gitmodules || die)" while [[ ${submodules[@]} ]]; do @@ -839,7 +847,9 @@ git-r3_fetch() { local subrepos _git-r3_set_subrepos "${url}" "${repos[@]}" - git-r3_fetch "${subrepos[*]}" "${commit}" "${local_id}/${subname}" + _GIT_SUBMODULE_PATH=${_GIT_SUBMODULE_PATH}${path}/ \ + git-r3_fetch "${subrepos[*]}" "${commit}" \ + "${local_id}/${subname}" "" fi submodules=( "${submodules[@]:3}" ) # shift @@ -892,7 +902,7 @@ git-r3_checkout() { local -x GIT_DIR _git-r3_set_gitdir "${repos[0]}" - einfo "Checking out \e[1m${repos[0]}\e[22m to \e[1m${out_dir}\e[22m ..." + einfo "Checking out ${repos[0]} to ${out_dir} ..." if ! git cat-file -e refs/git-r3/"${local_id}"/__main__; then die "Logic error: no local clone of ${repos[0]}. git-r3_fetch not used?" @@ -975,7 +985,7 @@ git-r3_checkout() { # recursively checkout submodules if [[ -f ${out_dir}/.gitmodules && ! ${checkout_paths} ]]; then local submodules - _git-r3_set_submodules \ + _git-r3_set_submodules "${_GIT_SUBMODULE_PATH}" \ "$(<"${out_dir}"/.gitmodules)" while [[ ${submodules[@]} ]]; do @@ -989,6 +999,7 @@ git-r3_checkout() { local subrepos _git-r3_set_subrepos "${url}" "${repos[@]}" + _GIT_SUBMODULE_PATH=${_GIT_SUBMODULE_PATH}${path}/ \ git-r3_checkout "${subrepos[*]}" "${out_dir}/${path}" \ "${local_id}/${subname}" fi @@ -1042,7 +1053,7 @@ git-r3_peek_remote_ref() { local r success for r in "${repos[@]}"; do - einfo "Peeking \e[1m${remote_ref}\e[22m on \e[1m${r}\e[22m ..." >&2 + einfo "Peeking ${remote_ref} on ${r} ..." >&2 local lookup_ref if [[ ${remote_ref} == refs/* || ${remote_ref} == HEAD ]] @@ -1098,9 +1109,9 @@ git-r3_pkg_needrebuild() { [[ ${new_commit_id} && ${EGIT_VERSION} ]] || die "Lookup failed" if [[ ${EGIT_VERSION} != ${new_commit_id} ]]; then - einfo "Update from \e[1m${EGIT_VERSION}\e[22m to \e[1m${new_commit_id}\e[22m" + einfo "Update from ${EGIT_VERSION} to ${new_commit_id}" else - einfo "Local and remote at \e[1m${EGIT_VERSION}\e[22m" + einfo "Local and remote at ${EGIT_VERSION}" fi [[ ${EGIT_VERSION} != ${new_commit_id} ]] diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass index 9c11959fdf84..89b32ed1201b 100644 --- a/eclass/go-module.eclass +++ b/eclass/go-module.eclass @@ -59,6 +59,10 @@ BDEPEND=">=dev-lang/go-1.12" # this will become the default in the future. export GO111MODULE=on +# Set the default for the go build cache +# See "go help environment" for information on this setting +export GOCACHE="${T}/go-build" + # The following go flags should be used for all builds. # -mod=vendor stopps downloading of dependencies from the internet. # -v prints the names of packages as they are compiled diff --git a/eclass/kde5-functions.eclass b/eclass/kde5-functions.eclass index 7bf5a9caa33f..bbb8d6d90f25 100644 --- a/eclass/kde5-functions.eclass +++ b/eclass/kde5-functions.eclass @@ -15,23 +15,11 @@ if [[ -z ${_KDE5_FUNCTIONS_ECLASS} ]]; then _KDE5_FUNCTIONS_ECLASS=1 -inherit toolchain-funcs - case ${EAPI} in 7) ;; *) die "EAPI=${EAPI:-0} is not supported" ;; esac -# @ECLASS-VARIABLE: KDE_BUILD_TYPE -# @DESCRIPTION: -# If PV matches "*9999*", this is automatically set to "live". -# Otherwise, this is automatically set to "release". -KDE_BUILD_TYPE="release" -if [[ ${PV} = *9999* ]]; then - KDE_BUILD_TYPE="live" -fi -export KDE_BUILD_TYPE - # @ECLASS-VARIABLE: QT_MINIMAL # @DESCRIPTION: # Minimum version of Qt to require. This affects add_qt_dep. @@ -52,40 +40,6 @@ export KDE_BUILD_TYPE # Minimum version of KDE Applications to require. This affects add_kdeapps_dep. : ${KDE_APPS_MINIMAL:=19.04.3} -# @ECLASS-VARIABLE: KDE_GCC_MINIMAL -# @DEFAULT_UNSET -# @DESCRIPTION: -# Minimum version of active GCC to require. This is checked in kde5.eclass in -# kde5_pkg_pretend and kde5_pkg_setup. - -# @FUNCTION: _check_gcc_version -# @INTERNAL -# @DESCRIPTION: -# Determine if the current GCC version is acceptable, otherwise die. -_check_gcc_version() { - if [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && tc-is-gcc; then - - local version=$(gcc-version) - local major=${version%.*} - local minor=${version#*.} - local min_major=${KDE_GCC_MINIMAL%.*} - local min_minor=${KDE_GCC_MINIMAL#*.} - - debug-print "GCC version check activated" - debug-print "Version detected:" - debug-print " - Full: ${version}" - debug-print " - Major: ${major}" - debug-print " - Minor: ${minor}" - debug-print "Version required:" - debug-print " - Major: ${min_major}" - debug-print " - Minor: ${min_minor}" - - [[ ${major} -lt ${min_major} ]] || \ - ( [[ ${major} -eq ${min_major} && ${minor} -lt ${min_minor} ]] ) \ - && die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later is required for this package (found ${version})." - fi -} - # @FUNCTION: _add_category_dep # @INTERNAL # @DESCRIPTION: diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass index ef45ba420d73..884d4b4a47d5 100644 --- a/eclass/kde5.eclass +++ b/eclass/kde5.eclass @@ -9,15 +9,16 @@ # @DESCRIPTION: # This eclass is *deprecated*. Please read the PORTING notes for switching to # ecm.eclass in case the package is using extra-cmake-modules, otherwise just -# use cmake-utils.eclass instead. For projects hosted on kde.org infrastructure, +# use cmake.eclass instead. For projects hosted on kde.org infrastructure, # inherit kde.org.eclass to fetch and unpack sources independent of the build # system being used. # # This eclass unconditionally inherits kde5-functions.eclass and all its public # functions and variables may be considered as part of this eclass's API. # -# This eclass unconditionally inherits kde.org.eclass and cmake-utils.eclass -# and all their public variables and helper functions (not phase functions) may +# This eclass unconditionally inherits kde.org.eclass and either ecm.eclass if +# KDE_AUTODEPS=true (default) or cmake.eclass if KDE_AUTODEPS=false. +# All their public variables and helper functions (not phase functions) may # be considered as part of this eclass's API. # # This eclass's phase functions are not intended to be mixed and matched, so if @@ -32,27 +33,7 @@ if [[ -z ${KDE_ORG_NAME} ]]; then KDE_ORG_NAME=${KMNAME:=$PN} fi -# @ECLASS-VARIABLE: VIRTUALX_REQUIRED -# @DESCRIPTION: -# For proper description see virtualx.eclass manpage. -# Here we redefine default value to be manual, if your package needs virtualx -# for tests you should proceed with setting VIRTUALX_REQUIRED=test. -: ${VIRTUALX_REQUIRED:=manual} - -inherit cmake-utils flag-o-matic kde.org kde5-functions virtualx xdg - -if [[ -v KDE_GCC_MINIMAL ]]; then - EXPORT_FUNCTIONS pkg_pretend -fi - -EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm - -# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS -# @DESCRIPTION: -# If set to "false", do nothing. -# For any other value, assume the package is using KDEInstallDirs macro and switch -# KDE_INSTALL_USE_QT_SYS_PATHS to ON. -: ${ECM_KDEINSTALLDIRS:=true} +inherit flag-o-matic kde.org kde5-functions xdg # @ECLASS-VARIABLE: KDE_AUTODEPS # @DESCRIPTION: @@ -65,7 +46,7 @@ EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_in # @ECLASS-VARIABLE: KDE_DEBUG # @DESCRIPTION: -# If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and -DQT_NO_DEBUG +# If set to "false", add -DNDEBUG (via cmake_src_configure) and -DQT_NO_DEBUG # to CPPFLAGS. # Otherwise, add debug to IUSE. # PORTING: ECM_DEBUG in ecm.eclass @@ -173,75 +154,95 @@ case ${KDE_SUBSLOT} in esac case ${KDE_AUTODEPS} in - false) ;; - *) - BDEPEND+=" $(add_frameworks_dep extra-cmake-modules)" - RDEPEND+=" >=kde-frameworks/kf-env-4" - COMMONDEPEND+=" $(add_qt_dep qtcore)" + false) + inherit cmake + # @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS + # @DESCRIPTION: + # If set to "false", do nothing. + # For any other value, assume the package is using KDEInstallDirs macro and switch + # KDE_INSTALL_USE_QT_SYS_PATHS to ON. + : ${ECM_KDEINSTALLDIRS:=true} + + case ${KDE_DEBUG} in + false) ;; + *) + IUSE+=" debug" + ;; + esac + case ${KDE_TEST} in + false) ;; + *) + IUSE+=" test" + DEPEND+=" test? ( dev-qt/qttest:5 )" + ;; + esac + ;; + *) # all packages need breeze/oxygen icons for basic iconset, bug #564838 if [[ ${PN} != breeze-icons && ${PN} != oxygen-icons ]]; then - RDEPEND+=" || ( $(add_frameworks_dep breeze-icons) kde-frameworks/oxygen-icons:* )" + ECM_NONGUI=false fi - ;; -esac - -case ${KDE_DEBUG} in - false) ;; - *) - IUSE+=" debug" - ;; -esac - -case ${KDE_DESIGNERPLUGIN} in - false) ;; - *) - IUSE+=" designer" - if [[ ${CATEGORY} = kde-apps && ${PV} = 19.0[48]* ]]; then - BDEPEND+=" designer? ( $(add_frameworks_dep kdesignerplugin) )" - else - BDEPEND+=" designer? ( $(add_qt_dep designer) )" + # propagate deprecated variables to ecm.eclass + if [[ -z ${ECM_DESIGNERPLUGIN} && ${CATEGORY} != kde-apps ]]; then + ECM_DESIGNERPLUGIN=${KDE_DESIGNERPLUGIN} + KDE_DESIGNERPLUGIN=false # use fallback var only for kde-apps fi -esac - -case ${KDE_EXAMPLES} in - false) ;; - *) - IUSE+=" examples" + [[ -z ${ECM_DEBUG} ]] && ECM_DEBUG=${KDE_DEBUG} + [[ -z ${ECM_EXAMPLES} ]] && ECM_EXAMPLES=${KDE_EXAMPLES} + [[ -z ${ECM_HANDBOOK} ]] && ECM_HANDBOOK=${KDE_HANDBOOK} + [[ -z ${ECM_HANDBOOK_DIR} ]] && ECM_HANDBOOK_DIR=${KDE_DOC_DIR} + [[ -z ${ECM_PO_DIRS} ]] && ECM_PO_DIRS=${KDE_PO_DIRS} + [[ -z ${ECM_QTHELP} ]] && ECM_QTHELP=${KDE_QTHELP} + [[ -z ${ECM_TEST} ]] && ECM_TEST=${KDE_TEST} + [[ -z ${KFMIN} ]] && KFMIN=${FRAMEWORKS_MINIMAL} + inherit ecm ;; esac -case ${KDE_HANDBOOK} in - false) ;; - *) - IUSE+=" +handbook" - BDEPEND+=" handbook? ( $(add_frameworks_dep kdoctools) )" - ;; -esac +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm -case ${KDE_QTHELP} in - false) ;; - *) - IUSE+=" doc" - COMMONDEPEND+=" doc? ( $(add_qt_dep qt-docs) )" - BDEPEND+=" doc? ( - $(add_qt_dep qthelp) - >=app-doc/doxygen-1.8.13-r1 - )" - ;; -esac +# @FUNCTION: _kde5_strip_handbook_translations +# @INTERNAL +# @DESCRIPTION: +# If LINGUAS is defined, enable only the requested translations when required. +_kde5_strip_handbook_translations() { + if ! [[ -v LINGUAS ]]; then + return + fi -case ${KDE_TEST} in - false) ;; - *) - IUSE+=" test" - DEPEND+=" test? ( $(add_qt_dep qttest) )" - ;; -esac + local lang po + for po in ${ECM_PO_DIRS}; do + if [[ -d ${po} ]] ; then + pushd ${po} > /dev/null || die + local lang + for lang in *; do + if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then + case ${lang} in + cmake_modules | \ + CMakeLists.txt | \ + ${PN}.pot) ;; + *) rm -r ${lang} || die ;; + esac + if [[ -e CMakeLists.txt ]] ; then + cmake_comment_add_subdirectory ${lang} + sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:space:]]*)/d" \ + -i CMakeLists.txt || die + fi + fi + done + popd > /dev/null || die + fi + done +} -DEPEND+=" ${COMMONDEPEND}" -RDEPEND+=" ${COMMONDEPEND}" -unset COMMONDEPEND +# @FUNCTION: cmake_use_find_package +# @USAGE: <USE flag> <package name> +# @DESCRIPTION: +# Compatibility alias for cmake.eclass -> cmake.eclass +cmake-utils_use_find_package() { + cmake_use_find_package "$@" ; +} # @FUNCTION: kde5_pkg_pretend # @DESCRIPTION: @@ -249,7 +250,10 @@ unset COMMONDEPEND # phase function is only exported if KDE_GCC_MINIMAL is defined. kde5_pkg_pretend() { debug-print-function ${FUNCNAME} "$@" - _check_gcc_version + case ${KDE_AUTODEPS} in + false) ;; + *) ecm_pkg_pretend ;; + esac } # @FUNCTION: kde5_pkg_setup @@ -257,7 +261,10 @@ kde5_pkg_pretend() { # Checks if the active compiler meets the minimum version requirements. kde5_pkg_setup() { debug-print-function ${FUNCNAME} "$@" - _check_gcc_version + case ${KDE_AUTODEPS} in + false) ;; + *) ecm_pkg_setup ;; + esac } # @FUNCTION: kde5_src_unpack @@ -270,67 +277,33 @@ kde5_src_unpack() { # @FUNCTION: kde5_src_prepare # @DESCRIPTION: -# Wrapper for cmake-utils_src_prepare with lots of extra logic for magic +# Wrapper for cmake_src_prepare with lots of extra logic for magic # handling of linguas, tests, handbook etc. kde5_src_prepare() { debug-print-function ${FUNCNAME} "$@" + case ${KDE_AUTODEPS} in + false) + cmake_src_prepare - cmake-utils_src_prepare - - # only build examples when required - if ! { in_iuse examples && use examples; } ; then - cmake_comment_add_subdirectory examples - fi - - # only enable handbook when required - if in_iuse handbook && ! use handbook ; then - cmake_comment_add_subdirectory ${KDE_DOC_DIR} - - if [[ ${KDE_HANDBOOK} = forceoptional ]] ; then - punt_bogus_dep KF5 DocTools - sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt || die - fi - fi - - # drop translations when nls is not wanted - if in_iuse nls && ! use nls ; then - local po - for po in ${KDE_PO_DIRS}; do - if [[ -d ${po} ]] ; then - rm -r ${po} || die - fi - done - fi + _kde5_strip_handbook_translations - # enable only the requested translations when required - # always install unconditionally for kconfigwidgets - if you use language - # X as system language, and there is a combobox with language names, the - # translated language name for language Y is taken from /usr/share/locale/Y/kf5_entry.desktop - if [[ -v LINGUAS && ${PN} != kconfigwidgets ]] ; then - local po - for po in ${KDE_PO_DIRS}; do - if [[ -d ${po} ]] ; then - pushd ${po} > /dev/null || die - local lang - for lang in *; do - if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then - case ${lang} in - cmake_modules | \ - CMakeLists.txt | \ - ${PN}.pot) ;; - *) rm -r ${lang} || die ;; - esac - if [[ -e CMakeLists.txt ]] ; then - cmake_comment_add_subdirectory ${lang} - sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:space:]]*)/d" \ - -i CMakeLists.txt || die - fi + # only build unit tests when required + if ! { in_iuse test && use test; } ; then + if [[ ${KDE_TEST} = forceoptional ]] ; then + punt_bogus_dep Qt5 Test + # if forceoptional, also cover non-kde categories + cmake_comment_add_subdirectory autotests test tests + elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then + cmake_comment_add_subdirectory autotests test tests fi - done - popd > /dev/null || die - fi - done - fi + fi + # in frameworks, tests = manual tests so never build them + if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules ]]; then + cmake_comment_add_subdirectory tests + fi + ;; + *) ecm_src_prepare ;; + esac # PORTING: bogus, overzealous 'en' docbook disabling is not carried over if [[ ${KDE_BUILD_TYPE} = release && ${CATEGORY} != kde-apps ]] ; then @@ -345,146 +318,81 @@ kde5_src_prepare() { popd > /dev/null || die fi fi - - # only build unit tests when required - if ! { in_iuse test && use test; } ; then - if [[ ${KDE_TEST} = forceoptional ]] ; then - punt_bogus_dep Qt5 Test - # if forceoptional, also cover non-kde categories - cmake_comment_add_subdirectory autotests test tests - elif [[ ${KDE_TEST} = forceoptional-recursive ]] ; then - punt_bogus_dep Qt5 Test - local f pf="${T}/${P}"-tests-optional.patch - touch ${pf} || die "Failed to touch patch file" - for f in $(find . -type f -name "CMakeLists.txt" -exec \ - grep -l "^\s*add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)" {} \;); do - cp ${f} ${f}.old || die "Failed to prepare patch origfile" - pushd ${f%/*} > /dev/null || die - punt_bogus_dep Qt5 Test - sed -i CMakeLists.txt -e \ - "/^#/! s/add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)/if(BUILD_TESTING)\n&\nendif()/" \ - || die - popd > /dev/null || die - diff -Naur ${f}.old ${f} 1>>${pf} - rm ${f}.old || die "Failed to clean up" - done - einfo "Build system was modified by KDE_TEST=forceoptional-recursive." - einfo "Unified diff file ready for pickup in:" - einfo " ${pf}" - einfo "Push it upstream to make this message go away." - elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then - cmake_comment_add_subdirectory autotests test tests - fi - fi - - # in frameworks, tests = manual tests so never build them - if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules ]]; then - cmake_comment_add_subdirectory tests - fi } # @FUNCTION: kde5_src_configure # @DESCRIPTION: -# Wrapper for cmake-utils_src_configure with extra logic for magic handling of +# Wrapper for cmake_src_configure with extra logic for magic handling of # handbook, tests etc. kde5_src_configure() { debug-print-function ${FUNCNAME} "$@" + case ${KDE_AUTODEPS} in + false) + # we rely on cmake.eclass to append -DNDEBUG too + if in_iuse debug && ! use debug; then + append-cppflags -DQT_NO_DEBUG + fi - # we rely on cmake-utils.eclass to append -DNDEBUG too - if in_iuse debug && ! use debug; then - append-cppflags -DQT_NO_DEBUG - fi - - local cmakeargs - - if in_iuse test && ! use test ; then - cmakeargs+=( -DBUILD_TESTING=OFF ) - - if [[ ${KDE_TEST} = optional ]] ; then - cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON ) - fi - fi - - if in_iuse handbook && ! use handbook && [[ ${KDE_HANDBOOK} = optional ]] ; then - cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON ) - fi - - if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then - if [[ ${CATEGORY} = kde-frameworks ]]; then - cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) ) - else - cmakeargs+=( $(cmake-utils_use_find_package designer KF5DesignerPlugin) ) - fi - fi + local cmakeargs - if [[ ${KDE_QTHELP} != false ]]; then - cmakeargs+=( -DBUILD_QCH=$(usex doc) ) - fi + if in_iuse test && ! use test ; then + cmakeargs+=( -DBUILD_TESTING=OFF ) - if [[ ${ECM_KDEINSTALLDIRS} != false ]] ; then - cmakeargs+=( - # install mkspecs in the same directory as qt stuff - -DKDE_INSTALL_USE_QT_SYS_PATHS=ON - # move handbook outside of doc dir, bug 667138 - -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help" - ) - fi + if [[ ${KDE_TEST} = optional ]] ; then + cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON ) + fi + fi + if [[ ${ECM_KDEINSTALLDIRS} != false ]] ; then + cmakeargs+=( + # install mkspecs in the same directory as qt stuff + -DKDE_INSTALL_USE_QT_SYS_PATHS=ON + # move handbook outside of doc dir, bug 667138 + -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help" + ) + fi - # allow the ebuild to override what we set here - mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}") + # allow the ebuild to override what we set here + mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}") - cmake-utils_src_configure + cmake_src_configure + ;; + *) ecm_src_configure ;; + esac } # @FUNCTION: kde5_src_compile # @DESCRIPTION: -# Wrapper for cmake-utils_src_compile. Currently doesn't do anything extra, but +# Wrapper for cmake_src_compile. Currently doesn't do anything extra, but # is included as part of the API just in case it's needed in the future. kde5_src_compile() { debug-print-function ${FUNCNAME} "$@" - - cmake-utils_src_compile "$@" + case ${KDE_AUTODEPS} in + false) cmake_src_compile ;; + *) ecm_src_compile ;; + esac } # @FUNCTION: kde5_src_test # @DESCRIPTION: -# Wrapper for cmake-utils_src_test with extra logic for magic handling of dbus +# Wrapper for cmake_src_test with extra logic for magic handling of dbus # and virtualx. kde5_src_test() { debug-print-function ${FUNCNAME} "$@" - - _test_runner() { - if [[ -n "${VIRTUALDBUS_TEST}" ]]; then - export $(dbus-launch) - fi - - cmake-utils_src_test - } - - # When run as normal user during ebuild development with the ebuild command, the - # kde tests tend to access the session DBUS. This however is not possible in a real - # emerge or on the tinderbox. - # > make sure it does not happen, so bad tests can be recognized and disabled - unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID - - if [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]]; then - virtx _test_runner - else - _test_runner - fi - - if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then - kill ${DBUS_SESSION_BUS_PID} - fi + case ${KDE_AUTODEPS} in + false) cmake_src_test ;; + *) ecm_src_test ;; + esac } # @FUNCTION: kde5_src_install # @DESCRIPTION: -# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra. +# Wrapper for cmake_src_install. Currently doesn't do anything extra. kde5_src_install() { debug-print-function ${FUNCNAME} "$@" - - cmake-utils_src_install + case ${KDE_AUTODEPS} in + false) cmake_src_install ;; + *) ecm_src_install ;; + esac } # @FUNCTION: kde5_pkg_preinst @@ -492,8 +400,10 @@ kde5_src_install() { # Sets up environment variables required in kde5_pkg_postinst. kde5_pkg_preinst() { debug-print-function ${FUNCNAME} "$@" - - xdg_pkg_preinst + case ${KDE_AUTODEPS} in + false) xdg_pkg_preinst ;; + *) ecm_pkg_preinst ;; + esac } # @FUNCTION: kde5_pkg_postinst @@ -501,17 +411,10 @@ kde5_pkg_preinst() { # Updates the various XDG caches (icon, desktop, mime) if necessary. kde5_pkg_postinst() { debug-print-function ${FUNCNAME} "$@" - - xdg_pkg_postinst - - if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then - if [[ ${KDE_BUILD_TYPE} = live ]]; then - echo - einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}" - einfo "Use it at your own risk." - einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!" - fi - fi + case ${KDE_AUTODEPS} in + false) xdg_pkg_postinst ;; + *) ecm_pkg_postinst ;; + esac } # @FUNCTION: kde5_pkg_postrm @@ -519,8 +422,10 @@ kde5_pkg_postinst() { # Updates the various XDG caches (icon, desktop, mime) if necessary. kde5_pkg_postrm() { debug-print-function ${FUNCNAME} "$@" - - xdg_pkg_postrm + case ${KDE_AUTODEPS} in + false) xdg_pkg_postrm ;; + *) ecm_pkg_postrm ;; + esac } fi diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass new file mode 100644 index 000000000000..028f0da8148e --- /dev/null +++ b/eclass/kernel-build.eclass @@ -0,0 +1,175 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: kernel-build.eclass +# @MAINTAINER: +# Distribution Kernel Project <dist-kernel@gentoo.org> +# @AUTHOR: +# Michał Górny <mgorny@gentoo.org> +# @SUPPORTED_EAPIS: 7 +# @BLURB: Build mechanics for Distribution Kernels +# @DESCRIPTION: +# This eclass provides the logic to build a Distribution Kernel from +# source and install it. Post-install and test logic is inherited +# from kernel-install.eclass. +# +# The ebuild must take care of unpacking the kernel sources, copying +# an appropriate .config into them (e.g. in src_prepare()) and setting +# correct S. The eclass takes care of respecting savedconfig, building +# the kernel and installing it along with its modules and subset +# of sources needed to build external modules. + +if [[ ! ${_KERNEL_BUILD_ECLASS} ]]; then + +case "${EAPI:-0}" in + 0|1|2|3|4|5|6) + die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" + ;; + 7) + ;; + *) + die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" + ;; +esac + +inherit savedconfig toolchain-funcs kernel-install + +BDEPEND=" + sys-devel/bc + virtual/libelf" + +# @FUNCTION: kernel-build_src_configure +# @DESCRIPTION: +# Prepare the toolchain for building the kernel, get the default .config +# or restore savedconfig, and get build tree configured for modprep. +kernel-build_src_configure() { + debug-print-function ${FUNCNAME} "${@}" + + # force ld.bfd if we can find it easily + local LD="$(tc-getLD)" + if type -P "${LD}.bfd" &>/dev/null; then + LD+=.bfd + fi + + tc-export_build_env + MAKEARGS=( + V=1 + + HOSTCC="$(tc-getBUILD_CC)" + HOSTCXX="$(tc-getBUILD_CXX)" + HOSTCFLAGS="${BUILD_CFLAGS}" + HOSTLDFLAGS="${BUILD_LDFLAGS}" + + CROSS_COMPILE=${CHOST}- + AS="$(tc-getAS)" + CC="$(tc-getCC)" + LD="${LD}" + AR="$(tc-getAR)" + NM="$(tc-getNM)" + STRIP=":" + OBJCOPY="$(tc-getOBJCOPY)" + OBJDUMP="$(tc-getOBJDUMP)" + + # we need to pass it to override colliding Gentoo envvar + ARCH=$(tc-arch-kernel) + ) + + [[ -f .config ]] || die "Ebuild error: please copy default config into .config" + restore_config .config + + mkdir -p "${WORKDIR}"/modprep || die + mv .config "${WORKDIR}"/modprep/ || die + emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig + emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" modules_prepare + cp -pR "${WORKDIR}"/modprep "${WORKDIR}"/build || die +} + +# @FUNCTION: kernel-build_src_compile +# @DESCRIPTION: +# Compile the kernel sources. +kernel-build_src_compile() { + debug-print-function ${FUNCNAME} "${@}" + + emake O="${WORKDIR}"/build "${MAKEARGS[@]}" all +} + +# @FUNCTION: kernel-build_src_test +# @DESCRIPTION: +# Test the built kernel via qemu. This just wraps the logic +# from kernel-install.eclass with the correct paths. +kernel-build_src_test() { + debug-print-function ${FUNCNAME} "${@}" + + emake O="${WORKDIR}"/build "${MAKEARGS[@]}" \ + INSTALL_MOD_PATH="${T}" modules_install + + kernel-install_test "${PV}" \ + "${WORKDIR}/build/$(kernel-install_get_image_path)" \ + "${T}/lib/modules/${PV}" +} + +# @FUNCTION: kernel-build_src_install +# @DESCRIPTION: +# Install the built kernel along with subset of sources +# into /usr/src/linux-${PV}. Install the modules. Save the config. +kernel-build_src_install() { + debug-print-function ${FUNCNAME} "${@}" + + # do not use 'make install' as it behaves differently based + # on what kind of installkernel is installed + emake O="${WORKDIR}"/build "${MAKEARGS[@]}" \ + INSTALL_MOD_PATH="${ED}" modules_install + + # note: we're using mv rather than doins to save space and time + # install main and arch-specific headers first, and scripts + local kern_arch=$(tc-arch-kernel) + dodir "/usr/src/linux-${PV}/arch/${kern_arch}" + mv include scripts "${ED}/usr/src/linux-${PV}/" || die + mv "arch/${kern_arch}/include" \ + "${ED}/usr/src/linux-${PV}/arch/${kern_arch}/" || die + + # remove everything but Makefile* and Kconfig* + find -type f '!' '(' -name 'Makefile*' -o -name 'Kconfig*' ')' \ + -delete || die + find -type l -delete || die + cp -p -R * "${ED}/usr/src/linux-${PV}/" || die + + cd "${WORKDIR}" || die + # strip out-of-source build stuffs from modprep + # and then copy built files as well + find modprep -type f '(' \ + -name Makefile -o \ + -name '*.[ao]' -o \ + '(' -name '.*' -a -not -name '.config' ')' \ + ')' -delete || die + rm modprep/source || die + cp -p -R modprep/. "${ED}/usr/src/linux-${PV}"/ || die + + # install the kernel and files needed for module builds + insinto "/usr/src/linux-${PV}" + doins build/{System.map,Module.symvers} + local image_path=$(kernel-install_get_image_path) + cp -p "build/${image_path}" "${ED}/usr/src/linux-${PV}/${image_path}" || die + + # strip empty directories + find "${D}" -type d -empty -exec rmdir {} + || die + + # fix source tree and build dir symlinks + dosym ../../../usr/src/linux-${PV} /lib/modules/${PV}/build + dosym ../../../usr/src/linux-${PV} /lib/modules/${PV}/source + + save_config build/.config +} + +# @FUNCTION: kernel-build_pkg_postinst +# @DESCRIPTION: +# Combine postinst from kernel-install and savedconfig eclasses. +kernel-build_pkg_postinst() { + kernel-install_pkg_postinst + savedconfig_pkg_postinst +} + +_KERNEL_BUILD_ECLASS=1 +fi + +EXPORT_FUNCTIONS src_configure src_compile src_test src_install pkg_postinst diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass new file mode 100644 index 000000000000..7e64f44c8c33 --- /dev/null +++ b/eclass/kernel-install.eclass @@ -0,0 +1,311 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: kernel-install.eclass +# @MAINTAINER: +# Distribution Kernel Project <dist-kernel@gentoo.org> +# @AUTHOR: +# Michał Górny <mgorny@gentoo.org> +# @SUPPORTED_EAPIS: 7 +# @BLURB: Installation mechanics for Distribution Kernels +# @DESCRIPTION: +# This eclass provides the logic needed to test and install different +# kinds of Distribution Kernel packages, including both kernels built +# from source and distributed as binaries. The eclass relies on the +# ebuild installing a subset of built kernel tree into +# /usr/src/linux-${PV} containing the kernel image in its standard +# location and System.map. +# +# The eclass exports src_test, pkg_postinst and pkg_postrm. +# Additionally, the inherited mount-boot eclass exports pkg_pretend. +# It also stubs out pkg_preinst and pkg_prerm defined by mount-boot. + +if [[ ! ${_KERNEL_INSTALL_ECLASS} ]]; then + +case "${EAPI:-0}" in + 0|1|2|3|4|5|6) + die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" + ;; + 7) + ;; + *) + die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" + ;; +esac + +inherit mount-boot + +TCL_VER=10.1 +SRC_URI+=" + test? ( + amd64? ( + https://dev.gentoo.org/~mgorny/dist/tinycorelinux-${TCL_VER}-amd64.qcow2 + ) + x86? ( + https://dev.gentoo.org/~mgorny/dist/tinycorelinux-${TCL_VER}-x86.qcow2 + ) + )" + +SLOT="${PV}" +IUSE="+initramfs test" +RESTRICT+=" !test? ( test ) test? ( userpriv )" + +# install-DEPEND actually +# note: we need installkernel with initramfs support! +RDEPEND=" + || ( + sys-kernel/installkernel-gentoo + sys-kernel/installkernel-systemd-boot + ) + initramfs? ( >=sys-kernel/dracut-049-r3 )" +BDEPEND=" + test? ( + dev-tcltk/expect + sys-kernel/dracut + amd64? ( app-emulation/qemu[qemu_softmmu_targets_x86_64] ) + x86? ( app-emulation/qemu[qemu_softmmu_targets_i386] ) + )" + +# @FUNCTION: kernel-install_build_initramfs +# @USAGE: <output> <version> +# @DESCRIPTION: +# Build an initramfs for the kernel. <output> specifies the absolute +# path where initramfs will be created, while <version> specifies +# the kernel version, used to find modules. +kernel-install_build_initramfs() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments" + local output=${1} + local version=${2} + + ebegin "Building initramfs via dracut" + dracut --force "${output}" "${version}" + eend ${?} || die "Building initramfs failed" +} + +# @FUNCTION: kernel-install_get_image_path +# @DESCRIPTION: +# Get relative kernel image path specific to the current ${ARCH}. +kernel-install_get_image_path() { + case ${ARCH} in + amd64|x86) + echo arch/x86/boot/bzImage + ;; + *) + die "${FUNCNAME}: unsupported ARCH=${ARCH}" + ;; + esac +} + +# @FUNCTION: kernel-install_install_kernel +# @USAGE: <version> <image> <system.map> +# @DESCRIPTION: +# Install kernel using installkernel tool. <version> specifies +# the kernel version, <image> full path to the image, <system.map> +# full path to System.map. +kernel-install_install_kernel() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments" + local version=${1} + local image=${2} + local map=${3} + + ebegin "Installing the kernel via installkernel" + # note: .config is taken relatively to System.map; + # initrd relatively to bzImage + installkernel "${version}" "${image}" "${map}" + eend ${?} || die "Installing the kernel failed" +} + +# @FUNCTION: kernel-install_update_symlink +# @USAGE: <target> <version> +# @DESCRIPTION: +# Update the kernel source symlink at <target> (full path) with a link +# to <target>-<version> if it's either missing or pointing out to +# an older version of this package. +kernel-install_update_symlink() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments" + local target=${1} + local version=${2} + + if [[ ! -e ${target} ]]; then + ebegin "Creating ${target} symlink" + ln -f -n -s "${target##*/}-${version}" "${target}" + eend ${?} + else + local symlink_target=$(readlink "${target}") + local symlink_ver=${symlink_target#${target##*/}-} + if [[ ${symlink_target} == ${target##*/}-* && \ + -z ${symlink_ver//[0-9.]/} ]] + then + local symlink_pkg=${CATEGORY}/${PN}-${symlink_ver} + # if the current target is either being replaced, or still + # installed (probably depclean candidate), update the symlink + if has "${symlink_ver}" ${REPLACING_VERSIONS} || + has_version -r "~${symlink_pkg}" + then + ebegin "Updating ${target} symlink" + ln -f -n -s "${target##*/}-${version}" "${target}" + eend ${?} + fi + fi + fi +} + +# @FUNCTION: kernel-install_get_qemu_arch +# @DESCRIPTION: +# Get appropriate qemu suffix for the current ${ARCH}. +kernel-install_get_qemu_arch() { + debug-print-function ${FUNCNAME} "${@}" + + case ${ARCH} in + amd64) + echo x86_64 + ;; + x86) + echo i386 + ;; + *) + die "${FUNCNAME}: unsupported ARCH=${ARCH}" + ;; + esac +} + +# @FUNCTION: kernel-install_test +# @USAGE: <version> <image> <modules> +# @DESCRIPTION: +# Test that the kernel can successfully boot a minimal system image +# in qemu. <version> is the kernel version, <image> path to the image, +# <modules> path to module tree. +kernel-install_test() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments" + local version=${1} + local image=${2} + local modules=${3} + + local qemu_arch=$(kernel-install_get_qemu_arch) + + dracut \ + --conf /dev/null \ + --confdir /dev/null \ + --no-hostonly \ + --kmoddir "${modules}" \ + "${T}/initrd" "${version}" || die + # get a read-write copy of the disk image + cp "${DISTDIR}/tinycorelinux-${TCL_VER}-${ARCH}.qcow2" \ + "${T}/fs.qcow2" || die + + cd "${T}" || die + cat > run.sh <<-EOF || die + #!/bin/sh + exec qemu-system-${qemu_arch} \ + -m 256M \ + -display none \ + -no-reboot \ + -kernel '${image}' \ + -initrd '${T}/initrd' \ + -serial mon:stdio \ + -hda '${T}/fs.qcow2' \ + -append 'root=/dev/sda console=ttyS0,115200n8' + EOF + chmod +x run.sh || die + # TODO: initramfs does not let core finish starting on some systems, + # figure out how to make it better at that + expect - <<-EOF || die "Booting kernel failed" + set timeout 900 + spawn ./run.sh + expect { + "Kernel panic" { + send_error "\n* Kernel panic" + exit 1 + } + "Entering emergency mode" { + send_error "\n* Initramfs failed to start the system" + exit 1 + } + "Core 10.1" { + send_error "\n* Booted successfully" + exit 0 + } + timeout { + send_error "\n* Kernel boot timed out" + exit 2 + } + } + EOF +} + +# @FUNCTION: kernel-install_src_test +# @DESCRIPTION: +# Boilerplate function to remind people to call the tests. +kernel-install_src_test() { + debug-print-function ${FUNCNAME} "${@}" + + die "Please redefine src_test() and call kernel-install_test()." +} + +# @FUNCTION: kernel-install_pkg_preinst +# @DESCRIPTION: +# Stub out mount-boot.eclass. +kernel-install_pkg_preinst() { + debug-print-function ${FUNCNAME} "${@}" + + # (no-op) +} + +# @FUNCTION: kernel-install_pkg_postinst +# @DESCRIPTION: +# Build an initramfs for the kernel, install it and update +# the /usr/src/linux symlink. +kernel-install_pkg_postinst() { + debug-print-function ${FUNCNAME} "${@}" + + if [[ -z ${ROOT} ]]; then + mount-boot_pkg_preinst + + local image_path=$(kernel-install_get_image_path) + if use initramfs; then + # putting it alongside kernel image as 'initrd' makes + # kernel-install happier + kernel-install_build_initramfs \ + "${EROOT}/usr/src/linux-${PV}/${image_path%/*}/initrd" \ + "${PV}" + fi + + kernel-install_install_kernel "${PV}" \ + "${EROOT}/usr/src/linux-${PV}/${image_path}" \ + "${EROOT}/usr/src/linux-${PV}/System.map" + fi + + kernel-install_update_symlink "${EROOT}/usr/src/linux" "${PV}" +} + +# @FUNCTION: kernel-install_pkg_prerm +# @DESCRIPTION: +# Stub out mount-boot.eclass. +kernel-install_pkg_prerm() { + debug-print-function ${FUNCNAME} "${@}" + + # (no-op) +} + +# @FUNCTION: kernel-install_pkg_postrm +# @DESCRIPTION: +# No-op at the moment. Will be used to remove obsolete kernels +# in the future. +kernel-install_pkg_postrm() { + debug-print-function ${FUNCNAME} "${@}" + + # (no-op at the moment) +} + +_KERNEL_INSTALL_ECLASS=1 +fi + +EXPORT_FUNCTIONS src_test pkg_preinst pkg_postinst pkg_prerm pkg_postrm diff --git a/eclass/kodi-addon.eclass b/eclass/kodi-addon.eclass index e924dbdd6972..914ee3e9f750 100644 --- a/eclass/kodi-addon.eclass +++ b/eclass/kodi-addon.eclass @@ -9,13 +9,12 @@ # @DESCRIPTION: # Provides a src_configure function for correct CMake configuration -inherit cmake-utils - case "${EAPI:-0}" in 4|5|6) - inherit multilib + inherit cmake-utils multilib ;; 7) + inherit cmake ;; *) die "EAPI=${EAPI} is not supported" ;; esac @@ -31,5 +30,8 @@ kodi-addon_src_configure() { -DCMAKE_INSTALL_LIBDIR=${EPREFIX%/}/usr/$(get_libdir)/kodi ) - cmake-utils_src_configure + case ${EAPI} in + 4|5|6) cmake-utils_src_configure ;; + 7) cmake_src_configure ;; + esac } diff --git a/eclass/llvm.org.eclass b/eclass/llvm.org.eclass index f07441e863c3..d9ea22ab2aca 100644 --- a/eclass/llvm.org.eclass +++ b/eclass/llvm.org.eclass @@ -126,7 +126,7 @@ llvm.org_set_globals() { elif [[ ${_LLVM_SOURCE_TYPE} == tar ]]; then if ver_test -ge 9.0.1_rc1; then # 9.0.1 RCs as GitHub archive - SRC_URI=" + SRC_URI+=" https://github.com/llvm/llvm-project/archive/llvmorg-${PV/_/-}.tar.gz" else local a archives=() @@ -198,7 +198,7 @@ llvm.org_src_unpack() { tar -x -z -o --strip-components 1 \ -f "${DISTDIR}/${archive}" \ "${components[@]/#/llvm-project-${archive%.tar*}/}" || die - eend + eend ${?} else local c archives # TODO: optimize this @@ -212,7 +212,7 @@ llvm.org_src_unpack() { mkdir -p "${top_dir}" || die tar -C "${top_dir}" -x -J -o --strip-components 1 \ -f "${DISTDIR}/${archives[0]}" "${sub_path}" || die - eend + eend ${?} done fi fi diff --git a/eclass/meson.eclass b/eclass/meson.eclass index fa859ace996f..e642ac49af9b 100644 --- a/eclass/meson.eclass +++ b/eclass/meson.eclass @@ -50,8 +50,8 @@ EXPORT_FUNCTIONS src_configure src_compile src_test src_install if [[ -z ${_MESON_ECLASS} ]]; then _MESON_ECLASS=1 -MESON_DEPEND=">=dev-util/meson-0.48.2 - >=dev-util/ninja-1.7.2" +MESON_DEPEND=">=dev-util/meson-0.51.2 + >=dev-util/ninja-1.8.2" if [[ ${EAPI:-0} == [6] ]]; then DEPEND=${MESON_DEPEND} diff --git a/eclass/mozconfig-v6.52.eclass b/eclass/mozconfig-v6.52.eclass index c0b4b47155e7..698b8b24b24f 100644 --- a/eclass/mozconfig-v6.52.eclass +++ b/eclass/mozconfig-v6.52.eclass @@ -126,7 +126,7 @@ RDEPEND=">=app-text/hunspell-1.2:= x11-libs/libXfixes x11-libs/libXrender x11-libs/libXt - system-cairo? ( >=x11-libs/cairo-1.12[X,xcb] >=x11-libs/pixman-0.19.2 ) + system-cairo? ( >=x11-libs/cairo-1.12[X,xcb(+)] >=x11-libs/pixman-0.19.2 ) system-icu? ( >=dev-libs/icu-58.1:= ) system-jpeg? ( >=media-libs/libjpeg-turbo-1.2.1 ) system-libevent? ( >=dev-libs/libevent-2.0:0=[threads] ) diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass index 00f02df98fdf..f20b27b7643a 100644 --- a/eclass/multilib-build.eclass +++ b/eclass/multilib-build.eclass @@ -369,8 +369,8 @@ multilib_copy_sources() { # MULTILIB_CHOST_TOOLS=( # /usr/bin/foo-config # ) - # @CODE + # @FUNCTION: multilib_prepare_wrappers # @USAGE: [<install-root>] # @DESCRIPTION: diff --git a/eclass/obs-download.eclass b/eclass/obs-download.eclass index e40cdd2876fa..d700f18edbd4 100644 --- a/eclass/obs-download.eclass +++ b/eclass/obs-download.eclass @@ -1,6 +1,9 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +# @DEAD +# All consumers were last rited. Removal in 30 days. + # @ECLASS: obs-download.eclass # @MAINTAINER: # maintainer-needed@gentoo.org diff --git a/eclass/obs-service.eclass b/eclass/obs-service.eclass index faa879c0636e..ed568e493b89 100644 --- a/eclass/obs-service.eclass +++ b/eclass/obs-service.eclass @@ -1,6 +1,9 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +# @DEAD +# All consumers were last rited. Removal in 30 days. + # @ECLASS: obs-service.eclass # @MAINTAINER: # maintainer-needed@gentoo.org diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass index 3863ef6fa849..878e337ff3c2 100644 --- a/eclass/python-any-r1.eclass +++ b/eclass/python-any-r1.eclass @@ -7,7 +7,7 @@ # @AUTHOR: # Author: Michał Górny <mgorny@gentoo.org> # Based on work of: Krzysztof Pawlik <nelchael@gentoo.org> -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 +# @SUPPORTED_EAPIS: 5 6 7 # @BLURB: An eclass for packages having build-time dependency on Python. # @DESCRIPTION: # A minimal eclass for packages which need any Python interpreter @@ -37,11 +37,9 @@ # https://wiki.gentoo.org/wiki/Project:Python/python-any-r1 case "${EAPI:-0}" in - 0|1|2|3|4|5|6|7) - ;; - *) - die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" - ;; + [0-4]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;; + [5-7]) ;; + *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;; esac if [[ ! ${_PYTHON_ANY_R1} ]]; then diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass index e87b59967cde..dd350a436fa5 100644 --- a/eclass/python-r1.eclass +++ b/eclass/python-r1.eclass @@ -126,7 +126,7 @@ fi # @CODE # dev-lang/python-exec:= # python_targets_python2_7? ( dev-lang/python:2.7[gdbm] ) -# python_targets_pypy? ( virtual/pypy[gdbm] ) +# python_targets_pypy? ( dev-python/pypy[gdbm] ) # @CODE # @ECLASS-VARIABLE: PYTHON_USEDEP diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass index f042bf4e1167..b82c3a29f5c4 100644 --- a/eclass/python-single-r1.eclass +++ b/eclass/python-single-r1.eclass @@ -136,7 +136,7 @@ EXPORT_FUNCTIONS pkg_setup # @CODE # dev-lang/python-exec:= # python_single_target_python2_7? ( dev-lang/python:2.7[gdbm] ) -# python_single_target_pypy? ( virtual/pypy[gdbm] ) +# python_single_target_pypy? ( dev-python/pypy[gdbm] ) # @CODE # @ECLASS-VARIABLE: PYTHON_USEDEP diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 3eadc50f93e6..91a32434dfaa 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: python-utils-r1.eclass @@ -7,7 +7,7 @@ # @AUTHOR: # Author: Michał Górny <mgorny@gentoo.org> # Based on work of: Krzysztof Pawlik <nelchael@gentoo.org> -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 +# @SUPPORTED_EAPIS: 5 6 7 # @BLURB: Utility functions for packages with Python parts. # @DESCRIPTION: # A utility eclass providing functions to query Python implementations, @@ -20,11 +20,9 @@ # https://wiki.gentoo.org/wiki/Project:Python/python-utils-r1 case "${EAPI:-0}" in - 0|1|2|3|4|5|6|7) - ;; - *) - die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" - ;; + [0-4]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;; + [5-7]) ;; + *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;; esac if [[ ${_PYTHON_ECLASS_INHERITED} ]]; then @@ -33,7 +31,7 @@ fi if [[ ! ${_PYTHON_UTILS_R1} ]]; then -[[ ${EAPI:-0} == [012345] ]] && inherit eutils multilib +[[ ${EAPI} == 5 ]] && inherit eutils multilib inherit toolchain-funcs # @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS @@ -41,10 +39,9 @@ inherit toolchain-funcs # @DESCRIPTION: # All supported Python implementations, most preferred last. _PYTHON_ALL_IMPLS=( - jython2_7 - pypy pypy3 + pypy3 python2_7 - python3_5 python3_6 python3_7 python3_8 + python3_6 python3_7 python3_8 ) readonly _PYTHON_ALL_IMPLS @@ -80,17 +77,12 @@ _python_impl_supported() { # keep in sync with _PYTHON_ALL_IMPLS! # (not using that list because inline patterns shall be faster) case "${impl}" in - python2_7|python3_[5678]|jython2_7) + python2_7|python3_[678]|pypy3) return 0 ;; - pypy1_[89]|pypy2_0|python2_[56]|python3_[1234]) + jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345]) return 1 ;; - pypy|pypy3) - if [[ ${EAPI:-0} == [01234] ]]; then - die "PyPy is supported in EAPI 5 and newer only." - fi - ;; *) [[ ${PYTHON_COMPAT_NO_STRICT} ]] && return 1 die "Invalid implementation in PYTHON_COMPAT: ${impl}" @@ -480,9 +472,9 @@ python_export() { python*) PYTHON_PKG_DEP="dev-lang/python:${impl#python}";; pypy) - PYTHON_PKG_DEP='>=virtual/pypy-5:0=';; + PYTHON_PKG_DEP='>=dev-python/pypy-5:0=';; pypy3) - PYTHON_PKG_DEP='>=virtual/pypy3-5:0=';; + PYTHON_PKG_DEP='>=dev-python/pypy3-5:0=';; jython2.7) PYTHON_PKG_DEP='dev-java/jython:2.7';; *) @@ -776,9 +768,6 @@ python_newexe() { [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>" - if [[ ${EAPI:-0} == [0123] ]]; then - die "python_do* and python_new* helpers are banned in EAPIs older than 4." - fi local wrapd=${python_scriptroot:-/usr/bin} @@ -906,9 +895,6 @@ python_domodule() { debug-print-function ${FUNCNAME} "${@}" [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' - if [[ ${EAPI:-0} == [0123] ]]; then - die "python_do* and python_new* helpers are banned in EAPIs older than 4." - fi local d if [[ ${python_moduleroot} == /* ]]; then @@ -948,9 +934,6 @@ python_doheader() { debug-print-function ${FUNCNAME} "${@}" [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' - if [[ ${EAPI:-0} == [0123] ]]; then - die "python_do* and python_new* helpers are banned in EAPIs older than 4." - fi local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR} [[ ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR @@ -1093,10 +1076,7 @@ python_is_installed() { [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON" local hasv_args=() - case ${EAPI:-0} in - 0|1|2|3|4) - local -x ROOT=/ - ;; + case ${EAPI} in 5|6) hasv_args+=( --host-root ) ;; @@ -1265,7 +1245,7 @@ python_fix_shebang() { if [[ ! ${any_fixed} ]]; then local cmd=eerror - [[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn + [[ ${EAPI} == 5 ]] && cmd=eqawarn "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files." if [[ ${any_correct} ]]; then diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass index 2bee3a3fae47..e1b32e71ab4f 100644 --- a/eclass/qt5-build.eclass +++ b/eclass/qt5-build.eclass @@ -643,6 +643,9 @@ qt5_base_configure() { # enable in respective modules to avoid poisoning QT.global_private.enabled_features -no-gui -no-widgets + # QTBUG-76521, default will change to zstd in Qt6 + $([[ ${QT5_MINOR_VERSION} -ge 13 ]] && echo -no-zstd) + # module-specific options "${myconf[@]}" ) diff --git a/eclass/ruby-ng.eclass b/eclass/ruby-ng.eclass index db701d81f4fc..f92547b49a9f 100644 --- a/eclass/ruby-ng.eclass +++ b/eclass/ruby-ng.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2019 Gentoo Authors +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: ruby-ng.eclass @@ -137,7 +137,7 @@ ruby_samelib() { local res= for _ruby_implementation in $(_ruby_get_all_impls); do has -${_ruby_implementation} $@ || \ - res="${res}ruby_targets_${_ruby_implementation}?," + res="${res}ruby_targets_${_ruby_implementation}(-)?," done echo "[${res%,}]" @@ -151,9 +151,9 @@ _ruby_atoms_samelib_generic() { "||" | "(" | ")" | *"?") echo "${token}" ;; *]) - echo "${token%[*}[RUBYTARGET,${token/*[}" ;; + echo "${token%[*}[RUBYTARGET(-),${token/*[}" ;; *) - echo "${token}[RUBYTARGET]" ;; + echo "${token}[RUBYTARGET(-)]" ;; esac done echo ")" diff --git a/eclass/ruby-utils.eclass b/eclass/ruby-utils.eclass index 89d06fd75e33..2934c94ffac9 100644 --- a/eclass/ruby-utils.eclass +++ b/eclass/ruby-utils.eclass @@ -28,10 +28,10 @@ if [[ ! ${_RUBY_UTILS} ]]; then # provide for a better first installation experience. # All stable RUBY_TARGETS -RUBY_TARGETS_PREFERENCE="ruby24 " +RUBY_TARGETS_PREFERENCE="ruby25 ruby24 " # All other active ruby targets -RUBY_TARGETS_PREFERENCE+="ruby25 ruby26" +RUBY_TARGETS_PREFERENCE+="ruby26 ruby27" _ruby_implementation_depend() { @@ -75,6 +75,10 @@ _ruby_implementation_depend() { rubypn="dev-lang/ruby" rubyslot=":2.6" ;; + ruby27) + rubypn="dev-lang/ruby" + rubyslot=":2.7" + ;; ree18) rubypn="dev-lang/ruby-enterprise" rubyslot=":1.8" diff --git a/eclass/subversion.eclass b/eclass/subversion.eclass index 6d26820bc090..093c83967bf4 100644 --- a/eclass/subversion.eclass +++ b/eclass/subversion.eclass @@ -72,7 +72,7 @@ ESVN_OPTIONS="${ESVN_OPTIONS:-}" # @DESCRIPTION: # repository uri # -# e.g. http://foo/trunk, svn://bar/trunk, svn://bar/branch/foo@1234 +# e.g. http://example.org/trunk, svn://example.org/branch/foo@1234 # # supported URI schemes: # http:// diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh index b0b97ea0bc1e..90eaf3a6ffb0 100755 --- a/eclass/tests/flag-o-matic.sh +++ b/eclass/tests/flag-o-matic.sh @@ -8,7 +8,7 @@ inherit flag-o-matic CFLAGS="-a -b -c=1 --param l1-cache-size=32" CXXFLAGS="-x -y -z=2" -LDFLAGS="-l -m -n=3" +LDFLAGS="-l -m -n=3 -Wl,--remove-me" ftend() { local ret=$? local msg="Failed; flags are:" @@ -53,7 +53,7 @@ done <<<" 1 -n " -tbegin "strip-unsupported-flags" +tbegin "strip-unsupported-flags for -z=2" strip-unsupported-flags [[ ${CFLAGS} == "--param l1-cache-size=32" ]] && [[ ${CXXFLAGS} == "-z=2" ]] && [[ ${LDFLAGS} == "" ]] ftend diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index e883da38cead..279324e163ba 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -109,7 +109,7 @@ if [[ -x /usr/bin/pypy ]]; then test_var PYTHON_SITEDIR pypy "/usr/lib*/pypy2.7/site-packages" test_var PYTHON_INCLUDEDIR pypy "/usr/lib*/pypy2.7/include" fi -test_var PYTHON_PKG_DEP pypy '*virtual/pypy*:0=' +test_var PYTHON_PKG_DEP pypy '*dev-python/pypy*:0=' test_var PYTHON_SCRIPTDIR pypy /usr/lib/python-exec/pypy test_var EPYTHON pypy3 pypy3 @@ -118,7 +118,7 @@ if [[ -x /usr/bin/pypy3 ]]; then test_var PYTHON_SITEDIR pypy3 "/usr/lib*/pypy3.?/site-packages" test_var PYTHON_INCLUDEDIR pypy3 "/usr/lib*/pypy3.?/include" fi -test_var PYTHON_PKG_DEP pypy3 '*virtual/pypy3*:0=' +test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0=' test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3 test_is "python_is_python3 python2.7" 1 @@ -181,16 +181,16 @@ test_is "_python_impl_supported python3_1" 1 test_is "_python_impl_supported python3_2" 1 test_is "_python_impl_supported python3_3" 1 test_is "_python_impl_supported python3_4" 1 -test_is "_python_impl_supported python3_5" 0 +test_is "_python_impl_supported python3_5" 1 test_is "_python_impl_supported python3_6" 0 test_is "_python_impl_supported python3_7" 0 test_is "_python_impl_supported python3_8" 0 test_is "_python_impl_supported pypy1_8" 1 test_is "_python_impl_supported pypy1_9" 1 test_is "_python_impl_supported pypy2_0" 1 -test_is "_python_impl_supported pypy" 0 +test_is "_python_impl_supported pypy" 1 test_is "_python_impl_supported pypy3" 0 -test_is "_python_impl_supported jython2_7" 0 +test_is "_python_impl_supported jython2_7" 1 # check _python_impl_matches behavior test_is "_python_impl_matches python2_7 -2" 0 diff --git a/eclass/tests/toolchain.sh b/eclass/tests/toolchain.sh index 56609aa180e4..1d05f6c126ba 100755 --- a/eclass/tests/toolchain.sh +++ b/eclass/tests/toolchain.sh @@ -12,6 +12,12 @@ source tests-common.sh inherit toolchain +# Ignore actually running version of gcc and fake new version +# to force downgrade test on all conditions below. +gcc-version() { + echo "99.99" +} + test_downgrade_arch_flags() { local exp msg ret=0 ver @@ -26,13 +32,14 @@ test_downgrade_arch_flags() { downgrade_arch_flags ${ver} if [[ ${CFLAGS} != ${exp} ]]; then - msg="Failure - Expected: \"${exp}\" Got: \"${CFLAGS}\"" + msg="Failure - Expected: \"${exp}\" Got: \"${CFLAGS}\" Ver: ${ver}" ret=1 fi tend ${ret} ${msg} } # ver expected given +test_downgrade_arch_flags 10 "-march=haswell" "-march=haswell" test_downgrade_arch_flags 4.9 "-march=haswell" "-march=haswell" test_downgrade_arch_flags 4.8 "-march=core-avx2" "-march=haswell" test_downgrade_arch_flags 4.7 "-march=core-avx2" "-march=haswell" @@ -64,6 +71,7 @@ test_downgrade_arch_flags 3.3 "-march=c3" "-march=c3-2" test_downgrade_arch_flags 4.5 "-march=garbage" "-march=garbage" +test_downgrade_arch_flags 10 "-mtune=intel" "-mtune=intel" test_downgrade_arch_flags 4.9 "-mtune=intel" "-mtune=intel" test_downgrade_arch_flags 4.8 "-mtune=generic" "-mtune=intel" test_downgrade_arch_flags 3.4 "" "-mtune=generic" @@ -74,9 +82,11 @@ test_downgrade_arch_flags 4.5 "-march=amdfam10 -mtune=generic" "-march=btver2 -m test_downgrade_arch_flags 3.3 "-march=k6-2" "-march=geode -mtune=barcelona" test_downgrade_arch_flags 3.4 "-march=k8" "-march=btver2 -mtune=generic" +test_downgrade_arch_flags 10 "-march=native" "-march=native" test_downgrade_arch_flags 4.2 "-march=native" "-march=native" test_downgrade_arch_flags 4.1 "-march=nocona" "-march=native" +test_downgrade_arch_flags 10 "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" test_downgrade_arch_flags 4.9 "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" test_downgrade_arch_flags 4.8 "-march=foo -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" test_downgrade_arch_flags 4.7 "-march=foo -mno-avx2 -mno-avx -mno-sse4.1" "-march=foo -mno-sha -mno-rtm -mno-avx2 -mno-avx -mno-sse4.1" diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 8929a1869fc6..bd3d024f9891 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -438,9 +438,9 @@ toolchain_pkg_setup() { toolchain_src_unpack() { if [[ ${PV} == *9999* ]]; then git-r3_src_unpack - else - gcc_quick_unpack fi + + gcc_quick_unpack } gcc_quick_unpack() { @@ -455,6 +455,8 @@ gcc_quick_unpack() { # 'GCC_A_FAKEIT' to specify it's own source and binary tarballs. if [[ -n ${GCC_A_FAKEIT} ]] ; then unpack ${GCC_A_FAKEIT} + elif [[ ${PV} == *9999* ]]; then + : # sources comes from git, not tarball elif [[ -n ${PRERELEASE} ]] ; then unpack gcc-${PRERELEASE}.tar.bz2 elif [[ -n ${SNAPSHOT} ]] ; then @@ -1207,6 +1209,15 @@ toolchain_src_configure() { is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double ) [[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=( --enable-e500-double ) ;; + ppc64) + # On ppc64 big endian target gcc assumes elfv1 by default, + # and elfv2 on little endian + # but musl does not support elfv1 at all on any endian ppc64 + # see https://git.musl-libc.org/cgit/musl/tree/INSTALL + # https://bugs.gentoo.org/704784 + # https://gcc.gnu.org/PR93157 + [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 ) + ;; riscv) # Add --with-abi flags to set default ABI confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) ) @@ -1395,7 +1406,8 @@ downgrade_arch_flags() { local arch bver i isa myarch mytune rep ver bver=${1:-${GCC_BRANCH_VER}} - [[ $(gcc-version) < ${bver} ]] && return 0 + # Don't perform downgrade if running gcc is older than ebuild's. + tc_version_is_at_least ${bver} $(gcc-version) || return 0 [[ $(tc-arch) != amd64 && $(tc-arch) != x86 ]] && return 0 myarch=$(get-flag march) @@ -1403,7 +1415,7 @@ downgrade_arch_flags() { # If -march=native isn't supported we have to tease out the actual arch if [[ ${myarch} == native || ${mytune} == native ]] ; then - if [[ ${bver} < 4.2 ]] ; then + if ! tc_version_is_at_least 4.2 ${bver}; then arch=$($(tc-getCC) -march=native -v -E -P - </dev/null 2>&1 \ | sed -rn "/cc1.*-march/s:.*-march=([^ ']*).*:\1:p") replace-cpu-flags native ${arch} @@ -1411,10 +1423,10 @@ downgrade_arch_flags() { fi # Handle special -mtune flags - [[ ${mytune} == intel && ${bver} < 4.9 ]] && replace-cpu-flags intel generic - [[ ${mytune} == generic && ${bver} < 4.2 ]] && filter-flags '-mtune=*' + [[ ${mytune} == intel ]] && ! tc_version_is_at_least 4.9 ${bver} && replace-cpu-flags intel generic + [[ ${mytune} == generic ]] && ! tc_version_is_at_least 4.2 ${bver} && filter-flags '-mtune=*' [[ ${mytune} == x86-64 ]] && filter-flags '-mtune=*' - [[ ${bver} < 3.4 ]] && filter-flags '-mtune=*' + tc_version_is_at_least 3.4 ${bver} || filter-flags '-mtune=*' # "added" "arch" "replacement" local archlist=( @@ -1464,8 +1476,8 @@ downgrade_arch_flags() { [[ ${myarch} != ${arch} && ${mytune} != ${arch} ]] && continue - if [[ ${ver} > ${bver} ]] ; then - einfo "Replacing ${myarch} (added in gcc ${ver}) with ${rep}..." + if ! tc_version_is_at_least ${ver} ${bver}; then + einfo "Downgrading '${myarch}' (added in gcc ${ver}) with '${rep}'..." [[ ${myarch} == ${arch} ]] && replace-cpu-flags ${myarch} ${rep} [[ ${mytune} == ${arch} ]] && replace-cpu-flags ${mytune} ${rep} continue @@ -1513,7 +1525,7 @@ downgrade_arch_flags() { for ((i = 0; i < ${#isalist[@]}; i += 2)) ; do ver=${isalist[i]} isa=${isalist[i + 1]} - [[ ${ver} > ${bver} ]] && filter-flags ${isa} ${isa/-m/-mno-} + tc_version_is_at_least ${ver} ${bver} || filter-flags ${isa} ${isa/-m/-mno-} done } @@ -1763,8 +1775,10 @@ gcc_do_make() { toolchain_src_test() { cd "${WORKDIR}"/build - # enable verbose test run and result logging - emake -k check + # 'asan' wants to be preloaded first, so does 'sandbox'. + # To make asan tests work disable sandbox for all of test suite. + # 'backtrace' tests also does not like 'libsandbox.so' presence. + SANDBOX_ON=0 LD_PRELOAD= emake -k check } #---->> src_install <<---- diff --git a/eclass/vala.eclass b/eclass/vala.eclass index 1c9229489fff..640af998deba 100644 --- a/eclass/vala.eclass +++ b/eclass/vala.eclass @@ -54,7 +54,8 @@ vala_api_versions() { for ((minor_version = ${VALA_MAX_API_VERSION#*.}; minor_version >= ${VALA_MIN_API_VERSION#*.}; minor_version = minor_version - 2)); do # 0.38 was never in main tree; remove the special case once minimal_supported_minor_version >= 40 - if ((minor_version >= minimal_supported_minor_version)) && ((minor_version != 38)); then + # 0.42 is EOL and removed from tree; remove special case once minimal_support_minor_version >= 44 + if ((minor_version >= minimal_supported_minor_version)) && ((minor_version != 38)) && ((minor_version != 42)); then echo "0.${minor_version}" fi done diff --git a/eclass/xemacs-elisp-common.eclass b/eclass/xemacs-elisp-common.eclass index 5f8fec40d4c9..e0d864b13302 100644 --- a/eclass/xemacs-elisp-common.eclass +++ b/eclass/xemacs-elisp-common.eclass @@ -10,6 +10,11 @@ # Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> # Copyright 2007 Ulrich Müller <ulm@gentoo.org> # +# @DEAD +# Ulrich Müller <ulm@gentoo.org> (2019-12-16) +# No longer used by any ebuild in the Gentoo repository. +# Removal in 30 days. +# # @ECLASS: xemacs-elisp-common.eclass # @MAINTAINER: # xemacs@gentoo.org diff --git a/eclass/xemacs-elisp.eclass b/eclass/xemacs-elisp.eclass index 45546fb0adc3..a5500af4da01 100644 --- a/eclass/xemacs-elisp.eclass +++ b/eclass/xemacs-elisp.eclass @@ -8,6 +8,11 @@ # Copyright 2002-2003 Matthew Kennedy <mkennedy@gentoo.org> # Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> # +# @DEAD +# Ulrich Müller <ulm@gentoo.org> (2019-12-16) +# No longer used by any ebuild in the Gentoo repository. +# Removal in 30 days. +# # @ECLASS: xemacs-elisp.eclass # @MAINTAINER: # xemacs@gentoo.org |