From patchwork Thu Mar 5 11:03:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwenhael Goavec-Merou X-Patchwork-Id: 446667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id B251B140142 for ; Thu, 5 Mar 2015 21:07:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C08EEA374D; Thu, 5 Mar 2015 10:07:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iazRCIdn2Wto; Thu, 5 Mar 2015 10:07:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 52BAAA3722; Thu, 5 Mar 2015 10:07:00 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id DF6B01C2923 for ; Thu, 5 Mar 2015 10:06:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id DC51892084 for ; Thu, 5 Mar 2015 10:06:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aUxVAUpF-beG for ; Thu, 5 Mar 2015 10:06:53 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp2-g21.free.fr (smtp2-g21.free.fr [212.27.42.2]) by whitealder.osuosl.org (Postfix) with ESMTPS id 61B7C92082 for ; Thu, 5 Mar 2015 10:06:53 +0000 (UTC) Received: from serveur.trabucayre.com (unknown [81.56.132.22]) by smtp2-g21.free.fr (Postfix) with ESMTP id 4AACF4B026E; Thu, 5 Mar 2015 11:06:12 +0100 (CET) From: Gwenhael Goavec-Merou To: buildroot@busybox.net Date: Thu, 5 Mar 2015 12:03:19 +0100 Message-Id: <1425553401-27461-1-git-send-email-gwenj@trabucayre.com> X-Mailer: git-send-email 1.7.10.4 Cc: Thomas Petazzoni , Gwenhael Goavec-Merou Subject: [Buildroot] [PATCH v4 1/3] pkg-cmake: allow to build package in a subdirectory X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Gwenhael Goavec-Merou 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 Tested-by: Samuel Martin Acked-by: Samuel Martin --- Changes v2 -> v3: * Update docs to add detail about LIBFOO_BUILDDIR Changes v1 -> v2: * Allow to overload $(2)_BUILDDIR instead of adding a new variable and test --- docs/manual/adding-packages-cmake.txt | 7 ++++++- package/pkg-cmake.mk | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/manual/adding-packages-cmake.txt b/docs/manual/adding-packages-cmake.txt index d92b209..05738f0 100644 --- a/docs/manual/adding-packages-cmake.txt +++ b/docs/manual/adding-packages-cmake.txt @@ -79,7 +79,7 @@ First, all the package metadata information variables that exist in the generic infrastructure also exist in the CMake infrastructure: +LIBFOO_VERSION+, +LIBFOO_SOURCE+, +LIBFOO_PATCH+, +LIBFOO_SITE+, +LIBFOO_SUBDIR+, +LIBFOO_DEPENDENCIES+, +LIBFOO_INSTALL_STAGING+, -+LIBFOO_INSTALL_TARGET+. ++LIBFOO_INSTALL_TARGET+, +LIBFOO_BUILDDIR+. A few additional variables, specific to the CMake infrastructure, can also be defined. Many of them are only useful in very specific cases, @@ -91,6 +91,11 @@ typical packages will therefore only use a few of them. the tree extracted by the tarball. If +HOST_LIBFOO_SUBDIR+ is not specified, it defaults to +LIBFOO_SUBDIR+. +* +LIBFOO_BUILDDIR+ may overload the default build directory when a + package prevents from in-source-tree build. For example, + FOO_BUILDDIR = $(FOO_SRCDIR)/.build, will be used to compile foo + package in .build subdirectory. + * +LIBFOO_CONF_ENV+, to specify additional environment variables to pass to CMake. By default, empty. diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk index 2404c40..c50039d 100644 --- a/package/pkg-cmake.mk +++ b/package/pkg-cmake.mk @@ -61,7 +61,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 @@ -73,7 +73,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) \ @@ -98,7 +99,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) \