commit:     04f9f72582c8aa0e532fec8378e4ee0933ffc99c
Author:     Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Wed Jul 13 20:02:11 2022 +0000
Commit:     Maciej Barć <xgqt <AT> gentoo <DOT> org>
CommitDate: Wed Jul 13 20:40:30 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04f9f725

dev-lang/nim: respect flags

Signed-off-by: Anna Vyalkova <cyber+gentoo <AT> sysrq.in>
Closes: https://github.com/gentoo/gentoo/pull/26387
Signed-off-by: Maciej Barć <xgqt <AT> gentoo.org>

 dev-lang/nim/nim-1.6.6-r1.ebuild | 64 +++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 31 deletions(-)

diff --git a/dev-lang/nim/nim-1.6.6-r1.ebuild b/dev-lang/nim/nim-1.6.6-r1.ebuild
index 0ab7dd480dca..9d4da4f7a23b 100644
--- a/dev-lang/nim/nim-1.6.6-r1.ebuild
+++ b/dev-lang/nim/nim-1.6.6-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit bash-completion-r1 multiprocessing toolchain-funcs
+inherit bash-completion-r1 multiprocessing toolchain-funcs xdg-utils
 
 DESCRIPTION="compiled, garbage-collected systems programming language"
 HOMEPAGE="https://nim-lang.org/";
@@ -24,20 +24,8 @@ DEPEND="${RDEPEND}"
 
 PATCHES=( "${FILESDIR}"/${PN}-0.20.0-paths.patch )
 
-# Generated by nim
-QA_FLAGS_IGNORED="
-usr/bin/atlas
-usr/bin/nim
-usr/bin/nim_dbg
-usr/bin/nimble
-usr/bin/nimgrep
-usr/bin/nimpretty
-usr/bin/nimsuggest
-usr/bin/testament
-"
-
 _run() {
-       echo "Running: ${@}"
+       einfo "Running: ${@}"
        PATH="${S}/bin:${PATH}" "${@}" || die "Failed: \"${*}\""
 }
 
@@ -46,6 +34,31 @@ nim_use_enable() {
        use "${1}" && echo "-d:${2}"
 }
 
+# Borrowed from nim-utils.eclass (guru overlay).
+nim_gen_config() {
+       cat > nim.cfg <<- EOF || die "Failed to create Nim config"
+       cc:"gcc"
+       gcc.exe:"$(tc-getCC)"
+       gcc.linkerexe:"$(tc-getCC)"
+       gcc.cpp.exe:"$(tc-getCXX)"
+       gcc.cpp.linkerexe:"$(tc-getCXX)"
+       gcc.options.speed:"${CFLAGS}"
+       gcc.options.size:"${CFLAGS}"
+       gcc.options.debug:"${CFLAGS}"
+       gcc.options.always:"${CPPFLAGS}"
+       gcc.options.linker:"${LDFLAGS}"
+       gcc.cpp.options.speed:"${CXXFLAGS}"
+       gcc.cpp.options.size:"${CXXFLAGS}"
+       gcc.cpp.options.debug:"${CXXFLAGS}"
+       gcc.cpp.options.always:"${CPPFLAGS}"
+       gcc.cpp.options.linker:"${LDFLAGS}"
+
+       $([[ "${NOCOLOR}" == true || "${NOCOLOR}" == yes ]] && echo 
'--colors:"off"')
+       -d:"$(usex debug debug release)"
+       --parallelBuild:"$(makeopts_jobs)"
+       EOF
+}
+
 src_prepare() {
        default
 
@@ -55,31 +68,20 @@ src_prepare() {
 }
 
 src_configure() {
-       export XDG_CACHE_HOME="${T}/cache"  # 667182
+       xdg_environment_reset  # bug 667182
+
        unset NIMBLE_DIR
        tc-export CC CXX LD
 
-       local build_type
-       if use debug ; then
-               build_type="debug"
-       else
-               build_type="release"
-       fi
-       export NIM_OPTS=( --parallelBuild:$(makeopts_jobs) -d:${build_type} )
-
-       # Override defaults
-       echo "gcc.exe            = \"$(tc-getCC)\""  >> config/nim.cfg || die
-       echo "gcc.linkerexe      = \"$(tc-getCC)\""  >> config/nim.cfg || die
-       echo "gcc.cpp.exe        = \"$(tc-getCXX)\"" >> config/nim.cfg || die
-       echo "gcc.cpp.linkerexe  = \"$(tc-getCXX)\"" >> config/nim.cfg || die
+       nim_gen_config
 }
 
 src_compile() {
        _run bash ./build.sh
 
-       _run ./bin/nim ${NIM_OPTS[@]} compile koch
-       _run ./koch boot ${NIM_OPTS[@]} $(nim_use_enable readline 
useGnuReadline)
-       _run ./koch tools ${NIM_OPTS[@]}
+       _run ./bin/nim compile koch
+       _run ./koch boot $(nim_use_enable readline useGnuReadline)
+       _run ./koch tools
 }
 
 src_test() {

Reply via email to