Bug 239654 - devel/googletest and devel/googlemock: Change build to use CMake
Summary: devel/googletest and devel/googlemock: Change build to use CMake
Status: Closed Not Accepted
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-05 11:31 UTC by Ben Woods
Modified: 2019-08-12 10:52 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (jbeich)


Attachments
Patch to change devel/googletest and devel/googlemock to use CMake (10.02 KB, patch)
2019-08-05 11:31 UTC, Ben Woods
jbeich: maintainer-approval-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Woods freebsd_committer 2019-08-05 11:31:22 UTC
Created attachment 206291 [details]
Patch to change devel/googletest and devel/googlemock to use CMake

devel/googletest and devel/googlemock: Change build to use CMake

The latest (master) version of Google Test has now fully moved to using CMake for the configure process, with all support from GNU configure removed. The latest RELEASED version (1.8.1) has introduced support for CMake, but still had GNU configure support also.

Interestingly, this change has the following impact on installed files:
1. The pkg-config files are installed with CMake
2. The bin/gtest-config and bin/gmock-config files cannot be installed, as the shell script is not compiled from the "*.in" files in googletest/scripts/gtest-config.in and googlemock/scripts/gmock-config.in
Comment 1 Jan Beich freebsd_committer 2019-08-11 09:15:52 UTC
Comment on attachment 206291 [details]
Patch to change devel/googletest and devel/googlemock to use CMake

Previous try was in review D19430.

> Index: devel/googlemock/Makefile
[...]
> -USES=		autoreconf compiler:c++11-lang libtool localbase python:run shebangfix
> +USES=		cmake compiler:c++11-lang libtool localbase python:run shebangfix

Is USES=localbase still required? If so add :ldflags as CMake rarely supports LIBS variable.

>  TEST_TARGET=	check

Does "make test" still work? If not adjust and make sure tests are built (e.g., via an option).

> +STRIP=		yes

Already defined, see /usr/share/mk/bsd.own.mk. Ditto in googletest.

> +CMAKE_ARGS=	-DBUILD_SHARED_LIBS:BOOL=ON \
> +		-DBUILD_GMOCK:BOOL=ON

Convert to CMAKE_ON/CMAKE_OFF. Ditto in googletest.
 
> +	find "${STAGEDIR}" -name '*.pump' -print0 | xargs -0 rm -v

Why not ${FIND} ${STAGEDIR} -name '*.pump' -delete ? Needs to be reported upstream. Ditto in googletest.

> +	${RM} -r ${STAGEDIR}${PREFIX}/include/gtest \
> +		${STAGEDIR}${PREFIX}/lib/cmake \
> +		${STAGEDIR}${PREFIX}/lib/libgtest* \
> +		${STAGEDIR}${PREFIX}/libdata/pkgconfig/gtest*

Why not drop "add_subdirectory( googletest )" in CMakeLists.txt or at least mark as EXCLUDE_FROM_ALL?
 
> -lib/libgmock.a
>  lib/libgmock.so
> -lib/libgmock.so.0
> -lib/libgmock.so.0.0.0
> -lib/libgmock_main.a
>  lib/libgmock_main.so
> -lib/libgmock_main.so.0
> -lib/libgmock_main.so.0.0.0

- SONAME has changed, so all consumers need PORTREVISION bump
- Static library is gone, so consumers need to be tested
- Ditto in googletest

> Index: devel/googletest/Makefile
[...]
> +	${INSTALL_DATA} ${WRKSRC}/googletest/m4/gtest.m4 ${STAGEDIR}${PREFIX}/share/aclocal
 
If unused by consumers just drop the file.

> -bin/gtest-config

OK but you have to fix consumers. There're 3 types: used by default, used if an option is set and used only via "make test".

> +include/gtest/internal/custom/README.md

README.md isn't part of API. Needs to be reported upstream.

> +lib/cmake/GTest/GTestConfig.cmake
> +lib/cmake/GTest/GTestConfigVersion.cmake
> +lib/cmake/GTest/GTestTargets-%%CMAKE_BUILD_TYPE%%.cmake
> +lib/cmake/GTest/GTestTargets.cmake

Why googlemock doesn't install CMake configs?
Comment 2 Jan Beich freebsd_committer 2019-08-11 09:54:46 UTC
autotools is gone[1], so cmake switch have to be done during the next update[2]. Hopefully, some cmake bugs were fixed.

[1] http://github.com/google/googletest/commit/d7003576dd13
[2] maybe master snapshot given how upstream looks at stable releases
    https://github.com/google/googletest/issues/2267
Comment 3 Ben Woods freebsd_committer 2019-08-12 10:52:25 UTC
Will wait until next update to change