FS#67739 - [re2] Build with cmake so that it provides re2Config.cmake for other cmake-based projects
Attached to Project:
Arch Linux
Opened by Massimiliano Torromeo (mtorromeo) - Friday, 28 August 2020, 08:45 GMT
Last edited by Evangelos Foutras (foutrelis) - Thursday, 10 September 2020, 18:56 GMT
Opened by Massimiliano Torromeo (mtorromeo) - Friday, 28 August 2020, 08:45 GMT
Last edited by Evangelos Foutras (foutrelis) - Thursday, 10 September 2020, 18:56 GMT
|
Details
re2 only provides /usr/lib/pkgconfig/re2.pc but while
upgrading the grpc package to the latest 1.31.1 release I
had to add the "-DgRPC_RE2_PROVIDER=package" flag to make
and the build then fails while looking for
re2Config.cmake.
re2 can already be compiled with cmake which ends up generating the re2Config.cmake file that grpc needs. Sadly this ends up not automatically installing the re2.pc file anymore but it's something that is easily fixable since a template is in the source directory and it can be compiled with a simple sed like: sed 's#@includedir@#/usr/include#;s#@libdir@#/usr/lib#' re2.pc The inverse task of manually generating a re2Config.cmake while still building with make is not feasible IMO. Another thing that needs a fix is the versioning of the so libraries. By default only re2.so is installed. The SOVERSION is only specified in the original Makefile. I used a simple grep to extract the version and then append the required line in CMakeLists.txt. The final PKGBUILD should be this https://gist.github.com/mtorromeo/1d48de16534dc8ee29cd872f94b070e5 Also a warning on the tests. I noticed that with cmake it seems like there are additional "extensive" tests being run that take a lot of time. They all pass just fine though. |
This task depends upon
Closed by Evangelos Foutras (foutrelis)
Thursday, 10 September 2020, 18:56 GMT
Reason for closing: Won't implement
Additional comments about closing: re2 upstream contributed cmake detection code to grpc that works with ./configure-built re2. 🎉
Thursday, 10 September 2020, 18:56 GMT
Reason for closing: Won't implement
Additional comments about closing: re2 upstream contributed cmake detection code to grpc that works with ./configure-built re2. 🎉
find_package(PkgConfig)
pkg_check_modules(RE2 re2 IMPORTED GLOBAL)
target_link_libraries then uses the PkgConfig::RE2 target.
Would it make MORE sense? I don't think so.
I mean, the fact that re2 provides a pkgconfig file if you build it one way and re2Config.cmake if you build it with cmake does not seem right to me.
Basically typical cmake garbage...
(If upstream properly supported cmake, then I guess there wouldn't be much harm in using it. But they don't, which seems like a dealbreaker to me.)
Switching grpc to use cmake was even more of a mess but there were literally parts of the stacks that were not buildable without cmake, which almost suggest that they support more cmake in this case.
The grpc package is already a very complex software to build that I actually managed to clean-up to a reasonable state and I would just strongly prefer not having to patch anything else there.
I realize that this would mean patching this instead but I am not suggesting this to just push the burden on someone else.
If I were the maintainer of both packages I would find it way easier to maintain a patch of re2 rather than in grpc, and, like I said, it also seems the "right" thing to patch to me.
@foutrelis let me know what you want to do here and if I should just patch grpc. I appreciate it either way!
(Aside: meson actually supports generating cmake config files in addition to pkg-config ones.)