# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 DLANG_COMPAT=( dmd-2_{106..109} gdc-1{3,4} ldc2-1_{35..39} ) DUB_DEPENDENCIES=( gitcompatibledubpackage@1.0.1 gitcompatibledubpackage@1.0.4 urld@2.1.1 ) inherit dlang-single dub shell-completion DESCRIPTION="Package and build management system for D" HOMEPAGE="https://code.dlang.org/" GITHUB_URI="https://codeload.github.com/dlang" SRC_URI=" ${GITHUB_URI}/${PN}/tar.gz/v${PV} -> ${P}.tar.gz test? ( ${DUB_DEPENDENCIES_URIS} ) " LICENSE="MIT" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="doc test" RESTRICT="!test? ( test )" RDEPEND+=" virtual/pkgconfig" src_unpack() { dub_gen_settings unpack "${P}.tar.gz" use test && dub_copy_dependencies_locally "${DUB_DEPENDENCIES[@]}" } src_configure() { # gdc generates unaligned memory accesses with optimizations and avx # enabled. It has been fixed upstream. See: # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114171 # Fixed in >=sys-devel/gcc-13.2.1_p20240330. Adding -mno-sse2 makes # tests fail so defer to removing the common way users get avx # instructions enabled (-march=native) and warn them. if [[ ${ARCH} == amd64 && ${EDC} == gdc-13 && ${DCFLAGS} == *-march=native* ]]; then ewarn " to bypass this" ewarn "precaution." ewarn "" ewarn "See also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114171" dlang-filter-dflags "gdc*" "-march=native" fi } src_compile() { local imports=source versions="DubApplication DubUseCurl" dlang_compile_bin bin/dub $(