cmake: use lib.cmake* functions

Also, a bit of cosmetic rewriting.
This commit is contained in:
Anderson Torres 2023-10-16 11:08:11 -03:00
parent 0f4bc8579f
commit 9f4436aa8c

View File

@ -4,8 +4,10 @@
, buildPackages , buildPackages
, bzip2 , bzip2
, curlMinimal , curlMinimal
, darwin
, expat , expat
, libarchive , libarchive
, libsForQt5
, libuv , libuv
, ncurses , ncurses
, openssl , openssl
@ -16,13 +18,11 @@
, texinfo , texinfo
, xz , xz
, zlib , zlib
, buildDocs ? !(isBootstrap || (uiToolkits == []))
, isBootstrap ? false , isBootstrap ? false
, uiToolkits ? [] # can contain "ncurses" and/or "qt5"
, useOpenSSL ? !isBootstrap , useOpenSSL ? !isBootstrap
, useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin) , useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin)
, uiToolkits ? [] # can contain "ncurses" and/or "qt5"
, buildDocs ? !(isBootstrap || (uiToolkits == []))
, darwin
, libsForQt5
}: }:
let let
@ -129,15 +129,17 @@ stdenv.mkDerivation (finalAttrs: {
# Unfortunately cmake seems to expect absolute paths for ar, ranlib, and # Unfortunately cmake seems to expect absolute paths for ar, ranlib, and
# strip. Otherwise they are taken to be relative to the source root of the # strip. Otherwise they are taken to be relative to the source root of the
# package being built. # package being built.
"-DCMAKE_CXX_COMPILER=${stdenv.cc.targetPrefix}c++" (lib.cmakeFeature "CMAKE_CXX_COMPILER" "${stdenv.cc.targetPrefix}c++")
"-DCMAKE_C_COMPILER=${stdenv.cc.targetPrefix}cc" (lib.cmakeFeature "CMAKE_C_COMPILER" "${stdenv.cc.targetPrefix}cc")
"-DCMAKE_AR=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar" (lib.cmakeFeature "CMAKE_AR"
"-DCMAKE_RANLIB=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib" "${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar")
"-DCMAKE_STRIP=${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip" (lib.cmakeFeature "CMAKE_RANLIB"
"${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib")
(lib.cmakeFeature "CMAKE_STRIP"
"${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip")
"-DCMAKE_USE_OPENSSL=${if useOpenSSL then "ON" else "OFF"}" (lib.cmakeBool "CMAKE_USE_OPENSSL" useOpenSSL)
# Avoid depending on frameworks. (lib.cmakeBool "BUILD_CursesDialog" cursesUI)
"-DBUILD_CursesDialog=${if cursesUI then "ON" else "OFF"}"
]; ];
# make install attempts to use the just-built cmake # make install attempts to use the just-built cmake