# Copyright 1999-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 DLANG_COMPAT=( gdc-1{2..5} ) inherit dlang-r1 prefix DESCRIPTION="Wrapper script for gdc that emulates the dmd command" HOMEPAGE="https://www.gdcproject.org/" COMMIT="d14f7301b4bbae44996bc962121c9a1e7f7e3f12" SRC_URI="https://github.com/D-Programming-GDC/gdmd/archive/${COMMIT}.tar.gz -> gdmd-${COMMIT}.tar.gz" S="${WORKDIR}/gdmd-${COMMIT}" LICENSE="GPL-3+" SLOT="0" KEYWORDS="~amd64 ~arm64 ~x86" RESTRICT="test" # no tests REQUIRED_USE=${DLANG_REQUIRED_USE} # Ignore ${DLANG_DEPS}, we only need gcc[d] gen_gccslot_dep() { local impl dep=${1} result=() for impl in "${_DLANG_SUPPORTED_IMPLS[@]}"; do local slot=${impl#gdc-} local req=dlang_targets_${impl} local subdep=${dep//\$\{GCC_SLOT\}/${slot}} result+=( "${req}? ( ${subdep} )" ) done echo "${result[@]}" } RDEPEND=" dev-lang/perl $(gen_gccslot_dep ' sys-devel/gcc:${GCC_SLOT}[d] !&1) || return 0 local curr_config_ver=$(gcc-config -S ${curr_config} | awk '{print $2}') local curr_specs=$(gcc-config -S ${curr_config} | awk '{print $3}') local exp_USE=dlang_targets_gdc-${curr_config_ver} # We should call gcc-config to make sure the addition of gdmd is # propagated in $PATH, if the currently eselected gcc matches a slot # that we are targeting. Don't do anything if not on a traditional # layout, the risk of breaking something outweighs having the # script in $PATH. [[ ${curr_specc} ]] && return 0 ! has "${exp_USE}" ${IUSE} && return 0 ! use "${exp_USE}" && return 0 gcc-config "${CTARGET}-${curr_config_ver}" }