diff options
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/Manifest.gz | bin | 36588 -> 36592 bytes | |||
-rw-r--r-- | eclass/cargo.eclass | 103 | ||||
-rw-r--r-- | eclass/distutils-r1.eclass | 42 | ||||
-rw-r--r-- | eclass/elisp-common.eclass | 6 | ||||
-rw-r--r-- | eclass/multilib-build.eclass | 18 | ||||
-rw-r--r-- | eclass/python-utils-r1.eclass | 1 |
6 files changed, 91 insertions, 79 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz Binary files differindex 7ad89561b3b0..4922289c95f3 100644 --- a/eclass/Manifest.gz +++ b/eclass/Manifest.gz diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index ccbf87aa9a6c..6d341601a112 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -22,17 +22,29 @@ esac inherit multiprocessing toolchain-funcs -EXPORT_FUNCTIONS src_unpack src_compile src_install src_test +EXPORT_FUNCTIONS src_unpack src_configure src_compile src_install src_test IUSE="${IUSE} debug" ECARGO_HOME="${WORKDIR}/cargo_home" ECARGO_VENDOR="${ECARGO_HOME}/gentoo" -# @ECLASS-VARIABLE: CARGO_INSTALL_PATH +# @VARIABLE: myfeatures +# @DEFAULT_UNSET # @DESCRIPTION: -# Allows overriding the default cwd to run cargo install from -: ${CARGO_INSTALL_PATH:=.} +# Optional cargo features defined as bash array. +# Should be defined before calling cargo_src_configure(). +# +# Example package that has x11 and wayland as features, and disables default. +# @CODE +# src_configure() { +# local myfeatures=( +# $(usex X x11 '') +# $(usev wayland) +# ) +# cargo_src_configure --no-default-features +# } +# @CODE # @FUNCTION: cargo_crate_uris # @DESCRIPTION: @@ -112,6 +124,7 @@ cargo_live_src_unpack() { mkdir -p "${S}" || die pushd "${S}" > /dev/null || die + # need to specify CARGO_HOME before cargo_gen_config fired CARGO_HOME="${ECARGO_HOME}" cargo fetch || die CARGO_HOME="${ECARGO_HOME}" cargo vendor "${ECARGO_VENDOR}" || die popd > /dev/null || die @@ -151,6 +164,56 @@ cargo_gen_config() { EOF # honor NOCOLOR setting [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo "color = 'never'" >> "${ECARGO_HOME}/config" + + export CARGO_HOME="${ECARGO_HOME}" +} + +# @FUNCTION: cargo_src_configure +# @DESCRIPTION: +# Configure cargo package features and arguments. +# Extra positional arguments supplied to this function +# will be passed to cargo in all phases. +# Make sure all cargo subcommands support flags passed here. +# +# Example for package that explicitly builds only 'baz' binary and +# enables 'barfeature' and optional 'foo' feature. +# will pass '--features barfeature --features foo --bin baz' +# in src_{compile,test,install} +# +# @CODE +# src_configure() { +# local myfeatures=( +# barfeature +# $(usev foo) +# ) +# cargo_src_configure --bin baz +# } +# @CODE +# +# In some cases crates may need '--no-default-features' option, +# as there is no way to disable single feature, except disabling all. +# It can be passed directly to cargo_src_configure(). + +cargo_src_configure() { + debug-print-function ${FUNCNAME} "$@" + + [[ -z ${myfeatures} ]] && declare -a myfeatures=() + local myfeaturestype=$(declare -p myfeatures 2>&-) + if [[ "${myfeaturestype}" != "declare -a myfeatures="* ]]; then + die "myfeatures must be declared as array" + fi + + # transform array from simple feature list + # to multiple cargo args: + # --features feature1 --features feature2 ... + # this format is chosen because 2 other methods of + # listing features (space OR comma separated) require + # more fiddling with strings we'd like to avoid here. + myfeatures=( ${myfeatures[@]/#/--features } ) + + readonly ECARGO_ARGS=( ${myfeatures[@]} ${@} ${ECARGO_EXTRA_ARGS} ) + + [[ ${ECARGO_ARGS[@]} ]] && einfo "Configured with: ${ECARGO_ARGS[@]}" } # @FUNCTION: cargo_src_compile @@ -159,25 +222,32 @@ cargo_gen_config() { cargo_src_compile() { debug-print-function ${FUNCNAME} "$@" - export CARGO_HOME="${ECARGO_HOME}" + tc-export AR CC CXX - tc-export AR CC - - cargo build $(usex debug "" --release) "$@" \ - || die "cargo build failed" + set -- cargo build $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@" + einfo "${@}" + "${@}" || die "cargo build failed" } # @FUNCTION: cargo_src_install # @DESCRIPTION: # Installs the binaries generated by cargo +# In come case workspaces need alternative --path parameter +# default is '--path ./' if nothing specified. +# '--path ./somedir' can be passed directly to cargo_src_install() + cargo_src_install() { debug-print-function ${FUNCNAME} "$@" - 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" + set -- cargo install $(has --path ${@} || echo --path ./) \ + --root "${ED}/usr" \ + $(usex debug --debug "") \ + ${ECARGO_ARGS[@]} "$@" + einfo "${@}" + "${@}" || die "cargo install failed" + + rm -f "${ED}/usr/.crates.toml" || die + rm -f "${ED}/usr/.crates2.json" || die [ -d "${S}/man" ] && doman "${S}/man" || return 0 } @@ -188,8 +258,9 @@ cargo_src_install() { cargo_src_test() { debug-print-function ${FUNCNAME} "$@" - cargo test $(usex debug "" --release) "$@" \ - || die "cargo test failed" + set -- cargo test $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@" + einfo "${@}" + "${@}" || die "cargo test failed" } fi diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index e0e7a945ab87..25cb67b78a31 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -455,47 +455,6 @@ distutils_enable_tests() { return 0 } -# @FUNCTION: _distutils-r1_verify_use_setuptools -# @INTERNAL -# @DESCRIPTION: -# Check setup.py for signs that DISTUTILS_USE_SETUPTOOLS have been set -# incorrectly. -_distutils_verify_use_setuptools() { - [[ ${DISTUTILS_OPTIONAL} ]] && return - [[ ${DISTUTILS_USE_SETUPTOOLS} == manual ]] && return - [[ ${DISTUTILS_USE_SETUPTOOLS} == pyproject.toml ]] && return - - # ok, those are cheap greps. we can try toimprove them if we hit - # false positives. - local expected=no - if [[ ${CATEGORY}/${PN} == dev-python/setuptools ]]; then - # 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 - expected=rdepend - elif grep -F -q -s '[options.entry_points]' setup.cfg; then - expected=rdepend - elif grep -F -q -s '[entry_points]' setup.cfg; then # pbr - expected=rdepend - else - expected=bdepend - fi - fi - - if [[ ${DISTUTILS_USE_SETUPTOOLS} != ${expected} ]]; then - if [[ ! ${_DISTUTILS_SETUPTOOLS_WARNED} ]]; then - _DISTUTILS_SETUPTOOLS_WARNED=1 - local def= - [[ ${DISTUTILS_USE_SETUPTOOLS} == bdepend ]] && def=' (default?)' - - eqawarn "DISTUTILS_USE_SETUPTOOLS value is probably incorrect" - eqawarn " value: DISTUTILS_USE_SETUPTOOLS=${DISTUTILS_USE_SETUPTOOLS}${def}" - eqawarn " expected: DISTUTILS_USE_SETUPTOOLS=${expected}" - fi - fi -} - # @FUNCTION: esetup.py # @USAGE: [<args>...] # @DESCRIPTION: @@ -518,7 +477,6 @@ esetup.py() { [[ ${EAPI} != [45] ]] && die_args+=( -n ) [[ ${BUILD_DIR} ]] && _distutils-r1_create_setup_cfg - _distutils_verify_use_setuptools set -- "${EPYTHON:-python}" setup.py "${mydistutilsargs[@]}" "${@}" diff --git a/eclass/elisp-common.eclass b/eclass/elisp-common.eclass index 0bf6c014af1f..e6346d43ccfb 100644 --- a/eclass/elisp-common.eclass +++ b/eclass/elisp-common.eclass @@ -393,9 +393,9 @@ elisp-modules-install() { # @DESCRIPTION: # Install Emacs site-init file in SITELISP directory. Automatically # inserts a standard comment header with the name of the package -# (unless it is already present). Tokens @SITELISP@, @SITEETC@, and -# @EMACSMODULES@ are replaced by the path to the package's subdirectory -# in SITELISP, SITEETC, and EMACSMODULES, respectively. +# (unless it is already present). Tokens @SITELISP@, @SITEETC@, +# and @EMACSMODULES@ are replaced by the path to the package's +# subdirectory in SITELISP, SITEETC, and EMACSMODULES, respectively. elisp-site-file-install() { local sf="${1##*/}" my_pn="${2:-${PN}}" modules ret diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass index 21ca275c3c77..585364de6273 100644 --- a/eclass/multilib-build.eclass +++ b/eclass/multilib-build.eclass @@ -47,10 +47,6 @@ _MULTILIB_FLAGS=( abi_mips_o32:o32 # abi_ppc_32:ppc,ppc_aix,ppc_macos # abi_ppc_64:ppc64 - abi_riscv_lp64d:lp64d - abi_riscv_lp64:lp64 - abi_riscv_ilp32d:ilp32d - abi_riscv_ilp32:ilp32 abi_s390_32:s390 abi_s390_64:s390x ) @@ -493,20 +489,6 @@ multilib_prepare_wrappers() { # elif(_MIPS_SIM == _ABIO32) /* o32 */ # error "abi_mips_o32 not supported by the package." # endif -#elif defined(__riscv) -# if (__riscv_xlen == 64) && defined(__riscv_float_abi_double) -# error "abi_riscv_lp64d not supported by the package." -# elif (__riscv_xlen == 64) && defined(__riscv_float_abi_single) -# error "abi_riscv_lp64f not supported by the package." -# elif (__riscv_xlen == 64) -# error "abi_riscv_lp64 not supported by the package." -# elif (__riscv_xlen == 32) && defined(__riscv_float_abi_double) -# error "abi_riscv_ilp32d not supported by the package." -# elif (__riscv_xlen == 32) && defined(__riscv_float_abi_single) -# error "abi_riscv_ilp32f not supported by the package." -# else -# error "abi_riscv_ilp32 not supported by the package." -# endif #elif defined(__sparc__) # if defined(__arch64__) # error "abi_sparc_64 not supported by the package." diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 87cb662c64fd..9c8b6a14d2ac 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -608,6 +608,7 @@ python_optimize() { local PYTHON=${PYTHON} [[ ${PYTHON} ]] || _python_export PYTHON + [[ -x ${PYTHON} ]] || die "PYTHON (${PYTHON}) is not executable" # default to sys.path if [[ ${#} -eq 0 ]]; then |