summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authoracxz2019-12-10 17:49:55 -0500
committeracxz2019-12-10 17:49:55 -0500
commitcdb46bdd99a08cf442fc8983f34b25a4857e5fb0 (patch)
tree65f2c025e40abaa6a61230471a3895bdb43bd8c4
downloadaur-cdb46bdd99a08cf442fc8983f34b25a4857e5fb0.tar.gz
Create py3 compiled version of gtest/gmock
-rw-r--r--.SRCINFO34
-rw-r--r--PKGBUILD101
-rw-r--r--gtest-1.8.1-libversion.patch29
-rw-r--r--gtest-1.8.1-null-pointer.patch17
4 files changed, 181 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..59f53845e4da
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,34 @@
+pkgbase = gtest-py3
+ pkgdesc = Google Test - C++ testing utility
+ pkgver = 1.8.1
+ pkgrel = 1
+ url = https://github.com/google/googletest
+ arch = x86_64
+ license = BSD
+ makedepends = python
+ makedepends = cmake
+ makedepends = gcc-libs
+ makedepends = sh
+ source = googletest-release-1.8.1.tar.gz::https://github.com/google/googletest/archive/release-1.8.1.tar.gz
+ source = gtest-1.8.1-libversion.patch
+ source = gtest-1.8.1-null-pointer.patch
+ sha512sums = e6283c667558e1fd6e49fa96e52af0e415a3c8037afe1d28b7ff1ec4c2ef8f49beb70a9327b7fc77eb4052a58c4ccad8b5260ec90e4bceeac7a46ff59c4369d7
+ sha512sums = e9bd9d65f6e54f71be0026b84c6543a71f9e3d5c0da92eb7f01df3f5937871eff2b8177e3680fec8d733888327eda5f5f3caaf88a3263ada542cdd2b42475ac5
+ sha512sums = afa75f975d8aed453c901245dae753939958d8b72e3e5c52995efe7980f44de4fd1ea08f1b0a4cc927443d858de0a1fe34a919512ce05ae443bfb9600b08f029
+
+pkgname = gtest-py3
+ pkgdesc = Google Test - C++ testing utility based on the xUnit framework (like JUnit)
+ depends = gcc-libs
+ depends = sh
+ provides = gtest
+ conflicts = gtest
+
+pkgname = gmock-py3
+ pkgdesc = Google Mock - A library for writing and using C++ mock classes
+ depends = python
+ depends = gtest
+ depends = gcc-libs
+ depends = sh
+ provides = gmock
+ conflicts = gmock
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..0d2726128cfc
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,101 @@
+# Maintainer: acxz <akashpatel2008 at yahoo dot com>
+
+pkgbase=gtest-py3
+pkgname=('gtest-py3' 'gmock-py3')
+pkgver=1.8.1
+pkgrel=1
+pkgdesc='Google Test - C++ testing utility'
+url='https://github.com/google/googletest'
+arch=('x86_64')
+license=('BSD')
+makedepends=('python' 'cmake' 'gcc-libs' 'sh')
+_srcname=googletest-release-${pkgver}
+source=(${_srcname}.tar.gz::https://github.com/google/googletest/archive/release-${pkgver}.tar.gz
+ gtest-1.8.1-libversion.patch
+ gtest-1.8.1-null-pointer.patch)
+sha512sums=('e6283c667558e1fd6e49fa96e52af0e415a3c8037afe1d28b7ff1ec4c2ef8f49beb70a9327b7fc77eb4052a58c4ccad8b5260ec90e4bceeac7a46ff59c4369d7'
+ 'e9bd9d65f6e54f71be0026b84c6543a71f9e3d5c0da92eb7f01df3f5937871eff2b8177e3680fec8d733888327eda5f5f3caaf88a3263ada542cdd2b42475ac5'
+ 'afa75f975d8aed453c901245dae753939958d8b72e3e5c52995efe7980f44de4fd1ea08f1b0a4cc927443d858de0a1fe34a919512ce05ae443bfb9600b08f029')
+
+prepare() {
+ cd ${_srcname}
+ cp ../gtest-1.8.1-libversion.patch gtest-1.8.1-libversion.patch
+ sed "s|__GOOGLETEST_VERSION__|${pkgver}|g" -i gtest-1.8.1-libversion.patch
+ # https://src.fedoraproject.org/rpms/gtest/tree/master
+ patch -Np1 -i gtest-1.8.1-libversion.patch
+ patch -Np1 -i ../gtest-1.8.1-null-pointer.patch
+
+ # fixup version as they are never correct
+ sed -E "s|(GOOGLETEST_VERSION) [0-9\\.]+|\\1 ${pkgver}|" -i CMakeLists.txt
+ sed -E "s|^( +)\\[[0-9\\.]+\\],$|\\1[${pkgver}],|" -i {googletest,googlemock,.}/configure.ac
+ sed -E "s|(GTEST_MIN_VERSION)=\"1.8.0\"|\\1=\"${pkgver}\"|" -i googlemock/configure.ac
+}
+
+build() {
+ mkdir -p build
+ mkdir -p cmake
+ cmake -H${_srcname} -Bbuild \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DBUILD_SHARED_LIBS=ON \
+ cmake build
+
+ # Only for g{test,mock}-config
+ cd ${_srcname}/googletest
+ autoreconf -fvi
+ ./configure --prefix=/usr
+ cd ../googlemock
+ autoreconf -fvi
+ ./configure --prefix=/usr
+}
+
+package_gtest-py3() {
+ pkgdesc='Google Test - C++ testing utility based on the xUnit framework (like JUnit)'
+ depends=('gcc-libs' 'sh')
+ provides=('gtest')
+ conflicts=('gtest')
+
+ DESTDIR="${pkgdir}" cmake --build build --target install
+
+ # Shouldn't be present
+ find "${pkgdir}" -name '*.pump' -printf 'Removing %P\n' -delete
+
+ # Split gmock
+ mkdir -p gmock/{include,lib/pkgconfig}
+ mv "${pkgdir}"/usr/include/gmock gmock/include/
+ mv "${pkgdir}"/usr/lib/libgmock* gmock/lib/
+ mv "${pkgdir}"/usr/lib/pkgconfig/gmock* gmock/lib/pkgconfig/
+
+ cd ${_srcname}/googletest
+ install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -Dm 644 README.md CHANGES CONTRIBUTORS -t "${pkgdir}/usr/share/doc/${pkgname}"
+ install -Dm 755 scripts/gtest-config -t "${pkgdir}/usr/bin"
+ install -Dm 644 m4/gtest.m4 -t "${pkgdir}/usr/share/aclocal"
+ install -Dm 644 cmake/* -t "${pkgdir}/usr/src/gtest/cmake"
+ install -Dm 644 src/* -t "${pkgdir}/usr/src/gtest/src"
+ install -Dm 644 CMakeLists.txt -t "${pkgdir}/usr/src/gtest"
+}
+
+package_gmock-py3() {
+ pkgdesc='Google Mock - A library for writing and using C++ mock classes'
+ depends=('python' 'gtest' 'gcc-libs' 'sh')
+ provides=('gmock')
+ conflicts=('gmock')
+
+ mv gmock "${pkgdir}/usr"
+
+ cd ${_srcname}/googlemock
+ install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
+ install -Dm 644 README.md CHANGES CONTRIBUTORS -t "${pkgdir}/usr/share/doc/${pkgname}"
+ install -Dm 755 scripts/gmock-config -t "${pkgdir}/usr/bin"
+ install -Dm 644 src/* -t "${pkgdir}/usr/src/gmock"
+ install -Dm 644 scripts/generator/{*.py,LICENSE,README*} -t "${pkgdir}/usr/share/gmock/generator"
+ install -Dm 644 scripts/generator/cpp/* -t "${pkgdir}/usr/share/gmock/generator/cpp"
+
+ sed -i 's|src/||' "${pkgdir}/usr/src/gmock/gmock-all.cc"
+
+ python -m compileall -d /usr/share/gmock "${pkgdir}/usr/share/gmock"
+ python -O -m compileall -d /usr/share/gmock "${pkgdir}/usr/share/gmock"
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/gtest-1.8.1-libversion.patch b/gtest-1.8.1-libversion.patch
new file mode 100644
index 000000000000..a9c2c5f68492
--- /dev/null
+++ b/gtest-1.8.1-libversion.patch
@@ -0,0 +1,29 @@
+diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt
+index 8a8de1f..3d86a59 100644
+--- a/googlemock/CMakeLists.txt
++++ b/googlemock/CMakeLists.txt
+@@ -109,8 +109,10 @@ if (MSVC)
+ else()
+ cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
+ target_link_libraries(gmock PUBLIC gtest)
++ set_target_properties(gmock PROPERTIES VERSION __GOOGLETEST_VERSION__)
+ cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
+ target_link_libraries(gmock_main PUBLIC gmock)
++ set_target_properties(gmock_main PROPERTIES VERSION __GOOGLETEST_VERSION__)
+ endif()
+ # If the CMake version supports it, attach header directory information
+ # to the targets for when we are part of a parent build (ie being pulled
+diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt
+index 9ee7940..8099130 100644
+--- a/googletest/CMakeLists.txt
++++ b/googletest/CMakeLists.txt
+@@ -131,7 +131,9 @@ endif()
+ # are used for other targets, to ensure that gtest can be compiled by a user
+ # aggressive about warnings.
+ cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
++set_target_properties(gtest PROPERTIES VERSION __GOOGLETEST_VERSION__)
+ cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
++set_target_properties(gtest_main PROPERTIES VERSION __GOOGLETEST_VERSION__)
+ # If the CMake version supports it, attach header directory information
+ # to the targets for when we are part of a parent build (ie being pulled
+ # in via add_subdirectory() rather than being a standalone build).
diff --git a/gtest-1.8.1-null-pointer.patch b/gtest-1.8.1-null-pointer.patch
new file mode 100644
index 000000000000..d062baca40c8
--- /dev/null
+++ b/gtest-1.8.1-null-pointer.patch
@@ -0,0 +1,17 @@
+diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
+index 96b07c6..4af3e5a 100644
+--- a/googletest/src/gtest.cc
++++ b/googletest/src/gtest.cc
+@@ -2693,10 +2693,12 @@ void TestInfo::Run() {
+ test->Run();
+ }
+
++ if (test != NULL) {
+ // Deletes the test object.
+ impl->os_stack_trace_getter()->UponLeavingGTest();
+ internal::HandleExceptionsInMethodIfSupported(
+ test, &Test::DeleteSelf_, "the test fixture's destructor");
++ }
+
+ result_.set_elapsed_time(internal::GetTimeInMillis() - start);
+