aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2021-04-10 01:41:53 +0000
committerSam James <sam@gentoo.org>2021-08-01 03:38:39 +0100
commitcb01338bb42175efee3af2aeca1055c544b33140 (patch)
treefb9dcd28d3c202636858099d7fdd38dd22bb4fb1 /ebuild-writing
parentebuild-writing/common-mistakes: mention leftover USE flags, inherits (diff)
downloaddevmanual-cb01338bb42175efee3af2aeca1055c544b33140.tar.gz
devmanual-cb01338bb42175efee3af2aeca1055c544b33140.tar.bz2
devmanual-cb01338bb42175efee3af2aeca1055c544b33140.zip
ebuild-writing/common-mistakes: add 'Calling pkg-config directly'
Quite a lot of ebuilds do this. We should instead use the tc-getPKG_CONFIG helper from toolchain-funcs.eclass which respects ${PKG_CONFIG} - useful for e.g. cross-compiling. Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'ebuild-writing')
-rw-r--r--ebuild-writing/common-mistakes/text.xml23
1 files changed, 22 insertions, 1 deletions
diff --git a/ebuild-writing/common-mistakes/text.xml b/ebuild-writing/common-mistakes/text.xml
index 1969efe..cc87d74 100644
--- a/ebuild-writing/common-mistakes/text.xml
+++ b/ebuild-writing/common-mistakes/text.xml
@@ -505,8 +505,29 @@ the ebuild's quality and ease review.
</p>
</body>
</subsection>
-</section>
+<subsection>
+<title>Calling pkg-config directly</title>
+<body>
+
+<p>
+You should not call <c>pkg-config</c> directly in ebuilds because this is
+problematic for e.g. cross-compiling. The correct helper respects
+<c>${PKG_CONFIG}</c>. Instead, use <c>tc-getPKG_CONFIG</c> from
+<c>toolchain-funcs.eclass</c>, e.g.
+</p>
+
+<codesample lang="ebuild">
+sed -i -e "s:-lncurses:$($(tc-getPKG_CONFIG) --libs ncurses):" || die
+</codesample>
+
+<p>
+Don't then forget to add <c>virtual/pkgconfig</c> to BDEPEND!
+</p>
+
+</body>
+</subsection>
+</section>
<section>
<title>Common Ebuild Submission Mistakes</title>