Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] gtest: update recipe to use autotools
@ 2015-03-02 12:52 Carlos Santos
  2015-04-19 11:17 ` Fabio Porcedda
  0 siblings, 1 reply; 8+ messages in thread
From: Carlos Santos @ 2015-03-02 12:52 UTC (permalink / raw)
  To: buildroot

The previous recipe build gtest using cmake, which prevented compiling
gmock (to be submitted in a following patch).

Gmock requires the gtest-config script, which is installed only if gtest
is built with autotools.

Signed-off-by: Marcelo Barbosa <marcelo.barbosa@datacom.ind.br>
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 package/gtest/gtest.mk | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index 7129c93..e148462 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -12,24 +12,16 @@ GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
 GTEST_LICENSE_FILES = LICENSE
 
-# While it is possible to build gtest as shared library, using this gtest shared
-# library requires to set some special configure option in the project using
-# gtest.
-# So, force to build gtest as a static library.
-#
-# For further details, refer to the explaination given in the README file from
-# the gtest sources.
-GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
-
 define GTEST_EXTRACT_CMDS
 	$(UNZIP) $(DL_DIR)/$(GTEST_SOURCE) -d $(BUILD_DIR)
 endef
 
 define GTEST_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/libgtest.a $(STAGING_DIR)/usr/lib/libgtest.a
-	$(INSTALL) -D -m 0755 $(@D)/libgtest_main.a $(STAGING_DIR)/usr/lib/libgtest_main.a
+	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgtest.a $(STAGING_DIR)/usr/lib/libgtest.a
+	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgtest_main.a $(STAGING_DIR)/usr/lib/libgtest_main.a
+	$(INSTALL) -D -m 0755 $(@D)/scripts/gtest-config $(STAGING_DIR)/usr/lib/scripts/gtest-config
 	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gtest/
 	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
 endef
 
-$(eval $(cmake-package))
+$(eval $(autotools-package))
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/1] gtest: update recipe to use autotools
  2015-03-02 12:52 [Buildroot] [PATCH 1/1] gtest: update recipe to use autotools Carlos Santos
@ 2015-04-19 11:17 ` Fabio Porcedda
  2015-04-22 20:20   ` Carlos Santos
  2015-04-22 20:29   ` [Buildroot] [PATCH v2 " Carlos Santos
  0 siblings, 2 replies; 8+ messages in thread
From: Fabio Porcedda @ 2015-04-19 11:17 UTC (permalink / raw)
  To: buildroot

On Mon, Mar 2, 2015 at 1:52 PM, Carlos Santos <casantos@datacom.ind.br> wrote:
> The previous recipe build gtest using cmake, which prevented compiling
> gmock (to be submitted in a following patch).
>
> Gmock requires the gtest-config script, which is installed only if gtest
> is built with autotools.


Because the autotools build script is no longer officially supported
[1] it would be better to use cmake, there is no way to generate the
gtest-config script within cmake?

[1]:
gtest-1.7.0/README:
The Autotools build script (configure + make) is no longer officially
supportted.  You are encouraged to migrate to your own build system or
use CMake.  If you still need to use Autotools, you can find
instructions in the README file from Google Test 1.4.0.



> Signed-off-by: Marcelo Barbosa <marcelo.barbosa@datacom.ind.br>
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
>  package/gtest/gtest.mk | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
> index 7129c93..e148462 100644
> --- a/package/gtest/gtest.mk
> +++ b/package/gtest/gtest.mk
> @@ -12,24 +12,16 @@ GTEST_INSTALL_TARGET = NO
>  GTEST_LICENSE = BSD-3c
>  GTEST_LICENSE_FILES = LICENSE
>
> -# While it is possible to build gtest as shared library, using this gtest shared
> -# library requires to set some special configure option in the project using
> -# gtest.
> -# So, force to build gtest as a static library.
> -#
> -# For further details, refer to the explaination given in the README file from
> -# the gtest sources.
> -GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
> -
>  define GTEST_EXTRACT_CMDS
>         $(UNZIP) $(DL_DIR)/$(GTEST_SOURCE) -d $(BUILD_DIR)
>  endef
>
>  define GTEST_INSTALL_STAGING_CMDS
> -       $(INSTALL) -D -m 0755 $(@D)/libgtest.a $(STAGING_DIR)/usr/lib/libgtest.a
> -       $(INSTALL) -D -m 0755 $(@D)/libgtest_main.a $(STAGING_DIR)/usr/lib/libgtest_main.a
> +       $(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgtest.a $(STAGING_DIR)/usr/lib/libgtest.a
> +       $(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgtest_main.a $(STAGING_DIR)/usr/lib/libgtest_main.a
> +       $(INSTALL) -D -m 0755 $(@D)/scripts/gtest-config $(STAGING_DIR)/usr/lib/scripts/gtest-config
>         $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gtest/
>         cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
>  endef
>
> -$(eval $(cmake-package))
> +$(eval $(autotools-package))
> --
> 1.8.3.1

This patch apply fine, but it fails to install the gtest package:

defconfig:
BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_PACKAGE_GTEST=y

>>> gtest 1.7.0 Installing to staging directory
/usr/bin/install -D -m 0755
/home/tetsuya/buildroot/br/output/build/gtest-1.7.0/lib/.libs/libgtest.a
/home/tetsuya/buildroot/br/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib/libgtest.a
/usr/bin/install: cannot stat
?/home/tetsuya/buildroot/br/output/build/gtest-1.7.0/lib/.libs/libgtest.a?:
No such file or directory
package/pkg-generic.mk:203: recipe for target
'/home/tetsuya/buildroot/br/output/build/gtest-1.7.0/.stamp_staging_installed'
failed
make: *** [/home/tetsuya/buildroot/br/output/build/gtest-1.7.0/.stamp_staging_installed]
Error 1

BR
-- 
Fabio Porcedda

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/1] gtest: update recipe to use autotools
  2015-04-19 11:17 ` Fabio Porcedda
@ 2015-04-22 20:20   ` Carlos Santos
  2015-04-22 20:29   ` [Buildroot] [PATCH v2 " Carlos Santos
  1 sibling, 0 replies; 8+ messages in thread
From: Carlos Santos @ 2015-04-22 20:20 UTC (permalink / raw)
  To: buildroot

----- Original Message -----
> From: "Fabio Porcedda" <fabio.porcedda@gmail.com>
> To: "Carlos Santos" <casantos@datacom.ind.br>
> Cc: buildroot at buildroot.org
> Sent: Sunday, April 19, 2015 8:17:00 AM
> Subject: Re: [Buildroot] [PATCH 1/1] gtest: update recipe to use autotools

> On Mon, Mar 2, 2015 at 1:52 PM, Carlos Santos <casantos@datacom.ind.br> wrote:
>> The previous recipe build gtest using cmake, which prevented compiling
>> gmock (to be submitted in a following patch).
>>
>> Gmock requires the gtest-config script, which is installed only if gtest
>> is built with autotools.
> 
> 
> Because the autotools build script is no longer officially supported
> [1] it would be better to use cmake, there is no way to generate the
> gtest-config script within cmake?

OK, I will look for an alternative using CMake.

> 
> [1]:
> gtest-1.7.0/README:
> The Autotools build script (configure + make) is no longer officially
> supportted.  You are encouraged to migrate to your own build system or
> use CMake.  If you still need to use Autotools, you can find
> instructions in the README file from Google Test 1.4.0.
> 
> 
> 
>> Signed-off-by: Marcelo Barbosa <marcelo.barbosa@datacom.ind.br>
>> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
>> ---
>>  package/gtest/gtest.mk | 16 ++++------------
>>  1 file changed, 4 insertions(+), 12 deletions(-)
>>
>> diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
>> index 7129c93..e148462 100644
>> --- a/package/gtest/gtest.mk
>> +++ b/package/gtest/gtest.mk
>> @@ -12,24 +12,16 @@ GTEST_INSTALL_TARGET = NO
>>  GTEST_LICENSE = BSD-3c
>>  GTEST_LICENSE_FILES = LICENSE
>>
>> -# While it is possible to build gtest as shared library, using this gtest
>> shared
>> -# library requires to set some special configure option in the project using
>> -# gtest.
>> -# So, force to build gtest as a static library.
>> -#
>> -# For further details, refer to the explaination given in the README file from
>> -# the gtest sources.
>> -GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
>> -
>>  define GTEST_EXTRACT_CMDS
>>         $(UNZIP) $(DL_DIR)/$(GTEST_SOURCE) -d $(BUILD_DIR)
>>  endef
>>
>>  define GTEST_INSTALL_STAGING_CMDS
>> -       $(INSTALL) -D -m 0755 $(@D)/libgtest.a $(STAGING_DIR)/usr/lib/libgtest.a
>> -       $(INSTALL) -D -m 0755 $(@D)/libgtest_main.a
>> $(STAGING_DIR)/usr/lib/libgtest_main.a
>> +       $(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgtest.a
>> $(STAGING_DIR)/usr/lib/libgtest.a
>> +       $(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgtest_main.a
>> $(STAGING_DIR)/usr/lib/libgtest_main.a
>> +       $(INSTALL) -D -m 0755 $(@D)/scripts/gtest-config
>> $(STAGING_DIR)/usr/lib/scripts/gtest-config
>>         $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gtest/
>>         cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
>>  endef
>>
>> -$(eval $(cmake-package))
>> +$(eval $(autotools-package))
>> --
>> 1.8.3.1
> 
> This patch apply fine, but it fails to install the gtest package:
> 
> defconfig:
> BR2_arm=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_PACKAGE_GTEST=y
> 
>>>> gtest 1.7.0 Installing to staging directory
> /usr/bin/install -D -m 0755
> /home/tetsuya/buildroot/br/output/build/gtest-1.7.0/lib/.libs/libgtest.a
> /home/tetsuya/buildroot/br/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib/libgtest.a
> /usr/bin/install: cannot stat
> ?/home/tetsuya/buildroot/br/output/build/gtest-1.7.0/lib/.libs/libgtest.a?:
> No such file or directory
> package/pkg-generic.mk:203: recipe for target
> '/home/tetsuya/buildroot/br/output/build/gtest-1.7.0/.stamp_staging_installed'
> failed
> make: ***
> [/home/tetsuya/buildroot/br/output/build/gtest-1.7.0/.stamp_staging_installed]
> Error 1

Ouch! It requires forcing autotools to build the static libraries. I will update the patch accordingly.

> BR
> --
> Fabio Porcedda



Carlos Santos (Casantos)
DATACOM, P&D

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 1/1] gtest: update recipe to use autotools
  2015-04-19 11:17 ` Fabio Porcedda
  2015-04-22 20:20   ` Carlos Santos
@ 2015-04-22 20:29   ` Carlos Santos
  2015-04-22 20:46     ` Thomas Petazzoni
  1 sibling, 1 reply; 8+ messages in thread
From: Carlos Santos @ 2015-04-22 20:29 UTC (permalink / raw)
  To: buildroot

The previous recipe build gtest using cmake, which prevented compiling
gmock (to be submitted in a following patch).

Gmock requires the gtest-config script, which is installed only if gtest
is built with autotools.

Change-Id: I71e52d2ccc19160ca936d80b41c127e79f1a7d6a
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 package/gtest/gtest.mk | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index 7129c93..1176030 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -11,25 +11,20 @@ GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
 GTEST_LICENSE_FILES = LICENSE
-
-# While it is possible to build gtest as shared library, using this gtest shared
-# library requires to set some special configure option in the project using
-# gtest.
-# So, force to build gtest as a static library.
-#
-# For further details, refer to the explaination given in the README file from
-# the gtest sources.
-GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
+GTEST_CONF_OPTS = --enable-static --disable-shared
 
 define GTEST_EXTRACT_CMDS
 	$(UNZIP) $(DL_DIR)/$(GTEST_SOURCE) -d $(BUILD_DIR)
 endef
 
 define GTEST_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/libgtest.a $(STAGING_DIR)/usr/lib/libgtest.a
-	$(INSTALL) -D -m 0755 $(@D)/libgtest_main.a $(STAGING_DIR)/usr/lib/libgtest_main.a
+	$(INSTALL) -D -m 0644 $(@D)/lib/.libs/libgtest.a $(STAGING_DIR)/usr/lib/libgtest.a
+	$(INSTALL) -D -m 0644 $(@D)/lib/.libs/libgtest_main.a $(STAGING_DIR)/usr/lib/libgtest_main.a
+	$(INSTALL) -D -m 0644 $(@D)/scripts/gtest-config $(STAGING_DIR)/usr/lib/scripts/gtest-config
 	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gtest/
-	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
+	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gtest/internal/
+	$(INSTALL) -D -m 0644 $(@D)/include/gtest/*.h* $(STAGING_DIR)/usr/include/gtest/
+	$(INSTALL) -D -m 0644 $(@D)/include/gtest/internal/*.h* $(STAGING_DIR)/usr/include/gtest/internal/
 endef
 
-$(eval $(cmake-package))
+$(eval $(autotools-package))
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 1/1] gtest: update recipe to use autotools
  2015-04-22 20:29   ` [Buildroot] [PATCH v2 " Carlos Santos
@ 2015-04-22 20:46     ` Thomas Petazzoni
  2015-04-23 11:23       ` Carlos Santos
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2015-04-22 20:46 UTC (permalink / raw)
  To: buildroot

Dear Carlos Santos,

On Wed, 22 Apr 2015 17:29:28 -0300, Carlos Santos wrote:

> -$(eval $(cmake-package))
> +$(eval $(autotools-package))

I still don't understand. Fabio quoted the README of gtest, which says:

"""
The Autotools build script (configure + make) is no longer officially
supportted.  You are encouraged to migrate to your own build system or
use CMake.
"""

So why moving from using the supported CMake to the no-longer supported
autotools build system would be an improvement?

This really needs more explanations.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 1/1] gtest: update recipe to use autotools
  2015-04-22 20:46     ` Thomas Petazzoni
@ 2015-04-23 11:23       ` Carlos Santos
  2015-04-23 20:14         ` Arnout Vandecappelle
  0 siblings, 1 reply; 8+ messages in thread
From: Carlos Santos @ 2015-04-23 11:23 UTC (permalink / raw)
  To: buildroot

> From: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
> To: "Carlos Santos" <casantos@datacom.ind.br>
> Cc: buildroot at buildroot.org
> Sent: Wednesday, April 22, 2015 5:46:20 PM
> Subject: Re: [Buildroot] [PATCH v2 1/1] gtest: update recipe to use autotools

> Dear Carlos Santos,
> 
> On Wed, 22 Apr 2015 17:29:28 -0300, Carlos Santos wrote:
> 
>> -$(eval $(cmake-package))
>> +$(eval $(autotools-package))
> 
> I still don't understand. Fabio quoted the README of gtest, which says:
> 
> """
> The Autotools build script (configure + make) is no longer officially
> supportted.  You are encouraged to migrate to your own build system or
> use CMake.
> """
> 
> So why moving from using the supported CMake to the no-longer supported
> autotools build system would be an improvement?
> 
> This really needs more explanations.

I agree that using autotools is not the ideal approach but so I don't have a solution to generate the gtest-config script using CMake. I will spend some additional time on this today and submit and alternate patch if possible.

> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com

Carlos Santos (Casantos)
DATACOM, P&D

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 1/1] gtest: update recipe to use autotools
  2015-04-23 11:23       ` Carlos Santos
@ 2015-04-23 20:14         ` Arnout Vandecappelle
  2015-04-25  9:25           ` Thomas Petazzoni
  0 siblings, 1 reply; 8+ messages in thread
From: Arnout Vandecappelle @ 2015-04-23 20:14 UTC (permalink / raw)
  To: buildroot

On 04/23/15 13:23, Carlos Santos wrote:
>> From: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
>> To: "Carlos Santos" <casantos@datacom.ind.br>
>> Cc: buildroot at buildroot.org
>> Sent: Wednesday, April 22, 2015 5:46:20 PM
>> Subject: Re: [Buildroot] [PATCH v2 1/1] gtest: update recipe to use autotools
> 
>> Dear Carlos Santos,
>>
>> On Wed, 22 Apr 2015 17:29:28 -0300, Carlos Santos wrote:
>>
>>> -$(eval $(cmake-package))
>>> +$(eval $(autotools-package))
>>
>> I still don't understand. Fabio quoted the README of gtest, which says:
>>
>> """
>> The Autotools build script (configure + make) is no longer officially
>> supportted.  You are encouraged to migrate to your own build system or
>> use CMake.
>> """
>>
>> So why moving from using the supported CMake to the no-longer supported
>> autotools build system would be an improvement?
>>
>> This really needs more explanations.
> 
> I agree that using autotools is not the ideal approach but so I don't have a solution to generate the gtest-config script using CMake. I will spend some additional time on this today and submit and alternate patch if possible.

 I think it's fairly simple:

# gtest-config is only generated when gtest is built with autotools,
# so generate it manually here.
define GTEST_INSTALL_CONFIG
	sed 's/@PACKAGE_TARNAME@/gtest/;\
		s/@PACKAGE_VERSION@/$(GTEST_VERSION)/;\
		s/..../' \
		$(@D)/scripts/gtest-config.in \
		> $(STAGING_DIR)/usr/bin/gtest-config
endef
GTEST_POST_STAGING_INSTALL_HOOKS += GTEST_INSTALL_CONFIG

 Not tested, of course :-)

 In particular, I'm not sure if gtest-config gives the correct feedback when
gtest has been installed with cmake.


 Regards,
 Arnout


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH v2 1/1] gtest: update recipe to use autotools
  2015-04-23 20:14         ` Arnout Vandecappelle
@ 2015-04-25  9:25           ` Thomas Petazzoni
  0 siblings, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2015-04-25  9:25 UTC (permalink / raw)
  To: buildroot

Arnout, Carlos,

On Thu, 23 Apr 2015 22:14:55 +0200, Arnout Vandecappelle wrote:

> # gtest-config is only generated when gtest is built with autotools,
> # so generate it manually here.
> define GTEST_INSTALL_CONFIG
> 	sed 's/@PACKAGE_TARNAME@/gtest/;\
> 		s/@PACKAGE_VERSION@/$(GTEST_VERSION)/;\
> 		s/..../' \
> 		$(@D)/scripts/gtest-config.in \
> 		> $(STAGING_DIR)/usr/bin/gtest-config
> endef
> GTEST_POST_STAGING_INSTALL_HOOKS += GTEST_INSTALL_CONFIG

I've implemented this solution, see commit:

  http://git.buildroot.net/buildroot/commit/?id=39186b5f5ac61c72d4b3d3088b7facbfd739abfa

I test that the generated gtest-config returns sane values, but I
didn't test with a real program using gtest obviously.

Carlos, can you let us know if that works for your use case?

Thanks a lot,

Thomas Petazzoni
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-25  9:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-02 12:52 [Buildroot] [PATCH 1/1] gtest: update recipe to use autotools Carlos Santos
2015-04-19 11:17 ` Fabio Porcedda
2015-04-22 20:20   ` Carlos Santos
2015-04-22 20:29   ` [Buildroot] [PATCH v2 " Carlos Santos
2015-04-22 20:46     ` Thomas Petazzoni
2015-04-23 11:23       ` Carlos Santos
2015-04-23 20:14         ` Arnout Vandecappelle
2015-04-25  9:25           ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox