[libc-commits] [PATCH] D99484: Use `GNUInstallDirs` to support custom installation dirs.
John Ericson via Phabricator via libc-commits
libc-commits at lists.llvm.org
Sun Mar 28 21:54:56 PDT 2021
Ericson2314 created this revision.
Herald added subscribers: libc-commits, libcxx-commits, dcaballe, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, kerbowa, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, csigg, antiagainst, shauheen, rriddle, mehdi_amini, arphaman, steven_wu, hiraditya, mgorny, nhaehnle, jvesely.
Herald added a reviewer: bollu.
Herald added a reviewer: ldionne.
Herald added a reviewer: sscalpone.
Herald added a reviewer: awarzynski.
Herald added projects: libunwind, libc-project.
Herald added a reviewer: libunwind.
Ericson2314 requested review of this revision.
Herald added subscribers: llvm-commits, openmp-commits, lldb-commits, Sanitizers, cfe-commits, stephenneuendorffer, nicolasvasilache.
Herald added projects: clang, Sanitizers, LLDB, libc++, OpenMP, libc++abi, MLIR, LLVM, clang-tools-extra.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.
This is a new draft of D28234 <https://reviews.llvm.org/D28234>. I previously did the unorthodox thing of
pushing to it when I wasn't the original author, but since this version
- Uses `GNUInstallDirs`, rather than mimics it, as the original author was hesitant to do but others requested.
- Is much broader, effecting many more projects than LLVM itself.
I figured it was time to make a new revision.
I am using this patch (and many back-ports) as the basis of
https://github.com/NixOS/nixpkgs/pull/111487 for my distro (NixOS). It
looked like people were generally on board in D28234 <https://reviews.llvm.org/D28234>, but I make note of
this here in case extra motivation is useful.
---
As pointed out in the original issue, a central tension is that LLVM
already has some partial support for these sorts of things. Sometimes
GNUInstallDirs alone is more expressive, but sometimes the existing
stuff is, e.g. with the "utils" vs "tools" distinction or perhaps when
everything is being built together.
Another related tension was that the GNUInstallDirs variables may be
relative `CMAKE_INSTALL_PREFIX` *or* absolute paths that need not lead
within that directory. We in fact do the common case in Nixpkgs (and in
my PR), where the package and "-dev" package data (analogizing from
conventional distros) are installed in separate prefixes. Supporting
this fall range of the GNU variables means this patch can't always be a
simple "find and replace" of `bin/`, `lib/`, `include/`, etc., as we
sometimes need to get clever where a leading `CMAKE_INSTALL_PREFIX` was
previously mandatory.
I am not a frequent LLVM contributor, so I didn't want to broach the
topic of removing functionality / breaking changes, so I instead
implemented GNUInstallDirs along side the existing stuff. Existing
custom install dirs are derived from the GNUInstallDirs ones by default,
but may be separately sepcified. Existing prefixes come before
`CMAKE_CONFIGURE_PREFIX`. In a few cases that was a small breaking
change when the default per-project prefix was itself
`CMAKE_CONFIGURE_PREFIX` rather than the empty string, but the majority
aready had the empty string default.
I do think it would be wise for others to remove some of the old install
dir mechanisms, as the LLVM CMake is already quite complex, but I would
strongly prefer to leave that to others who are more familiar with the
project and its main users' needs re compat vs features of the build
system.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99484
Files:
clang-tools-extra/clang-doc/tool/CMakeLists.txt
clang-tools-extra/clang-include-fixer/find-all-symbols/tool/CMakeLists.txt
clang-tools-extra/clang-include-fixer/tool/CMakeLists.txt
clang-tools-extra/clang-tidy/CMakeLists.txt
clang-tools-extra/clang-tidy/tool/CMakeLists.txt
clang-tools-extra/modularize/CMakeLists.txt
clang/CMakeLists.txt
clang/cmake/modules/AddClang.cmake
clang/lib/Headers/CMakeLists.txt
clang/tools/c-index-test/CMakeLists.txt
clang/tools/clang-format/CMakeLists.txt
clang/tools/clang-rename/CMakeLists.txt
clang/tools/libclang/CMakeLists.txt
clang/tools/scan-build/CMakeLists.txt
clang/tools/scan-view/CMakeLists.txt
clang/utils/hmaptool/CMakeLists.txt
compiler-rt/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
compiler-rt/cmake/Modules/CompilerRTUtils.cmake
compiler-rt/cmake/base-config-ix.cmake
compiler-rt/include/CMakeLists.txt
compiler-rt/lib/dfsan/CMakeLists.txt
flang/CMakeLists.txt
flang/cmake/modules/AddFlang.cmake
flang/tools/f18/CMakeLists.txt
flang/tools/flang-driver/CMakeLists.txt
libc/CMakeLists.txt
libc/lib/CMakeLists.txt
libcxx/CMakeLists.txt
libcxx/cmake/Modules/HandleLibCXXABI.cmake
libcxx/include/CMakeLists.txt
libcxx/src/CMakeLists.txt
libcxxabi/CMakeLists.txt
libunwind/CMakeLists.txt
libunwind/src/CMakeLists.txt
lld/CMakeLists.txt
lld/cmake/modules/AddLLD.cmake
lld/tools/lld/CMakeLists.txt
lldb/CMakeLists.txt
lldb/cmake/modules/AddLLDB.cmake
lldb/cmake/modules/LLDBConfig.cmake
lldb/tools/intel-features/CMakeLists.txt
llvm/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
llvm/cmake/modules/AddOCaml.cmake
llvm/cmake/modules/AddSphinxTarget.cmake
llvm/cmake/modules/CMakeLists.txt
llvm/cmake/modules/LLVMInstallSymlink.cmake
llvm/docs/CMake.rst
llvm/examples/Bye/CMakeLists.txt
llvm/include/llvm/CMakeLists.txt
llvm/tools/llvm-config/BuildVariables.inc.in
llvm/tools/llvm-config/llvm-config.cpp
llvm/tools/lto/CMakeLists.txt
llvm/tools/opt-viewer/CMakeLists.txt
llvm/tools/remarks-shlib/CMakeLists.txt
mlir/CMakeLists.txt
mlir/cmake/modules/AddMLIR.cmake
openmp/CMakeLists.txt
openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
openmp/libomptarget/plugins/ve/CMakeLists.txt
openmp/runtime/src/CMakeLists.txt
openmp/tools/multiplex/CMakeLists.txt
polly/CMakeLists.txt
polly/cmake/CMakeLists.txt
polly/cmake/polly_macros.cmake
polly/lib/External/CMakeLists.txt
pstl/CMakeLists.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99484.333765.patch
Type: text/x-patch
Size: 61044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210329/79434b7e/attachment-0001.bin>
More information about the libc-commits
mailing list