Wiki - https://fedoraproject.org/wiki/Changes/CMake_drop_install_vars
Discussion thread -
https://discussion.fedoraproject.org/t/f42-change-proposal-cmake-drop-non-standard-variables-system-wide/148864

This is a proposed Change for Fedora Linux.
This document represents a proposed Change. As part of the Changes
process, proposals are publicly announced in order to receive
community feedback. This proposal will only be implemented if approved
by the Fedora Engineering Steering Committee.

== Summary ==

Drop variables that are not standardized by CMake in the `%cmake`
macro. The dropped options are`-DINCLUDE_INSTALL_DIR`,
`-DLIB_INSTALL_DIR`, `-DSYSCONF_INSTALL_DIR`, `-DSHARE_INSTALL_PREFIX`
and `-DLIB_SUFFIX`.  Affected projects are tracked in
[https://copr.fedorainfracloud.org/coprs/lecris/cmake-drop_vars/ this
copr repo], please check if your packages are failing there.

== Owner ==

* Name: [[User:lecris| Cristian Le]]
* Email: fed...@lecris.me


== Detailed Description ==

The variables `*_INSTALL_DIR`, `SHARE_INSTALL_PREFIX` and `LIB_SUFFIX`
have been passed by default in the `%cmake` macro, however these
variables have never been standardized by CMake, and thus the
definition and usage of these variables is up to the individual
project, e.g. it is unclear if `INCLUDE_INSTALL_DIR` is meant to be
the absolute or relative path.

Since CMake 3.0, the standardized installation path is defined in
`GNUInstallDirs` and many distributions and packaging environment have
been defining their standards in that module. Upstream projects should
be migrating to this standard instead.

=== Migration ===


{{admon/tip | Compatibility with fedora releases | Any proposed
changes here are compatible with any CMake versions and can be
included at any point and backported to any Fedora release.
<br>The corresponding
[https://src.fedoraproject.org/rpms/cmake/pull-request/50 cmake PR]
will not be merged until the affected packages are patched.
}}

* As a quick fix, the affected package can manually add the
corresponding variables, specifically:
  %cmake \
    -DINCLUDE_INSTALL_DIR:PATH=%{_includedir} \
    -DLIB_INSTALL_DIR:PATH=%{_libdir} \
    -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \
    -DSHARE_INSTALL_PREFIX:PATH=%{_datadir} \
    %if "%{?_lib}" == "lib64"
      %{?_cmake_lib_suffix64} \
    %endif
    ...
* Upstream projects can alter the defaults of these variables based on
`GNUInstallDirs` variables, e.g.
  project(...)
  include(GNUInstallDirs)
  set(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "")
* To replicate the `LIB_SUFFIX` the project could use:
  include(GNUInstallDirs)
  if(CMAKE_INSTALL_LIBDIR MATCHES "lib64$")
    set(LIB_SUFFIX 64)
  endif()

== Benefit to Fedora ==

* Avoid packaging issue due to the current assumption that the the
paths used are meant to be absolute paths.
* Encourage upstream build system modernization and standardization.

== Scope ==
* Proposal owners:
** Drop the non-standard CMake variables
** Try to propose appropriate fixes as much as possible
** Assist the more complicated migrations and be a point of contact
for upstream issue

* Other developers:
** Adjust the spec file at least with the minimum quick fix. See [[Migration]].
** Contact upstream to request/suggest the more long-term solution
described in [[Migration]]. Change owner is available if upstream
requires more specialized CMake discussions.

* Release engineering: [https://pagure.io/releng/issues #Releng issue number]

* Policies and guidelines: N/A (not needed for this Change)


== Upgrade/compatibility impact ==

Affected packages would be FTBFS (in the tracked
[https://copr.fedorainfracloud.org/coprs/lecris/cmake-drop_vars/ copr
repo]) and would require patching before the corresponding
[https://src.fedoraproject.org/rpms/cmake/pull-request/50 cmake PR]
can be merged.


== How To Test ==

A copr repo will be provided with these variables dropped. Use it to
try local builds, e.g. using:

  copr mock-config lecris/cmake-drop_vars fedora-rawhide-x86_64

If the build is successful, that should be sufficient.


== Dependencies ==
There are currently 309/2359 packages affected gathered and built
using mass-pre-build in
[https://copr.fedorainfracloud.org/coprs/lecris/cmake-drop_vars/
copr], 
[https://copr.fedorainfracloud.org/coprs/lecris/cmake-drop_vars.checker/builds/
many of them] are previously FTBFS in rawhide.



== Contingency Plan ==

* Contingency mechanism: N/A (no deadline set)
* Contingency deadline: No deadline necessary yet
* Blocks release? No


== Documentation ==
* [https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
GNUInstallDirs]
* Example migrations: [https://github.com/gnuradio/gnuradio/pull/7768
complex project]

== Release Notes ==



-- 
Aoife Moloney

Fedora Operations Architect

Fedora Project

Matrix: @amoloney:fedora.im

IRC: amoloney

-- 
_______________________________________________
devel-announce mailing list -- devel-annou...@lists.fedoraproject.org
To unsubscribe send an email to devel-announce-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel-annou...@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue
-- 
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to