diff options
Diffstat (limited to 'abs/extra/gtest')
-rw-r--r-- | abs/extra/gtest/PKGBUILD | 108 | ||||
-rw-r--r-- | abs/extra/gtest/gtest-1.8.1-libversion.patch | 29 | ||||
-rw-r--r-- | abs/extra/gtest/gtest-1.8.1-null-pointer.patch | 17 |
3 files changed, 154 insertions, 0 deletions
diff --git a/abs/extra/gtest/PKGBUILD b/abs/extra/gtest/PKGBUILD new file mode 100644 index 0000000..55c84b8 --- /dev/null +++ b/abs/extra/gtest/PKGBUILD @@ -0,0 +1,108 @@ +# Maintainer: Felix Yan <felixonmars@archlinux.org> +# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org> +# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> +# Contributor: Alexandre Bique <bique.alexandre@gmail.com> +# Contributor: Louis R. Marascio <lrm@fitnr.com> +# Contributor: Cody Maloney <cmaloney@theoreticalchaos.com> + +pkgbase=gtest +pkgname=('gtest' 'gmock') +pkgver=1.8.1 +pkgrel=3 +pkgdesc='Google Test - C++ testing utility' +url='https://github.com/google/googletest' +arch=('x86_64') +license=('BSD') +makedepends=('python2' '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 + + find . -name '*.py' -exec sed -i '1s|python$|&2|g' {} + + + # 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() { + cmake -H${_srcname} -Bbuild \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib \ + -DBUILD_SHARED_LIBS=ON \ + -DPython_ADDITIONAL_VERSIONS=2.7 \ + -Dgtest_build_tests=ON + cmake --build build + + # Only for g{test,mock}-config + cd ${_srcname}/googletest + autoreconf -fvi + ./configure --prefix=/usr + cd ../googlemock + autoreconf -fvi + ./configure --prefix=/usr +} + +check() { + cmake --build build --target test +} + +package_gtest() { + pkgdesc='Google Test - C++ testing utility based on the xUnit framework (like JUnit)' + depends=('gcc-libs' 'sh') + + 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() { + pkgdesc='Google Mock - A library for writing and using C++ mock classes' + depends=('python2' 'gtest' 'gcc-libs' 'sh') + + 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" + + python2 -m compileall -d /usr/share/gmock "${pkgdir}/usr/share/gmock" + python2 -O -m compileall -d /usr/share/gmock "${pkgdir}/usr/share/gmock" +} + +# vim: ts=2 sw=2 et: diff --git a/abs/extra/gtest/gtest-1.8.1-libversion.patch b/abs/extra/gtest/gtest-1.8.1-libversion.patch new file mode 100644 index 0000000..a9c2c5f --- /dev/null +++ b/abs/extra/gtest/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/abs/extra/gtest/gtest-1.8.1-null-pointer.patch b/abs/extra/gtest/gtest-1.8.1-null-pointer.patch new file mode 100644 index 0000000..d062bac --- /dev/null +++ b/abs/extra/gtest/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); + |