From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 634B213933E for ; Sun, 1 Aug 2021 02:38:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 50A4FE096B; Sun, 1 Aug 2021 02:38:50 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 36549E096B for ; Sun, 1 Aug 2021 02:38:50 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 05AF934399E for ; Sun, 1 Aug 2021 02:38:49 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8D67284F for ; Sun, 1 Aug 2021 02:38:47 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1627785519.cb01338bb42175efee3af2aeca1055c544b33140.sam@gentoo> Subject: [gentoo-commits] proj/devmanual:master commit in: ebuild-writing/common-mistakes/ X-VCS-Repository: proj/devmanual X-VCS-Files: ebuild-writing/common-mistakes/text.xml X-VCS-Directories: ebuild-writing/common-mistakes/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: cb01338bb42175efee3af2aeca1055c544b33140 X-VCS-Branch: master Date: Sun, 1 Aug 2021 02:38:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6814274c-ee20-4c1a-98e2-f990d990b501 X-Archives-Hash: 781b8fe7653b3c2c1eba5a0b335b0e6f commit: cb01338bb42175efee3af2aeca1055c544b33140 Author: Sam James gentoo org> AuthorDate: Sat Apr 10 01:41:53 2021 +0000 Commit: Sam James gentoo org> CommitDate: Sun Aug 1 02:38:39 2021 +0000 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=cb01338b 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 gentoo.org> ebuild-writing/common-mistakes/text.xml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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.

- + +Calling pkg-config directly + + +

+You should not call pkg-config directly in ebuilds because this is +problematic for e.g. cross-compiling. The correct helper respects +${PKG_CONFIG}. Instead, use tc-getPKG_CONFIG from +toolchain-funcs.eclass, e.g. +

+ + +sed -i -e "s:-lncurses:$($(tc-getPKG_CONFIG) --libs ncurses):" || die + + +

+Don't then forget to add virtual/pkgconfig to BDEPEND! +

+ + +
+
Common Ebuild Submission Mistakes