Skip to contentSkip to conversation

gmock: new package

PATCH Superseded Carlos Santos 6 participants 16 messages Mar 2, 2015 – Oct 3, 2015

lore
Share & tools
lore
#0 lore raw

cover gmock: new package

Warning: This change requires an updated recipe for gtest (submittted as a separate patch) because Gmock requires the gtest-config, which is installed only if gtest is built with autotools.

Carlos Santos (1):
gmock: new package

 package/Config.in        |  1 +
 package/gmock/Config.in  | 26 ++++++++++++++++++++++++++
 package/gmock/gmock.hash |  3 +++
 package/gmock/gmock.mk   | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 77 insertions(+)
 create mode 100644 package/gmock/Config.in
 create mode 100644 package/gmock/gmock.hash
 create mode 100644 package/gmock/gmock.mk
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 gmock: new package

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/

---
 package/Config.in        |  1 +
 package/gmock/Config.in  | 26 ++++++++++++++++++++++++++
 package/gmock/gmock.hash |  3 +++
 package/gmock/gmock.mk   | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 77 insertions(+)
 create mode 100644 package/gmock/Config.in
 create mode 100644 package/gmock/gmock.hash
 create mode 100644 package/gmock/gmock.mk
package/Config.in +1 -0
index 262a7fb..26db447 100644
@@ -932,6 +932,7 @@ menu "Other"
 	source "package/flann/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"
package/gmock/Config.in new file +26 -0
new file mode 100644
index 0000000..001da22
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_GMOCK
+	bool "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.
+
+	  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/
+
+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
package/gmock/gmock.hash new file +3 -0
new file mode 100644
index 0000000..4d038e2
@@ -0,0 +1,3 @@
+# No upstream hashes for the following:
+md5 073b984d8798ea1594f5e44d85b20d66 gmock-1.7.0.zip
+sha1 f9d9dd882a25f4069ed9ee48e70aff1b53e3c5a5 gmock-1.7.0.zip
package/gmock/gmock.mk new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/1 gmock: new package

Quoted 18 lines · Carlos Santos

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/

Quoted 9 lines
---
 package/Config.in        |  1 +
 package/gmock/Config.in  | 26 ++++++++++++++++++++++++++
 package/gmock/gmock.hash |  3 +++
 package/gmock/gmock.mk   | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 77 insertions(+)
 create mode 100644 package/gmock/Config.in
 create mode 100644 package/gmock/gmock.hash
 create mode 100644 package/gmock/gmock.mk

This patch depends on this patch:
http://patchwork.ozlabs.org/patch/445112/

Without that patch this package fails to build.

You have already said it in the mail "[PATCH 0/1] gmock: new package" but that mail is not visible in patchwork so I've replayed to this mail.

Quoted 109 lines
package/Config.in +1 -0
index 262a7fb..26db447 100644
@@ -932,6 +932,7 @@ menu "Other"
        source "package/flann/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"
package/gmock/Config.in new file +26 -0
new file mode 100644
index 0000000..001da22
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_GMOCK
+       bool "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.
+
+         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/
+
+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
package/gmock/gmock.hash new file +3 -0
new file mode 100644
index 0000000..4d038e2
@@ -0,0 +1,3 @@
+# No upstream hashes for the following:
+md5 073b984d8798ea1594f5e44d85b20d66 gmock-1.7.0.zip
+sha1 f9d9dd882a25f4069ed9ee48e70aff1b53e3c5a5 gmock-1.7.0.zip
package/gmock/gmock.mk new file +47 -1
new file mode 100644
index 0000000..5ecf940
@@ -0,0 +1,47 @@
+################################################################################
+#
+# gmock
+#
+################################################################################
+
+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_DEPENDENCIES = host-python
+
+GMOCK_CONF_OPTS = --with-gtest=$(STAGING_DIR)/usr/lib/
+
+define GMOCK_EXTRACT_CMDS
+       $(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
+endef
+
+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/
+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_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+endef
+
+$(eval $(autotools-package))
+$(eval $(host-generic-package))
--

1.8.3.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

BR

Signature · 1 line
Fabio Porcedda
#3 lore raw

PATCH 1/1 gmock: new package

In reply to Carlos Santos

Dear Carlos Santos,

package/gmock/gmock.hash line 1

Quoted 7 lines · Carlos Santos
package/gmock/gmock.hash new file +1 -0
new file mode 100644
index 0000000..4d038e2
@@ -0,0 +1,3 @@
+# No upstream hashes for the following:

We use:

# Locally computed

and a single sha256 hash.

Quoted 26 lines
package/gmock/gmock.hash new file +2 -0
+md5 073b984d8798ea1594f5e44d85b20d66 gmock-1.7.0.zip
+sha1 f9d9dd882a25f4069ed9ee48e70aff1b53e3c5a5 gmock-1.7.0.zip
package/gmock/gmock.mk new file +18 -0
new file mode 100644
index 0000000..5ecf940
@@ -0,0 +1,47 @@
+################################################################################
+#
+# gmock
+#
+################################################################################
+
+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_DEPENDENCIES = host-python
+
+GMOCK_CONF_OPTS = --with-gtest=$(STAGING_DIR)/usr/lib/
+

package/gmock/gmock.mk line 28

Quoted 10 lines
package/gmock/gmock.mk new file +10 -0
+define GMOCK_EXTRACT_CMDS
+	$(UNZIP) $(DL_DIR)/$(GMOCK_SOURCE) -d $(BUILD_DIR)
+endef
+
+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/
+endef

Why don't you use the default rule for autotools-package staging installation?

Quoted 9 lines
package/gmock/gmock.mk new file +9 -0
+
+
+# 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)

package/gmock/gmock.mk line 47

Quoted 10 lines
package/gmock/gmock.mk new file +10 -0
+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_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+endef
+
+$(eval $(autotools-package))
+$(eval $(host-generic-package))

Who is using host-gmock? Your code is not using it apparently, so it seems like dead code. Can you explain more how it is supposed to be used? And why would it be a host-generic-package and not host-autotools-package?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH v2 1/1 gmock: new package

In reply to Carlos Santos

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.

---
 package/Config.in        |  1 +
 package/gmock/Config.in  | 31 +++++++++++++++++++++++++++++
 package/gmock/gmock.hash |  2 ++
 package/gmock/gmock.mk   | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 86 insertions(+)
 create mode 100644 package/gmock/Config.in
 create mode 100644 package/gmock/gmock.hash
 create mode 100644 package/gmock/gmock.mk
package/Config.in +1 -0
index af4d2b7..3190bf8 100644
@@ -1014,6 +1014,7 @@ menu "Other"
 	source "package/flann/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"
package/gmock/Config.in new file +31 -0
new file mode 100644
index 0000000..8a18c29
@@ -0,0 +1,31 @@
+config BR2_PACKAGE_GMOCK
+	bool "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.
+	  
+	  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
package/gmock/gmock.hash new file +2 -0
new file mode 100644
index 0000000..2b71739
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
package/gmock/gmock.mk new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.1.0
#5 lore raw

PATCH v2 1/1 gmock: new package

Carlos, all,

Quoted 96 lines · Carlos Santos

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.

---
 package/Config.in        |  1 +
 package/gmock/Config.in  | 31 +++++++++++++++++++++++++++++
 package/gmock/gmock.hash |  2 ++
 package/gmock/gmock.mk   | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 86 insertions(+)
 create mode 100644 package/gmock/Config.in
 create mode 100644 package/gmock/gmock.hash
 create mode 100644 package/gmock/gmock.mk
package/Config.in +1 -0
index af4d2b7..3190bf8 100644
@@ -1014,6 +1014,7 @@ menu "Other"
        source "package/flann/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"
package/gmock/Config.in new file +31 -0
new file mode 100644
index 0000000..8a18c29
@@ -0,0 +1,31 @@
+config BR2_PACKAGE_GMOCK
+       bool "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.
+
+         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
package/gmock/gmock.hash new file +2 -0
new file mode 100644
index 0000000..2b71739
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
package/gmock/gmock.mk new file +0 -0
new file mode 100644
index 0000000..3a7173e

package/gmock/gmock.mk line 7

Quoted 7 lines
package/gmock/gmock.mk new file +7 -0
@@ -0,0 +1,52 @@
+################################################################################
+#
+# gmock
+#
+################################################################################
+
+GMOCK_VERSION = 1.7.0

According to [1], gmock version must be the same as the gtest's one, so maybe we should do:
GMOCK_VERSION = $(GTEST_VERSION)
(but, taking care of the *.mk inclusion to get GTEST_VERSION defined before including gmock.mk).

package/gmock/gmock.mk line 15

Quoted 8 lines
package/gmock/gmock.mk new file +8 -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_DEPENDENCIES = host-python

Does this require python2? or can it work with python3?

package/gmock/gmock.mk line 17

Quoted 2 lines
package/gmock/gmock.mk new file +2 -0
+
+GMOCK_CONF_OPTS = --enable-static --disable-shared

Why do you always force the static lib to be built? is it for the same reason as gtest [2]?

Quoted 25 lines
package/gmock/gmock.mk new file +25 -0
+
+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/
+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
+

package/gmock/gmock.mk line 52

Quoted 10 lines
package/gmock/gmock.mk new file +10 -0
+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_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+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))

AFAI understand, host-gmock only install tools needed when building a package depending on gmock (target package).
Since host-gmock is not a dependency of gmock, a package using gmock will have to depend on both gmock and host-gmock at buildtime. Maybe, it would be good to make gmock depends on host-gmock to ensure that all needed tools will be available when building a package depending on gmock, but without the explicitly dependency on host-gmock.
Thoughts?

Please, take into account these comments and submit a new version of this patch if you are still interested in having it in the official Buildroot tree, meanwhile it'll be marked as "Change Requested" in patchwork.

[1] https://code.google.com/p/googlemock/source/browse/trunk/README#43
[2] http://git.buildroot.net/buildroot/tree/package/gtest/gtest.mk#n15

Regards,

Signature · 1 line
Samuel
#6 lore raw

PATCH v2 1/1 gmock: new package

Samuel, Carlos,

Quoted 4 lines · Samuel Martin
Quoted 4 lines
package/gmock/gmock.mk new file +4 -0
+################################################################################
+#
+# gmock
+#
Quoted 8 lines

package/gmock/gmock.mk line 7

Quoted 3 lines
package/gmock/gmock.mk new file +3 -0
+################################################################################
+
+GMOCK_VERSION = 1.7.0

According to [1], gmock version must be the same as the gtest's one, so maybe we should do:
GMOCK_VERSION = $(GTEST_VERSION)
(but, taking care of the *.mk inclusion to get GTEST_VERSION defined before including gmock.mk).

I don't think this is a good idea. gmock is included *before* gtest, and there's not much that can be done about this.

So instead, I would recommend to just to:

# Make sure this remains the same version as the gtest one GMOCK_VERSION = 1.7.0

and then in gtest.mk:

# Make sure this remains the same version as the gmock one GTEST_VERSION = 1.7.0

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH v2 1/1 gmock: new package

In reply to Samuel Martin
Quoted 25 lines

From: "Samuel Martin" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Tuesday, July 14, 2015 7:09:34 AM
Subject: Re: [Buildroot] [PATCH v2 1/1] gmock: new package

package/gmock/gmock.mk line 7

Quoted 13 lines
package/gmock/gmock.mk new file +7 -0
new file mode 100644
index 0000000..3a7173e
@@ -0,0 +1,52 @@
+################################################################################
+#
+# gmock
+#
+################################################################################
+
+GMOCK_VERSION = 1.7.0

According to [1], gmock version must be the same as the gtest's one, so maybe we should do:
GMOCK_VERSION = $(GTEST_VERSION)
(but, taking care of the *.mk inclusion to get GTEST_VERSION defined before including gmock.mk).

Quoted 9 lines

package/gmock/gmock.mk line 15

Quoted 8 lines
package/gmock/gmock.mk new file +8 -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_DEPENDENCIES = host-python

Does this require python2? or can it work with ?

I did not test with python3. I will give it a try and update gmock.mk accordingly.

Quoted 3 lines

package/gmock/gmock.mk line 17

Quoted 1 line
package/gmock/gmock.mk new file +1 -0
+GMOCK_CONF_OPTS = --enable-static --disable-shared

Why do you always force the static lib to be built? is it for the same reason as gtest [2]?

It's required in order to keep the GMock package completely separated from GTest. According to [3] "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".

[...]

Quoted 4 lines

package/gmock/gmock.mk line 52

Quoted 3 lines
package/gmock/gmock.mk new file +3 -0
+# 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))
Quoted 8 lines

AFAI understand, host-gmock only install tools needed when building a package depending on gmock (target package).
Since host-gmock is not a dependency of gmock, a package using gmock will have to depend on both gmock and host-gmock at buildtime. Maybe, it would be good to make gmock depends on host-gmock to ensure that all needed tools will be available when building a package depending on gmock, but without the explicitly dependency on host-gmock.

Yes, I will add a dependence on host-gmock.

Quoted 8 lines

Please, take into account these comments and submit a new version of this patch if you are still interested in having it in the official Buildroot tree, meanwhile it'll be marked as "Change Requested" in patchwork.

[1] https://code.google.com/p/googlemock/source/browse/trunk/README#43
[2] http://git.buildroot.net/buildroot/tree/package/gtest/gtest.mk#n15

[3] https://code.google.com/p/googlemock/source/browse/trunk/README#276

Carlos Santos (Casantos)
DATACOM, P&D

#8 lore raw

PATCH v2 1/1 gmock: new package

Quoted 5 lines

From: "Carlos Santos" <[email protected]>
To: "Samuel Martin" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Thursday, July 16, 2015 8:34:51 AM
Subject: Re: [Buildroot] [PATCH v2 1/1] gmock: new package

[...]

Quoted 5 lines
Quoted 5 lines

From: "Samuel Martin" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Tuesday, July 14, 2015 7:09:34 AM
Subject: Re: [Buildroot] [PATCH v2 1/1] gmock: new package

[...]

Quoted 11 lines
Quoted 10 lines

package/gmock/gmock.mk line 15

Quoted 8 lines
package/gmock/gmock.mk new file +8 -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_DEPENDENCIES = host-python

Does this require python2? or can it work with python3?

Quoted 2 lines

I did not test with python3. I will give it a try and update gmock.mk accordingly.

Is there a way to select between host-python and host-python3? I can select either python or python3 via menuconfig in

    Target packages -> Interpreter languages and scripting

but this would add python to the target system.

Carlos Santos (Casantos)
DATACOM, P&D

#9 lore raw

PATCH v2 1/1 gmock: new package

Carlos,

On Thu, Jul 16, 2015 at 10:51 PM, Carlos Santos <[email protected]> wrote:
[...]

Quoted 6 lines

Is there a way to select between host-python and host-python3? I can select either python or python3 via menuconfig in

    Target packages -> Interpreter languages and scripting

but this would add python to the target system.

When you select python3 for the target, the host-python3 is built and set as default python interpreter in $(HOST_DIR) ; iow, $(HOST_DIR)/usr/bin/python points to python3.

So the way of buiilding host-python3 is selecting python3 for the target.

Regards,

Signature · 1 line
Samuel
#10 lore raw

PATCH v3 1/1 gmock: new package

In reply to Carlos Santos

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.

Notice that GMock 1.7.0 requires the Python 2 host package even if Python 3 is selected as a target package.

---
 package/Config.in                                 |  1 +
 package/gmock/0001-fuse_gtest_files-python2.patch |  8 ++++
 package/gmock/0002-gmock_gen-python2.patch        |  8 ++++
 package/gmock/Config.in                           | 31 +++++++++++++
 package/gmock/gmock.hash                          |  2 +
 package/gmock/gmock.mk                            | 56 +++++++++++++++++++++++
 package/gtest/gtest.mk                            |  1 +
 7 files changed, 107 insertions(+)
 create mode 100644 package/gmock/0001-fuse_gtest_files-python2.patch
 create mode 100644 package/gmock/0002-gmock_gen-python2.patch
 create mode 100644 package/gmock/Config.in
 create mode 100644 package/gmock/gmock.hash
 create mode 100644 package/gmock/gmock.mk
package/Config.in +1 -0
index 9942e3a..c95bfe6 100644
@@ -1042,6 +1042,7 @@ 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"
package/gmock/0001-fuse_gtest_files-python2.patch new file +8 -0
new file mode 100644
index 0000000..dc0096e
@@ -0,0 +1,8 @@
+--- ./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.
package/gmock/0002-gmock_gen-python2.patch new file +8 -0
new file mode 100644
index 0000000..9015a22
@@ -0,0 +1,8 @@
+--- ./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.
+ #
package/gmock/Config.in new file +31 -0
new file mode 100644
index 0000000..d792945
@@ -0,0 +1,31 @@
+config BR2_PACKAGE_GMOCK
+	bool "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.
+
+	  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
package/gmock/gmock.hash new file +2 -0
new file mode 100644
index 0000000..2b71739
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
package/gmock/gmock.mk new file +56 -0

56 lines not on this page · raw message

package/gtest/gtest.mk +1 -0
index 562acf0..da08621 100644
@@ -4,6 +4,7 @@
 #
 ################################################################################
 
+# Make sure this remains the same version as the gmock one
 GTEST_VERSION = 1.7.0
 GTEST_SOURCE = gtest-$(GTEST_VERSION).zip
 GTEST_SITE = http://googletest.googlecode.com/files
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH v3 1/1 gmock: new package

Hi Carlos,

Le 23/07/2015 22:39, Carlos Santos a ?crit :

Quoted 73 lines

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.

Notice that GMock 1.7.0 requires the Python 2 host package even if Python 3 is selected as a target package.

---
 package/Config.in                                 |  1 +
 package/gmock/0001-fuse_gtest_files-python2.patch |  8 ++++
 package/gmock/0002-gmock_gen-python2.patch        |  8 ++++
 package/gmock/Config.in                           | 31 +++++++++++++
 package/gmock/gmock.hash                          |  2 +
 package/gmock/gmock.mk                            | 56 +++++++++++++++++++++++
 package/gtest/gtest.mk                            |  1 +
 7 files changed, 107 insertions(+)
 create mode 100644 package/gmock/0001-fuse_gtest_files-python2.patch
 create mode 100644 package/gmock/0002-gmock_gen-python2.patch
 create mode 100644 package/gmock/Config.in
 create mode 100644 package/gmock/gmock.hash
 create mode 100644 package/gmock/gmock.mk
package/Config.in +1 -0
index 9942e3a..c95bfe6 100644
@@ -1042,6 +1042,7 @@ 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"
package/gmock/0001-fuse_gtest_files-python2.patch new file +8 -0
new file mode 100644
index 0000000..dc0096e
@@ -0,0 +1,8 @@
+--- ./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.
package/gmock/0002-gmock_gen-python2.patch new file +0 -0
new file mode 100644
index 0000000..9015a22

package/gmock/0002-gmock_gen-python2.patch line 8

Quoted 8 lines
package/gmock/0002-gmock_gen-python2.patch new file +8 -0
@@ -0,0 +1,8 @@
+--- ./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.
+ #

These two patches can be squashed since they do the same thing. Also, a short description and a Sob line are needed. See:
http://buildroot.uclibc.org/downloads/manual/manual.html#_format_and_licensing_of_the_package_patches

package/gmock/Config.in line 2

Quoted 8 lines
package/gmock/Config.in new file +2 -0
new file mode 100644
index 0000000..d792945
@@ -0,0 +1,31 @@
+config BR2_PACKAGE_GMOCK
+	bool "gmock"

Here gmock must select gtest package since it's a mandatory dependency.
select BR2_PACKAGE_GTEST

Quoted 54 lines
package/gmock/Config.in new file +29 -0
+	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
package/gmock/gmock.hash new file +2 -0
new file mode 100644
index 0000000..2b71739
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
package/gmock/gmock.mk new file +11 -0
new file mode 100644
index 0000000..aad2183
@@ -0,0 +1,56 @@
+################################################################################
+#
+# 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

package/gmock/gmock.mk line 21

Quoted 10 lines
package/gmock/gmock.mk new file +10 -0
+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
+
+GMOCK_CONF_OPTS = --enable-static --disable-shared

Maybe add a comment to explain why we want only static libraries. You can use the answer you gave to Samuel.

Otherwise, your patch is almost ready.
I build it with a uClibc-ng and musl ARM toolchains.

Best regards,
Romain Naour

Quoted 48 lines
package/gmock/gmock.mk new file +35 -0
+
+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/
+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))
package/gtest/gtest.mk +1 -0
index 562acf0..da08621 100644
@@ -4,6 +4,7 @@
 #
 ################################################################################
 
+# Make sure this remains the same version as the gmock one
 GTEST_VERSION = 1.7.0
 GTEST_SOURCE = gtest-$(GTEST_VERSION).zip
 GTEST_SITE = http://googletest.googlecode.com/files
#12 lore raw

PATCH v4 1/1 gmock: new package

In reply to Carlos Santos

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.

Notice that GMock 1.7.0 requires the Python 2 host package even if Python 3 is selected as a target package.

---
 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                     | 62 ++++++++++++++++++++++++++++++
 package/gtest/gtest.mk                     |  1 +
 6 files changed, 118 insertions(+)
 create mode 100644 package/gmock/0001-force-use-python2.patch
 create mode 100644 package/gmock/Config.in
 create mode 100644 package/gmock/gmock.hash
 create mode 100644 package/gmock/gmock.mk
package/Config.in +1 -0
index 43c58ca..70593fb 100644
@@ -1053,6 +1053,7 @@ 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"
package/gmock/0001-force-use-python2.patch new file +20 -0
new file mode 100644
index 0000000..5dcb231
@@ -0,0 +1,20 @@
+Force use of Python 2 even when Python 3 is the default Python interpreter.
+
+Signed-off-by: Carlos Santos <[email protected]>
+
+--- ./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.
+ #
package/gmock/Config.in new file +32 -0
new file mode 100644
index 0000000..ec3eb92
@@ -0,0 +1,32 @@
+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
package/gmock/gmock.hash new file +2 -0
new file mode 100644
index 0000000..2b71739
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
package/gmock/gmock.mk new file +62 -0

62 lines not on this page · raw message

package/gtest/gtest.mk +1 -0
index 562acf0..da08621 100644
@@ -4,6 +4,7 @@
 #
 ################################################################################
 
+# Make sure this remains the same version as the gmock one
 GTEST_VERSION = 1.7.0
 GTEST_SOURCE = gtest-$(GTEST_VERSION).zip
 GTEST_SITE = http://googletest.googlecode.com/files
Signature · 1 line
1.8.3.1
#13 lore raw

PATCH v4 1/1 gmock: new package

Hi Carlos,

Le 31/07/2015 13:53, Carlos Santos a ?crit :

Quoted 21 lines

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.

Quoted 5 lines

Notice that GMock 1.7.0 requires the Python 2 host package even if Python 3 is selected as a target package.

Best regards,
Romain Naour

Quoted 178 lines
---
 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                     | 62 ++++++++++++++++++++++++++++++
 package/gtest/gtest.mk                     |  1 +
 6 files changed, 118 insertions(+)
 create mode 100644 package/gmock/0001-force-use-python2.patch
 create mode 100644 package/gmock/Config.in
 create mode 100644 package/gmock/gmock.hash
 create mode 100644 package/gmock/gmock.mk
package/Config.in +1 -0
index 43c58ca..70593fb 100644
@@ -1053,6 +1053,7 @@ 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"
package/gmock/0001-force-use-python2.patch new file +20 -0
new file mode 100644
index 0000000..5dcb231
@@ -0,0 +1,20 @@
+Force use of Python 2 even when Python 3 is the default Python interpreter.
+
+Signed-off-by: Carlos Santos <[email protected]>
+
+--- ./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.
+ #
package/gmock/Config.in new file +32 -0
new file mode 100644
index 0000000..ec3eb92
@@ -0,0 +1,32 @@
+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
package/gmock/gmock.hash new file +2 -0
new file mode 100644
index 0000000..2b71739
@@ -0,0 +1,2 @@
+# Locally computed
+sha256 26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b  gmock-1.7.0.zip
package/gmock/gmock.mk new file +62 -0
new file mode 100644
index 0000000..a0351d0
@@ -0,0 +1,62 @@
+################################################################################
+#
+# 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/
+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))
package/gtest/gtest.mk +1 -0
index 562acf0..da08621 100644
@@ -4,6 +4,7 @@
 #
 ################################################################################
 
+# Make sure this remains the same version as the gmock one
 GTEST_VERSION = 1.7.0
 GTEST_SOURCE = gtest-$(GTEST_VERSION).zip
 GTEST_SITE = http://googletest.googlecode.com/files
#14 lore raw

PATCH v4 1/1 gmock: new package

Hello,

Gentle reminder: this change still needs to be applied:

    http://patchwork.ozlabs.org/patch/502506/

Carlos Santos (Casantos)
DATACOM, P&D

----- Original Message -----

Quoted 39 lines

From: "Romain Naour" <[email protected]>
To: "Carlos Santos" <[email protected]>, buildroot at buildroot.org
Sent: Friday, July 31, 2015 11:06:11 AM
Subject: Re: [Buildroot] [PATCH V4 1/1] gmock: new package

Hi Carlos,

Le 31/07/2015 13:53, Carlos Santos a ?crit :

Quoted 21 lines

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.

Quoted 5 lines

Notice that GMock 1.7.0 requires the Python 2 host package even if Python 3 is selected as a target package.

Best regards,
Romain Naour

#15 lore raw

PATCH v4 1/1 gmock: new package

In reply to Carlos Santos
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

Hi,

Sorry for the slow response!

Quoted 21 lines

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.

Quoted 5 lines

Notice that GMock 1.7.0 requires the Python 2 host package even if Python 3 is selected as a target package.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard