Skip to content

Commit 04f9f72

Browse files
CyberTailorxgqt
authored andcommitted
dev-lang/nim: respect flags
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in> Closes: gentoo#26387 Signed-off-by: Maciej Barć <xgqt@gentoo.org>
1 parent 38ad8d4 commit 04f9f72

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

dev-lang/nim/nim-1.6.6-r1.ebuild

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
EAPI=8
55

6-
inherit bash-completion-r1 multiprocessing toolchain-funcs
6+
inherit bash-completion-r1 multiprocessing toolchain-funcs xdg-utils
77

88
DESCRIPTION="compiled, garbage-collected systems programming language"
99
HOMEPAGE="https://nim-lang.org/"
@@ -24,20 +24,8 @@ DEPEND="${RDEPEND}"
2424

2525
PATCHES=( "${FILESDIR}"/${PN}-0.20.0-paths.patch )
2626

27-
# Generated by nim
28-
QA_FLAGS_IGNORED="
29-
usr/bin/atlas
30-
usr/bin/nim
31-
usr/bin/nim_dbg
32-
usr/bin/nimble
33-
usr/bin/nimgrep
34-
usr/bin/nimpretty
35-
usr/bin/nimsuggest
36-
usr/bin/testament
37-
"
38-
3927
_run() {
40-
echo "Running: ${@}"
28+
einfo "Running: ${@}"
4129
PATH="${S}/bin:${PATH}" "${@}" || die "Failed: \"${*}\""
4230
}
4331

@@ -46,6 +34,31 @@ nim_use_enable() {
4634
use "${1}" && echo "-d:${2}"
4735
}
4836

37+
# Borrowed from nim-utils.eclass (guru overlay).
38+
nim_gen_config() {
39+
cat > nim.cfg <<- EOF || die "Failed to create Nim config"
40+
cc:"gcc"
41+
gcc.exe:"$(tc-getCC)"
42+
gcc.linkerexe:"$(tc-getCC)"
43+
gcc.cpp.exe:"$(tc-getCXX)"
44+
gcc.cpp.linkerexe:"$(tc-getCXX)"
45+
gcc.options.speed:"${CFLAGS}"
46+
gcc.options.size:"${CFLAGS}"
47+
gcc.options.debug:"${CFLAGS}"
48+
gcc.options.always:"${CPPFLAGS}"
49+
gcc.options.linker:"${LDFLAGS}"
50+
gcc.cpp.options.speed:"${CXXFLAGS}"
51+
gcc.cpp.options.size:"${CXXFLAGS}"
52+
gcc.cpp.options.debug:"${CXXFLAGS}"
53+
gcc.cpp.options.always:"${CPPFLAGS}"
54+
gcc.cpp.options.linker:"${LDFLAGS}"
55+
56+
$([[ "${NOCOLOR}" == true || "${NOCOLOR}" == yes ]] && echo '--colors:"off"')
57+
-d:"$(usex debug debug release)"
58+
--parallelBuild:"$(makeopts_jobs)"
59+
EOF
60+
}
61+
4962
src_prepare() {
5063
default
5164

@@ -55,31 +68,20 @@ src_prepare() {
5568
}
5669

5770
src_configure() {
58-
export XDG_CACHE_HOME="${T}/cache" # 667182
71+
xdg_environment_reset # bug 667182
72+
5973
unset NIMBLE_DIR
6074
tc-export CC CXX LD
6175

62-
local build_type
63-
if use debug ; then
64-
build_type="debug"
65-
else
66-
build_type="release"
67-
fi
68-
export NIM_OPTS=( --parallelBuild:$(makeopts_jobs) -d:${build_type} )
69-
70-
# Override defaults
71-
echo "gcc.exe = \"$(tc-getCC)\"" >> config/nim.cfg || die
72-
echo "gcc.linkerexe = \"$(tc-getCC)\"" >> config/nim.cfg || die
73-
echo "gcc.cpp.exe = \"$(tc-getCXX)\"" >> config/nim.cfg || die
74-
echo "gcc.cpp.linkerexe = \"$(tc-getCXX)\"" >> config/nim.cfg || die
76+
nim_gen_config
7577
}
7678

7779
src_compile() {
7880
_run bash ./build.sh
7981

80-
_run ./bin/nim ${NIM_OPTS[@]} compile koch
81-
_run ./koch boot ${NIM_OPTS[@]} $(nim_use_enable readline useGnuReadline)
82-
_run ./koch tools ${NIM_OPTS[@]}
82+
_run ./bin/nim compile koch
83+
_run ./koch boot $(nim_use_enable readline useGnuReadline)
84+
_run ./koch tools
8385
}
8486

8587
src_test() {

0 commit comments

Comments
 (0)