All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] gtest: bump to version 1.8.0
@ 2016-09-07 14:39 Fabrice Fontaine
  2016-09-07 15:19 ` Carlos Santos
  2016-09-07 22:20 ` [Buildroot] [PATCH 1/1] gtest/gmock: " Carlos Santos
  0 siblings, 2 replies; 25+ messages in thread
From: Fabrice Fontaine @ 2016-09-07 14:39 UTC (permalink / raw)
  To: buildroot

Version 1.8.0 now includes gmock so merge gmock package inside gtest
In this merge:
 - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
   following advice from Arnout Vandecappelle
 - Use cmake to install libraries and headers and add missing files
   (gtest.pc, gtest-config, gmock.pc) in
   GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
   GTEST_INSTALL_STAGING_CMDS
 - Remove patch on Python as gmock/gtest now supports python 3.0
   (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
 - Add the correct license in HOST_GTEST_LICENSE as all python code in
   googlemock/scripts/generator is licensed under Apache-2.0 and not
   BSD-3c
 - Fix URL of gtest project in Config.in

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
---
 package/Config.in                          |  1 -
 package/gmock/0001-force-use-python2.patch | 20 ----------
 package/gmock/Config.in                    | 32 ---------------
 package/gmock/gmock.hash                   |  2 -
 package/gmock/gmock.mk                     | 64 ------------------------------
 package/gtest/Config.in                    | 31 ++++++++++++++-
 package/{gmock => gtest}/gmock.pc          |  2 +-
 package/gtest/gtest.hash                   |  2 +-
 package/gtest/gtest.mk                     | 52 +++++++++++++++++++-----
 package/gtest/gtest.pc                     |  2 +-
 10 files changed, 75 insertions(+), 133 deletions(-)
 delete mode 100644 package/gmock/0001-force-use-python2.patch
 delete mode 100644 package/gmock/Config.in
 delete mode 100644 package/gmock/gmock.hash
 delete mode 100644 package/gmock/gmock.mk
 rename package/{gmock => gtest}/gmock.pc (93%)

diff --git a/package/Config.in b/package/Config.in
index add6052..a70aaca 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1269,7 +1269,6 @@ menu "Other"
 	source "package/gflags/Config.in"
 	source "package/glibmm/Config.in"
 	source "package/glm/Config.in"
-	source "package/gmock/Config.in"
 	source "package/gmp/Config.in"
 	source "package/gsl/Config.in"
 	source "package/gtest/Config.in"
diff --git a/package/gmock/0001-force-use-python2.patch b/package/gmock/0001-force-use-python2.patch
deleted file mode 100644
index 5dcb231..0000000
--- a/package/gmock/0001-force-use-python2.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Force use of Python 2 even when Python 3 is the default Python interpreter.
-
-Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
-
---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
-+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2009, Google Inc.
- # All rights reserved.
---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
-+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2008 Google Inc. All Rights Reserved.
- #
diff --git a/package/gmock/Config.in b/package/gmock/Config.in
deleted file mode 100644
index ec3eb92..0000000
--- a/package/gmock/Config.in
+++ /dev/null
@@ -1,32 +0,0 @@
-config BR2_PACKAGE_GMOCK
-	bool "gmock"
-	select BR2_PACKAGE_GTEST
-	depends on BR2_USE_WCHAR
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_USE_MMU # fork()
-	help
-	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
-	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
-	  short) is a library for writing and using C++ mock classes.
-
-	  Google Mock:
-
-	    * lets you create mock classes trivially using simple macros,
-	    * supports a rich set of matchers and actions,
-	    * handles unordered, partially ordered, or completely ordered
-	      expectations,
-	    * is extensible by users, and
-	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
-	      Symbian.
-
-	    http://code.google.com/p/googlemock/
-
-	  There are both host and target packages. The target one has include
-	  files required to compile the tests and the static libraries required
-	  to link/run them. The host package installs gmock_gen, a Python script
-	  used to generate code mocks.
-
-comment "gmock needs a toolchain w/ C++, wchar, threads"
-	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
deleted file mode 100644
index 2b71739..0000000
--- a/package/gmock/gmock.hash
+++ /dev/null
@@ -1,2 +0,0 @@
-# Locally computed
-sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
deleted file mode 100644
index 4f04422..0000000
--- a/package/gmock/gmock.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-################################################################################
-#
-# gmock
-#
-################################################################################
-
-# Make sure this remains the same version as the gtest one
-GMOCK_VERSION = 1.7.0
-GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
-GMOCK_SITE = http://googlemock.googlecode.com/files
-GMOCK_INSTALL_STAGING = YES
-GMOCK_INSTALL_TARGET = NO
-GMOCK_LICENSE = BSD-3c
-GMOCK_LICENSE_FILES = LICENSE
-GMOCK_DEPENDENCIES = gtest host-gmock
-
-# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
-HOST_GMOCK_DEPENDENCIES = host-python
-HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
-
-# Static linking is required in order to keep the GMock package completely
-# separated from GTest. According to GMock's README file:
-#
-#   "Google Mock can be used as a DLL, but the same DLL must contain Google
-#    Test as well.  See Google Test's README file for instructions on how to
-#    set up necessary compiler settings".
-GMOCK_CONF_OPTS = --enable-static --disable-shared
-
-define GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
-endef
-
-# We can't use the default rule for autotools-package staging because it fails
-# because it tries to rebuild/install gtest stuff and fails after this error:
-#    "'make install' is dangerous and not supported. Instead, see README for
-#      how to integrate Google Test into your build system."
-define GMOCK_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
-	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
-	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
-	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
-		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
-endef
-
-# Unzipping inside $(@D) and moving everything from the created subdirectory is
-# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
-# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
-define HOST_GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
-	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
-	rmdir $(@D)/gmock-$(GMOCK_VERSION)
-endef
-
-define HOST_GMOCK_INSTALL_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
-	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
-	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
-endef
-
-$(eval $(autotools-package))
-# The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-autotools-package.
-$(eval $(host-generic-package))
diff --git a/package/gtest/Config.in b/package/gtest/Config.in
index c07f13b..9f514da 100644
--- a/package/gtest/Config.in
+++ b/package/gtest/Config.in
@@ -19,8 +19,35 @@ config BR2_PACKAGE_GTEST
 	  This package allows running testsuites on the target which
 	  might be advantageous in certain cases.
 
-	  http://code.google.com/p/googletest/
+	  https://github.com/google/googletest
+
+if BR2_PACKAGE_GTEST
+
+config BR2_PACKAGE_GTEST_GMOCK
+	bool "gmock"
+	help
+	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
+	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
+	  short) is a library for writing and using C++ mock classes.
+
+	  Google Mock:
+
+	    * lets you create mock classes trivially using simple macros,
+	    * supports a rich set of matchers and actions,
+	    * handles unordered, partially ordered, or completely ordered
+	      expectations,
+	    * is extensible by users, and
+	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
+	      Symbian.
+
+	  There are both host and target packages. The target one has include
+	  files required to compile the tests and the static libraries required
+	  to link/run them. The host package installs gmock_gen, a Python script
+	  used to generate code mocks.
+
+endif # BR2_PACKAGE_GTEST
 
 comment "gtest needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.pc b/package/gtest/gmock.pc
similarity index 93%
rename from package/gmock/gmock.pc
rename to package/gtest/gmock.pc
index 2f90068..4c72354 100644
--- a/package/gmock/gmock.pc
+++ b/package/gtest/gmock.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gmock
 Description: Google C++ Mocking Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgmock
 Libs.private: -lpthread
 Cflags: -I${includedir}
diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
index 79e31e4..474008d 100644
--- a/package/gtest/gtest.hash
+++ b/package/gtest/gtest.hash
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
+sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-release-1.8.0.tar.gz
diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index eb30905..249971e 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -4,13 +4,27 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gmock one
-GTEST_VERSION = release-1.7.0
+GTEST_VERSION = release-1.8.0
 GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
 GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
-GTEST_LICENSE_FILES = LICENSE
+GTEST_LICENSE_FILES = googletest/LICENSE
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_LICENSE_FILES += googlemock/LICENSE
+GTEST_DEPENDENCIES = host-gtest
+
+HOST_GTEST_LICENSE = Apache-2.0
+HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
+HOST_GTEST_DEPENDENCIES = host-python
+else
+# By default, gtest also builds gmock
+GTEST_SUBDIR = googletest
+endif
+
+HOST_GTEST_GMOCK_PYTHONPATH = \
+        $(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
 
 # 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
@@ -21,11 +35,7 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-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 $(STAGING_DIR)/usr/include/gtest/
-	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
+define GTEST_INSTALL_MISSING_FILES
 	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
 	# Generate the gtest-config script manually, since the CMake
@@ -39,9 +49,33 @@ define GTEST_INSTALL_STAGING_CMDS
 		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
 		s%@PTHREAD_CFLAGS@%%;\
 		s%@PTHREAD_LIBS@%-lpthread%;' \
-		$(@D)/scripts/gtest-config.in \
+		$(@D)/googletest/scripts/gtest-config.in \
 		> $(STAGING_DIR)/usr/bin/gtest-config
 	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
 endef
 
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+define GTEST_GMOCK_INSTALL_MISSING_FILE
+	$(INSTALL) -D -m 0755 package/gtest/gmock.pc \
+		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
+endef
+
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
+
+define HOST_GTEST_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
+		$(HOST_DIR)/usr/bin/gmock_gen.py
+	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
+	cp -rp $(@D)/googlemock/scripts/generator/cpp \
+		$(HOST_GTEST_GMOCK_PYTHONPATH)
+endef
+endif
+
 $(eval $(cmake-package))
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+# The host package does not build anything, just installs gmock_gen stuff, so
+# it does not need to be a host-cmake-package.
+$(eval $(host-generic-package))
+endif
diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
index b7a8aa4..594e79d 100644
--- a/package/gtest/gtest.pc
+++ b/package/gtest/gtest.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gtest
 Description: Google C++ Testing Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgtest
 Libs.private: -lpthread
 Cflags: -I${includedir}
-- 
2.7.4

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

* [Buildroot] [PATCH 1/1] gtest: bump to version 1.8.0
  2016-09-07 14:39 [Buildroot] [PATCH 1/1] gtest: bump to version 1.8.0 Fabrice Fontaine
@ 2016-09-07 15:19 ` Carlos Santos
  2016-09-07 22:20 ` [Buildroot] [PATCH 1/1] gtest/gmock: " Carlos Santos
  1 sibling, 0 replies; 25+ messages in thread
From: Carlos Santos @ 2016-09-07 15:19 UTC (permalink / raw)
  To: buildroot

> From: "Fabrice Fontaine" <fontaine.fabrice@gmail.com>
> To: buildroot at buildroot.org
> Cc: "Fabrice Fontaine" <fabrice.fontaine@orange.com>
> Sent: Wednesday, September 7, 2016 11:39:45 AM
> Subject: [Buildroot] [PATCH 1/1] gtest: bump to version 1.8.0

> Version 1.8.0 now includes gmock so merge gmock package inside gtest
> In this merge:
> - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
>   following advice from Arnout Vandecappelle
> - Use cmake to install libraries and headers and add missing files
>   (gtest.pc, gtest-config, gmock.pc) in
>   GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
>   GTEST_INSTALL_STAGING_CMDS
> - Remove patch on Python as gmock/gtest now supports python 3.0
>   (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
> - Add the correct license in HOST_GTEST_LICENSE as all python code in
>   googlemock/scripts/generator is licensed under Apache-2.0 and not
>   BSD-3c
> - Fix URL of gtest project in Config.in
> 
> Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
> ---
> package/Config.in                          |  1 -
> package/gmock/0001-force-use-python2.patch | 20 ----------
> package/gmock/Config.in                    | 32 ---------------
> package/gmock/gmock.hash                   |  2 -
> package/gmock/gmock.mk                     | 64 ------------------------------
> package/gtest/Config.in                    | 31 ++++++++++++++-
> package/{gmock => gtest}/gmock.pc          |  2 +-
> package/gtest/gtest.hash                   |  2 +-
> package/gtest/gtest.mk                     | 52 +++++++++++++++++++-----
> package/gtest/gtest.pc                     |  2 +-
> 10 files changed, 75 insertions(+), 133 deletions(-)
> delete mode 100644 package/gmock/0001-force-use-python2.patch
> delete mode 100644 package/gmock/Config.in
> delete mode 100644 package/gmock/gmock.hash
> delete mode 100644 package/gmock/gmock.mk
> rename package/{gmock => gtest}/gmock.pc (93%)
> 
> diff --git a/package/Config.in b/package/Config.in
> index add6052..a70aaca 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1269,7 +1269,6 @@ menu "Other"
> 	source "package/gflags/Config.in"
> 	source "package/glibmm/Config.in"
> 	source "package/glm/Config.in"
> -	source "package/gmock/Config.in"
> 	source "package/gmp/Config.in"
> 	source "package/gsl/Config.in"
> 	source "package/gtest/Config.in"
> diff --git a/package/gmock/0001-force-use-python2.patch
> b/package/gmock/0001-force-use-python2.patch
> deleted file mode 100644
> index 5dcb231..0000000
> --- a/package/gmock/0001-force-use-python2.patch
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -Force use of Python 2 even when Python 3 is the default Python interpreter.
> -
> -Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> -
> ---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000
> -0300
> -+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
> -@@ -1,4 +1,4 @@
> --#!/usr/bin/env python
> -+#!/usr/bin/env python2
> - #
> - # Copyright 2009, Google Inc.
> - # All rights reserved.
> ---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
> -+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
> -@@ -1,4 +1,4 @@
> --#!/usr/bin/env python
> -+#!/usr/bin/env python2
> - #
> - # Copyright 2008 Google Inc. All Rights Reserved.
> - #
> diff --git a/package/gmock/Config.in b/package/gmock/Config.in
> deleted file mode 100644
> index ec3eb92..0000000
> --- a/package/gmock/Config.in
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -config BR2_PACKAGE_GMOCK
> -	bool "gmock"
> -	select BR2_PACKAGE_GTEST
> -	depends on BR2_USE_WCHAR
> -	depends on BR2_TOOLCHAIN_HAS_THREADS
> -	depends on BR2_INSTALL_LIBSTDCPP
> -	depends on BR2_USE_MMU # fork()
> -	help
> -	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
> -	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
> -	  short) is a library for writing and using C++ mock classes.
> -
> -	  Google Mock:
> -
> -	    * lets you create mock classes trivially using simple macros,
> -	    * supports a rich set of matchers and actions,
> -	    * handles unordered, partially ordered, or completely ordered
> -	      expectations,
> -	    * is extensible by users, and
> -	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
> -	      Symbian.
> -
> -	    http://code.google.com/p/googlemock/
> -
> -	  There are both host and target packages. The target one has include
> -	  files required to compile the tests and the static libraries required
> -	  to link/run them. The host package installs gmock_gen, a Python script
> -	  used to generate code mocks.
> -
> -comment "gmock needs a toolchain w/ C++, wchar, threads"
> -	depends on BR2_USE_MMU
> -	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS ||
> !BR2_INSTALL_LIBSTDCPP
> diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
> deleted file mode 100644
> index 2b71739..0000000
> --- a/package/gmock/gmock.hash
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -# Locally computed
> -sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b
> gmock-1.7.0.zip
> diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
> deleted file mode 100644
> index 4f04422..0000000
> --- a/package/gmock/gmock.mk
> +++ /dev/null
> @@ -1,64 +0,0 @@
> -################################################################################
> -#
> -# gmock
> -#
> -################################################################################
> -
> -# Make sure this remains the same version as the gtest one
> -GMOCK_VERSION = 1.7.0
> -GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
> -GMOCK_SITE = http://googlemock.googlecode.com/files
> -GMOCK_INSTALL_STAGING = YES
> -GMOCK_INSTALL_TARGET = NO
> -GMOCK_LICENSE = BSD-3c
> -GMOCK_LICENSE_FILES = LICENSE
> -GMOCK_DEPENDENCIES = gtest host-gmock
> -
> -# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
> -HOST_GMOCK_DEPENDENCIES = host-python
> -HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
> -
> -# Static linking is required in order to keep the GMock package completely
> -# separated from GTest. According to GMock's README file:
> -#
> -#   "Google Mock can be used as a DLL, but the same DLL must contain Google
> -#    Test as well.  See Google Test's README file for instructions on how to
> -#    set up necessary compiler settings".
> -GMOCK_CONF_OPTS = --enable-static --disable-shared
> -
> -define GMOCK_EXTRACT_CMDS
> -	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
> -endef
> -
> -# We can't use the default rule for autotools-package staging because it fails
> -# because it tries to rebuild/install gtest stuff and fails after this error:
> -#    "'make install' is dangerous and not supported. Instead, see README for
> -#      how to integrate Google Test into your build system."
> -define GMOCK_INSTALL_STAGING_CMDS
> -	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a
> $(STAGING_DIR)/usr/lib/libgmock.a
> -	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a
> $(STAGING_DIR)/usr/lib/libgmock_main.a
> -	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
> -	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
> -	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
> -		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
> -endef
> -
> -# Unzipping inside $(@D) and moving everything from the created subdirectory is
> -# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
> -# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
> -define HOST_GMOCK_EXTRACT_CMDS
> -	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
> -	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
> -	rmdir $(@D)/gmock-$(GMOCK_VERSION)
> -endef
> -
> -define HOST_GMOCK_INSTALL_CMDS
> -	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py
> $(HOST_DIR)/usr/bin/gmock_gen.py
> -	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
> -	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
> -endef
> -
> -$(eval $(autotools-package))
> -# The host package does not build anything, just installs gmock_gen stuff, so
> -# it does not need to be a host-autotools-package.
> -$(eval $(host-generic-package))
> diff --git a/package/gtest/Config.in b/package/gtest/Config.in
> index c07f13b..9f514da 100644
> --- a/package/gtest/Config.in
> +++ b/package/gtest/Config.in
> @@ -19,8 +19,35 @@ config BR2_PACKAGE_GTEST
> 	  This package allows running testsuites on the target which
> 	  might be advantageous in certain cases.
> 
> -	  http://code.google.com/p/googletest/
> +	  https://github.com/google/googletest
> +
> +if BR2_PACKAGE_GTEST
> +
> +config BR2_PACKAGE_GTEST_GMOCK
> +	bool "gmock"
> +	help
> +	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
> +	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
> +	  short) is a library for writing and using C++ mock classes.
> +
> +	  Google Mock:
> +
> +	    * lets you create mock classes trivially using simple macros,
> +	    * supports a rich set of matchers and actions,
> +	    * handles unordered, partially ordered, or completely ordered
> +	      expectations,
> +	    * is extensible by users, and
> +	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
> +	      Symbian.
> +
> +	  There are both host and target packages. The target one has include
> +	  files required to compile the tests and the static libraries required
> +	  to link/run them. The host package installs gmock_gen, a Python script
> +	  used to generate code mocks.
> +
> +endif # BR2_PACKAGE_GTEST

Here you are removing the "gmock" package and replacing it by an option that resembles a package. This breaks the build of any package declaring "gmock" in its dependency list because there is no such package. I think I have a solution for this problem but I will need some time to work on it this afternoon.

Carlos Santos (Casantos)
DATACOM, P&D

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

* [Buildroot] [PATCH 1/1] gtest/gmock: bump to version 1.8.0
  2016-09-07 14:39 [Buildroot] [PATCH 1/1] gtest: bump to version 1.8.0 Fabrice Fontaine
  2016-09-07 15:19 ` Carlos Santos
@ 2016-09-07 22:20 ` Carlos Santos
  2016-09-07 23:16   ` [Buildroot] [PATCH v2] " Carlos Santos
  1 sibling, 1 reply; 25+ messages in thread
From: Carlos Santos @ 2016-09-07 22:20 UTC (permalink / raw)
  To: buildroot

From: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Version 1.8.0 now includes gmock so merge gmock package inside gtest.

In this merge:
 - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
   following advice from Arnout Vandecappelle
 - Make gmock a virtual package that selects BR2_PACKAGE_GTEST and
   BR2_PACKAGE_GTEST_GMOCK, to provide backward compatibility
 - Use cmake to install libraries and headers and add missing files
   (gtest.pc, gtest-config, gmock.pc) in
   GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
   GTEST_INSTALL_STAGING_CMDS
 - Remove patch on Python as gmock/gtest now supports python 3.0
   (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
 - Add the correct license in HOST_GTEST_LICENSE as all python code in
   googlemock/scripts/generator is licensed under Apache-2.0 and not
   BSD-3c
 - Fix URL of gtest project in Config.in

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 package/gmock/0001-force-use-python2.patch | 20 ----------
 package/gmock/Config.in                    | 26 +++++--------
 package/gmock/gmock.hash                   |  2 -
 package/gmock/gmock.mk                     | 59 +-----------------------------
 package/gtest/Config.in                    | 28 +++++++++++++-
 package/{gmock => gtest}/gmock.pc          |  2 +-
 package/gtest/gtest.hash                   |  2 +-
 package/gtest/gtest.mk                     | 52 +++++++++++++++++++++-----
 package/gtest/gtest.pc                     |  2 +-
 9 files changed, 83 insertions(+), 110 deletions(-)
 delete mode 100644 package/gmock/0001-force-use-python2.patch
 delete mode 100644 package/gmock/gmock.hash
 rename package/{gmock => gtest}/gmock.pc (93%)

diff --git a/package/gmock/0001-force-use-python2.patch b/package/gmock/0001-force-use-python2.patch
deleted file mode 100644
index 5dcb231..0000000
--- a/package/gmock/0001-force-use-python2.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Force use of Python 2 even when Python 3 is the default Python interpreter.
-
-Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
-
---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
-+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2009, Google Inc.
- # All rights reserved.
---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
-+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2008 Google Inc. All Rights Reserved.
- #
diff --git a/package/gmock/Config.in b/package/gmock/Config.in
index ec3eb92..c2b36f3 100644
--- a/package/gmock/Config.in
+++ b/package/gmock/Config.in
@@ -1,31 +1,23 @@
 config BR2_PACKAGE_GMOCK
 	bool "gmock"
 	select BR2_PACKAGE_GTEST
+	select BR2_PACKAGE_GTEST_GMOCK
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_MMU # fork()
 	help
-	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
-	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
-	  short) is a library for writing and using C++ mock classes.
+	  This virtual package provides backward compatibility for
+	  packages that depend on the old "gmock" package, whose
+	  functionality is provided by "gtest", now.
 
-	  Google Mock:
+if BR2_PACKAGE_GMOCK
 
-	    * lets you create mock classes trivially using simple macros,
-	    * supports a rich set of matchers and actions,
-	    * handles unordered, partially ordered, or completely ordered
-	      expectations,
-	    * is extensible by users, and
-	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
-	      Symbian.
+config BR2_PACKAGE_PROVIDES_GMOCK
+	string
+	default "gtest"
 
-	    http://code.google.com/p/googlemock/
-
-	  There are both host and target packages. The target one has include
-	  files required to compile the tests and the static libraries required
-	  to link/run them. The host package installs gmock_gen, a Python script
-	  used to generate code mocks.
+endif
 
 comment "gmock needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
deleted file mode 100644
index 2b71739..0000000
--- a/package/gmock/gmock.hash
+++ /dev/null
@@ -1,2 +0,0 @@
-# Locally computed
-sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
index 4f04422..21def82 100644
--- a/package/gmock/gmock.mk
+++ b/package/gmock/gmock.mk
@@ -4,61 +4,4 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gtest one
-GMOCK_VERSION = 1.7.0
-GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
-GMOCK_SITE = http://googlemock.googlecode.com/files
-GMOCK_INSTALL_STAGING = YES
-GMOCK_INSTALL_TARGET = NO
-GMOCK_LICENSE = BSD-3c
-GMOCK_LICENSE_FILES = LICENSE
-GMOCK_DEPENDENCIES = gtest host-gmock
-
-# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
-HOST_GMOCK_DEPENDENCIES = host-python
-HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
-
-# Static linking is required in order to keep the GMock package completely
-# separated from GTest. According to GMock's README file:
-#
-#   "Google Mock can be used as a DLL, but the same DLL must contain Google
-#    Test as well.  See Google Test's README file for instructions on how to
-#    set up necessary compiler settings".
-GMOCK_CONF_OPTS = --enable-static --disable-shared
-
-define GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
-endef
-
-# We can't use the default rule for autotools-package staging because it fails
-# because it tries to rebuild/install gtest stuff and fails after this error:
-#    "'make install' is dangerous and not supported. Instead, see README for
-#      how to integrate Google Test into your build system."
-define GMOCK_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
-	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
-	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
-	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
-		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
-endef
-
-# Unzipping inside $(@D) and moving everything from the created subdirectory is
-# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
-# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
-define HOST_GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
-	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
-	rmdir $(@D)/gmock-$(GMOCK_VERSION)
-endef
-
-define HOST_GMOCK_INSTALL_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
-	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
-	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
-endef
-
-$(eval $(autotools-package))
-# The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-autotools-package.
-$(eval $(host-generic-package))
+$(eval $(virtual-package))
diff --git a/package/gtest/Config.in b/package/gtest/Config.in
index c07f13b..3b0b5d5 100644
--- a/package/gtest/Config.in
+++ b/package/gtest/Config.in
@@ -19,7 +19,33 @@ config BR2_PACKAGE_GTEST
 	  This package allows running testsuites on the target which
 	  might be advantageous in certain cases.
 
-	  http://code.google.com/p/googletest/
+	  https://github.com/google/googletest
+
+if BR2_PACKAGE_GTEST
+
+config BR2_PACKAGE_GTEST_GMOCK
+	bool "Build the C++ mocking framework (gmock)"
+	help
+	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
+	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
+	  short) is a library for writing and using C++ mock classes.
+
+	  Google Mock:
+
+	    * lets you create mock classes trivially using simple macros,
+	    * supports a rich set of matchers and actions,
+	    * handles unordered, partially ordered, or completely ordered
+	      expectations,
+	    * is extensible by users, and
+	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
+	      Symbian.
+
+	  There are both host and target packages. The target one has include
+	  files required to compile the tests and the static libraries required
+	  to link/run them. The host package installs gmock_gen, a Python script
+	  used to generate code mocks.
+
+endif # BR2_PACKAGE_GTEST
 
 comment "gtest needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
diff --git a/package/gmock/gmock.pc b/package/gtest/gmock.pc
similarity index 93%
rename from package/gmock/gmock.pc
rename to package/gtest/gmock.pc
index 2f90068..4c72354 100644
--- a/package/gmock/gmock.pc
+++ b/package/gtest/gmock.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gmock
 Description: Google C++ Mocking Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgmock
 Libs.private: -lpthread
 Cflags: -I${includedir}
diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
index 79e31e4..474008d 100644
--- a/package/gtest/gtest.hash
+++ b/package/gtest/gtest.hash
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
+sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-release-1.8.0.tar.gz
diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index eb30905..249971e 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -4,13 +4,27 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gmock one
-GTEST_VERSION = release-1.7.0
+GTEST_VERSION = release-1.8.0
 GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
 GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
-GTEST_LICENSE_FILES = LICENSE
+GTEST_LICENSE_FILES = googletest/LICENSE
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_LICENSE_FILES += googlemock/LICENSE
+GTEST_DEPENDENCIES = host-gtest
+
+HOST_GTEST_LICENSE = Apache-2.0
+HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
+HOST_GTEST_DEPENDENCIES = host-python
+else
+# By default, gtest also builds gmock
+GTEST_SUBDIR = googletest
+endif
+
+HOST_GTEST_GMOCK_PYTHONPATH = \
+        $(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
 
 # 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
@@ -21,11 +35,7 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-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 $(STAGING_DIR)/usr/include/gtest/
-	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
+define GTEST_INSTALL_MISSING_FILES
 	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
 	# Generate the gtest-config script manually, since the CMake
@@ -39,9 +49,33 @@ define GTEST_INSTALL_STAGING_CMDS
 		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
 		s%@PTHREAD_CFLAGS@%%;\
 		s%@PTHREAD_LIBS@%-lpthread%;' \
-		$(@D)/scripts/gtest-config.in \
+		$(@D)/googletest/scripts/gtest-config.in \
 		> $(STAGING_DIR)/usr/bin/gtest-config
 	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
 endef
 
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+define GTEST_GMOCK_INSTALL_MISSING_FILE
+	$(INSTALL) -D -m 0755 package/gtest/gmock.pc \
+		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
+endef
+
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
+
+define HOST_GTEST_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
+		$(HOST_DIR)/usr/bin/gmock_gen.py
+	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
+	cp -rp $(@D)/googlemock/scripts/generator/cpp \
+		$(HOST_GTEST_GMOCK_PYTHONPATH)
+endef
+endif
+
 $(eval $(cmake-package))
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+# The host package does not build anything, just installs gmock_gen stuff, so
+# it does not need to be a host-cmake-package.
+$(eval $(host-generic-package))
+endif
diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
index b7a8aa4..594e79d 100644
--- a/package/gtest/gtest.pc
+++ b/package/gtest/gtest.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gtest
 Description: Google C++ Testing Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgtest
 Libs.private: -lpthread
 Cflags: -I${includedir}
-- 
2.7.4

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

* [Buildroot] [PATCH v2] gtest/gmock: bump to version 1.8.0
  2016-09-07 22:20 ` [Buildroot] [PATCH 1/1] gtest/gmock: " Carlos Santos
@ 2016-09-07 23:16   ` Carlos Santos
  2016-09-11 12:09     ` Arnout Vandecappelle
                       ` (4 more replies)
  0 siblings, 5 replies; 25+ messages in thread
From: Carlos Santos @ 2016-09-07 23:16 UTC (permalink / raw)
  To: buildroot

From: Fabrice Fontaine <fontaine.fabrice@gmail.com>

Version 1.8.0 now includes gmock so merge gmock package inside gtest.

In this merge:
 - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
   following advice from Arnout Vandecappelle
 - Make gmock a virtual package that selects BR2_PACKAGE_GTEST and
   BR2_PACKAGE_GTEST_GMOCK, to provide backward compatibility
 - Use cmake to install libraries and headers and add missing files
   (gtest.pc, gtest-config, gmock.pc) in
   GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
   GTEST_INSTALL_STAGING_CMDS
 - Remove patch on Python as gmock/gtest now supports python 3.0
   (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
 - Add the correct license in HOST_GTEST_LICENSE as all python code in
   googlemock/scripts/generator is licensed under Apache-2.0 and not
   BSD-3c
 - Fix URL of gtest project in Config.in

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>

---
Changes v1 -> v2
  - Add mirtual package for host-gmock, as pointed-out by Arnout
    Vandecappelle.

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 package/gmock/0001-force-use-python2.patch | 20 ----------
 package/gmock/Config.in                    | 26 +++++--------
 package/gmock/gmock.hash                   |  2 -
 package/gmock/gmock.mk                     | 60 +-----------------------------
 package/gtest/Config.in                    | 28 +++++++++++++-
 package/{gmock => gtest}/gmock.pc          |  2 +-
 package/gtest/gtest.hash                   |  2 +-
 package/gtest/gtest.mk                     | 52 +++++++++++++++++++++-----
 package/gtest/gtest.pc                     |  2 +-
 9 files changed, 84 insertions(+), 110 deletions(-)
 delete mode 100644 package/gmock/0001-force-use-python2.patch
 delete mode 100644 package/gmock/gmock.hash
 rename package/{gmock => gtest}/gmock.pc (93%)

diff --git a/package/gmock/0001-force-use-python2.patch b/package/gmock/0001-force-use-python2.patch
deleted file mode 100644
index 5dcb231..0000000
--- a/package/gmock/0001-force-use-python2.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Force use of Python 2 even when Python 3 is the default Python interpreter.
-
-Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
-
---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
-+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2009, Google Inc.
- # All rights reserved.
---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
-+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2008 Google Inc. All Rights Reserved.
- #
diff --git a/package/gmock/Config.in b/package/gmock/Config.in
index ec3eb92..c2b36f3 100644
--- a/package/gmock/Config.in
+++ b/package/gmock/Config.in
@@ -1,31 +1,23 @@
 config BR2_PACKAGE_GMOCK
 	bool "gmock"
 	select BR2_PACKAGE_GTEST
+	select BR2_PACKAGE_GTEST_GMOCK
 	depends on BR2_USE_WCHAR
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_MMU # fork()
 	help
-	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
-	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
-	  short) is a library for writing and using C++ mock classes.
+	  This virtual package provides backward compatibility for
+	  packages that depend on the old "gmock" package, whose
+	  functionality is provided by "gtest", now.
 
-	  Google Mock:
+if BR2_PACKAGE_GMOCK
 
-	    * lets you create mock classes trivially using simple macros,
-	    * supports a rich set of matchers and actions,
-	    * handles unordered, partially ordered, or completely ordered
-	      expectations,
-	    * is extensible by users, and
-	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
-	      Symbian.
+config BR2_PACKAGE_PROVIDES_GMOCK
+	string
+	default "gtest"
 
-	    http://code.google.com/p/googlemock/
-
-	  There are both host and target packages. The target one has include
-	  files required to compile the tests and the static libraries required
-	  to link/run them. The host package installs gmock_gen, a Python script
-	  used to generate code mocks.
+endif
 
 comment "gmock needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
deleted file mode 100644
index 2b71739..0000000
--- a/package/gmock/gmock.hash
+++ /dev/null
@@ -1,2 +0,0 @@
-# Locally computed
-sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
index 4f04422..70a006c 100644
--- a/package/gmock/gmock.mk
+++ b/package/gmock/gmock.mk
@@ -4,61 +4,5 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gtest one
-GMOCK_VERSION = 1.7.0
-GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
-GMOCK_SITE = http://googlemock.googlecode.com/files
-GMOCK_INSTALL_STAGING = YES
-GMOCK_INSTALL_TARGET = NO
-GMOCK_LICENSE = BSD-3c
-GMOCK_LICENSE_FILES = LICENSE
-GMOCK_DEPENDENCIES = gtest host-gmock
-
-# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
-HOST_GMOCK_DEPENDENCIES = host-python
-HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
-
-# Static linking is required in order to keep the GMock package completely
-# separated from GTest. According to GMock's README file:
-#
-#   "Google Mock can be used as a DLL, but the same DLL must contain Google
-#    Test as well.  See Google Test's README file for instructions on how to
-#    set up necessary compiler settings".
-GMOCK_CONF_OPTS = --enable-static --disable-shared
-
-define GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
-endef
-
-# We can't use the default rule for autotools-package staging because it fails
-# because it tries to rebuild/install gtest stuff and fails after this error:
-#    "'make install' is dangerous and not supported. Instead, see README for
-#      how to integrate Google Test into your build system."
-define GMOCK_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
-	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
-	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
-	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
-		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
-endef
-
-# Unzipping inside $(@D) and moving everything from the created subdirectory is
-# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
-# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
-define HOST_GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
-	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
-	rmdir $(@D)/gmock-$(GMOCK_VERSION)
-endef
-
-define HOST_GMOCK_INSTALL_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
-	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
-	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
-endef
-
-$(eval $(autotools-package))
-# The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-autotools-package.
-$(eval $(host-generic-package))
+$(eval $(virtual-package))
+$(eval $(host-virtual-package))
diff --git a/package/gtest/Config.in b/package/gtest/Config.in
index c07f13b..3b0b5d5 100644
--- a/package/gtest/Config.in
+++ b/package/gtest/Config.in
@@ -19,7 +19,33 @@ config BR2_PACKAGE_GTEST
 	  This package allows running testsuites on the target which
 	  might be advantageous in certain cases.
 
-	  http://code.google.com/p/googletest/
+	  https://github.com/google/googletest
+
+if BR2_PACKAGE_GTEST
+
+config BR2_PACKAGE_GTEST_GMOCK
+	bool "Build the C++ mocking framework (gmock)"
+	help
+	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
+	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
+	  short) is a library for writing and using C++ mock classes.
+
+	  Google Mock:
+
+	    * lets you create mock classes trivially using simple macros,
+	    * supports a rich set of matchers and actions,
+	    * handles unordered, partially ordered, or completely ordered
+	      expectations,
+	    * is extensible by users, and
+	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
+	      Symbian.
+
+	  There are both host and target packages. The target one has include
+	  files required to compile the tests and the static libraries required
+	  to link/run them. The host package installs gmock_gen, a Python script
+	  used to generate code mocks.
+
+endif # BR2_PACKAGE_GTEST
 
 comment "gtest needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
diff --git a/package/gmock/gmock.pc b/package/gtest/gmock.pc
similarity index 93%
rename from package/gmock/gmock.pc
rename to package/gtest/gmock.pc
index 2f90068..4c72354 100644
--- a/package/gmock/gmock.pc
+++ b/package/gtest/gmock.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gmock
 Description: Google C++ Mocking Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgmock
 Libs.private: -lpthread
 Cflags: -I${includedir}
diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
index 79e31e4..474008d 100644
--- a/package/gtest/gtest.hash
+++ b/package/gtest/gtest.hash
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
+sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-release-1.8.0.tar.gz
diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index eb30905..249971e 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -4,13 +4,27 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gmock one
-GTEST_VERSION = release-1.7.0
+GTEST_VERSION = release-1.8.0
 GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
 GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
-GTEST_LICENSE_FILES = LICENSE
+GTEST_LICENSE_FILES = googletest/LICENSE
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_LICENSE_FILES += googlemock/LICENSE
+GTEST_DEPENDENCIES = host-gtest
+
+HOST_GTEST_LICENSE = Apache-2.0
+HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
+HOST_GTEST_DEPENDENCIES = host-python
+else
+# By default, gtest also builds gmock
+GTEST_SUBDIR = googletest
+endif
+
+HOST_GTEST_GMOCK_PYTHONPATH = \
+        $(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
 
 # 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
@@ -21,11 +35,7 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-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 $(STAGING_DIR)/usr/include/gtest/
-	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
+define GTEST_INSTALL_MISSING_FILES
 	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
 	# Generate the gtest-config script manually, since the CMake
@@ -39,9 +49,33 @@ define GTEST_INSTALL_STAGING_CMDS
 		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
 		s%@PTHREAD_CFLAGS@%%;\
 		s%@PTHREAD_LIBS@%-lpthread%;' \
-		$(@D)/scripts/gtest-config.in \
+		$(@D)/googletest/scripts/gtest-config.in \
 		> $(STAGING_DIR)/usr/bin/gtest-config
 	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
 endef
 
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+define GTEST_GMOCK_INSTALL_MISSING_FILE
+	$(INSTALL) -D -m 0755 package/gtest/gmock.pc \
+		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
+endef
+
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
+
+define HOST_GTEST_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
+		$(HOST_DIR)/usr/bin/gmock_gen.py
+	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
+	cp -rp $(@D)/googlemock/scripts/generator/cpp \
+		$(HOST_GTEST_GMOCK_PYTHONPATH)
+endef
+endif
+
 $(eval $(cmake-package))
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+# The host package does not build anything, just installs gmock_gen stuff, so
+# it does not need to be a host-cmake-package.
+$(eval $(host-generic-package))
+endif
diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
index b7a8aa4..594e79d 100644
--- a/package/gtest/gtest.pc
+++ b/package/gtest/gtest.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gtest
 Description: Google C++ Testing Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgtest
 Libs.private: -lpthread
 Cflags: -I${includedir}
-- 
2.7.4

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

* [Buildroot] [PATCH v2] gtest/gmock: bump to version 1.8.0
  2016-09-07 23:16   ` [Buildroot] [PATCH v2] " Carlos Santos
@ 2016-09-11 12:09     ` Arnout Vandecappelle
  2017-02-06 15:43       ` Romain Naour
  2017-02-11 11:32     ` [Buildroot] [PATCH v3] " Carlos Santos
                       ` (3 subsequent siblings)
  4 siblings, 1 reply; 25+ messages in thread
From: Arnout Vandecappelle @ 2016-09-11 12:09 UTC (permalink / raw)
  To: buildroot

 Big patch, so lots of comments on this one...


On 08-09-16 01:16, Carlos Santos wrote:
> From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> 
> Version 1.8.0 now includes gmock so merge gmock package inside gtest.
> 
> In this merge:
>  - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
>    following advice from Arnout Vandecappelle
>  - Make gmock a virtual package that selects BR2_PACKAGE_GTEST and
>    BR2_PACKAGE_GTEST_GMOCK, to provide backward compatibility

 I don't think this is a good idea.

* It means we have to keep on supporting the BR2_PACKAGE_GMOCK option for some
time. Let's say two years down the line we decide to remove it, it means we have
to move it to legacy at that time. So long term, we gain exactly nothing.
* The legacy approach works perfectly. The Config.in.legacy entry will make sure
that the package remains selected. If an external package depends on gmock,
you'll get an immediate build termination because make doesn't know how to build
gmock. Since the user has just removed gmock from the legacy menu, it should be
quite obvious what needs to be done.
* This is abusing the virtual package infra for something it wasn't meant for.
We want to avoid adding bad examples to buildroot.


>  - Use cmake to install libraries and headers and add missing files
>    (gtest.pc, gtest-config, gmock.pc) in
>    GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
>    GTEST_INSTALL_STAGING_CMDS
>  - Remove patch on Python as gmock/gtest now supports python 3.0
>    (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
>  - Add the correct license in HOST_GTEST_LICENSE as all python code in
>    googlemock/scripts/generator is licensed under Apache-2.0 and not
>    BSD-3c
>  - Fix URL of gtest project in Config.in
> 
> Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> 
> ---
> Changes v1 -> v2
>   - Add mirtual package for host-gmock, as pointed-out by Arnout
>     Vandecappelle.

 Well, no, I never mentioned virtual-package, I said to add a legacy entry.

> 
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
>  package/gmock/0001-force-use-python2.patch | 20 ----------
>  package/gmock/Config.in                    | 26 +++++--------
>  package/gmock/gmock.hash                   |  2 -
>  package/gmock/gmock.mk                     | 60 +-----------------------------
>  package/gtest/Config.in                    | 28 +++++++++++++-
>  package/{gmock => gtest}/gmock.pc          |  2 +-
>  package/gtest/gtest.hash                   |  2 +-
>  package/gtest/gtest.mk                     | 52 +++++++++++++++++++++-----
>  package/gtest/gtest.pc                     |  2 +-
>  9 files changed, 84 insertions(+), 110 deletions(-)
>  delete mode 100644 package/gmock/0001-force-use-python2.patch
>  delete mode 100644 package/gmock/gmock.hash
>  rename package/{gmock => gtest}/gmock.pc (93%)
[snip]
> diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
> index eb30905..249971e 100644
> --- a/package/gtest/gtest.mk
> +++ b/package/gtest/gtest.mk
> @@ -4,13 +4,27 @@
>  #
>  ################################################################################
>  
> -# Make sure this remains the same version as the gmock one
> -GTEST_VERSION = release-1.7.0
> +GTEST_VERSION = release-1.8.0
>  GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
>  GTEST_INSTALL_STAGING = YES
>  GTEST_INSTALL_TARGET = NO
>  GTEST_LICENSE = BSD-3c
> -GTEST_LICENSE_FILES = LICENSE
> +GTEST_LICENSE_FILES = googletest/LICENSE
> +
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> +GTEST_LICENSE_FILES += googlemock/LICENSE

 It has the same content, so it doesn't make sense adding it. Since it's now a
single package, a single license file is definitely enough.

> +GTEST_DEPENDENCIES = host-gtest
> +
> +HOST_GTEST_LICENSE = Apache-2.0

 This is so weird that it deserves a separate comment.

# HOST_GTEST is just the generator script, which has a different license
# than the rest of gtest. Also, the generator script is not installed on
# target so its license doesn't need to be mentioned for the target package.

> +HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
> +HOST_GTEST_DEPENDENCIES = host-python

 Is the host-python dependency still needed? If python-2.6 doesn't work, yes it
is, but then there should be a comment. But the README file says "Python 2.3.5
or later"...

 All this HOST_GTEST stuff should be defined unconditionally.

> +else
> +# By default, gtest also builds gmock
> +GTEST_SUBDIR = googletest

 Actually, the top-level CMakeLists has the options BUILD_GTEST and BUILD_GMOCK
(the latter implies the former in a rather complicated way). It's better to use
those rather than messing with SUBDIR.

> +endif
> +
> +HOST_GTEST_GMOCK_PYTHONPATH = \
> +        $(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
>  
>  # 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
> @@ -21,11 +35,7 @@ GTEST_LICENSE_FILES = LICENSE
>  # the gtest sources.
>  GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
>  
> -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 $(STAGING_DIR)/usr/include/gtest/
> -	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
> +define GTEST_INSTALL_MISSING_FILES
>  	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
>  		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
>  	# Generate the gtest-config script manually, since the CMake
> @@ -39,9 +49,33 @@ define GTEST_INSTALL_STAGING_CMDS
>  		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
>  		s%@PTHREAD_CFLAGS@%%;\
>  		s%@PTHREAD_LIBS@%-lpthread%;' \
> -		$(@D)/scripts/gtest-config.in \
> +		$(@D)/googletest/scripts/gtest-config.in \
>  		> $(STAGING_DIR)/usr/bin/gtest-config
>  	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
>  endef
>  
> +GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
> +
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> +define GTEST_GMOCK_INSTALL_MISSING_FILE
> +	$(INSTALL) -D -m 0755 package/gtest/gmock.pc \
> +		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
> +endef
> +
> +GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
> +
> +define HOST_GTEST_INSTALL_CMDS

 This shouldn't be inside the GTEST_GMOCK condition.

> +	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
> +		$(HOST_DIR)/usr/bin/gmock_gen.py
> +	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
> +	cp -rp $(@D)/googlemock/scripts/generator/cpp \
> +		$(HOST_GTEST_GMOCK_PYTHONPATH)

 This is just copied from the current implementation, so OK. However, now I look
like it, this seems a really twisted way of installing this script. The normal
approach would be

	mkdir -p $(HOST_DIR)/usr/lib/gmock
	cp -r $(@D)/googlemock/scripts/generator/* $(HOST_DIR)/usr/lib/gmock
	ln -sf ../lib/gmock/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen

 I.e. install the script itself together with the libraries it imports, and
symlink to it from $PATH. This way, the script will find the libraries by itself
(it extends sys.path with $0).

 That way, the script is also usable with the system's python. So, unless you
make this change, the host-python dependency really _is_ needed, otherwise the
gmock_gen imports won't be found when executing the script.

> +endef
> +endif
> +
>  $(eval $(cmake-package))
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)

 This should _definitely_ not be in the GTEST_GMOCK condition. We never let the
package definition itself depend on the config options.


 Regards,
 Arnout

> +# The host package does not build anything, just installs gmock_gen stuff, so
> +# it does not need to be a host-cmake-package.
> +$(eval $(host-generic-package))
> +endif
> diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
> index b7a8aa4..594e79d 100644
> --- a/package/gtest/gtest.pc
> +++ b/package/gtest/gtest.pc
> @@ -5,7 +5,7 @@ includedir=${prefix}/include
>  
>  Name: gtest
>  Description: Google C++ Testing Framework
> -Version: 1.7.0
> +Version: 1.8.0
>  Libs: -L${libdir} -lgtest
>  Libs.private: -lpthread
>  Cflags: -I${includedir}
> 

-- 
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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v2] gtest/gmock: bump to version 1.8.0
  2016-09-11 12:09     ` Arnout Vandecappelle
@ 2017-02-06 15:43       ` Romain Naour
  2017-02-06 16:46         ` Carlos Santos
  0 siblings, 1 reply; 25+ messages in thread
From: Romain Naour @ 2017-02-06 15:43 UTC (permalink / raw)
  To: buildroot

Hi Carlos, Fabrice, All,

I removed the last remaining gtest related patch [1] from patchwork since the
gtest/gmock 1.8.0 is now available.

What's the status of this patch bump?
Can you send an updated version?

Thanks!

Best regards,
Romain

[1] http://patchwork.ozlabs.org/patch/667729/

Le 11/09/2016 ? 14:09, Arnout Vandecappelle a ?crit :
>  Big patch, so lots of comments on this one...
> 
> 
> On 08-09-16 01:16, Carlos Santos wrote:
>> From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>>
>> Version 1.8.0 now includes gmock so merge gmock package inside gtest.
>>
>> In this merge:
>>  - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
>>    following advice from Arnout Vandecappelle
>>  - Make gmock a virtual package that selects BR2_PACKAGE_GTEST and
>>    BR2_PACKAGE_GTEST_GMOCK, to provide backward compatibility
> 
>  I don't think this is a good idea.
> 
> * It means we have to keep on supporting the BR2_PACKAGE_GMOCK option for some
> time. Let's say two years down the line we decide to remove it, it means we have
> to move it to legacy at that time. So long term, we gain exactly nothing.
> * The legacy approach works perfectly. The Config.in.legacy entry will make sure
> that the package remains selected. If an external package depends on gmock,
> you'll get an immediate build termination because make doesn't know how to build
> gmock. Since the user has just removed gmock from the legacy menu, it should be
> quite obvious what needs to be done.
> * This is abusing the virtual package infra for something it wasn't meant for.
> We want to avoid adding bad examples to buildroot.
> 
> 
>>  - Use cmake to install libraries and headers and add missing files
>>    (gtest.pc, gtest-config, gmock.pc) in
>>    GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
>>    GTEST_INSTALL_STAGING_CMDS
>>  - Remove patch on Python as gmock/gtest now supports python 3.0
>>    (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
>>  - Add the correct license in HOST_GTEST_LICENSE as all python code in
>>    googlemock/scripts/generator is licensed under Apache-2.0 and not
>>    BSD-3c
>>  - Fix URL of gtest project in Config.in
>>
>> Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
>> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
>>
>> ---
>> Changes v1 -> v2
>>   - Add mirtual package for host-gmock, as pointed-out by Arnout
>>     Vandecappelle.
> 
>  Well, no, I never mentioned virtual-package, I said to add a legacy entry.
> 
>>
>> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
>> ---
>>  package/gmock/0001-force-use-python2.patch | 20 ----------
>>  package/gmock/Config.in                    | 26 +++++--------
>>  package/gmock/gmock.hash                   |  2 -
>>  package/gmock/gmock.mk                     | 60 +-----------------------------
>>  package/gtest/Config.in                    | 28 +++++++++++++-
>>  package/{gmock => gtest}/gmock.pc          |  2 +-
>>  package/gtest/gtest.hash                   |  2 +-
>>  package/gtest/gtest.mk                     | 52 +++++++++++++++++++++-----
>>  package/gtest/gtest.pc                     |  2 +-
>>  9 files changed, 84 insertions(+), 110 deletions(-)
>>  delete mode 100644 package/gmock/0001-force-use-python2.patch
>>  delete mode 100644 package/gmock/gmock.hash
>>  rename package/{gmock => gtest}/gmock.pc (93%)
> [snip]
>> diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
>> index eb30905..249971e 100644
>> --- a/package/gtest/gtest.mk
>> +++ b/package/gtest/gtest.mk
>> @@ -4,13 +4,27 @@
>>  #
>>  ################################################################################
>>  
>> -# Make sure this remains the same version as the gmock one
>> -GTEST_VERSION = release-1.7.0
>> +GTEST_VERSION = release-1.8.0
>>  GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
>>  GTEST_INSTALL_STAGING = YES
>>  GTEST_INSTALL_TARGET = NO
>>  GTEST_LICENSE = BSD-3c
>> -GTEST_LICENSE_FILES = LICENSE
>> +GTEST_LICENSE_FILES = googletest/LICENSE
>> +
>> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
>> +GTEST_LICENSE_FILES += googlemock/LICENSE
> 
>  It has the same content, so it doesn't make sense adding it. Since it's now a
> single package, a single license file is definitely enough.
> 
>> +GTEST_DEPENDENCIES = host-gtest
>> +
>> +HOST_GTEST_LICENSE = Apache-2.0
> 
>  This is so weird that it deserves a separate comment.
> 
> # HOST_GTEST is just the generator script, which has a different license
> # than the rest of gtest. Also, the generator script is not installed on
> # target so its license doesn't need to be mentioned for the target package.
> 
>> +HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
>> +HOST_GTEST_DEPENDENCIES = host-python
> 
>  Is the host-python dependency still needed? If python-2.6 doesn't work, yes it
> is, but then there should be a comment. But the README file says "Python 2.3.5
> or later"...
> 
>  All this HOST_GTEST stuff should be defined unconditionally.
> 
>> +else
>> +# By default, gtest also builds gmock
>> +GTEST_SUBDIR = googletest
> 
>  Actually, the top-level CMakeLists has the options BUILD_GTEST and BUILD_GMOCK
> (the latter implies the former in a rather complicated way). It's better to use
> those rather than messing with SUBDIR.
> 
>> +endif
>> +
>> +HOST_GTEST_GMOCK_PYTHONPATH = \
>> +        $(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
>>  
>>  # 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
>> @@ -21,11 +35,7 @@ GTEST_LICENSE_FILES = LICENSE
>>  # the gtest sources.
>>  GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
>>  
>> -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 $(STAGING_DIR)/usr/include/gtest/
>> -	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
>> +define GTEST_INSTALL_MISSING_FILES
>>  	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
>>  		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
>>  	# Generate the gtest-config script manually, since the CMake
>> @@ -39,9 +49,33 @@ define GTEST_INSTALL_STAGING_CMDS
>>  		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
>>  		s%@PTHREAD_CFLAGS@%%;\
>>  		s%@PTHREAD_LIBS@%-lpthread%;' \
>> -		$(@D)/scripts/gtest-config.in \
>> +		$(@D)/googletest/scripts/gtest-config.in \
>>  		> $(STAGING_DIR)/usr/bin/gtest-config
>>  	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
>>  endef
>>  
>> +GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
>> +
>> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
>> +define GTEST_GMOCK_INSTALL_MISSING_FILE
>> +	$(INSTALL) -D -m 0755 package/gtest/gmock.pc \
>> +		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
>> +endef
>> +
>> +GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
>> +
>> +define HOST_GTEST_INSTALL_CMDS
> 
>  This shouldn't be inside the GTEST_GMOCK condition.
> 
>> +	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
>> +		$(HOST_DIR)/usr/bin/gmock_gen.py
>> +	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
>> +	cp -rp $(@D)/googlemock/scripts/generator/cpp \
>> +		$(HOST_GTEST_GMOCK_PYTHONPATH)
> 
>  This is just copied from the current implementation, so OK. However, now I look
> like it, this seems a really twisted way of installing this script. The normal
> approach would be
> 
> 	mkdir -p $(HOST_DIR)/usr/lib/gmock
> 	cp -r $(@D)/googlemock/scripts/generator/* $(HOST_DIR)/usr/lib/gmock
> 	ln -sf ../lib/gmock/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
> 
>  I.e. install the script itself together with the libraries it imports, and
> symlink to it from $PATH. This way, the script will find the libraries by itself
> (it extends sys.path with $0).
> 
>  That way, the script is also usable with the system's python. So, unless you
> make this change, the host-python dependency really _is_ needed, otherwise the
> gmock_gen imports won't be found when executing the script.
> 
>> +endef
>> +endif
>> +
>>  $(eval $(cmake-package))
>> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> 
>  This should _definitely_ not be in the GTEST_GMOCK condition. We never let the
> package definition itself depend on the config options.
> 
> 
>  Regards,
>  Arnout
> 
>> +# The host package does not build anything, just installs gmock_gen stuff, so
>> +# it does not need to be a host-cmake-package.
>> +$(eval $(host-generic-package))
>> +endif
>> diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
>> index b7a8aa4..594e79d 100644
>> --- a/package/gtest/gtest.pc
>> +++ b/package/gtest/gtest.pc
>> @@ -5,7 +5,7 @@ includedir=${prefix}/include
>>  
>>  Name: gtest
>>  Description: Google C++ Testing Framework
>> -Version: 1.7.0
>> +Version: 1.8.0
>>  Libs: -L${libdir} -lgtest
>>  Libs.private: -lpthread
>>  Cflags: -I${includedir}
>>
> 

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

* [Buildroot] [PATCH v2] gtest/gmock: bump to version 1.8.0
  2017-02-06 15:43       ` Romain Naour
@ 2017-02-06 16:46         ` Carlos Santos
  2017-02-06 16:54           ` Romain Naour
  0 siblings, 1 reply; 25+ messages in thread
From: Carlos Santos @ 2017-02-06 16:46 UTC (permalink / raw)
  To: buildroot

> From: "Romain Naour" <romain.naour@gmail.com>
> To: "Arnout Vandecappelle" <arnout@mind.be>, "Carlos Santos" <casantos@datacom.ind.br>, buildroot at buildroot.org
> Cc: "fabrice fontaine" <fabrice.fontaine@orange.com>, "fontaine fabrice" <fontaine.fabrice@gmail.com>, "Thomas
> Petazzoni" <thomas.petazzoni@free-electrons.com>
> Sent: Monday, February 6, 2017 1:43:17 PM
> Subject: Re: [Buildroot] [PATCH v2] gtest/gmock: bump to version 1.8.0

> Hi Carlos, Fabrice, All,
> 
> I removed the last remaining gtest related patch [1] from patchwork since the
> gtest/gmock 1.8.0 is now available.
> 
> What's the status of this patch bump?
> Can you send an updated version?
> 
> Thanks!
> 
> Best regards,
> Romain
> 
> [1] http://patchwork.ozlabs.org/patch/667729/

I will probably have time to work on these GTest/Gmock issues again by Thursday.

Carlos Santos (Casantos) - DATACOM, P&D
?Something must be done. This is something. Therefore we must do it.?
(from the BBC series ?Yes, Prime Minister?, ?Power to the people?)

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

* [Buildroot] [PATCH v2] gtest/gmock: bump to version 1.8.0
  2017-02-06 16:46         ` Carlos Santos
@ 2017-02-06 16:54           ` Romain Naour
  0 siblings, 0 replies; 25+ messages in thread
From: Romain Naour @ 2017-02-06 16:54 UTC (permalink / raw)
  To: buildroot

Hi Carlos,

Le 06/02/2017 ? 17:46, Carlos Santos a ?crit :
>> From: "Romain Naour" <romain.naour@gmail.com>
>> To: "Arnout Vandecappelle" <arnout@mind.be>, "Carlos Santos" <casantos@datacom.ind.br>, buildroot at buildroot.org
>> Cc: "fabrice fontaine" <fabrice.fontaine@orange.com>, "fontaine fabrice" <fontaine.fabrice@gmail.com>, "Thomas
>> Petazzoni" <thomas.petazzoni@free-electrons.com>
>> Sent: Monday, February 6, 2017 1:43:17 PM
>> Subject: Re: [Buildroot] [PATCH v2] gtest/gmock: bump to version 1.8.0
> 
>> Hi Carlos, Fabrice, All,
>>
>> I removed the last remaining gtest related patch [1] from patchwork since the
>> gtest/gmock 1.8.0 is now available.
>>
>> What's the status of this patch bump?
>> Can you send an updated version?
>>
>> Thanks!
>>
>> Best regards,
>> Romain
>>
>> [1] http://patchwork.ozlabs.org/patch/667729/
> 
> I will probably have time to work on these GTest/Gmock issues again by Thursday.

Great, thanks!

Best regards,
Romain

> 
> Carlos Santos (Casantos) - DATACOM, P&D
> ?Something must be done. This is something. Therefore we must do it.?
> (from the BBC series ?Yes, Prime Minister?, ?Power to the people?)
> 

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

* [Buildroot] [PATCH v3] gtest/gmock: bump to version 1.8.0
  2016-09-07 23:16   ` [Buildroot] [PATCH v2] " Carlos Santos
  2016-09-11 12:09     ` Arnout Vandecappelle
@ 2017-02-11 11:32     ` Carlos Santos
  2017-02-11 13:50       ` Romain Naour
  2017-02-11 18:11     ` [Buildroot] [PATCH v4] " Carlos Santos
                       ` (2 subsequent siblings)
  4 siblings, 1 reply; 25+ messages in thread
From: Carlos Santos @ 2017-02-11 11:32 UTC (permalink / raw)
  To: buildroot

GTest version 1.8.0 includes gmock so merge both packages inside gtest

In this merge:

- Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
  following advice from Arnout Vandecappelle
- Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST
  and BR2_PACKAGE_GTEST_GMOCK.
- Use cmake to install libraries and headers and add missing files
  (gtest.pc, gtest-config, gmock.pc) in
  GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
  GTEST_INSTALL_STAGING_CMDS
- Remove patch on Python as gmock/gtest now supports python 3.0
  (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
- Add the correct license in HOST_GTEST_LICENSE as all python code in
  googlemock/scripts/generator is licensed under Apache-2.0 and not
  BSD-3c
- Fix URL of gtest project in Config.in
- Remove the gmock entry from DEVELOPERS

Notice that any external package that depends on gmock will cause an
immediate build termination because make doesn't know how to build
gmock. Since the user has just removed gmock from the legacy menu, it
should be quite obvious what needs to be done.

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
Version history:

v1 (Fabrice Fontaine)
  - Add gmock as a suboption
  - Use cmake to install
  - Remove patch on Python
  - Add the correct license
  - Fix URL of gtest project

v1->v2 (Carlos Santos)
  - Add gmock a virtual package (yeah, yeah, big mistake)

v2->v3 (Carlos Santos)
  - Got rid of the gmock virtual package (yeah, BIG mistake)
  - Use $(PYTHON3_VERSION_MAJOR) to choose the Python version
  - Several fixes, as suggested by Arnout Vandecappelle

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 Config.in.legacy                           |  7 ++++
 DEVELOPERS                                 |  1 -
 package/Config.in                          |  1 -
 package/gmock/0001-force-use-python2.patch | 20 ----------
 package/gmock/Config.in                    | 32 ---------------
 package/gmock/gmock.hash                   |  2 -
 package/gmock/gmock.mk                     | 64 ------------------------------
 package/gtest/Config.in                    | 29 +++++++++++++-
 package/{gmock => gtest}/gmock.pc          |  2 +-
 package/gtest/gtest.hash                   |  2 +-
 package/gtest/gtest.mk                     | 59 ++++++++++++++++++++++-----
 package/gtest/gtest.pc                     |  2 +-
 12 files changed, 87 insertions(+), 134 deletions(-)
 delete mode 100644 package/gmock/0001-force-use-python2.patch
 delete mode 100644 package/gmock/Config.in
 delete mode 100644 package/gmock/gmock.hash
 delete mode 100644 package/gmock/gmock.mk
 rename package/{gmock => gtest}/gmock.pc (93%)

diff --git a/Config.in.legacy b/Config.in.legacy
index 20445b8..23184e8 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -145,6 +145,13 @@ endif
 ###############################################################################
 comment "Legacy options removed in 2017.02"
 
+config BR2_PACKAGE_GMOCK
+	bool "gmock removed"
+	select BR2_PACKAGE_GTEST
+	select BR2_PACKAGE_GTEST_GMOCK
+	help
+	  GMock is now a suboption of GTest
+
 config BR2_PACKAGE_PERL_DB_FILE
 	bool "perl-db-file removed"
 	select BR2_LEGACY
diff --git a/DEVELOPERS b/DEVELOPERS
index 94f6804..5ff6223 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -286,7 +286,6 @@ N:	Carlo Caione <carlo.caione@gmail.com>
 F:	package/sunxi-boards/
 
 N:	Carlos Santos <casantos@datacom.ind.br>
-F:	package/gmock/
 F:	package/gtest/
 F:	package/libpam-radius-auth/
 F:	package/libpam-tacplus/
diff --git a/package/Config.in b/package/Config.in
index deff0fe..70e3fff 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1325,7 +1325,6 @@ menu "Other"
 	source "package/gflags/Config.in"
 	source "package/glibmm/Config.in"
 	source "package/glm/Config.in"
-	source "package/gmock/Config.in"
 	source "package/gmp/Config.in"
 	source "package/gsl/Config.in"
 	source "package/gtest/Config.in"
diff --git a/package/gmock/0001-force-use-python2.patch b/package/gmock/0001-force-use-python2.patch
deleted file mode 100644
index 5dcb231..0000000
--- a/package/gmock/0001-force-use-python2.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Force use of Python 2 even when Python 3 is the default Python interpreter.
-
-Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
-
---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
-+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2009, Google Inc.
- # All rights reserved.
---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
-+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2008 Google Inc. All Rights Reserved.
- #
diff --git a/package/gmock/Config.in b/package/gmock/Config.in
deleted file mode 100644
index ec3eb92..0000000
--- a/package/gmock/Config.in
+++ /dev/null
@@ -1,32 +0,0 @@
-config BR2_PACKAGE_GMOCK
-	bool "gmock"
-	select BR2_PACKAGE_GTEST
-	depends on BR2_USE_WCHAR
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_USE_MMU # fork()
-	help
-	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
-	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
-	  short) is a library for writing and using C++ mock classes.
-
-	  Google Mock:
-
-	    * lets you create mock classes trivially using simple macros,
-	    * supports a rich set of matchers and actions,
-	    * handles unordered, partially ordered, or completely ordered
-	      expectations,
-	    * is extensible by users, and
-	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
-	      Symbian.
-
-	    http://code.google.com/p/googlemock/
-
-	  There are both host and target packages. The target one has include
-	  files required to compile the tests and the static libraries required
-	  to link/run them. The host package installs gmock_gen, a Python script
-	  used to generate code mocks.
-
-comment "gmock needs a toolchain w/ C++, wchar, threads"
-	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
deleted file mode 100644
index 2b71739..0000000
--- a/package/gmock/gmock.hash
+++ /dev/null
@@ -1,2 +0,0 @@
-# Locally computed
-sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
deleted file mode 100644
index 4f04422..0000000
--- a/package/gmock/gmock.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-################################################################################
-#
-# gmock
-#
-################################################################################
-
-# Make sure this remains the same version as the gtest one
-GMOCK_VERSION = 1.7.0
-GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
-GMOCK_SITE = http://googlemock.googlecode.com/files
-GMOCK_INSTALL_STAGING = YES
-GMOCK_INSTALL_TARGET = NO
-GMOCK_LICENSE = BSD-3c
-GMOCK_LICENSE_FILES = LICENSE
-GMOCK_DEPENDENCIES = gtest host-gmock
-
-# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
-HOST_GMOCK_DEPENDENCIES = host-python
-HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
-
-# Static linking is required in order to keep the GMock package completely
-# separated from GTest. According to GMock's README file:
-#
-#   "Google Mock can be used as a DLL, but the same DLL must contain Google
-#    Test as well.  See Google Test's README file for instructions on how to
-#    set up necessary compiler settings".
-GMOCK_CONF_OPTS = --enable-static --disable-shared
-
-define GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
-endef
-
-# We can't use the default rule for autotools-package staging because it fails
-# because it tries to rebuild/install gtest stuff and fails after this error:
-#    "'make install' is dangerous and not supported. Instead, see README for
-#      how to integrate Google Test into your build system."
-define GMOCK_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
-	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
-	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
-	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
-		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
-endef
-
-# Unzipping inside $(@D) and moving everything from the created subdirectory is
-# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
-# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
-define HOST_GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
-	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
-	rmdir $(@D)/gmock-$(GMOCK_VERSION)
-endef
-
-define HOST_GMOCK_INSTALL_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
-	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
-	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
-endef
-
-$(eval $(autotools-package))
-# The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-autotools-package.
-$(eval $(host-generic-package))
diff --git a/package/gtest/Config.in b/package/gtest/Config.in
index 355b736..9f514da 100644
--- a/package/gtest/Config.in
+++ b/package/gtest/Config.in
@@ -21,6 +21,33 @@ config BR2_PACKAGE_GTEST
 
 	  https://github.com/google/googletest
 
+if BR2_PACKAGE_GTEST
+
+config BR2_PACKAGE_GTEST_GMOCK
+	bool "gmock"
+	help
+	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
+	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
+	  short) is a library for writing and using C++ mock classes.
+
+	  Google Mock:
+
+	    * lets you create mock classes trivially using simple macros,
+	    * supports a rich set of matchers and actions,
+	    * handles unordered, partially ordered, or completely ordered
+	      expectations,
+	    * is extensible by users, and
+	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
+	      Symbian.
+
+	  There are both host and target packages. The target one has include
+	  files required to compile the tests and the static libraries required
+	  to link/run them. The host package installs gmock_gen, a Python script
+	  used to generate code mocks.
+
+endif # BR2_PACKAGE_GTEST
+
 comment "gtest needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.pc b/package/gtest/gmock.pc
similarity index 93%
rename from package/gmock/gmock.pc
rename to package/gtest/gmock.pc
index 2f90068..4c72354 100644
--- a/package/gmock/gmock.pc
+++ b/package/gtest/gmock.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gmock
 Description: Google C++ Mocking Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgmock
 Libs.private: -lpthread
 Cflags: -I${includedir}
diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
index 79e31e4..854ace8 100644
--- a/package/gtest/gtest.hash
+++ b/package/gtest/gtest.hash
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
+sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-1.8.0.tar.gz
diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index eb30905..fac1ab7 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -4,13 +4,30 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gmock one
-GTEST_VERSION = release-1.7.0
-GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
+GTEST_VERSION = 1.8.0
+GTEST_VERSION_TAG = release-$(GTEST_VERSION)
+GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION_TAG))
 GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
-GTEST_LICENSE_FILES = LICENSE
+GTEST_LICENSE_FILES = googletest/LICENSE
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_DEPENDENCIES = host-gtest
+endif
+
+HOST_GTEST_LICENSE = Apache-2.0
+HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python3
+else
+HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python
+endif
+
+HOST_GTEST_GMOCK_PYTHONPATH = \
+        $(HOST_DIR)/usr/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages
 
 # 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
@@ -21,11 +38,12 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-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 $(STAGING_DIR)/usr/include/gtest/
-	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
+# By default, build gmock and gtest
+ifneq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_CONF_OPTS = -DBUILD_GTEST=ON -DBUILD_GMOCK=OFF
+endif
+
+define GTEST_INSTALL_MISSING_FILES
 	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
 	# Generate the gtest-config script manually, since the CMake
@@ -39,9 +57,30 @@ define GTEST_INSTALL_STAGING_CMDS
 		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
 		s%@PTHREAD_CFLAGS@%%;\
 		s%@PTHREAD_LIBS@%-lpthread%;' \
-		$(@D)/scripts/gtest-config.in \
+		$(@D)/googletest/scripts/gtest-config.in \
 		> $(STAGING_DIR)/usr/bin/gtest-config
 	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
 endef
 
+define GTEST_GMOCK_INSTALL_MISSING_FILE
+	$(INSTALL) -D -m 0755 package/gtest/gmock.pc \
+		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
+endef
+
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
+endif
+
+define HOST_GTEST_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
+		$(HOST_DIR)/usr/bin/gmock_gen.py
+	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
+	cp -rp $(@D)/googlemock/scripts/generator/cpp \
+		$(HOST_GTEST_GMOCK_PYTHONPATH)
+endef
+
 $(eval $(cmake-package))
+# The host package does not build anything, just installs gmock_gen stuff, so
+# it does not need to be a host-cmake-package.
+$(eval $(host-generic-package))
diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
index b7a8aa4..594e79d 100644
--- a/package/gtest/gtest.pc
+++ b/package/gtest/gtest.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gtest
 Description: Google C++ Testing Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgtest
 Libs.private: -lpthread
 Cflags: -I${includedir}
-- 
2.7.4

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

* [Buildroot] [PATCH v3] gtest/gmock: bump to version 1.8.0
  2017-02-11 11:32     ` [Buildroot] [PATCH v3] " Carlos Santos
@ 2017-02-11 13:50       ` Romain Naour
  2017-02-11 18:08         ` Carlos Santos
  0 siblings, 1 reply; 25+ messages in thread
From: Romain Naour @ 2017-02-11 13:50 UTC (permalink / raw)
  To: buildroot

Hi Carlos,

Thanks for this new version, I hope it will merged soon.

Le 11/02/2017 ? 12:32, Carlos Santos a ?crit :
> GTest version 1.8.0 includes gmock so merge both packages inside gtest
> 
> In this merge:
> 
> - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
>   following advice from Arnout Vandecappelle
> - Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST
>   and BR2_PACKAGE_GTEST_GMOCK.
> - Use cmake to install libraries and headers and add missing files
>   (gtest.pc, gtest-config, gmock.pc) in
>   GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
>   GTEST_INSTALL_STAGING_CMDS
> - Remove patch on Python as gmock/gtest now supports python 3.0
>   (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
> - Add the correct license in HOST_GTEST_LICENSE as all python code in
>   googlemock/scripts/generator is licensed under Apache-2.0 and not
>   BSD-3c
> - Fix URL of gtest project in Config.in
> - Remove the gmock entry from DEVELOPERS
> 
> Notice that any external package that depends on gmock will cause an
> immediate build termination because make doesn't know how to build
> gmock. Since the user has just removed gmock from the legacy menu, it
> should be quite obvious what needs to be done.
> 
> Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
> Version history:
> 
> v1 (Fabrice Fontaine)
>   - Add gmock as a suboption
>   - Use cmake to install
>   - Remove patch on Python
>   - Add the correct license
>   - Fix URL of gtest project
> 
> v1->v2 (Carlos Santos)
>   - Add gmock a virtual package (yeah, yeah, big mistake)
> 
> v2->v3 (Carlos Santos)
>   - Got rid of the gmock virtual package (yeah, BIG mistake)
>   - Use $(PYTHON3_VERSION_MAJOR) to choose the Python version
>   - Several fixes, as suggested by Arnout Vandecappelle
> 
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
>  Config.in.legacy                           |  7 ++++
>  DEVELOPERS                                 |  1 -
>  package/Config.in                          |  1 -
>  package/gmock/0001-force-use-python2.patch | 20 ----------
>  package/gmock/Config.in                    | 32 ---------------
>  package/gmock/gmock.hash                   |  2 -
>  package/gmock/gmock.mk                     | 64 ------------------------------
>  package/gtest/Config.in                    | 29 +++++++++++++-
>  package/{gmock => gtest}/gmock.pc          |  2 +-
>  package/gtest/gtest.hash                   |  2 +-
>  package/gtest/gtest.mk                     | 59 ++++++++++++++++++++++-----
>  package/gtest/gtest.pc                     |  2 +-
>  12 files changed, 87 insertions(+), 134 deletions(-)
>  delete mode 100644 package/gmock/0001-force-use-python2.patch
>  delete mode 100644 package/gmock/Config.in
>  delete mode 100644 package/gmock/gmock.hash
>  delete mode 100644 package/gmock/gmock.mk
>  rename package/{gmock => gtest}/gmock.pc (93%)
> 
> diff --git a/Config.in.legacy b/Config.in.legacy
> index 20445b8..23184e8 100644
> --- a/Config.in.legacy
> +++ b/Config.in.legacy
> @@ -145,6 +145,13 @@ endif
>  ###############################################################################
>  comment "Legacy options removed in 2017.02"
>  
> +config BR2_PACKAGE_GMOCK
> +	bool "gmock removed"
> +	select BR2_PACKAGE_GTEST
> +	select BR2_PACKAGE_GTEST_GMOCK

missing select BR2_LEGACY

> +	help
> +	  GMock is now a suboption of GTest
> +
>  config BR2_PACKAGE_PERL_DB_FILE
>  	bool "perl-db-file removed"
>  	select BR2_LEGACY
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 94f6804..5ff6223 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -286,7 +286,6 @@ N:	Carlo Caione <carlo.caione@gmail.com>
>  F:	package/sunxi-boards/
>  
>  N:	Carlos Santos <casantos@datacom.ind.br>
> -F:	package/gmock/
>  F:	package/gtest/
>  F:	package/libpam-radius-auth/
>  F:	package/libpam-tacplus/
> diff --git a/package/Config.in b/package/Config.in
> index deff0fe..70e3fff 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1325,7 +1325,6 @@ menu "Other"
>  	source "package/gflags/Config.in"
>  	source "package/glibmm/Config.in"
>  	source "package/glm/Config.in"
> -	source "package/gmock/Config.in"
>  	source "package/gmp/Config.in"
>  	source "package/gsl/Config.in"
>  	source "package/gtest/Config.in"

[...]

> diff --git a/package/gtest/Config.in b/package/gtest/Config.in
> index 355b736..9f514da 100644
> --- a/package/gtest/Config.in
> +++ b/package/gtest/Config.in
> @@ -21,6 +21,33 @@ config BR2_PACKAGE_GTEST
>  
>  	  https://github.com/google/googletest
>  
> +if BR2_PACKAGE_GTEST
> +
> +config BR2_PACKAGE_GTEST_GMOCK
> +	bool "gmock"
> +	help
> +	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
> +	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
> +	  short) is a library for writing and using C++ mock classes.
> +
> +	  Google Mock:
> +
> +	    * lets you create mock classes trivially using simple macros,
> +	    * supports a rich set of matchers and actions,
> +	    * handles unordered, partially ordered, or completely ordered
> +	      expectations,
> +	    * is extensible by users, and
> +	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
> +	      Symbian.
> +
> +	  There are both host and target packages. The target one has include
> +	  files required to compile the tests and the static libraries required
> +	  to link/run them. The host package installs gmock_gen, a Python script
> +	  used to generate code mocks.

"The help text should be wrapped to fit 72 columns." see [1]

Note: one Tab count as 8 characters.

[1] http://nightly.buildroot.org/#writing-rules-config-in

> +
> +endif # BR2_PACKAGE_GTEST
> +
>  comment "gtest needs a toolchain w/ C++, wchar, threads"
>  	depends on BR2_USE_MMU
> -	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
> +	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
> +		!BR2_INSTALL_LIBSTDCPP
> diff --git a/package/gmock/gmock.pc b/package/gtest/gmock.pc
> similarity index 93%
> rename from package/gmock/gmock.pc
> rename to package/gtest/gmock.pc
> index 2f90068..4c72354 100644
> --- a/package/gmock/gmock.pc
> +++ b/package/gtest/gmock.pc
> @@ -5,7 +5,7 @@ includedir=${prefix}/include
>  
>  Name: gmock
>  Description: Google C++ Mocking Framework
> -Version: 1.7.0
> +Version: 1.8.0
>  Libs: -L${libdir} -lgmock
>  Libs.private: -lpthread
>  Cflags: -I${includedir}
> diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
> index 79e31e4..854ace8 100644
> --- a/package/gtest/gtest.hash
> +++ b/package/gtest/gtest.hash
> @@ -1,2 +1,2 @@
>  # Locally computed:
> -sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
> +sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-1.8.0.tar.gz
> diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
> index eb30905..fac1ab7 100644
> --- a/package/gtest/gtest.mk
> +++ b/package/gtest/gtest.mk
> @@ -4,13 +4,30 @@
>  #
>  ################################################################################
>  
> -# Make sure this remains the same version as the gmock one
> -GTEST_VERSION = release-1.7.0
> -GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
> +GTEST_VERSION = 1.8.0
> +GTEST_VERSION_TAG = release-$(GTEST_VERSION)

Why are you adding GTEST_VERSION_TAG ?
It seems ok to use "GTEST_VERSION = release-1.8.0" no ?

> +GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION_TAG))
>  GTEST_INSTALL_STAGING = YES
>  GTEST_INSTALL_TARGET = NO
>  GTEST_LICENSE = BSD-3c
> -GTEST_LICENSE_FILES = LICENSE
> +GTEST_LICENSE_FILES = googletest/LICENSE
> +
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> +GTEST_DEPENDENCIES = host-gtest
> +endif
> +
> +HOST_GTEST_LICENSE = Apache-2.0
> +HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
> +ifeq ($(BR2_PACKAGE_PYTHON3),y)
> +HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
> +HOST_GTEST_DEPENDENCIES = host-python3
> +else
> +HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
> +HOST_GTEST_DEPENDENCIES = host-python
> +endif
> +
> +HOST_GTEST_GMOCK_PYTHONPATH = \
> +        $(HOST_DIR)/usr/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages

Indent with one Tab.

>  
>  # 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
> @@ -21,11 +38,12 @@ GTEST_LICENSE_FILES = LICENSE
>  # the gtest sources.
>  GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
>  
> -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 $(STAGING_DIR)/usr/include/gtest/
> -	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
> +# By default, build gmock and gtest
> +ifneq ($(BR2_PACKAGE_GTEST_GMOCK),y)

Try using the "positive" logic:
ifeq ($(BR2_PACKAGE_GTEST_GMOCK),)

> +GTEST_CONF_OPTS = -DBUILD_GTEST=ON -DBUILD_GMOCK=OFF
> +endif
> +
> +define GTEST_INSTALL_MISSING_FILES
>  	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
>  		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
>  	# Generate the gtest-config script manually, since the CMake
> @@ -39,9 +57,30 @@ define GTEST_INSTALL_STAGING_CMDS
>  		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
>  		s%@PTHREAD_CFLAGS@%%;\
>  		s%@PTHREAD_LIBS@%-lpthread%;' \
> -		$(@D)/scripts/gtest-config.in \
> +		$(@D)/googletest/scripts/gtest-config.in \
>  		> $(STAGING_DIR)/usr/bin/gtest-config
>  	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
>  endef
>  
> +define GTEST_GMOCK_INSTALL_MISSING_FILE
> +	$(INSTALL) -D -m 0755 package/gtest/gmock.pc \

Use -m 0644, we don't need gmock.pc to be executable.

> +		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
> +endef
> +
> +GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> +GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
> +endif
> +
> +define HOST_GTEST_INSTALL_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \

Same for gmock_gen.py.

Otherwise:
  Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> +		$(HOST_DIR)/usr/bin/gmock_gen.py
> +	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
> +	cp -rp $(@D)/googlemock/scripts/generator/cpp \
> +		$(HOST_GTEST_GMOCK_PYTHONPATH)
> +endef
> +
>  $(eval $(cmake-package))
> +# The host package does not build anything, just installs gmock_gen stuff, so
> +# it does not need to be a host-cmake-package.
> +$(eval $(host-generic-package))
> diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
> index b7a8aa4..594e79d 100644
> --- a/package/gtest/gtest.pc
> +++ b/package/gtest/gtest.pc
> @@ -5,7 +5,7 @@ includedir=${prefix}/include
>  
>  Name: gtest
>  Description: Google C++ Testing Framework
> -Version: 1.7.0
> +Version: 1.8.0
>  Libs: -L${libdir} -lgtest
>  Libs.private: -lpthread
>  Cflags: -I${includedir}
> 

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

* [Buildroot] [PATCH v3] gtest/gmock: bump to version 1.8.0
  2017-02-11 13:50       ` Romain Naour
@ 2017-02-11 18:08         ` Carlos Santos
  0 siblings, 0 replies; 25+ messages in thread
From: Carlos Santos @ 2017-02-11 18:08 UTC (permalink / raw)
  To: buildroot

> From: "Romain Naour" <romain.naour@gmail.com>
> To: "Carlos Santos" <casantos@datacom.ind.br>, buildroot at buildroot.org
> Cc: arnout at mind.be, "Fabrice Fontaine" <fabrice.fontaine@orange.com>
> Sent: Saturday, February 11, 2017 11:50:36 AM
> Subject: Re: [PATCH v3] gtest/gmock: bump to version 1.8.0
[...]
>> --- a/Config.in.legacy
>> +++ b/Config.in.legacy
>> @@ -145,6 +145,13 @@ endif
>>  ###############################################################################
>>  comment "Legacy options removed in 2017.02"
>>  
>> +config BR2_PACKAGE_GMOCK
>> +	bool "gmock removed"
>> +	select BR2_PACKAGE_GTEST
>> +	select BR2_PACKAGE_GTEST_GMOCK
> 
> missing select BR2_LEGACY

Done

[...]
>> +config BR2_PACKAGE_GTEST_GMOCK
>> +	bool "gmock"
>> +	help
>> +	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
>> +	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
>> +	  short) is a library for writing and using C++ mock classes.
>> +
>> +	  Google Mock:
>> +
>> +	    * lets you create mock classes trivially using simple macros,
>> +	    * supports a rich set of matchers and actions,
>> +	    * handles unordered, partially ordered, or completely ordered
>> +	      expectations,
>> +	    * is extensible by users, and
>> +	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
>> +	      Symbian.
>> +
>> +	  There are both host and target packages. The target one has include
>> +	  files required to compile the tests and the static libraries required
>> +	  to link/run them. The host package installs gmock_gen, a Python script
>> +	  used to generate code mocks.
> 
> "The help text should be wrapped to fit 72 columns." see [1]

Done.

[...]
>> --- a/package/gtest/gtest.mk
>> +++ b/package/gtest/gtest.mk
>> @@ -4,13 +4,30 @@
>>  #
>>  ################################################################################
>>  
>> -# Make sure this remains the same version as the gmock one
>> -GTEST_VERSION = release-1.7.0
>> -GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
>> +GTEST_VERSION = 1.8.0
>> +GTEST_VERSION_TAG = release-$(GTEST_VERSION)
> 
> Why are you adding GTEST_VERSION_TAG ?
> It seems ok to use "GTEST_VERSION = release-1.8.0" no ?

To have a cleaner <pkg>_VERSION variable (and archive name). Previous
gtest/gmock archives were saved as "gtest-Z.Y.Z.zip" but it changed
when the package started to be downloaded from GitHub and started to
be called "gtest-release-1.7.0.tar.gz", including the "release" prefix
included in the tag, which is superfluous.

[...]
>> +HOST_GTEST_GMOCK_PYTHONPATH = \
>> +        $(HOST_DIR)/usr/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages
> 
> Indent with one Tab.

Done.

>> +# By default, build gmock and gtest
>> +ifneq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> 
> Try using the "positive" logic:
> ifeq ($(BR2_PACKAGE_GTEST_GMOCK),)

Done

[...]
>> +define HOST_GTEST_INSTALL_CMDS
>> +	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
> 
> Same for gmock_gen.py.

Do you mean -m 0644? No, this one must be executable.

> Otherwise:
>  Reviewed-by: Romain Naour <romain.naour@gmail.com>
> 
> Best regards,
> Romain
> 
>> +		$(HOST_DIR)/usr/bin/gmock_gen.py
>> +	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
>> +	cp -rp $(@D)/googlemock/scripts/generator/cpp \
>> +		$(HOST_GTEST_GMOCK_PYTHONPATH)
>> +endef
>> +
>>  $(eval $(cmake-package))
>> +# The host package does not build anything, just installs gmock_gen stuff, so
>> +# it does not need to be a host-cmake-package.
>> +$(eval $(host-generic-package))
>> diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
>> index b7a8aa4..594e79d 100644
>> --- a/package/gtest/gtest.pc
>> +++ b/package/gtest/gtest.pc
>> @@ -5,7 +5,7 @@ includedir=${prefix}/include
>>  
>>  Name: gtest
>>  Description: Google C++ Testing Framework
>> -Version: 1.7.0
>> +Version: 1.8.0
>>  Libs: -L${libdir} -lgtest
>>  Libs.private: -lpthread
>>  Cflags: -I${includedir}



Carlos Santos (Casantos) - DATACOM, P&D
?Something must be done. This is something. Therefore we must do it.?
(from the BBC series ?Yes, Prime Minister?, ?Power to the people?)

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

* [Buildroot] [PATCH v4] gtest/gmock: bump to version 1.8.0
  2016-09-07 23:16   ` [Buildroot] [PATCH v2] " Carlos Santos
  2016-09-11 12:09     ` Arnout Vandecappelle
  2017-02-11 11:32     ` [Buildroot] [PATCH v3] " Carlos Santos
@ 2017-02-11 18:11     ` Carlos Santos
  2017-02-12 12:17     ` [Buildroot] [PATCH v5] " Carlos Santos
  2017-02-14 11:05     ` [Buildroot] [PATCH v6] " Carlos Santos
  4 siblings, 0 replies; 25+ messages in thread
From: Carlos Santos @ 2017-02-11 18:11 UTC (permalink / raw)
  To: buildroot

GTest version 1.8.0 includes gmock so merge both packages inside gtest

In this merge:

- Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
  following advice from Arnout Vandecappelle
- Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST
  and BR2_PACKAGE_GTEST_GMOCK.
- Use cmake to install libraries and headers and add missing files
  (gtest.pc, gtest-config, gmock.pc) in
  GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
  GTEST_INSTALL_STAGING_CMDS
- Remove patch on Python as gmock/gtest now supports python 3.0
  (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
- Add the correct license in HOST_GTEST_LICENSE as all python code in
  googlemock/scripts/generator is licensed under Apache-2.0 and not
  BSD-3c
- Fix URL of gtest project in Config.in
- Remove the gmock entry from DEVELOPERS

Notice that any external package that depends on gmock will cause an
immediate build termination because make doesn't know how to build
gmock. Since the user has just removed gmock from the legacy menu, it
should be quite obvious what needs to be done.

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
Version history:

v1 (Fabrice Fontaine)
  - Add gmock as a suboption
  - Use cmake to install
  - Remove patch on Python
  - Add the correct license
  - Fix URL of gtest project

v1->v2 (Carlos Santos)
  - Add gmock a virtual package (yeah, yeah, big mistake)

v2->v3 (Carlos Santos)
  - Got rid of the gmock virtual package (yeah, BIG mistake)
  - Use $(PYTHON3_VERSION_MAJOR) to choose the Python version
  - Several fixes, as suggested by Arnout Vandecappelle

v3->v4 (Carlos Santos)
  - Several fixes, as suggested by Romain Naour

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 Config.in.legacy                           |  8 ++++
 DEVELOPERS                                 |  1 -
 package/Config.in                          |  1 -
 package/gmock/0001-force-use-python2.patch | 20 ----------
 package/gmock/Config.in                    | 32 ---------------
 package/gmock/gmock.hash                   |  2 -
 package/gmock/gmock.mk                     | 64 ------------------------------
 package/gtest/Config.in                    | 30 +++++++++++++-
 package/{gmock => gtest}/gmock.pc          |  2 +-
 package/gtest/gtest.hash                   |  2 +-
 package/gtest/gtest.mk                     | 59 ++++++++++++++++++++++-----
 package/gtest/gtest.pc                     |  2 +-
 12 files changed, 89 insertions(+), 134 deletions(-)
 delete mode 100644 package/gmock/0001-force-use-python2.patch
 delete mode 100644 package/gmock/Config.in
 delete mode 100644 package/gmock/gmock.hash
 delete mode 100644 package/gmock/gmock.mk
 rename package/{gmock => gtest}/gmock.pc (93%)

diff --git a/Config.in.legacy b/Config.in.legacy
index 20445b8..4532a9a 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -145,6 +145,14 @@ endif
 ###############################################################################
 comment "Legacy options removed in 2017.02"
 
+config BR2_PACKAGE_GMOCK
+	bool "gmock removed"
+	select BR2_LEGACY
+	select BR2_PACKAGE_GTEST
+	select BR2_PACKAGE_GTEST_GMOCK
+	help
+	  GMock is now a suboption of GTest
+
 config BR2_PACKAGE_PERL_DB_FILE
 	bool "perl-db-file removed"
 	select BR2_LEGACY
diff --git a/DEVELOPERS b/DEVELOPERS
index 94f6804..5ff6223 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -286,7 +286,6 @@ N:	Carlo Caione <carlo.caione@gmail.com>
 F:	package/sunxi-boards/
 
 N:	Carlos Santos <casantos@datacom.ind.br>
-F:	package/gmock/
 F:	package/gtest/
 F:	package/libpam-radius-auth/
 F:	package/libpam-tacplus/
diff --git a/package/Config.in b/package/Config.in
index deff0fe..70e3fff 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1325,7 +1325,6 @@ menu "Other"
 	source "package/gflags/Config.in"
 	source "package/glibmm/Config.in"
 	source "package/glm/Config.in"
-	source "package/gmock/Config.in"
 	source "package/gmp/Config.in"
 	source "package/gsl/Config.in"
 	source "package/gtest/Config.in"
diff --git a/package/gmock/0001-force-use-python2.patch b/package/gmock/0001-force-use-python2.patch
deleted file mode 100644
index 5dcb231..0000000
--- a/package/gmock/0001-force-use-python2.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Force use of Python 2 even when Python 3 is the default Python interpreter.
-
-Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
-
---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
-+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2009, Google Inc.
- # All rights reserved.
---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
-+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2008 Google Inc. All Rights Reserved.
- #
diff --git a/package/gmock/Config.in b/package/gmock/Config.in
deleted file mode 100644
index ec3eb92..0000000
--- a/package/gmock/Config.in
+++ /dev/null
@@ -1,32 +0,0 @@
-config BR2_PACKAGE_GMOCK
-	bool "gmock"
-	select BR2_PACKAGE_GTEST
-	depends on BR2_USE_WCHAR
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_USE_MMU # fork()
-	help
-	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
-	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
-	  short) is a library for writing and using C++ mock classes.
-
-	  Google Mock:
-
-	    * lets you create mock classes trivially using simple macros,
-	    * supports a rich set of matchers and actions,
-	    * handles unordered, partially ordered, or completely ordered
-	      expectations,
-	    * is extensible by users, and
-	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
-	      Symbian.
-
-	    http://code.google.com/p/googlemock/
-
-	  There are both host and target packages. The target one has include
-	  files required to compile the tests and the static libraries required
-	  to link/run them. The host package installs gmock_gen, a Python script
-	  used to generate code mocks.
-
-comment "gmock needs a toolchain w/ C++, wchar, threads"
-	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
deleted file mode 100644
index 2b71739..0000000
--- a/package/gmock/gmock.hash
+++ /dev/null
@@ -1,2 +0,0 @@
-# Locally computed
-sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
deleted file mode 100644
index 4f04422..0000000
--- a/package/gmock/gmock.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-################################################################################
-#
-# gmock
-#
-################################################################################
-
-# Make sure this remains the same version as the gtest one
-GMOCK_VERSION = 1.7.0
-GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
-GMOCK_SITE = http://googlemock.googlecode.com/files
-GMOCK_INSTALL_STAGING = YES
-GMOCK_INSTALL_TARGET = NO
-GMOCK_LICENSE = BSD-3c
-GMOCK_LICENSE_FILES = LICENSE
-GMOCK_DEPENDENCIES = gtest host-gmock
-
-# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
-HOST_GMOCK_DEPENDENCIES = host-python
-HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
-
-# Static linking is required in order to keep the GMock package completely
-# separated from GTest. According to GMock's README file:
-#
-#   "Google Mock can be used as a DLL, but the same DLL must contain Google
-#    Test as well.  See Google Test's README file for instructions on how to
-#    set up necessary compiler settings".
-GMOCK_CONF_OPTS = --enable-static --disable-shared
-
-define GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
-endef
-
-# We can't use the default rule for autotools-package staging because it fails
-# because it tries to rebuild/install gtest stuff and fails after this error:
-#    "'make install' is dangerous and not supported. Instead, see README for
-#      how to integrate Google Test into your build system."
-define GMOCK_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
-	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
-	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
-	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
-		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
-endef
-
-# Unzipping inside $(@D) and moving everything from the created subdirectory is
-# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
-# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
-define HOST_GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
-	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
-	rmdir $(@D)/gmock-$(GMOCK_VERSION)
-endef
-
-define HOST_GMOCK_INSTALL_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
-	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
-	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
-endef
-
-$(eval $(autotools-package))
-# The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-autotools-package.
-$(eval $(host-generic-package))
diff --git a/package/gtest/Config.in b/package/gtest/Config.in
index 355b736..3f1f385 100644
--- a/package/gtest/Config.in
+++ b/package/gtest/Config.in
@@ -21,6 +21,34 @@ config BR2_PACKAGE_GTEST
 
 	  https://github.com/google/googletest
 
+if BR2_PACKAGE_GTEST
+
+config BR2_PACKAGE_GTEST_GMOCK
+	bool "gmock"
+	help
+	  Inspired by jMock, EasyMock, and Hamcrest, and designed with
+	  C++'s specifics in mind, Google C++ Mocking Framework (or
+	  Google Mock for short) is a library for writing and using C++
+	  mock classes.
+
+	  Google Mock:
+
+	    * lets you create mock classes trivially using simple
+	      macros, supports a rich set of matchers and actions,
+	    * handles unordered, partially ordered, or completely
+	      ordered expectations,
+	    * is extensible by users, and
+	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW,
+	      and Symbian.
+
+	  There are both host and target packages. The target one has
+	  include files required to compile the tests and the static
+	  libraries required to link/run them. The host package installs
+	  gmock_gen, a Python script used to generate code mocks.
+
+endif # BR2_PACKAGE_GTEST
+
 comment "gtest needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.pc b/package/gtest/gmock.pc
similarity index 93%
rename from package/gmock/gmock.pc
rename to package/gtest/gmock.pc
index 2f90068..4c72354 100644
--- a/package/gmock/gmock.pc
+++ b/package/gtest/gmock.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gmock
 Description: Google C++ Mocking Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgmock
 Libs.private: -lpthread
 Cflags: -I${includedir}
diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
index 79e31e4..854ace8 100644
--- a/package/gtest/gtest.hash
+++ b/package/gtest/gtest.hash
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
+sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-1.8.0.tar.gz
diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index eb30905..eb5a7e6 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -4,13 +4,30 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gmock one
-GTEST_VERSION = release-1.7.0
-GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
+GTEST_VERSION = 1.8.0
+GTEST_VERSION_TAG = release-$(GTEST_VERSION)
+GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION_TAG))
 GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
-GTEST_LICENSE_FILES = LICENSE
+GTEST_LICENSE_FILES = googletest/LICENSE
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_DEPENDENCIES = host-gtest
+endif
+
+HOST_GTEST_LICENSE = Apache-2.0
+HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python3
+else
+HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python
+endif
+
+HOST_GTEST_GMOCK_PYTHONPATH = \
+	$(HOST_DIR)/usr/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages
 
 # 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
@@ -21,11 +38,12 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-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 $(STAGING_DIR)/usr/include/gtest/
-	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
+# By default, build gmock and gtest
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),)
+GTEST_CONF_OPTS = -DBUILD_GTEST=ON -DBUILD_GMOCK=OFF
+endif
+
+define GTEST_INSTALL_MISSING_FILES
 	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
 	# Generate the gtest-config script manually, since the CMake
@@ -39,9 +57,30 @@ define GTEST_INSTALL_STAGING_CMDS
 		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
 		s%@PTHREAD_CFLAGS@%%;\
 		s%@PTHREAD_LIBS@%-lpthread%;' \
-		$(@D)/scripts/gtest-config.in \
+		$(@D)/googletest/scripts/gtest-config.in \
 		> $(STAGING_DIR)/usr/bin/gtest-config
 	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
 endef
 
+define GTEST_GMOCK_INSTALL_MISSING_FILE
+	$(INSTALL) -D -m 0644 package/gtest/gmock.pc \
+		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
+endef
+
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
+endif
+
+define HOST_GTEST_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
+		$(HOST_DIR)/usr/bin/gmock_gen.py
+	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
+	cp -rp $(@D)/googlemock/scripts/generator/cpp \
+		$(HOST_GTEST_GMOCK_PYTHONPATH)
+endef
+
 $(eval $(cmake-package))
+# The host package does not build anything, just installs gmock_gen stuff, so
+# it does not need to be a host-cmake-package.
+$(eval $(host-generic-package))
diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
index b7a8aa4..594e79d 100644
--- a/package/gtest/gtest.pc
+++ b/package/gtest/gtest.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gtest
 Description: Google C++ Testing Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgtest
 Libs.private: -lpthread
 Cflags: -I${includedir}
-- 
2.7.4

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

* [Buildroot] [PATCH v5] gtest/gmock: bump to version 1.8.0
  2016-09-07 23:16   ` [Buildroot] [PATCH v2] " Carlos Santos
                       ` (2 preceding siblings ...)
  2017-02-11 18:11     ` [Buildroot] [PATCH v4] " Carlos Santos
@ 2017-02-12 12:17     ` Carlos Santos
  2017-02-12 14:15       ` Romain Naour
  2017-02-12 14:37       ` Thomas Petazzoni
  2017-02-14 11:05     ` [Buildroot] [PATCH v6] " Carlos Santos
  4 siblings, 2 replies; 25+ messages in thread
From: Carlos Santos @ 2017-02-12 12:17 UTC (permalink / raw)
  To: buildroot

GTest version 1.8.0 includes gmock so merge both packages inside gtest

In this merge:

- Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
  following advice from Arnout Vandecappelle
- Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST
  and BR2_PACKAGE_GTEST_GMOCK.
- Use cmake to install libraries and headers and add missing files
  (gtest.pc, gtest-config, gmock.pc) in
  GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
  GTEST_INSTALL_STAGING_CMDS
- Remove patch on Python as gmock/gtest now supports python 3.0
  (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
- Add the correct license in HOST_GTEST_LICENSE as all python code in
  googlemock/scripts/generator is licensed under Apache-2.0 and not
  BSD-3c
- Fix URL of gtest project in Config.in
- Remove the gmock entry from DEVELOPERS

Notice that any external package that depends on gmock will cause an
immediate build termination because make doesn't know how to build
gmock. Since the user has just removed gmock from the legacy menu, it
should be quite obvious what needs to be done.

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
Version history:

v1 (Fabrice Fontaine)
  - Add gmock as a suboption
  - Use cmake to install
  - Remove patch on Python
  - Add the correct license
  - Fix URL of gtest project

v1->v2 (Carlos Santos)
  - Add gmock a virtual package (yeah, yeah, big mistake)

v2->v3 (Carlos Santos)
  - Got rid of the gmock virtual package (yeah, BIG mistake)
  - Use $(PYTHON3_VERSION_MAJOR) to choose the Python version
  - Several fixes, as suggested by Arnout Vandecappelle

v3->v4 (Carlos Santos)
  - Several fixes, as suggested by Romain Naour

v4->v5 (Carlos Santos)
  - Drop GTEST_VERSION_TAG after a parallel conversation with Thomas
    Petazzoni and Yann E. MORIN
    (http://patchwork.ozlabs.org/patch/726836/).

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 Config.in.legacy                           |  8 ++++
 DEVELOPERS                                 |  1 -
 package/Config.in                          |  1 -
 package/gmock/0001-force-use-python2.patch | 20 ----------
 package/gmock/Config.in                    | 32 ---------------
 package/gmock/gmock.hash                   |  2 -
 package/gmock/gmock.mk                     | 64 ------------------------------
 package/gtest/Config.in                    | 30 +++++++++++++-
 package/{gmock => gtest}/gmock.pc          |  2 +-
 package/gtest/gtest.hash                   |  2 +-
 package/gtest/gtest.mk                     | 56 +++++++++++++++++++++-----
 package/gtest/gtest.pc                     |  2 +-
 12 files changed, 87 insertions(+), 133 deletions(-)
 delete mode 100644 package/gmock/0001-force-use-python2.patch
 delete mode 100644 package/gmock/Config.in
 delete mode 100644 package/gmock/gmock.hash
 delete mode 100644 package/gmock/gmock.mk
 rename package/{gmock => gtest}/gmock.pc (93%)

diff --git a/Config.in.legacy b/Config.in.legacy
index 20445b8..4532a9a 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -145,6 +145,14 @@ endif
 ###############################################################################
 comment "Legacy options removed in 2017.02"
 
+config BR2_PACKAGE_GMOCK
+	bool "gmock removed"
+	select BR2_LEGACY
+	select BR2_PACKAGE_GTEST
+	select BR2_PACKAGE_GTEST_GMOCK
+	help
+	  GMock is now a suboption of GTest
+
 config BR2_PACKAGE_PERL_DB_FILE
 	bool "perl-db-file removed"
 	select BR2_LEGACY
diff --git a/DEVELOPERS b/DEVELOPERS
index 94f6804..5ff6223 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -286,7 +286,6 @@ N:	Carlo Caione <carlo.caione@gmail.com>
 F:	package/sunxi-boards/
 
 N:	Carlos Santos <casantos@datacom.ind.br>
-F:	package/gmock/
 F:	package/gtest/
 F:	package/libpam-radius-auth/
 F:	package/libpam-tacplus/
diff --git a/package/Config.in b/package/Config.in
index deff0fe..70e3fff 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1325,7 +1325,6 @@ menu "Other"
 	source "package/gflags/Config.in"
 	source "package/glibmm/Config.in"
 	source "package/glm/Config.in"
-	source "package/gmock/Config.in"
 	source "package/gmp/Config.in"
 	source "package/gsl/Config.in"
 	source "package/gtest/Config.in"
diff --git a/package/gmock/0001-force-use-python2.patch b/package/gmock/0001-force-use-python2.patch
deleted file mode 100644
index 5dcb231..0000000
--- a/package/gmock/0001-force-use-python2.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Force use of Python 2 even when Python 3 is the default Python interpreter.
-
-Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
-
---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
-+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2009, Google Inc.
- # All rights reserved.
---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
-+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2008 Google Inc. All Rights Reserved.
- #
diff --git a/package/gmock/Config.in b/package/gmock/Config.in
deleted file mode 100644
index ec3eb92..0000000
--- a/package/gmock/Config.in
+++ /dev/null
@@ -1,32 +0,0 @@
-config BR2_PACKAGE_GMOCK
-	bool "gmock"
-	select BR2_PACKAGE_GTEST
-	depends on BR2_USE_WCHAR
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_USE_MMU # fork()
-	help
-	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
-	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
-	  short) is a library for writing and using C++ mock classes.
-
-	  Google Mock:
-
-	    * lets you create mock classes trivially using simple macros,
-	    * supports a rich set of matchers and actions,
-	    * handles unordered, partially ordered, or completely ordered
-	      expectations,
-	    * is extensible by users, and
-	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
-	      Symbian.
-
-	    http://code.google.com/p/googlemock/
-
-	  There are both host and target packages. The target one has include
-	  files required to compile the tests and the static libraries required
-	  to link/run them. The host package installs gmock_gen, a Python script
-	  used to generate code mocks.
-
-comment "gmock needs a toolchain w/ C++, wchar, threads"
-	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
deleted file mode 100644
index 2b71739..0000000
--- a/package/gmock/gmock.hash
+++ /dev/null
@@ -1,2 +0,0 @@
-# Locally computed
-sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
deleted file mode 100644
index 4f04422..0000000
--- a/package/gmock/gmock.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-################################################################################
-#
-# gmock
-#
-################################################################################
-
-# Make sure this remains the same version as the gtest one
-GMOCK_VERSION = 1.7.0
-GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
-GMOCK_SITE = http://googlemock.googlecode.com/files
-GMOCK_INSTALL_STAGING = YES
-GMOCK_INSTALL_TARGET = NO
-GMOCK_LICENSE = BSD-3c
-GMOCK_LICENSE_FILES = LICENSE
-GMOCK_DEPENDENCIES = gtest host-gmock
-
-# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
-HOST_GMOCK_DEPENDENCIES = host-python
-HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
-
-# Static linking is required in order to keep the GMock package completely
-# separated from GTest. According to GMock's README file:
-#
-#   "Google Mock can be used as a DLL, but the same DLL must contain Google
-#    Test as well.  See Google Test's README file for instructions on how to
-#    set up necessary compiler settings".
-GMOCK_CONF_OPTS = --enable-static --disable-shared
-
-define GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
-endef
-
-# We can't use the default rule for autotools-package staging because it fails
-# because it tries to rebuild/install gtest stuff and fails after this error:
-#    "'make install' is dangerous and not supported. Instead, see README for
-#      how to integrate Google Test into your build system."
-define GMOCK_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
-	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
-	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
-	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
-		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
-endef
-
-# Unzipping inside $(@D) and moving everything from the created subdirectory is
-# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
-# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
-define HOST_GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
-	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
-	rmdir $(@D)/gmock-$(GMOCK_VERSION)
-endef
-
-define HOST_GMOCK_INSTALL_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
-	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
-	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
-endef
-
-$(eval $(autotools-package))
-# The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-autotools-package.
-$(eval $(host-generic-package))
diff --git a/package/gtest/Config.in b/package/gtest/Config.in
index 355b736..3f1f385 100644
--- a/package/gtest/Config.in
+++ b/package/gtest/Config.in
@@ -21,6 +21,34 @@ config BR2_PACKAGE_GTEST
 
 	  https://github.com/google/googletest
 
+if BR2_PACKAGE_GTEST
+
+config BR2_PACKAGE_GTEST_GMOCK
+	bool "gmock"
+	help
+	  Inspired by jMock, EasyMock, and Hamcrest, and designed with
+	  C++'s specifics in mind, Google C++ Mocking Framework (or
+	  Google Mock for short) is a library for writing and using C++
+	  mock classes.
+
+	  Google Mock:
+
+	    * lets you create mock classes trivially using simple
+	      macros, supports a rich set of matchers and actions,
+	    * handles unordered, partially ordered, or completely
+	      ordered expectations,
+	    * is extensible by users, and
+	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW,
+	      and Symbian.
+
+	  There are both host and target packages. The target one has
+	  include files required to compile the tests and the static
+	  libraries required to link/run them. The host package installs
+	  gmock_gen, a Python script used to generate code mocks.
+
+endif # BR2_PACKAGE_GTEST
+
 comment "gtest needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.pc b/package/gtest/gmock.pc
similarity index 93%
rename from package/gmock/gmock.pc
rename to package/gtest/gmock.pc
index 2f90068..4c72354 100644
--- a/package/gmock/gmock.pc
+++ b/package/gtest/gmock.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gmock
 Description: Google C++ Mocking Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgmock
 Libs.private: -lpthread
 Cflags: -I${includedir}
diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
index 79e31e4..474008d 100644
--- a/package/gtest/gtest.hash
+++ b/package/gtest/gtest.hash
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
+sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-release-1.8.0.tar.gz
diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index eb30905..954a159 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -4,13 +4,29 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gmock one
-GTEST_VERSION = release-1.7.0
+GTEST_VERSION = release-1.8.0
 GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
 GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
-GTEST_LICENSE_FILES = LICENSE
+GTEST_LICENSE_FILES = googletest/LICENSE
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_DEPENDENCIES = host-gtest
+endif
+
+HOST_GTEST_LICENSE = Apache-2.0
+HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python3
+else
+HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python
+endif
+
+HOST_GTEST_GMOCK_PYTHONPATH = \
+	$(HOST_DIR)/usr/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages
 
 # 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
@@ -21,11 +37,12 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-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 $(STAGING_DIR)/usr/include/gtest/
-	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
+# By default, build gmock and gtest
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),)
+GTEST_CONF_OPTS = -DBUILD_GTEST=ON -DBUILD_GMOCK=OFF
+endif
+
+define GTEST_INSTALL_MISSING_FILES
 	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
 	# Generate the gtest-config script manually, since the CMake
@@ -39,9 +56,30 @@ define GTEST_INSTALL_STAGING_CMDS
 		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
 		s%@PTHREAD_CFLAGS@%%;\
 		s%@PTHREAD_LIBS@%-lpthread%;' \
-		$(@D)/scripts/gtest-config.in \
+		$(@D)/googletest/scripts/gtest-config.in \
 		> $(STAGING_DIR)/usr/bin/gtest-config
 	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
 endef
 
+define GTEST_GMOCK_INSTALL_MISSING_FILE
+	$(INSTALL) -D -m 0644 package/gtest/gmock.pc \
+		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
+endef
+
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
+endif
+
+define HOST_GTEST_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
+		$(HOST_DIR)/usr/bin/gmock_gen.py
+	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
+	cp -rp $(@D)/googlemock/scripts/generator/cpp \
+		$(HOST_GTEST_GMOCK_PYTHONPATH)
+endef
+
 $(eval $(cmake-package))
+# The host package does not build anything, just installs gmock_gen stuff, so
+# it does not need to be a host-cmake-package.
+$(eval $(host-generic-package))
diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
index b7a8aa4..594e79d 100644
--- a/package/gtest/gtest.pc
+++ b/package/gtest/gtest.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gtest
 Description: Google C++ Testing Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgtest
 Libs.private: -lpthread
 Cflags: -I${includedir}
-- 
2.7.4

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

* [Buildroot] [PATCH v5] gtest/gmock: bump to version 1.8.0
  2017-02-12 12:17     ` [Buildroot] [PATCH v5] " Carlos Santos
@ 2017-02-12 14:15       ` Romain Naour
  2017-02-12 14:37         ` Thomas Petazzoni
  2017-02-12 14:37       ` Thomas Petazzoni
  1 sibling, 1 reply; 25+ messages in thread
From: Romain Naour @ 2017-02-12 14:15 UTC (permalink / raw)
  To: buildroot

Hi Carlos,

One small typo...

Le 12/02/2017 ? 13:17, Carlos Santos a ?crit :
> GTest version 1.8.0 includes gmock so merge both packages inside gtest
> 
> In this merge:
> 
> - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
>   following advice from Arnout Vandecappelle
> - Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST
>   and BR2_PACKAGE_GTEST_GMOCK.
> - Use cmake to install libraries and headers and add missing files
>   (gtest.pc, gtest-config, gmock.pc) in
>   GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
>   GTEST_INSTALL_STAGING_CMDS
> - Remove patch on Python as gmock/gtest now supports python 3.0
>   (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
> - Add the correct license in HOST_GTEST_LICENSE as all python code in
>   googlemock/scripts/generator is licensed under Apache-2.0 and not
>   BSD-3c
> - Fix URL of gtest project in Config.in
> - Remove the gmock entry from DEVELOPERS
> 
> Notice that any external package that depends on gmock will cause an
> immediate build termination because make doesn't know how to build
> gmock. Since the user has just removed gmock from the legacy menu, it
> should be quite obvious what needs to be done.
> 
> Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
> Version history:
> 
> v1 (Fabrice Fontaine)
>   - Add gmock as a suboption
>   - Use cmake to install
>   - Remove patch on Python
>   - Add the correct license
>   - Fix URL of gtest project
> 
> v1->v2 (Carlos Santos)
>   - Add gmock a virtual package (yeah, yeah, big mistake)
> 
> v2->v3 (Carlos Santos)
>   - Got rid of the gmock virtual package (yeah, BIG mistake)
>   - Use $(PYTHON3_VERSION_MAJOR) to choose the Python version
>   - Several fixes, as suggested by Arnout Vandecappelle
> 
> v3->v4 (Carlos Santos)
>   - Several fixes, as suggested by Romain Naour
> 
> v4->v5 (Carlos Santos)
>   - Drop GTEST_VERSION_TAG after a parallel conversation with Thomas
>     Petazzoni and Yann E. MORIN
>     (http://patchwork.ozlabs.org/patch/726836/).
> 
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
>  Config.in.legacy                           |  8 ++++
>  DEVELOPERS                                 |  1 -
>  package/Config.in                          |  1 -
>  package/gmock/0001-force-use-python2.patch | 20 ----------
>  package/gmock/Config.in                    | 32 ---------------
>  package/gmock/gmock.hash                   |  2 -
>  package/gmock/gmock.mk                     | 64 ------------------------------
>  package/gtest/Config.in                    | 30 +++++++++++++-
>  package/{gmock => gtest}/gmock.pc          |  2 +-
>  package/gtest/gtest.hash                   |  2 +-
>  package/gtest/gtest.mk                     | 56 +++++++++++++++++++++-----
>  package/gtest/gtest.pc                     |  2 +-
>  12 files changed, 87 insertions(+), 133 deletions(-)
>  delete mode 100644 package/gmock/0001-force-use-python2.patch
>  delete mode 100644 package/gmock/Config.in
>  delete mode 100644 package/gmock/gmock.hash
>  delete mode 100644 package/gmock/gmock.mk
>  rename package/{gmock => gtest}/gmock.pc (93%)
> 
> diff --git a/Config.in.legacy b/Config.in.legacy
> index 20445b8..4532a9a 100644
> --- a/Config.in.legacy
> +++ b/Config.in.legacy
> @@ -145,6 +145,14 @@ endif
>  ###############################################################################
>  comment "Legacy options removed in 2017.02"
>  
> +config BR2_PACKAGE_GMOCK
> +	bool "gmock removed"
> +	select BR2_LEGACY
> +	select BR2_PACKAGE_GTEST
> +	select BR2_PACKAGE_GTEST_GMOCK
> +	help
> +	  GMock is now a suboption of GTest
> +
>  config BR2_PACKAGE_PERL_DB_FILE
>  	bool "perl-db-file removed"
>  	select BR2_LEGACY
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 94f6804..5ff6223 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -286,7 +286,6 @@ N:	Carlo Caione <carlo.caione@gmail.com>
>  F:	package/sunxi-boards/
>  
>  N:	Carlos Santos <casantos@datacom.ind.br>
> -F:	package/gmock/
>  F:	package/gtest/
>  F:	package/libpam-radius-auth/
>  F:	package/libpam-tacplus/
> diff --git a/package/Config.in b/package/Config.in
> index deff0fe..70e3fff 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1325,7 +1325,6 @@ menu "Other"
>  	source "package/gflags/Config.in"
>  	source "package/glibmm/Config.in"
>  	source "package/glm/Config.in"
> -	source "package/gmock/Config.in"
>  	source "package/gmp/Config.in"
>  	source "package/gsl/Config.in"
>  	source "package/gtest/Config.in"
> diff --git a/package/gmock/0001-force-use-python2.patch b/package/gmock/0001-force-use-python2.patch
> deleted file mode 100644
> index 5dcb231..0000000
> --- a/package/gmock/0001-force-use-python2.patch
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -Force use of Python 2 even when Python 3 is the default Python interpreter.
> -
> -Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> -
> ---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
> -+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
> -@@ -1,4 +1,4 @@
> --#!/usr/bin/env python
> -+#!/usr/bin/env python2
> - #
> - # Copyright 2009, Google Inc.
> - # All rights reserved.
> ---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
> -+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
> -@@ -1,4 +1,4 @@
> --#!/usr/bin/env python
> -+#!/usr/bin/env python2
> - #
> - # Copyright 2008 Google Inc. All Rights Reserved.
> - #
> diff --git a/package/gmock/Config.in b/package/gmock/Config.in
> deleted file mode 100644
> index ec3eb92..0000000
> --- a/package/gmock/Config.in
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -config BR2_PACKAGE_GMOCK
> -	bool "gmock"
> -	select BR2_PACKAGE_GTEST
> -	depends on BR2_USE_WCHAR
> -	depends on BR2_TOOLCHAIN_HAS_THREADS
> -	depends on BR2_INSTALL_LIBSTDCPP
> -	depends on BR2_USE_MMU # fork()
> -	help
> -	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
> -	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
> -	  short) is a library for writing and using C++ mock classes.
> -
> -	  Google Mock:
> -
> -	    * lets you create mock classes trivially using simple macros,
> -	    * supports a rich set of matchers and actions,
> -	    * handles unordered, partially ordered, or completely ordered
> -	      expectations,
> -	    * is extensible by users, and
> -	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
> -	      Symbian.
> -
> -	    http://code.google.com/p/googlemock/
> -
> -	  There are both host and target packages. The target one has include
> -	  files required to compile the tests and the static libraries required
> -	  to link/run them. The host package installs gmock_gen, a Python script
> -	  used to generate code mocks.
> -
> -comment "gmock needs a toolchain w/ C++, wchar, threads"
> -	depends on BR2_USE_MMU
> -	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
> diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
> deleted file mode 100644
> index 2b71739..0000000
> --- a/package/gmock/gmock.hash
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -# Locally computed
> -sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
> diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
> deleted file mode 100644
> index 4f04422..0000000
> --- a/package/gmock/gmock.mk
> +++ /dev/null
> @@ -1,64 +0,0 @@
> -################################################################################
> -#
> -# gmock
> -#
> -################################################################################
> -
> -# Make sure this remains the same version as the gtest one
> -GMOCK_VERSION = 1.7.0
> -GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
> -GMOCK_SITE = http://googlemock.googlecode.com/files
> -GMOCK_INSTALL_STAGING = YES
> -GMOCK_INSTALL_TARGET = NO
> -GMOCK_LICENSE = BSD-3c
> -GMOCK_LICENSE_FILES = LICENSE
> -GMOCK_DEPENDENCIES = gtest host-gmock
> -
> -# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
> -HOST_GMOCK_DEPENDENCIES = host-python
> -HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
> -
> -# Static linking is required in order to keep the GMock package completely
> -# separated from GTest. According to GMock's README file:
> -#
> -#   "Google Mock can be used as a DLL, but the same DLL must contain Google
> -#    Test as well.  See Google Test's README file for instructions on how to
> -#    set up necessary compiler settings".
> -GMOCK_CONF_OPTS = --enable-static --disable-shared
> -
> -define GMOCK_EXTRACT_CMDS
> -	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
> -endef
> -
> -# We can't use the default rule for autotools-package staging because it fails
> -# because it tries to rebuild/install gtest stuff and fails after this error:
> -#    "'make install' is dangerous and not supported. Instead, see README for
> -#      how to integrate Google Test into your build system."
> -define GMOCK_INSTALL_STAGING_CMDS
> -	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
> -	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
> -	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
> -	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
> -	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
> -		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
> -endef
> -
> -# Unzipping inside $(@D) and moving everything from the created subdirectory is
> -# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
> -# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
> -define HOST_GMOCK_EXTRACT_CMDS
> -	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
> -	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
> -	rmdir $(@D)/gmock-$(GMOCK_VERSION)
> -endef
> -
> -define HOST_GMOCK_INSTALL_CMDS
> -	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
> -	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
> -	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
> -endef
> -
> -$(eval $(autotools-package))
> -# The host package does not build anything, just installs gmock_gen stuff, so
> -# it does not need to be a host-autotools-package.
> -$(eval $(host-generic-package))
> diff --git a/package/gtest/Config.in b/package/gtest/Config.in
> index 355b736..3f1f385 100644
> --- a/package/gtest/Config.in
> +++ b/package/gtest/Config.in
> @@ -21,6 +21,34 @@ config BR2_PACKAGE_GTEST
>  
>  	  https://github.com/google/googletest
>  
> +if BR2_PACKAGE_GTEST
> +
> +config BR2_PACKAGE_GTEST_GMOCK
> +	bool "gmock"
> +	help
> +	  Inspired by jMock, EasyMock, and Hamcrest, and designed with
> +	  C++'s specifics in mind, Google C++ Mocking Framework (or
> +	  Google Mock for short) is a library for writing and using C++
> +	  mock classes.
> +
> +	  Google Mock:
> +
> +	    * lets you create mock classes trivially using simple
> +	      macros, supports a rich set of matchers and actions,
> +	    * handles unordered, partially ordered, or completely
> +	      ordered expectations,
> +	    * is extensible by users, and
> +	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW,
> +	      and Symbian.
> +
> +	  There are both host and target packages. The target one has
> +	  include files required to compile the tests and the static
> +	  libraries required to link/run them. The host package installs
> +	  gmock_gen, a Python script used to generate code mocks.
> +
> +endif # BR2_PACKAGE_GTEST
> +
>  comment "gtest needs a toolchain w/ C++, wchar, threads"
>  	depends on BR2_USE_MMU
> -	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
> +	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
> +		!BR2_INSTALL_LIBSTDCPP
> diff --git a/package/gmock/gmock.pc b/package/gtest/gmock.pc
> similarity index 93%
> rename from package/gmock/gmock.pc
> rename to package/gtest/gmock.pc
> index 2f90068..4c72354 100644
> --- a/package/gmock/gmock.pc
> +++ b/package/gtest/gmock.pc
> @@ -5,7 +5,7 @@ includedir=${prefix}/include
>  
>  Name: gmock
>  Description: Google C++ Mocking Framework
> -Version: 1.7.0
> +Version: 1.8.0
>  Libs: -L${libdir} -lgmock
>  Libs.private: -lpthread
>  Cflags: -I${includedir}
> diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
> index 79e31e4..474008d 100644
> --- a/package/gtest/gtest.hash
> +++ b/package/gtest/gtest.hash
> @@ -1,2 +1,2 @@
>  # Locally computed:
> -sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
> +sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-release-1.8.0.tar.gz
> diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
> index eb30905..954a159 100644
> --- a/package/gtest/gtest.mk
> +++ b/package/gtest/gtest.mk
> @@ -4,13 +4,29 @@
>  #
>  ################################################################################
>  
> -# Make sure this remains the same version as the gmock one
> -GTEST_VERSION = release-1.7.0
> +GTEST_VERSION = release-1.8.0
>  GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
>  GTEST_INSTALL_STAGING = YES
>  GTEST_INSTALL_TARGET = NO
>  GTEST_LICENSE = BSD-3c
> -GTEST_LICENSE_FILES = LICENSE
> +GTEST_LICENSE_FILES = googletest/LICENSE
> +
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> +GTEST_DEPENDENCIES = host-gtest
> +endif
> +
> +HOST_GTEST_LICENSE = Apache-2.0
> +HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
> +ifeq ($(BR2_PACKAGE_PYTHON3),y)
> +HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
> +HOST_GTEST_DEPENDENCIES = host-python3
> +else
> +HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
> +HOST_GTEST_DEPENDENCIES = host-python
> +endif
> +
> +HOST_GTEST_GMOCK_PYTHONPATH = \
> +	$(HOST_DIR)/usr/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages
>  
>  # 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
> @@ -21,11 +37,12 @@ GTEST_LICENSE_FILES = LICENSE
>  # the gtest sources.
>  GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
>  
> -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 $(STAGING_DIR)/usr/include/gtest/
> -	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
> +# By default, build gmock and gtest
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),)
> +GTEST_CONF_OPTS = -DBUILD_GTEST=ON -DBUILD_GMOCK=OFF
> +endif

Here, if BR2_PACKAGE_GTEST_GMOCK is not set -DBUILD_SHARED_LIBS=OFF will be
dropped from GTEST_CONF_OPTS.

You should use += here:
GTEST_CONF_OPTS += -DBUILD_GTEST=ON -DBUILD_GMOCK=OFF

Otherwise shared libraries will be build:

./googletest/libgtest_main.so
./googletest/libgtest.so

Maybe it's something that can be fixed while merging this patch?

With that fixed:
Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain

> +
> +define GTEST_INSTALL_MISSING_FILES
>  	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
>  		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
>  	# Generate the gtest-config script manually, since the CMake
> @@ -39,9 +56,30 @@ define GTEST_INSTALL_STAGING_CMDS
>  		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
>  		s%@PTHREAD_CFLAGS@%%;\
>  		s%@PTHREAD_LIBS@%-lpthread%;' \
> -		$(@D)/scripts/gtest-config.in \
> +		$(@D)/googletest/scripts/gtest-config.in \
>  		> $(STAGING_DIR)/usr/bin/gtest-config
>  	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
>  endef
>  
> +define GTEST_GMOCK_INSTALL_MISSING_FILE
> +	$(INSTALL) -D -m 0644 package/gtest/gmock.pc \
> +		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
> +endef
> +
> +GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_INSTALL_MISSING_FILES
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> +GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
> +endif
> +
> +define HOST_GTEST_INSTALL_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
> +		$(HOST_DIR)/usr/bin/gmock_gen.py
> +	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
> +	cp -rp $(@D)/googlemock/scripts/generator/cpp \
> +		$(HOST_GTEST_GMOCK_PYTHONPATH)
> +endef
> +
>  $(eval $(cmake-package))
> +# The host package does not build anything, just installs gmock_gen stuff, so
> +# it does not need to be a host-cmake-package.
> +$(eval $(host-generic-package))
> diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
> index b7a8aa4..594e79d 100644
> --- a/package/gtest/gtest.pc
> +++ b/package/gtest/gtest.pc
> @@ -5,7 +5,7 @@ includedir=${prefix}/include
>  
>  Name: gtest
>  Description: Google C++ Testing Framework
> -Version: 1.7.0
> +Version: 1.8.0
>  Libs: -L${libdir} -lgtest
>  Libs.private: -lpthread
>  Cflags: -I${includedir}
> 

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

* [Buildroot] [PATCH v5] gtest/gmock: bump to version 1.8.0
  2017-02-12 14:15       ` Romain Naour
@ 2017-02-12 14:37         ` Thomas Petazzoni
  0 siblings, 0 replies; 25+ messages in thread
From: Thomas Petazzoni @ 2017-02-12 14:37 UTC (permalink / raw)
  To: buildroot

Hello,

(It would be nice to strip the irrelevant part of an e-mail when
replying, so that one doesn't have to scroll through a huge e-mail just
to find one comment lost in the middle of the reply. Thanks!)

On Sun, 12 Feb 2017 15:15:17 +0100, Romain Naour wrote:

> > +# By default, build gmock and gtest
> > +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),)
> > +GTEST_CONF_OPTS = -DBUILD_GTEST=ON -DBUILD_GMOCK=OFF
> > +endif  
> 
> Here, if BR2_PACKAGE_GTEST_GMOCK is not set -DBUILD_SHARED_LIBS=OFF will be
> dropped from GTEST_CONF_OPTS.
> 
> You should use += here:
> GTEST_CONF_OPTS += -DBUILD_GTEST=ON -DBUILD_GMOCK=OFF
> 
> Otherwise shared libraries will be build:
> 
> ./googletest/libgtest_main.so
> ./googletest/libgtest.so
> 
> Maybe it's something that can be fixed while merging this patch?

Also, why is -BUILD_GTEST=on only passed when GMock is disabled?

I would have assumed something more like this:

GTEST_CONF_OPTS += -DBUILD_GTEST=ON

ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
GTEST_CONF_OPTS += -DBUILD_GMOCK=ON
else
GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
endif

Thanks,

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

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

* [Buildroot] [PATCH v5] gtest/gmock: bump to version 1.8.0
  2017-02-12 12:17     ` [Buildroot] [PATCH v5] " Carlos Santos
  2017-02-12 14:15       ` Romain Naour
@ 2017-02-12 14:37       ` Thomas Petazzoni
  2017-02-12 15:02         ` Carlos Santos
  1 sibling, 1 reply; 25+ messages in thread
From: Thomas Petazzoni @ 2017-02-12 14:37 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 12 Feb 2017 10:17:27 -0200, Carlos Santos wrote:

> +define HOST_GTEST_INSTALL_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
> +		$(HOST_DIR)/usr/bin/gmock_gen.py
> +	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen

Is there a good reason to not install directly gmock_gen.py as
gmock_gen ?

Thanks!

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

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

* [Buildroot] [PATCH v5] gtest/gmock: bump to version 1.8.0
  2017-02-12 14:37       ` Thomas Petazzoni
@ 2017-02-12 15:02         ` Carlos Santos
  2017-02-12 17:28           ` Thomas Petazzoni
  0 siblings, 1 reply; 25+ messages in thread
From: Carlos Santos @ 2017-02-12 15:02 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, "Fabrice Fontaine" <fabrice.fontaine@orange.com>, "romain naour" <romain.naour@gmail.com>,
> "yann morin 1998" <yann.morin.1998@free.fr>
> Sent: Sunday, February 12, 2017 12:37:49 PM
> Subject: Re: [Buildroot] [PATCH v5] gtest/gmock: bump to version 1.8.0

> Hello,
> 
> On Sun, 12 Feb 2017 10:17:27 -0200, Carlos Santos wrote:
> 
>> +define HOST_GTEST_INSTALL_CMDS
>> +	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
>> +		$(HOST_DIR)/usr/bin/gmock_gen.py
>> +	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
> 
> Is there a good reason to not install directly gmock_gen.py as
> gmock_gen ?

IIRC some of out tests build calling gmock_gen.py and other calling gmock_gen
but I need to check that tomorrow, at office. Right now I'm at home, without
access to that code.

Carlos Santos (Casantos) - DATACOM, P&D
?Something must be done. This is something. Therefore we must do it.?
(from the BBC series ?Yes, Prime Minister?, ?Power to the people?)

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

* [Buildroot] [PATCH v5] gtest/gmock: bump to version 1.8.0
  2017-02-12 15:02         ` Carlos Santos
@ 2017-02-12 17:28           ` Thomas Petazzoni
  0 siblings, 0 replies; 25+ messages in thread
From: Thomas Petazzoni @ 2017-02-12 17:28 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 12 Feb 2017 13:02:23 -0200 (BRST), Carlos Santos wrote:

> > Is there a good reason to not install directly gmock_gen.py as
> > gmock_gen ?  
> 
> IIRC some of out tests build calling gmock_gen.py and other calling gmock_gen
> but I need to check that tomorrow, at office. Right now I'm at home, without
> access to that code.

OK. Since it's weird, perhaps make sense to add a quick comment above
this piece of code.

Thanks!

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

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

* [Buildroot] [PATCH v6] gtest/gmock: bump to version 1.8.0
  2016-09-07 23:16   ` [Buildroot] [PATCH v2] " Carlos Santos
                       ` (3 preceding siblings ...)
  2017-02-12 12:17     ` [Buildroot] [PATCH v5] " Carlos Santos
@ 2017-02-14 11:05     ` Carlos Santos
  2017-02-22 17:27       ` [Buildroot] [PATCH v7] " Carlos Santos
  2017-03-05 21:17       ` [Buildroot] [PATCH v6] " Thomas Petazzoni
  4 siblings, 2 replies; 25+ messages in thread
From: Carlos Santos @ 2017-02-14 11:05 UTC (permalink / raw)
  To: buildroot

GTest version 1.8.0 includes gmock so merge both packages inside gtest

In this merge:

- Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
  following advice from Arnout Vandecappelle
- Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST
  and BR2_PACKAGE_GTEST_GMOCK.
- Use cmake to install libraries and headers and add missing files
  (gtest.pc, gtest-config, gmock.pc) in
  GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
  GTEST_INSTALL_STAGING_CMDS
- Remove patch on Python as gmock/gtest now supports python 3.0
  (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
- Add the correct license in HOST_GTEST_LICENSE as all python code in
  googlemock/scripts/generator is licensed under Apache-2.0 and not
  BSD-3c
- Fix URL of gtest project in Config.in
- Remove the gmock entry from DEVELOPERS
- Install gmock_gen directly, instead of as a symlink to gmock_gen.py

Notice that any external package that depends on gmock will cause an
immediate build termination because make doesn't know how to build
gmock. Since the user has just removed gmock from the legacy menu, it
should be quite obvious what needs to be done.

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
Reviewed-by: Romain Naour <romain.naour@gmail.com>
---
Version history:

v1 (Fabrice Fontaine)
  - Add gmock as a suboption
  - Use cmake to install
  - Remove patch on Python
  - Add the correct license
  - Fix URL of gtest project

v1->v2 (Carlos Santos)
  - Add gmock a virtual package (yeah, yeah, big mistake)

v2->v3 (Carlos Santos)
  - Got rid of the gmock virtual package (yeah, BIG mistake)
  - Use $(PYTHON3_VERSION_MAJOR) to choose the Python version
  - Several fixes, as suggested by Arnout Vandecappelle

v3->v4 (Carlos Santos)
  - Several fixes, as suggested by Romain Naour

v4->v5 (Carlos Santos)
  - Drop GTEST_VERSION_TAG after a parallel conversation with Thomas
    Petazzoni and Yann E. MORIN
    (http://patchwork.ozlabs.org/patch/726836/).

v5->v6 (Carlos Santos)
  - Fix typo found by Romain Naour
  - Clarify the logic to choose between gtest or gtest+gmock and drop
    gmock_gen symlink to gmock_gen.py as identified by Thomas Petazzoni
  - Move legacy entry to a 2017.05 session, since this will go to the
    "master" branch, not to "next".
---
Help git format-patch/send-email to build the recipient list (lazy boy)
Cc: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 Config.in.legacy                           | 11 +++++
 DEVELOPERS                                 |  1 -
 package/Config.in                          |  1 -
 package/gmock/0001-force-use-python2.patch | 20 ---------
 package/gmock/Config.in                    | 32 ---------------
 package/gmock/gmock.hash                   |  2 -
 package/gmock/gmock.mk                     | 64 -----------------------------
 package/gtest/Config.in                    | 30 +++++++++++++-
 package/{gmock => gtest}/gmock.pc          |  2 +-
 package/gtest/gtest.hash                   |  2 +-
 package/gtest/gtest.mk                     | 65 +++++++++++++++++++++++++-----
 package/gtest/gtest.pc                     |  2 +-
 12 files changed, 99 insertions(+), 133 deletions(-)
 delete mode 100644 package/gmock/0001-force-use-python2.patch
 delete mode 100644 package/gmock/Config.in
 delete mode 100644 package/gmock/gmock.hash
 delete mode 100644 package/gmock/gmock.mk
 rename package/{gmock => gtest}/gmock.pc (93%)

diff --git a/Config.in.legacy b/Config.in.legacy
index 20445b8..cc2ab69 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -143,6 +143,17 @@ comment "----------------------------------------------------"
 endif
 
 ###############################################################################
+comment "Legacy options removed in 2017.05"
+
+config BR2_PACKAGE_GMOCK
+	bool "gmock removed"
+	select BR2_LEGACY
+	select BR2_PACKAGE_GTEST
+	select BR2_PACKAGE_GTEST_GMOCK
+	help
+	  GMock is now a suboption of GTest
+
+###############################################################################
 comment "Legacy options removed in 2017.02"
 
 config BR2_PACKAGE_PERL_DB_FILE
diff --git a/DEVELOPERS b/DEVELOPERS
index 7f65909..f27ec83 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -286,7 +286,6 @@ N:	Carlo Caione <carlo.caione@gmail.com>
 F:	package/sunxi-boards/
 
 N:	Carlos Santos <casantos@datacom.ind.br>
-F:	package/gmock/
 F:	package/gtest/
 F:	package/libpam-radius-auth/
 F:	package/libpam-tacplus/
diff --git a/package/Config.in b/package/Config.in
index 0212121..2ed7a08 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1325,7 +1325,6 @@ menu "Other"
 	source "package/gflags/Config.in"
 	source "package/glibmm/Config.in"
 	source "package/glm/Config.in"
-	source "package/gmock/Config.in"
 	source "package/gmp/Config.in"
 	source "package/gsl/Config.in"
 	source "package/gtest/Config.in"
diff --git a/package/gmock/0001-force-use-python2.patch b/package/gmock/0001-force-use-python2.patch
deleted file mode 100644
index 5dcb231..0000000
--- a/package/gmock/0001-force-use-python2.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Force use of Python 2 even when Python 3 is the default Python interpreter.
-
-Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
-
---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
-+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2009, Google Inc.
- # All rights reserved.
---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
-+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2008 Google Inc. All Rights Reserved.
- #
diff --git a/package/gmock/Config.in b/package/gmock/Config.in
deleted file mode 100644
index ec3eb92..0000000
--- a/package/gmock/Config.in
+++ /dev/null
@@ -1,32 +0,0 @@
-config BR2_PACKAGE_GMOCK
-	bool "gmock"
-	select BR2_PACKAGE_GTEST
-	depends on BR2_USE_WCHAR
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_USE_MMU # fork()
-	help
-	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
-	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
-	  short) is a library for writing and using C++ mock classes.
-
-	  Google Mock:
-
-	    * lets you create mock classes trivially using simple macros,
-	    * supports a rich set of matchers and actions,
-	    * handles unordered, partially ordered, or completely ordered
-	      expectations,
-	    * is extensible by users, and
-	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
-	      Symbian.
-
-	    http://code.google.com/p/googlemock/
-
-	  There are both host and target packages. The target one has include
-	  files required to compile the tests and the static libraries required
-	  to link/run them. The host package installs gmock_gen, a Python script
-	  used to generate code mocks.
-
-comment "gmock needs a toolchain w/ C++, wchar, threads"
-	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
deleted file mode 100644
index 2b71739..0000000
--- a/package/gmock/gmock.hash
+++ /dev/null
@@ -1,2 +0,0 @@
-# Locally computed
-sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
deleted file mode 100644
index 4f04422..0000000
--- a/package/gmock/gmock.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-################################################################################
-#
-# gmock
-#
-################################################################################
-
-# Make sure this remains the same version as the gtest one
-GMOCK_VERSION = 1.7.0
-GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
-GMOCK_SITE = http://googlemock.googlecode.com/files
-GMOCK_INSTALL_STAGING = YES
-GMOCK_INSTALL_TARGET = NO
-GMOCK_LICENSE = BSD-3c
-GMOCK_LICENSE_FILES = LICENSE
-GMOCK_DEPENDENCIES = gtest host-gmock
-
-# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
-HOST_GMOCK_DEPENDENCIES = host-python
-HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
-
-# Static linking is required in order to keep the GMock package completely
-# separated from GTest. According to GMock's README file:
-#
-#   "Google Mock can be used as a DLL, but the same DLL must contain Google
-#    Test as well.  See Google Test's README file for instructions on how to
-#    set up necessary compiler settings".
-GMOCK_CONF_OPTS = --enable-static --disable-shared
-
-define GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
-endef
-
-# We can't use the default rule for autotools-package staging because it fails
-# because it tries to rebuild/install gtest stuff and fails after this error:
-#    "'make install' is dangerous and not supported. Instead, see README for
-#      how to integrate Google Test into your build system."
-define GMOCK_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
-	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
-	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
-	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
-		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
-endef
-
-# Unzipping inside $(@D) and moving everything from the created subdirectory is
-# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
-# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
-define HOST_GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
-	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
-	rmdir $(@D)/gmock-$(GMOCK_VERSION)
-endef
-
-define HOST_GMOCK_INSTALL_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
-	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
-	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
-endef
-
-$(eval $(autotools-package))
-# The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-autotools-package.
-$(eval $(host-generic-package))
diff --git a/package/gtest/Config.in b/package/gtest/Config.in
index 355b736..3f1f385 100644
--- a/package/gtest/Config.in
+++ b/package/gtest/Config.in
@@ -21,6 +21,34 @@ config BR2_PACKAGE_GTEST
 
 	  https://github.com/google/googletest
 
+if BR2_PACKAGE_GTEST
+
+config BR2_PACKAGE_GTEST_GMOCK
+	bool "gmock"
+	help
+	  Inspired by jMock, EasyMock, and Hamcrest, and designed with
+	  C++'s specifics in mind, Google C++ Mocking Framework (or
+	  Google Mock for short) is a library for writing and using C++
+	  mock classes.
+
+	  Google Mock:
+
+	    * lets you create mock classes trivially using simple
+	      macros, supports a rich set of matchers and actions,
+	    * handles unordered, partially ordered, or completely
+	      ordered expectations,
+	    * is extensible by users, and
+	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW,
+	      and Symbian.
+
+	  There are both host and target packages. The target one has
+	  include files required to compile the tests and the static
+	  libraries required to link/run them. The host package installs
+	  gmock_gen, a Python script used to generate code mocks.
+
+endif # BR2_PACKAGE_GTEST
+
 comment "gtest needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.pc b/package/gtest/gmock.pc
similarity index 93%
rename from package/gmock/gmock.pc
rename to package/gtest/gmock.pc
index 2f90068..4c72354 100644
--- a/package/gmock/gmock.pc
+++ b/package/gtest/gmock.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gmock
 Description: Google C++ Mocking Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgmock
 Libs.private: -lpthread
 Cflags: -I${includedir}
diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
index 79e31e4..474008d 100644
--- a/package/gtest/gtest.hash
+++ b/package/gtest/gtest.hash
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
+sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-release-1.8.0.tar.gz
diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index eb30905..046c38e 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -4,13 +4,29 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gmock one
-GTEST_VERSION = release-1.7.0
+GTEST_VERSION = release-1.8.0
 GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
 GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
-GTEST_LICENSE_FILES = LICENSE
+GTEST_LICENSE_FILES = googletest/LICENSE
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_DEPENDENCIES = host-gtest
+endif
+
+HOST_GTEST_LICENSE = Apache-2.0
+HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python3
+else
+HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python
+endif
+
+HOST_GTEST_GMOCK_PYTHONPATH = \
+	$(HOST_DIR)/usr/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages
 
 # 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
@@ -21,11 +37,22 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-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 $(STAGING_DIR)/usr/include/gtest/
-	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
+# GTest's CMakeLists.txt uses a tricky logic:
+# - by default sets BUILD_GMOCK to ON and BUILD_GTEST to OFF
+# - if BUILD_GMOCK is ON then builds gmock, which in its turn builds gtest,
+#   regardless the value of BUILD_GTEST
+# - otherwise, if BUILD_GTEST is ON then build gtest, only
+# So, to build only gtest we must set BUILD_GTEST to ON and BUILD_GMOCK to OFF
+# to revert the default values. Setting both to ON is not really necessary but
+# describes clearly what we intend to do.
+GTEST_CONF_OPTS += -DBUILD_GTEST=ON
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_CONF_OPTS += -DBUILD_GMOCK=ON
+else
+GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
+endif
+
+define GTEST_INSTALL_MISSING_FILES
 	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
 	# Generate the gtest-config script manually, since the CMake
@@ -39,9 +66,29 @@ define GTEST_INSTALL_STAGING_CMDS
 		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
 		s%@PTHREAD_CFLAGS@%%;\
 		s%@PTHREAD_LIBS@%-lpthread%;' \
-		$(@D)/scripts/gtest-config.in \
+		$(@D)/googletest/scripts/gtest-config.in \
 		> $(STAGING_DIR)/usr/bin/gtest-config
 	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
 endef
 
+define GTEST_GMOCK_INSTALL_MISSING_FILE
+	$(INSTALL) -D -m 0644 package/gtest/gmock.pc \
+		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
+endef
+
+GTEST_POST_INSTALL_STAGING_HOOKS = GTEST_INSTALL_MISSING_FILES
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
+endif
+
+define HOST_GTEST_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
+		$(HOST_DIR)/usr/bin/gmock_gen
+	cp -rp $(@D)/googlemock/scripts/generator/cpp \
+		$(HOST_GTEST_GMOCK_PYTHONPATH)
+endef
+
 $(eval $(cmake-package))
+# The host package does not build anything, just installs gmock_gen stuff, so
+# it does not need to be a host-cmake-package.
+$(eval $(host-generic-package))
diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
index b7a8aa4..594e79d 100644
--- a/package/gtest/gtest.pc
+++ b/package/gtest/gtest.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gtest
 Description: Google C++ Testing Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgtest
 Libs.private: -lpthread
 Cflags: -I${includedir}
-- 
2.7.4

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

* [Buildroot] [PATCH v7] gtest/gmock: bump to version 1.8.0
  2017-02-14 11:05     ` [Buildroot] [PATCH v6] " Carlos Santos
@ 2017-02-22 17:27       ` Carlos Santos
  2017-02-26 14:05         ` Thomas Petazzoni
  2017-03-05 21:17       ` [Buildroot] [PATCH v6] " Thomas Petazzoni
  1 sibling, 1 reply; 25+ messages in thread
From: Carlos Santos @ 2017-02-22 17:27 UTC (permalink / raw)
  To: buildroot

GTest version 1.8.0 includes gmock so merge both packages inside gtest

In this merge:

- Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
  following advice from Arnout Vandecappelle
- Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST
  and BR2_PACKAGE_GTEST_GMOCK.
- Use cmake to install libraries and headers and add missing files
  (gtest.pc, gtest-config, gmock.pc) in
  GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
  GTEST_INSTALL_STAGING_CMDS
- Remove patch on Python as gmock/gtest now supports python 3.0
  (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
- Add the correct license in HOST_GTEST_LICENSE as all python code in
  googlemock/scripts/generator is licensed under Apache-2.0 and not
  BSD-3c
- Fix URL of gtest project in Config.in
- Remove the gmock entry from DEVELOPERS
- Install gmock_gen directly, instead of as a symlink to gmock_gen.py

Notice that any external package that depends on gmock will cause an
immediate build termination because make doesn't know how to build
gmock. Since the user has just removed gmock from the legacy menu, it
should be quite obvious what needs to be done.

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
Version history:

v1 (Fabrice Fontaine)
  - Add gmock as a suboption
  - Use cmake to install
  - Remove patch on Python
  - Add the correct license
  - Fix URL of gtest project

v1->v2 (Carlos Santos)
  - Add gmock a virtual package (yeah, yeah, big mistake)

v2->v3 (Carlos Santos)
  - Got rid of the gmock virtual package (yeah, BIG mistake)
  - Use $(PYTHON3_VERSION_MAJOR) to choose the Python version
  - Several fixes, as suggested by Arnout Vandecappelle

v3->v4 (Carlos Santos)
  - Several fixes, as suggested by Romain Naour

v4->v5 (Carlos Santos)
  - Drop GTEST_VERSION_TAG after a parallel conversation with Thomas
    Petazzoni and Yann E. MORIN
    (http://patchwork.ozlabs.org/patch/726836/).

v5->v6 (Carlos Santos)
  - Fix typo found by Romain Naour
  - Clarify the logic to choose between gtest or gtest+gmock and drop
    gmock_gen symlink to gmock_gen.py as identified by Thomas Petazzoni
  - Move legacy entry to a 2017.05 session, since this will go to the
    "master" branch, not to "next".

v6->v7 (Carlos Santos)
  - Fix GTEST_CONF_OPTS to match the tricki logic in CMakeLists.txt. The
    change made in v6 made it build gtest, only, regardless the value of
    BR2_PACKAGE_GTEST_GMOCK.
---
Help git format-patch/send-email to build the recipient list (lazy boy)
Cc: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
CC: "Romain Naour" <romain.naour@gmail.com>
---
 Config.in.legacy                           | 11 +++++
 DEVELOPERS                                 |  1 -
 package/Config.in                          |  1 -
 package/gmock/0001-force-use-python2.patch | 20 ----------
 package/gmock/Config.in                    | 32 ---------------
 package/gmock/gmock.hash                   |  2 -
 package/gmock/gmock.mk                     | 64 ------------------------------
 package/gmock/gmock.pc                     | 11 -----
 package/gtest/Config.in                    | 30 +++++++++++++-
 package/gtest/gmock.pc                     | 11 +++++
 package/gtest/gtest.hash                   |  2 +-
 package/gtest/gtest.mk                     | 63 ++++++++++++++++++++++++-----
 package/gtest/gtest.pc                     |  2 +-
 13 files changed, 107 insertions(+), 143 deletions(-)
 delete mode 100644 package/gmock/0001-force-use-python2.patch
 delete mode 100644 package/gmock/Config.in
 delete mode 100644 package/gmock/gmock.hash
 delete mode 100644 package/gmock/gmock.mk
 delete mode 100644 package/gmock/gmock.pc
 create mode 100644 package/gtest/gmock.pc

diff --git a/Config.in.legacy b/Config.in.legacy
index 20445b8..cc2ab69 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -143,6 +143,17 @@ comment "----------------------------------------------------"
 endif
 
 ###############################################################################
+comment "Legacy options removed in 2017.05"
+
+config BR2_PACKAGE_GMOCK
+	bool "gmock removed"
+	select BR2_LEGACY
+	select BR2_PACKAGE_GTEST
+	select BR2_PACKAGE_GTEST_GMOCK
+	help
+	  GMock is now a suboption of GTest
+
+###############################################################################
 comment "Legacy options removed in 2017.02"
 
 config BR2_PACKAGE_PERL_DB_FILE
diff --git a/DEVELOPERS b/DEVELOPERS
index 09a0a6e..752b873 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -286,7 +286,6 @@ N:	Carlo Caione <carlo.caione@gmail.com>
 F:	package/sunxi-boards/
 
 N:	Carlos Santos <casantos@datacom.ind.br>
-F:	package/gmock/
 F:	package/gtest/
 F:	package/libpam-radius-auth/
 F:	package/libpam-tacplus/
diff --git a/package/Config.in b/package/Config.in
index 0212121..2ed7a08 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1325,7 +1325,6 @@ menu "Other"
 	source "package/gflags/Config.in"
 	source "package/glibmm/Config.in"
 	source "package/glm/Config.in"
-	source "package/gmock/Config.in"
 	source "package/gmp/Config.in"
 	source "package/gsl/Config.in"
 	source "package/gtest/Config.in"
diff --git a/package/gmock/0001-force-use-python2.patch b/package/gmock/0001-force-use-python2.patch
deleted file mode 100644
index 5dcb231..0000000
--- a/package/gmock/0001-force-use-python2.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Force use of Python 2 even when Python 3 is the default Python interpreter.
-
-Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
-
---- ./gtest/scripts/fuse_gtest_files.py.orig	2013-09-18 14:48:30.000000000 -0300
-+++ ./gtest/scripts/fuse_gtest_files.py	2015-07-22 15:42:53.291591205 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2009, Google Inc.
- # All rights reserved.
---- ./scripts/generator/gmock_gen.py.orig	2013-09-18 14:50:15.000000000 -0300
-+++ ./scripts/generator/gmock_gen.py	2015-07-22 17:06:51.071815634 -0300
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
- #
- # Copyright 2008 Google Inc. All Rights Reserved.
- #
diff --git a/package/gmock/Config.in b/package/gmock/Config.in
deleted file mode 100644
index ec3eb92..0000000
--- a/package/gmock/Config.in
+++ /dev/null
@@ -1,32 +0,0 @@
-config BR2_PACKAGE_GMOCK
-	bool "gmock"
-	select BR2_PACKAGE_GTEST
-	depends on BR2_USE_WCHAR
-	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on BR2_INSTALL_LIBSTDCPP
-	depends on BR2_USE_MMU # fork()
-	help
-	  Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
-	  specifics in mind, Google C++ Mocking Framework (or Google Mock for
-	  short) is a library for writing and using C++ mock classes.
-
-	  Google Mock:
-
-	    * lets you create mock classes trivially using simple macros,
-	    * supports a rich set of matchers and actions,
-	    * handles unordered, partially ordered, or completely ordered
-	      expectations,
-	    * is extensible by users, and
-	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW, and
-	      Symbian.
-
-	    http://code.google.com/p/googlemock/
-
-	  There are both host and target packages. The target one has include
-	  files required to compile the tests and the static libraries required
-	  to link/run them. The host package installs gmock_gen, a Python script
-	  used to generate code mocks.
-
-comment "gmock needs a toolchain w/ C++, wchar, threads"
-	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
diff --git a/package/gmock/gmock.hash b/package/gmock/gmock.hash
deleted file mode 100644
index 2b71739..0000000
--- a/package/gmock/gmock.hash
+++ /dev/null
@@ -1,2 +0,0 @@
-# Locally computed
-sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
diff --git a/package/gmock/gmock.mk b/package/gmock/gmock.mk
deleted file mode 100644
index 4f04422..0000000
--- a/package/gmock/gmock.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-################################################################################
-#
-# gmock
-#
-################################################################################
-
-# Make sure this remains the same version as the gtest one
-GMOCK_VERSION = 1.7.0
-GMOCK_SOURCE = gmock-$(GMOCK_VERSION).zip
-GMOCK_SITE = http://googlemock.googlecode.com/files
-GMOCK_INSTALL_STAGING = YES
-GMOCK_INSTALL_TARGET = NO
-GMOCK_LICENSE = BSD-3c
-GMOCK_LICENSE_FILES = LICENSE
-GMOCK_DEPENDENCIES = gtest host-gmock
-
-# GMock 1.7.0 relies on Python 2.7 syntax which is NOT compatible with Python3.
-HOST_GMOCK_DEPENDENCIES = host-python
-HOST_GMOCK_PYTHONPATH=$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
-
-# Static linking is required in order to keep the GMock package completely
-# separated from GTest. According to GMock's README file:
-#
-#   "Google Mock can be used as a DLL, but the same DLL must contain Google
-#    Test as well.  See Google Test's README file for instructions on how to
-#    set up necessary compiler settings".
-GMOCK_CONF_OPTS = --enable-static --disable-shared
-
-define GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
-endef
-
-# We can't use the default rule for autotools-package staging because it fails
-# because it tries to rebuild/install gtest stuff and fails after this error:
-#    "'make install' is dangerous and not supported. Instead, see README for
-#      how to integrate Google Test into your build system."
-define GMOCK_INSTALL_STAGING_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock.a $(STAGING_DIR)/usr/lib/libgmock.a
-	$(INSTALL) -D -m 0755 $(@D)/lib/.libs/libgmock_main.a $(STAGING_DIR)/usr/lib/libgmock_main.a
-	$(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/include/gmock/
-	cp -rp $(@D)/include/gmock/* $(STAGING_DIR)/usr/include/gmock/
-	$(INSTALL) -D -m 0755 package/gmock/gmock.pc \
-		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
-endef
-
-# Unzipping inside $(@D) and moving everything from the created subdirectory is
-# required because unzipping directly in $(BUILD_DIR) would cause host-gmock to
-# overwrite the gmock subdir instead of unzipping in a host-gmock subdir.
-define HOST_GMOCK_EXTRACT_CMDS
-	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(@D)
-	mv $(@D)/gmock-$(GMOCK_VERSION)/* $(@D)
-	rmdir $(@D)/gmock-$(GMOCK_VERSION)
-endef
-
-define HOST_GMOCK_INSTALL_CMDS
-	$(INSTALL) -D -m 0755 $(@D)/scripts/generator/gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen.py
-	ln -sf gmock_gen.py $(HOST_DIR)/usr/bin/gmock_gen
-	cp -rp $(@D)/scripts/generator/cpp $(HOST_GMOCK_PYTHONPATH)
-endef
-
-$(eval $(autotools-package))
-# The host package does not build anything, just installs gmock_gen stuff, so
-# it does not need to be a host-autotools-package.
-$(eval $(host-generic-package))
diff --git a/package/gmock/gmock.pc b/package/gmock/gmock.pc
deleted file mode 100644
index 2f90068..0000000
--- a/package/gmock/gmock.pc
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${prefix}/lib/
-includedir=${prefix}/include
-
-Name: gmock
-Description: Google C++ Mocking Framework
-Version: 1.7.0
-Libs: -L${libdir} -lgmock
-Libs.private: -lpthread
-Cflags: -I${includedir}
diff --git a/package/gtest/Config.in b/package/gtest/Config.in
index 355b736..3f1f385 100644
--- a/package/gtest/Config.in
+++ b/package/gtest/Config.in
@@ -21,6 +21,34 @@ config BR2_PACKAGE_GTEST
 
 	  https://github.com/google/googletest
 
+if BR2_PACKAGE_GTEST
+
+config BR2_PACKAGE_GTEST_GMOCK
+	bool "gmock"
+	help
+	  Inspired by jMock, EasyMock, and Hamcrest, and designed with
+	  C++'s specifics in mind, Google C++ Mocking Framework (or
+	  Google Mock for short) is a library for writing and using C++
+	  mock classes.
+
+	  Google Mock:
+
+	    * lets you create mock classes trivially using simple
+	      macros, supports a rich set of matchers and actions,
+	    * handles unordered, partially ordered, or completely
+	      ordered expectations,
+	    * is extensible by users, and
+	    * works on Linux, Mac OS X, Windows, Windows Mobile, minGW,
+	      and Symbian.
+
+	  There are both host and target packages. The target one has
+	  include files required to compile the tests and the static
+	  libraries required to link/run them. The host package installs
+	  gmock_gen, a Python script used to generate code mocks.
+
+endif # BR2_PACKAGE_GTEST
+
 comment "gtest needs a toolchain w/ C++, wchar, threads"
 	depends on BR2_USE_MMU
-	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP
+	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_INSTALL_LIBSTDCPP
diff --git a/package/gtest/gmock.pc b/package/gtest/gmock.pc
new file mode 100644
index 0000000..4c72354
--- /dev/null
+++ b/package/gtest/gmock.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${prefix}/lib/
+includedir=${prefix}/include
+
+Name: gmock
+Description: Google C++ Mocking Framework
+Version: 1.8.0
+Libs: -L${libdir} -lgmock
+Libs.private: -lpthread
+Cflags: -I${includedir}
diff --git a/package/gtest/gtest.hash b/package/gtest/gtest.hash
index 79e31e4..474008d 100644
--- a/package/gtest/gtest.hash
+++ b/package/gtest/gtest.hash
@@ -1,2 +1,2 @@
 # Locally computed:
-sha256	f73a6546fdf9fce9ff93a5015e0333a8af3062a152a9ad6bcb772c96687016cc	gtest-release-1.7.0.tar.gz
+sha256	58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8	gtest-release-1.8.0.tar.gz
diff --git a/package/gtest/gtest.mk b/package/gtest/gtest.mk
index eb30905..27ead0a 100644
--- a/package/gtest/gtest.mk
+++ b/package/gtest/gtest.mk
@@ -4,13 +4,29 @@
 #
 ################################################################################
 
-# Make sure this remains the same version as the gmock one
-GTEST_VERSION = release-1.7.0
+GTEST_VERSION = release-1.8.0
 GTEST_SITE = $(call github,google,googletest,$(GTEST_VERSION))
 GTEST_INSTALL_STAGING = YES
 GTEST_INSTALL_TARGET = NO
 GTEST_LICENSE = BSD-3c
-GTEST_LICENSE_FILES = LICENSE
+GTEST_LICENSE_FILES = googletest/LICENSE
+
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_DEPENDENCIES = host-gtest
+endif
+
+HOST_GTEST_LICENSE = Apache-2.0
+HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python3
+else
+HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
+HOST_GTEST_DEPENDENCIES = host-python
+endif
+
+HOST_GTEST_GMOCK_PYTHONPATH = \
+	$(HOST_DIR)/usr/lib/python$(HOST_GTEST_PYTHON_VERSION)/site-packages
 
 # 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
@@ -21,11 +37,20 @@ GTEST_LICENSE_FILES = LICENSE
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
-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 $(STAGING_DIR)/usr/include/gtest/
-	cp -rp $(@D)/include/gtest/* $(STAGING_DIR)/usr/include/gtest/
+# GTest's CMakeLists.txt uses a tricky logic:
+# - by default sets BUILD_GMOCK to ON and BUILD_GTEST to OFF
+# - if BUILD_GMOCK is ON then builds gmock, which in its turn builds gtest,
+#   regardless the value of BUILD_GTEST
+# - otherwise, if BUILD_GTEST is ON then build gtest, only
+# So, to build only gtest we must set BUILD_GTEST to ON and BUILD_GMOCK to OFF
+# to revert the default values. Setting both to ON is not really necessary but
+# describes clearly what we intend to do.
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),)
+GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
+GTEST_CONF_OPTS += -DBUILD_GTEST=ON
+endif
+
+define GTEST_INSTALL_MISSING_FILES
 	$(INSTALL) -D -m 0644 package/gtest/gtest.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/gtest.pc
 	# Generate the gtest-config script manually, since the CMake
@@ -39,9 +64,29 @@ define GTEST_INSTALL_STAGING_CMDS
 		s%@bindir@%$(STAGING_DIR)/usr/bin%;\
 		s%@PTHREAD_CFLAGS@%%;\
 		s%@PTHREAD_LIBS@%-lpthread%;' \
-		$(@D)/scripts/gtest-config.in \
+		$(@D)/googletest/scripts/gtest-config.in \
 		> $(STAGING_DIR)/usr/bin/gtest-config
 	chmod +x $(STAGING_DIR)/usr/bin/gtest-config
 endef
 
+define GTEST_GMOCK_INSTALL_MISSING_FILE
+	$(INSTALL) -D -m 0644 package/gtest/gmock.pc \
+		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
+endef
+
+GTEST_POST_INSTALL_STAGING_HOOKS = GTEST_INSTALL_MISSING_FILES
+ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
+GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
+endif
+
+define HOST_GTEST_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/googlemock/scripts/generator/gmock_gen.py \
+		$(HOST_DIR)/usr/bin/gmock_gen
+	cp -rp $(@D)/googlemock/scripts/generator/cpp \
+		$(HOST_GTEST_GMOCK_PYTHONPATH)
+endef
+
 $(eval $(cmake-package))
+# The host package does not build anything, just installs gmock_gen stuff, so
+# it does not need to be a host-cmake-package.
+$(eval $(host-generic-package))
diff --git a/package/gtest/gtest.pc b/package/gtest/gtest.pc
index b7a8aa4..594e79d 100644
--- a/package/gtest/gtest.pc
+++ b/package/gtest/gtest.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include
 
 Name: gtest
 Description: Google C++ Testing Framework
-Version: 1.7.0
+Version: 1.8.0
 Libs: -L${libdir} -lgtest
 Libs.private: -lpthread
 Cflags: -I${includedir}
-- 
2.7.4

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

* [Buildroot] [PATCH v7] gtest/gmock: bump to version 1.8.0
  2017-02-22 17:27       ` [Buildroot] [PATCH v7] " Carlos Santos
@ 2017-02-26 14:05         ` Thomas Petazzoni
  2017-02-27 12:31           ` Carlos Santos
  0 siblings, 1 reply; 25+ messages in thread
From: Thomas Petazzoni @ 2017-02-26 14:05 UTC (permalink / raw)
  To: buildroot

Hello,

Thanks for this new version, but there's still one thing (the same
thing as before) that I don't understand.

On Wed, 22 Feb 2017 14:27:32 -0300, Carlos Santos wrote:
> +# GTest's CMakeLists.txt uses a tricky logic:
> +# - by default sets BUILD_GMOCK to ON and BUILD_GTEST to OFF
> +# - if BUILD_GMOCK is ON then builds gmock, which in its turn builds gtest,
> +#   regardless the value of BUILD_GTEST
> +# - otherwise, if BUILD_GTEST is ON then build gtest, only
> +# So, to build only gtest we must set BUILD_GTEST to ON and BUILD_GMOCK to OFF
> +# to revert the default values. Setting both to ON is not really necessary but
> +# describes clearly what we intend to do.

Knowing this, why don't you simply do the much more obvious:

GTEST_CONF_OPTS += -DBUILD_GTEST=ON

ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
GTEST_CONF_OPTS += -DBUILD_GMOCK=ON
else
GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
endif

instead of the very cryptic!

> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),)
> +GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
> +GTEST_CONF_OPTS += -DBUILD_GTEST=ON
> +endif

Thanks,

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

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

* [Buildroot] [PATCH v7] gtest/gmock: bump to version 1.8.0
  2017-02-26 14:05         ` Thomas Petazzoni
@ 2017-02-27 12:31           ` Carlos Santos
  2017-03-01 22:09             ` Thomas Petazzoni
  0 siblings, 1 reply; 25+ messages in thread
From: Carlos Santos @ 2017-02-27 12:31 UTC (permalink / raw)
  To: buildroot

[resending, since Zimbra failed to deliver my last message]

> From: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
> To: "Carlos Santos" <casantos@datacom.ind.br>
> Cc: buildroot at buildroot.org, "Fabrice Fontaine" <fabrice.fontaine@orange.com>, "Romain Naour" <romain.naour@gmail.com>,
> "Yann E. MORIN" <yann.morin.1998@free.fr>
> Sent: Sunday, February 26, 2017 11:05:25 AM
> Subject: Re: [Buildroot] [PATCH v7] gtest/gmock: bump to version 1.8.0

> Hello,
> 
> Thanks for this new version, but there's still one thing (the same
> thing as before) that I don't understand.
> 
> On Wed, 22 Feb 2017 14:27:32 -0300, Carlos Santos wrote:
>> +# GTest's CMakeLists.txt uses a tricky logic:
>> +# - by default sets BUILD_GMOCK to ON and BUILD_GTEST to OFF
>> +# - if BUILD_GMOCK is ON then builds gmock, which in its turn builds gtest,
>> +#   regardless the value of BUILD_GTEST
>> +# - otherwise, if BUILD_GTEST is ON then build gtest, only
>> +# So, to build only gtest we must set BUILD_GTEST to ON and BUILD_GMOCK to OFF
>> +# to revert the default values. Setting both to ON is not really necessary but
>> +# describes clearly what we intend to do.
> 
> Knowing this, why don't you simply do the much more obvious:
> 
> GTEST_CONF_OPTS += -DBUILD_GTEST=ON
> 
> ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> GTEST_CONF_OPTS += -DBUILD_GMOCK=ON
> else
> GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
> endif
> 
> instead of the very cryptic!
> 
>> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),)
>> +GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
>> +GTEST_CONF_OPTS += -DBUILD_GTEST=ON
>> +endif

Because it does not work (try http://patchwork.ozlabs.org/patch/727786/).

-- 
Carlos Santos (Casantos) - DATACOM, P&D
?The greatest triumph that modern PR can offer is the transcendent 
success of having your words and actions judged by your reputation, 
rather than the other way about.? ? Christopher Hitchens

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

* [Buildroot] [PATCH v7] gtest/gmock: bump to version 1.8.0
  2017-02-27 12:31           ` Carlos Santos
@ 2017-03-01 22:09             ` Thomas Petazzoni
  2017-03-02 11:34               ` Carlos Santos
  0 siblings, 1 reply; 25+ messages in thread
From: Thomas Petazzoni @ 2017-03-01 22:09 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 27 Feb 2017 09:31:50 -0300 (BRT), Carlos Santos wrote:

> Because it does not work (try http://patchwork.ozlabs.org/patch/727786/).

Could you define "does not work" ? Indeed, I applied this version of
your patch (v6), and built it with the following configurations:

BR2_PACKAGE_GTEST=y
# BR2_PACKAGE_GTEST_GMOCK is not set

and:

BR2_PACKAGE_GTEST=y
BR2_PACKAGE_GTEST_GMOCK=y

and both built successfully.

The first one only installed gtest:

>>> gtest release-1.8.0 Installing to staging directory
PATH="/home/thomas/projets/buildroot/output/host/bin:/home/thomas/projets/buildroot/output/host/sbin:/home/thomas/projets/buildroot/output/host/usr/bin:/home/thomas/projets/buildroot/output/host/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/thomas/.rvm/bin:/home/thomas/sys/bin:/home/thomas/.gem/ruby/2.1.0/bin:/home/thomas/.rvm/bin"  /usr/bin/make -j5  DESTDIR=/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot install/fast -C /home/thomas/projets/buildroot/output/build/gtest-release-1.8.0/
Install the project...
-- Install configuration: "Release"
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libgtest.a
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libgtest_main.a
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-param-test.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-test-part.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-typed-test.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-message.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-death-test.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-param-util.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-linked_ptr.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-type-util.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-port-arch.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-type-util.h.pump
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-tuple.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-internal.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-param-util-generated.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-port.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-string.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-param-util-generated.h.pump
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-death-test-internal.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-filepath.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-tuple.h.pump
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/custom
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/custom/gtest-port.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/custom/gtest.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/custom/gtest-printers.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest_pred_impl.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-spi.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-printers.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest_prod.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-param-test.h.pump
/usr/bin/install -D -m 0644 package/gtest/gtest.pc /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig/gtest.pc
# Generate the gtest-config script manually, since the CMake
# build system is not doing it.
sed 's%@PACKAGE_TARNAME@%gtest%; s%@PACKAGE_VERSION@%release-1.8.0%; s%@prefix@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr%; s%@exec_prefix@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr%; s%@libdir@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib%; s%@includedir@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include%; s%@bindir@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin%; s%@PTHREAD_CFLAGS@%%; s%@PTHREAD_LIBS@%-lpthread%;' /home/thomas/projets/buildroot/output/build/gtest-release-1.8.0/googletest/scripts/gtest-config.in > /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin/gtest-config
chmod +x /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin/gtest-config

While the second one installed both gtest and gmock:

>>> gtest release-1.8.0 Installing to staging directory
PATH="/home/thomas/projets/buildroot/output/host/bin:/home/thomas/projets/buildroot/output/host/sbin:/home/thomas/projets/buildroot/output/host/usr/bin:/home/thomas/projets/buildroot/output/host/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/thomas/.rvm/bin:/home/thomas/sys/bin:/home/thomas/.gem/ruby/2.1.0/bin:/home/thomas/.rvm/bin"  /usr/bin/make -j5  DESTDIR=/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot install/fast -C /home/thomas/projets/buildroot/output/build/gtest-release-1.8.0/
Install the project...
-- Install configuration: "Release"
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libgmock.a
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libgmock_main.a
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-generated-nice-strict.h.pump
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-cardinalities.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-more-matchers.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-generated-nice-strict.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-generated-actions.h.pump
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-generated-matchers.h.pump
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-actions.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-more-actions.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal/gmock-port.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal/gmock-internal-utils.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal/gmock-generated-internal-utils.h.pump
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal/gmock-generated-internal-utils.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal/custom
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal/custom/gmock-port.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal/custom/gmock-generated-actions.h.pump
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal/custom/gmock-matchers.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/internal/custom/gmock-generated-actions.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-matchers.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-spec-builders.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-generated-actions.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-generated-function-mockers.h.pump
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-generated-matchers.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gmock/gmock-generated-function-mockers.h
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libgtest.a
-- Installing: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libgtest_main.a
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-param-test.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-test-part.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-typed-test.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-message.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-death-test.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-param-util.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-linked_ptr.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-type-util.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-port-arch.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-type-util.h.pump
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-tuple.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-internal.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-param-util-generated.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-port.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-string.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-param-util-generated.h.pump
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-death-test-internal.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-filepath.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/gtest-tuple.h.pump
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/custom
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/custom/gtest-port.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/custom/gtest.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/internal/custom/gtest-printers.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest_pred_impl.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-spi.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-printers.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest_prod.h
-- Up-to-date: /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/gtest/gtest-param-test.h.pump
/usr/bin/install -D -m 0644 package/gtest/gtest.pc /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig/gtest.pc
# Generate the gtest-config script manually, since the CMake
# build system is not doing it.
sed 's%@PACKAGE_TARNAME@%gtest%; s%@PACKAGE_VERSION@%release-1.8.0%; s%@prefix@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr%; s%@exec_prefix@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr%; s%@libdir@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib%; s%@includedir@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include%; s%@bindir@%/home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin%; s%@PTHREAD_CFLAGS@%%; s%@PTHREAD_LIBS@%-lpthread%;' /home/thomas/projets/buildroot/output/build/gtest-release-1.8.0/googletest/scripts/gtest-config.in > /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin/gtest-config
chmod +x /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/bin/gtest-config
/usr/bin/install -D -m 0644 package/gtest/gmock.pc /home/thomas/projets/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/pkgconfig/gmock.pc

What am I missing here ?

Thanks,

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

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

* [Buildroot] [PATCH v7] gtest/gmock: bump to version 1.8.0
  2017-03-01 22:09             ` Thomas Petazzoni
@ 2017-03-02 11:34               ` Carlos Santos
  0 siblings, 0 replies; 25+ messages in thread
From: Carlos Santos @ 2017-03-02 11:34 UTC (permalink / raw)
  To: buildroot

> From: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
> To: "Carlos Santos" <casantos@datacom.ind.br>
> Cc: "Fabrice Fontaine" <fabrice.fontaine@orange.com>, "Romain Naour" <romain.naour@gmail.com>, "Yann E. MORIN"
> <yann.morin.1998@free.fr>, buildroot at buildroot.org
> Sent: Wednesday, March 1, 2017 7:09:27 PM
> Subject: Re: [Buildroot] [PATCH v7] gtest/gmock: bump to version 1.8.0

> Hello,
> 
> On Mon, 27 Feb 2017 09:31:50 -0300 (BRT), Carlos Santos wrote:
> 
>> Because it does not work (try http://patchwork.ozlabs.org/patch/727786/).
> 
> Could you define "does not work" ? Indeed, I applied this version of
> your patch (v6), and built it with the following configurations:
> 
> BR2_PACKAGE_GTEST=y
> # BR2_PACKAGE_GTEST_GMOCK is not set
> 
> and:
> 
> BR2_PACKAGE_GTEST=y
> BR2_PACKAGE_GTEST_GMOCK=y
> 
> and both built successfully.

Hum, that's correct. I'm at work now, without access to the machine in
which I was running my tests, at home, and can't reproduce the problem
that led me to believe that v7 was necessary. Looks like it was just a
mistake.

Please apply v6 and discard v7. Sorry for the noise.

-- 
Carlos Santos (Casantos) - DATACOM, P&D
?The greatest triumph that modern PR can offer is the transcendent 
success of having your words and actions judged by your reputation, 
rather than the other way about.? ? Christopher Hitchens

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

* [Buildroot] [PATCH v6] gtest/gmock: bump to version 1.8.0
  2017-02-14 11:05     ` [Buildroot] [PATCH v6] " Carlos Santos
  2017-02-22 17:27       ` [Buildroot] [PATCH v7] " Carlos Santos
@ 2017-03-05 21:17       ` Thomas Petazzoni
  1 sibling, 0 replies; 25+ messages in thread
From: Thomas Petazzoni @ 2017-03-05 21:17 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 14 Feb 2017 09:05:16 -0200, Carlos Santos wrote:
> GTest version 1.8.0 includes gmock so merge both packages inside gtest
> 
> In this merge:
> 
> - Add gmock as a suboption of gtest (BR2_PACKAGE_GTEST_GMOCK)
>   following advice from Arnout Vandecappelle
> - Add BR2_PACKAGE_GMOCK as a legacy entry, selecting BR2_PACKAGE_GTEST
>   and BR2_PACKAGE_GTEST_GMOCK.
> - Use cmake to install libraries and headers and add missing files
>   (gtest.pc, gtest-config, gmock.pc) in
>   GTEST_POST_INSTALL_STAGING_HOOKS instead of redefining
>   GTEST_INSTALL_STAGING_CMDS
> - Remove patch on Python as gmock/gtest now supports python 3.0
>   (commit 456fc2b5c4e9ebf05a5987dfe1ff0ac9ffeb53cc)
> - Add the correct license in HOST_GTEST_LICENSE as all python code in
>   googlemock/scripts/generator is licensed under Apache-2.0 and not
>   BSD-3c
> - Fix URL of gtest project in Config.in
> - Remove the gmock entry from DEVELOPERS
> - Install gmock_gen directly, instead of as a symlink to gmock_gen.py
> 
> Notice that any external package that depends on gmock will cause an
> immediate build termination because make doesn't know how to build
> gmock. Since the user has just removed gmock from the legacy menu, it
> should be quite obvious what needs to be done.
> 
> Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> Reviewed-by: Romain Naour <romain.naour@gmail.com>

As we discussed, I have applied this v6, with a few changes, see below.


> +config BR2_PACKAGE_GMOCK
> +	bool "gmock removed"

It's not exactly removed, but merged into gtest, so I've changed the
prompt slightly here.


> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> +GTEST_DEPENDENCIES = host-gtest

Using a '=' here is not a good idea, += should be used instead. I agree
'=' works fine, but if someone else adds another GTEST_DEPENDENCIES =
above, then it will not be taken into account.

Generally speaking, for conditional assignments to <pkg>_DEPENDENCIES,
I really prefer when += is used.

> +endif
> +
> +HOST_GTEST_LICENSE = Apache-2.0
> +HOST_GTEST_LICENSE_FILES = googlemock/scripts/generator/LICENSE
> +ifeq ($(BR2_PACKAGE_PYTHON3),y)
> +HOST_GTEST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR)
> +HOST_GTEST_DEPENDENCIES = host-python3

Ditto.

> +else
> +HOST_GTEST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR)
> +HOST_GTEST_DEPENDENCIES = host-python

Ditto.


> +# GTest's CMakeLists.txt uses a tricky logic:
> +# - by default sets BUILD_GMOCK to ON and BUILD_GTEST to OFF
> +# - if BUILD_GMOCK is ON then builds gmock, which in its turn builds gtest,
> +#   regardless the value of BUILD_GTEST
> +# - otherwise, if BUILD_GTEST is ON then build gtest, only
> +# So, to build only gtest we must set BUILD_GTEST to ON and BUILD_GMOCK to OFF
> +# to revert the default values. Setting both to ON is not really necessary but
> +# describes clearly what we intend to do.

I really don't see what's tricky in the need to enable what you want to
build, and disable what you don't want, which is exactly what the
following piece of code does. So I've dropped this comment.

> +GTEST_CONF_OPTS += -DBUILD_GTEST=ON
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)
> +GTEST_CONF_OPTS += -DBUILD_GMOCK=ON
> +else
> +GTEST_CONF_OPTS += -DBUILD_GMOCK=OFF
> +endif
> +
> +define GTEST_GMOCK_INSTALL_MISSING_FILE
> +	$(INSTALL) -D -m 0644 package/gtest/gmock.pc \
> +		$(STAGING_DIR)/usr/lib/pkgconfig/gmock.pc
> +endef

I've moved this...

> +
> +GTEST_POST_INSTALL_STAGING_HOOKS = GTEST_INSTALL_MISSING_FILES
> +ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)

... inside the condition where it is actually used.

> +GTEST_POST_INSTALL_STAGING_HOOKS += GTEST_GMOCK_INSTALL_MISSING_FILE
> +endif

Thanks a lot for having worked on this, and going through the numerous
iterations!

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

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

end of thread, other threads:[~2017-03-05 21:17 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07 14:39 [Buildroot] [PATCH 1/1] gtest: bump to version 1.8.0 Fabrice Fontaine
2016-09-07 15:19 ` Carlos Santos
2016-09-07 22:20 ` [Buildroot] [PATCH 1/1] gtest/gmock: " Carlos Santos
2016-09-07 23:16   ` [Buildroot] [PATCH v2] " Carlos Santos
2016-09-11 12:09     ` Arnout Vandecappelle
2017-02-06 15:43       ` Romain Naour
2017-02-06 16:46         ` Carlos Santos
2017-02-06 16:54           ` Romain Naour
2017-02-11 11:32     ` [Buildroot] [PATCH v3] " Carlos Santos
2017-02-11 13:50       ` Romain Naour
2017-02-11 18:08         ` Carlos Santos
2017-02-11 18:11     ` [Buildroot] [PATCH v4] " Carlos Santos
2017-02-12 12:17     ` [Buildroot] [PATCH v5] " Carlos Santos
2017-02-12 14:15       ` Romain Naour
2017-02-12 14:37         ` Thomas Petazzoni
2017-02-12 14:37       ` Thomas Petazzoni
2017-02-12 15:02         ` Carlos Santos
2017-02-12 17:28           ` Thomas Petazzoni
2017-02-14 11:05     ` [Buildroot] [PATCH v6] " Carlos Santos
2017-02-22 17:27       ` [Buildroot] [PATCH v7] " Carlos Santos
2017-02-26 14:05         ` Thomas Petazzoni
2017-02-27 12:31           ` Carlos Santos
2017-03-01 22:09             ` Thomas Petazzoni
2017-03-02 11:34               ` Carlos Santos
2017-03-05 21:17       ` [Buildroot] [PATCH v6] " Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.