Bug 103211 - cmake: don't hardcode libdir
Summary: cmake: don't hardcode libdir
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-11 08:56 UTC by Emilio Pozuelo Monfort
Modified: 2017-11-05 21:45 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
cmake: support GNUInstallDirs (14.97 KB, patch)
2017-10-17 20:53 UTC, Emilio Pozuelo Monfort
Details | Splinter Review

Description Emilio Pozuelo Monfort 2017-10-11 08:56:22 UTC
Hi,

Looking at poppler 0.60.1, I saw that it removes the autotools build system, and it looks like the cmake build system hardcodes libdir to ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}

Unfortunately that's not good in all situations. E.g. in Debian we have multiarch directories, so libraries go in /usr/lib/<triplet>/. I could do that with autotools by setting --libdir (which our tooling does automatically) but I can't do it anymore in the cmake build system.

I hear there's a GNUInstallDirs cmake thing that sets some stuff, e.g. CMAKE_INSTALL_LIBDIR. Would it be possible to use that so that the libdir can be controlled?

https://cmake.org/cmake/help/v3.3/module/GNUInstallDirs.html
Comment 1 Emilio Pozuelo Monfort 2017-10-17 20:53:59 UTC
Created attachment 134892 [details] [review]
cmake: support GNUInstallDirs
Comment 2 Albert Astals Cid 2017-10-20 15:01:48 UTC
That patch seems ok to me, does it solve your issues?
Comment 3 Emilio Pozuelo Monfort 2017-10-20 15:07:13 UTC
It does. With it I can build with -DCMAKE_INSTALL_LIBDIR="path/to/lib/dir" and things go to the appropriate place.
Comment 4 Albert Astals Cid 2017-10-30 23:21:36 UTC
Pushed
Comment 5 ilovezfs 2017-11-05 18:24:04 UTC
Unfortunately this has the side-effect of breaking the pkg-config files for everyone else who isn't explicitly setting CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR. The reason is that rather than ending up with

libdir=${exec_prefix}/lib
includedir=${prefix}/include

instead, by default, you get

libdir=lib
includedir=include

I expect 0.61.0 will be a bit of a mess from a downstream packaging perspective as a result.

In Homebrew, while working on the 0.61.0 upgrade pull request, I just had to puzzle around over why none of the reverse dependencies would build until I found that the pkg-config files were broken and traced it back here. Multiply that by every other downstream and you get the picture.
Comment 6 Albert Astals Cid 2017-11-05 21:45:44 UTC
bug 103578


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.