diff mbox

pkg-cmake: Skip compilation in installation step

Message ID 1429733516-4466-1-git-send-email-cedric.marie@openmailbox.org
State Accepted
Headers show

Commit Message

Cédric Marie April 22, 2015, 8:11 p.m. UTC
With CMake build system, the "make install" command always compiles
before installing, to make sure that everything is up-to-date.

In Buildroot environment, this is quite useless, because the package
has always already been compiled, either at first build, or when
invoking "make <package>-rebuild".
In all cases, when it comes to staging or target installation step, the
package has just been compiled.

Using "make install/fast" - in order to skip the compilation step - is
therefore more appropriate, more consistent with what other build
systems do, and saves time when you need to rebuild your package.

Signed-off-by: Cédric Marie <cedric.marie@openmailbox.org>
---
 package/pkg-cmake.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Yann E. MORIN April 22, 2015, 9:58 p.m. UTC | #1
Cédric, All,

On 2015-04-22 22:11 +0200, Cédric Marie spake thusly:
> With CMake build system, the "make install" command always compiles
> before installing, to make sure that everything is up-to-date.
> 
> In Buildroot environment, this is quite useless, because the package
> has always already been compiled, either at first build, or when
> invoking "make <package>-rebuild".
> In all cases, when it comes to staging or target installation step, the
> package has just been compiled.
> 
> Using "make install/fast" - in order to skip the compilation step - is
> therefore more appropriate, more consistent with what other build
> systems do, and saves time when you need to rebuild your package.
> 
> Signed-off-by: Cédric Marie <cedric.marie@openmailbox.org>
> ---
>  package/pkg-cmake.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index 2262012..f17a883 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -57,8 +57,8 @@ $(2)_MAKE			?= $$(MAKE)
>  $(2)_MAKE_ENV			?=
>  $(2)_MAKE_OPTS			?=
>  $(2)_INSTALL_OPTS		?= install
> -$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install
> -$(2)_INSTALL_TARGET_OPTS		?= DESTDIR=$$(TARGET_DIR) install
> +$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install/fast
> +$(2)_INSTALL_TARGET_OPTS		?= DESTDIR=$$(TARGET_DIR) install/fast

Would it also make sense we install cmake itself with this rule, in
package/cmake/cmake.mk:47 , too?

Regards,
Yann E. MORIN.

>  $(2)_SRCDIR			= $$($(2)_DIR)/$$($(2)_SUBDIR)
>  
> -- 
> 2.1.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Arnout Vandecappelle April 22, 2015, 10:53 p.m. UTC | #2
On 04/22/15 22:11, Cédric Marie wrote:
> With CMake build system, the "make install" command always compiles
> before installing, to make sure that everything is up-to-date.
> 
> In Buildroot environment, this is quite useless, because the package
> has always already been compiled, either at first build, or when
> invoking "make <package>-rebuild".
> In all cases, when it comes to staging or target installation step, the
> package has just been compiled.
> 
> Using "make install/fast" - in order to skip the compilation step - is
> therefore more appropriate, more consistent with what other build
> systems do, and saves time when you need to rebuild your package.
> 
> Signed-off-by: Cédric Marie <cedric.marie@openmailbox.org>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Doing it for host-cmake itself can be a separate patch. And not very important
either, I can't measure the time difference...

 Regards,
 Arnout

> ---
>  package/pkg-cmake.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index 2262012..f17a883 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -57,8 +57,8 @@ $(2)_MAKE			?= $$(MAKE)
>  $(2)_MAKE_ENV			?=
>  $(2)_MAKE_OPTS			?=
>  $(2)_INSTALL_OPTS		?= install
> -$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install
> -$(2)_INSTALL_TARGET_OPTS		?= DESTDIR=$$(TARGET_DIR) install
> +$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install/fast
> +$(2)_INSTALL_TARGET_OPTS		?= DESTDIR=$$(TARGET_DIR) install/fast
>  
>  $(2)_SRCDIR			= $$($(2)_DIR)/$$($(2)_SUBDIR)
>  
>
Cédric Marie April 23, 2015, 6:59 a.m. UTC | #3
Hi,

> Would it also make sense we install cmake itself with this rule, in
> package/cmake/cmake.mk:47 , too?

That could make sense, yes. I had not thought about CMake being compiled 
with CMake generated makefiles.


> Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> 
>  Doing it for host-cmake itself can be a separate patch. And not very 
> important
> either, I can't measure the time difference...

OK for a separate patch.

I agree the time difference is not so big. But it can be several seconds 
with some packages (it is done twice: staging + target). When you have 
to rebuild your package regularly, you certainly appreciate saving these 
few seconds. I do :)

In fact, it is a little bit strange that the default behaviour of CMake 
install is to compile before installing. I understand it can be useful 
to check that everything is up-to-date, and maybe check if a new 
installation rule has been added. But outside Buildroot, when installing 
a CMake package to your computer, it might result in compiling with root 
privileges (since make install is likely to be called with root 
privileges). This point is out-of-scope regarding Buildroot, I was just 
wondering about CMake default behaviour...
Thomas Petazzoni April 23, 2015, 7:50 a.m. UTC | #4
Dear Cédric Marie,

On Wed, 22 Apr 2015 22:11:56 +0200, Cédric Marie wrote:
> With CMake build system, the "make install" command always compiles
> before installing, to make sure that everything is up-to-date.
> 
> In Buildroot environment, this is quite useless, because the package
> has always already been compiled, either at first build, or when
> invoking "make <package>-rebuild".
> In all cases, when it comes to staging or target installation step, the
> package has just been compiled.
> 
> Using "make install/fast" - in order to skip the compilation step - is
> therefore more appropriate, more consistent with what other build
> systems do, and saves time when you need to rebuild your package.
> 
> Signed-off-by: Cédric Marie <cedric.marie@openmailbox.org>
> ---
>  package/pkg-cmake.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Thomas
Cédric Marie April 23, 2015, 9:06 a.m. UTC | #5
Le 2015-04-23 09:50, Thomas Petazzoni a écrit :
> Applied, thanks.

Thank you.
Should I provide the patch for host-cmake as well?
Yann E. MORIN April 23, 2015, 4:44 p.m. UTC | #6
Cédric, All,

On 2015-04-23 11:06 +0200, Cédric Marie spake thusly:
> Le 2015-04-23 09:50, Thomas Petazzoni a écrit :
> >Applied, thanks.
> 
> Thank you.
> Should I provide the patch for host-cmake as well?

Yes, please. :-)

Even if the gain in time is not that important, I guess it is good to
use the same trick everywhere cmake is used.

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 2262012..f17a883 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -57,8 +57,8 @@  $(2)_MAKE			?= $$(MAKE)
 $(2)_MAKE_ENV			?=
 $(2)_MAKE_OPTS			?=
 $(2)_INSTALL_OPTS		?= install
-$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install
-$(2)_INSTALL_TARGET_OPTS		?= DESTDIR=$$(TARGET_DIR) install
+$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install/fast
+$(2)_INSTALL_TARGET_OPTS		?= DESTDIR=$$(TARGET_DIR) install/fast
 
 $(2)_SRCDIR			= $$($(2)_DIR)/$$($(2)_SUBDIR)