From patchwork Wed Mar 11 12:13:21 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: 448957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 25F731401AC for ; Wed, 11 Mar 2015 22:16:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C690695189; Wed, 11 Mar 2015 11:16:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OjEeXzyARAOb; Wed, 11 Mar 2015 11:16:47 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id E97069518E; Wed, 11 Mar 2015 11:16:46 +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 1A7451C2A8F for ; Wed, 11 Mar 2015 11:16:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1469F91D9E for ; Wed, 11 Mar 2015 11:16:44 +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 I+4n-C5Rr+5z for ; Wed, 11 Mar 2015 11:16:43 +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 DA73291D99 for ; Wed, 11 Mar 2015 11:16:42 +0000 (UTC) Received: from serveur.trabucayre.com (unknown [81.56.132.22]) by smtp2-g21.free.fr (Postfix) with ESMTP id 597BB4B0288; Wed, 11 Mar 2015 12:15:43 +0100 (CET) From: Gwenhael Goavec-Merou To: buildroot@busybox.net Date: Wed, 11 Mar 2015 13:13:21 +0100 Message-Id: <1426076003-12088-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 v6 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 Reviewed-by: Arnout Vandecappelle (Essensium/Mind) --- Changes v5 -> v6: * s/, no/,NO/ * s/$$($(2)_SUPPORTS_IN_SOURCE_BUILD)/$$($(3)_SUPPORTS_IN_SOURCE_BUILD)/ Changes v4 -> v5: * Instead of overloading BUILDDIR uses a variable to set if package is compiled in-source-tree or not * update again manual 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 | 3 +++ package/pkg-cmake.mk | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/manual/adding-packages-cmake.txt b/docs/manual/adding-packages-cmake.txt index d92b209..0d4f2fa 100644 --- a/docs/manual/adding-packages-cmake.txt +++ b/docs/manual/adding-packages-cmake.txt @@ -146,3 +146,6 @@ possible to customize what is done in any particular step: +LIBFOO_CONFIGURE_CMDS+ variable, it will be used instead of the default CMake one. However, using this method should be restricted to very specific cases. Do not use it in the general case. + +* By adding +LIBFOO_SUPPORTS_IN_SOURCE_BUILD = NO+ when a package + prevents doing an in-source-tree build. diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk index 2404c40..9de21b5 100644 --- a/package/pkg-cmake.mk +++ b/package/pkg-cmake.mk @@ -61,7 +61,12 @@ $(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install $(2)_INSTALL_TARGET_OPTS ?= DESTDIR=$$(TARGET_DIR) install $(2)_SRCDIR = $$($(2)_DIR)/$$($(2)_SUBDIR) + +ifeq ($$($(3)_SUPPORTS_IN_SOURCE_BUILD),NO) +$(2)_BUILDDIR = $$($(2)_SRCDIR)/buildroot-build +else $(2)_BUILDDIR = $$($(2)_SRCDIR) +endif # # Configure step. Only define it if not already defined by the package @@ -73,7 +78,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 +104,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) \