diff mbox

[v2,1/4] pkg-cmake: allow to build package in a subdirectory

Message ID 1424891914-27748-1-git-send-email-gwenj@trabucayre.com
State Superseded
Headers show

Commit Message

Gwenhael Goavec-Merou Feb. 25, 2015, 7:18 p.m. UTC
From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>

For some cmake based packages, like GNURadio, it's forbidden to do the
compilation directly in the sources directory. This patch add a new 
variable to specify, if needed, the name of a sub-directory used to compile.

Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
---
Changes v1 -> v2:
 * Allow to overload $(2)_BUILDDIR instead of adding a new variable and test
---
 package/pkg-cmake.mk | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Samuel Martin March 2, 2015, 9:55 p.m. UTC | #1
Hi Gwenhael,

On Wed, Feb 25, 2015 at 8:18 PM, Gwenhael Goavec-Merou
<gwenj@trabucayre.com> wrote:
> From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
>
> For some cmake based packages, like GNURadio, it's forbidden to do the
> compilation directly in the sources directory. This patch add a new
> variable to specify, if needed, the name of a sub-directory used to compile.
>
> Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>

Tested-by: Samuel Martin <s.martin49@gmail.com>
Acked-by: Samuel Martin <s.martin49@gmail.com>

It would be good to update the cmake-package section of the manual as well. ;-)

This doc should mention that the user has to set the build location
path for the target package, but also for the host package if any.
I.e.:
FOO_BUILDDIR = $(FOO_SRCDIR)/.build
HOST_FOO_BUILDDIR = $(HOST_FOO_SRCDIR)/.build


Regards,
Samuel Martin March 3, 2015, 10 a.m. UTC | #2
On Tue, Mar 3, 2015 at 11:00 AM, gwenhael.goavec <gwenj@trabucayre.com> wrote:
> Hi Samuel,
>
> On Mon, 2 Mar 2015 22:55:11 +0100
> Samuel Martin <s.martin49@gmail.com> wrote:
>
>> Hi Gwenhael,
>>
>> On Wed, Feb 25, 2015 at 8:18 PM, Gwenhael Goavec-Merou
>> <gwenj@trabucayre.com> wrote:
>> > From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
>> >
>> > For some cmake based packages, like GNURadio, it's forbidden to do the
>> > compilation directly in the sources directory. This patch add a new
>> > variable to specify, if needed, the name of a sub-directory used to compile.
>> >
>> > Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
>>
>> Tested-by: Samuel Martin <s.martin49@gmail.com>
>> Acked-by: Samuel Martin <s.martin49@gmail.com>
>>
>> It would be good to update the cmake-package section of the manual as well. ;-)
>>
>> This doc should mention that the user has to set the build location
>> path for the target package, but also for the host package if any.
>> I.e.:
>> FOO_BUILDDIR = $(FOO_SRCDIR)/.build
>> HOST_FOO_BUILDDIR = $(HOST_FOO_SRCDIR)/.build
>>
> True. This update needs to be provided by a new version of this series of patch
> or a new patch ?

A follow-up patch is enough to me ;)

>>
>> Regards,
>>
>> --
>> Samuel
>
> Thank for review and test.
>
> Regards
>
> Gwen

Cheers,
Gwenhael Goavec-Merou March 3, 2015, 10 a.m. UTC | #3
Hi Samuel,

On Mon, 2 Mar 2015 22:55:11 +0100
Samuel Martin <s.martin49@gmail.com> wrote:

> Hi Gwenhael,
> 
> On Wed, Feb 25, 2015 at 8:18 PM, Gwenhael Goavec-Merou
> <gwenj@trabucayre.com> wrote:
> > From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
> >
> > For some cmake based packages, like GNURadio, it's forbidden to do the
> > compilation directly in the sources directory. This patch add a new
> > variable to specify, if needed, the name of a sub-directory used to compile.
> >
> > Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
> 
> Tested-by: Samuel Martin <s.martin49@gmail.com>
> Acked-by: Samuel Martin <s.martin49@gmail.com>
> 
> It would be good to update the cmake-package section of the manual as well. ;-)
> 
> This doc should mention that the user has to set the build location
> path for the target package, but also for the host package if any.
> I.e.:
> FOO_BUILDDIR = $(FOO_SRCDIR)/.build
> HOST_FOO_BUILDDIR = $(HOST_FOO_SRCDIR)/.build
> 
True. This update needs to be provided by a new version of this series of patch
or a new patch ?
> 
> Regards,
> 
> -- 
> Samuel

Thank for review and test.

Regards

Gwen
diff mbox

Patch

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index eacd641..f3bd080 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -57,7 +57,7 @@  $(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install
 $(2)_INSTALL_TARGET_OPTS		?= DESTDIR=$$(TARGET_DIR) install
 
 $(2)_SRCDIR			= $$($(2)_DIR)/$$($(2)_SUBDIR)
-$(2)_BUILDDIR			= $$($(2)_SRCDIR)
+$(2)_BUILDDIR			?= $$($(2)_SRCDIR)
 
 #
 # Configure step. Only define it if not already defined by the package
@@ -69,7 +69,8 @@  ifeq ($(4),target)
 
 # Configure package for target
 define $(2)_CONFIGURE_CMDS
-	(cd $$($$(PKG)_BUILDDIR) && \
+	(mkdir -p $$($$(PKG)_BUILDDIR) && \
+	cd $$($$(PKG)_BUILDDIR) && \
 	rm -f CMakeCache.txt && \
 	PATH=$$(BR_PATH) \
 	$$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \
@@ -93,7 +94,8 @@  else
 
 # Configure package for host
 define $(2)_CONFIGURE_CMDS
-	(cd $$($$(PKG)_BUILDDIR) && \
+	(mkdir -p $$($$(PKG)_BUILDDIR) && \
+	cd $$($$(PKG)_BUILDDIR) && \
 	rm -f CMakeCache.txt && \
 	PATH=$$(BR_PATH) \
 	$$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \