diff options
author | Sam James <sam@gentoo.org> | 2021-04-10 01:41:53 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2021-08-01 03:38:39 +0100 |
commit | cb01338bb42175efee3af2aeca1055c544b33140 (patch) | |
tree | fb9dcd28d3c202636858099d7fdd38dd22bb4fb1 /ebuild-writing | |
parent | ebuild-writing/common-mistakes: mention leftover USE flags, inherits (diff) | |
download | devmanual-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.xml | 23 |
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> |