diff mbox

pkg-cmake.mk: set pkg-config env. vars. in the host configure environment

Message ID 20170805130605.25877-1-s.martin49@gmail.com
State Superseded
Headers show

Commit Message

Samuel Martin Aug. 5, 2017, 1:06 p.m. UTC
Cmake may run pkg-config to find the dependencies when configuring a
package. Because of the value of PATH, and it will use the Buildroot's
pkg-config wrapper, which, by default, is configured (via some
environment variables) to find the target dependencies.

So, this change makes sure the pkg-config environment variables are
properly set for finding host dependencies when configuring a
host-package.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
 package/pkg-cmake.mk | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Thomas Petazzoni Aug. 5, 2017, 1:42 p.m. UTC | #1
Hello,

On Sat,  5 Aug 2017 15:06:05 +0200, Samuel Martin wrote:
> Cmake may run pkg-config to find the dependencies when configuring a
> package. Because of the value of PATH, and it will use the Buildroot's
> pkg-config wrapper, which, by default, is configured (via some
> environment variables) to find the target dependencies.
> 
> So, this change makes sure the pkg-config environment variables are
> properly set for finding host dependencies when configuring a
> host-package.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>

Is this fixing a particular autobuild failure ?

Is this fixing a specific bug ?

I do remember someone reporting CMake related issues when building host
packages. Perhaps it was an e-mail. In such a case, there should be a
reference to this e-mail, or bug, or autobuild failure.

Currently, it's not clear whether your patch is fixing an actual
problem (and should be applied to master) or is just nice to have
(should be applied to next).

Of course, I do know that this patch is important and should be applied
to master, but it would be good to have a clearer commit log from that
respect.

Thanks!

Thomas
Samuel Martin Aug. 5, 2017, 2 p.m. UTC | #2
On Sat, Aug 5, 2017 at 3:42 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Sat,  5 Aug 2017 15:06:05 +0200, Samuel Martin wrote:
>> Cmake may run pkg-config to find the dependencies when configuring a
>> package. Because of the value of PATH, and it will use the Buildroot's
>> pkg-config wrapper, which, by default, is configured (via some
>> environment variables) to find the target dependencies.
>>
>> So, this change makes sure the pkg-config environment variables are
>> properly set for finding host dependencies when configuring a
>> host-package.
>>
>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>
> Is this fixing a particular autobuild failure ?
>
> Is this fixing a specific bug ?

No such a specific thing, just a mail reporting the issue [1].

Do you want me to file a ticket to have a trace in the bug tracker and
add its ref. to the commit log?

>
> I do remember someone reporting CMake related issues when building host
> packages. Perhaps it was an e-mail. In such a case, there should be a
> reference to this e-mail, or bug, or autobuild failure.

Unfortunately the abo have not (yet) trigger this bug for host-mariadb
(I have not checked for other potentially affected packages).

>
> Currently, it's not clear whether your patch is fixing an actual
> problem (and should be applied to master) or is just nice to have
> (should be applied to next).

IMHO, it's for master.

>
> Of course, I do know that this patch is important and should be applied
> to master, but it would be good to have a clearer commit log from that
> respect.
>
> Thanks!
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

[1] http://lists.busybox.net/pipermail/buildroot/2017-August/199776.html

Regards,
diff mbox

Patch

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 914bda7482..a91b0c2f57 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -109,6 +109,11 @@  define $(2)_CONFIGURE_CMDS
 	cd $$($$(PKG)_BUILDDIR) && \
 	rm -f CMakeCache.txt && \
 	PATH=$$(BR_PATH) \
+	PKG_CONFIG="$$(PKG_CONFIG_HOST_BINARY)" \
+	PKG_CONFIG_SYSROOT_DIR="/" \
+	PKG_CONFIG_LIBDIR="$$(HOST_DIR)/lib/pkgconfig:$$(HOST_DIR)/share/pkgconfig"
+	PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
+	PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
 	$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
 		-DCMAKE_INSTALL_SO_NO_EXE=0 \
 		-DCMAKE_FIND_ROOT_PATH="$$(HOST_DIR)" \