treewide: avoid string-concatenating cmakeFlags (#336178)

This commit is contained in:
Johannes Jöns 2024-09-01 12:35:24 +00:00 committed by GitHub
commit ef20533edd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 53 additions and 53 deletions

View File

@ -33,9 +33,9 @@ stdenv.mkDerivation rec {
--replace "CXX_STANDARD 14" "CXX_STANDARD 17"
'';
preConfigure = ''
cmakeFlags="$cmakeFlags -DMSK_PREFIX=$out"
'';
cmakeFlags = [
"-DMSK_PREFIX=${placeholder "out"}"
];
postFixup = ''
ln -s $out/lib/molsketch/* $out/lib/.

View File

@ -88,12 +88,10 @@ stdenv.mkDerivation (finalAttrs: {
substituteInPlace src/meshlab/src/external/ssynth.cmake \
--replace-fail '$'{SSYNTH_LINK} ${structuresynth.src} \
--replace-warn "MD5 ''${SSYNTH_MD5}" ""
export cmakeFlags="cmakeFlags
-DCMAKE_INSTALL_PREFIX=$out/${python3Packages.python.sitePackages}/pymeshlab
"
'';
cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/${python3Packages.python.sitePackages}/pymeshlab"
"-DVCGDIR=${vcg.src}"
];

View File

@ -18,11 +18,9 @@ stdenv.mkDerivation rec {
"-DYARP_COMPILE_UNMAINTAINED:BOOL=ON"
"-DCREATE_YARPC:BOOL=ON"
"-DCREATE_YARPCXX:BOOL=ON"
"-DCMAKE_INSTALL_LIBDIR=${placeholder "out"}/lib"
];
# since we cant expand $out in cmakeFlags
preConfigure = ''cmakeFlags="$cmakeFlags -DCMAKE_INSTALL_LIBDIR=$out/lib"'';
postInstall = "mv ./$out/lib/*.so $out/lib/";
meta = {

View File

@ -1,5 +1,5 @@
addAwsCCommonModuleDir() {
cmakeFlags="-DCMAKE_MODULE_PATH=@out@/lib/cmake ${cmakeFlags:-}"
prependToVar cmakeFlags "-DCMAKE_MODULE_PATH=@out@/lib/cmake"
}
postHooks+=(addAwsCCommonModuleDir)

View File

@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
];
preConfigure = ''
cmakeFlags="$cmakeFlags -DPACKAGE_ARCHITECTURE=$(uname -m)";
appendToVar cmakeFlags "-DPACKAGE_ARCHITECTURE=$(uname -m)"
'';
configureFlags = [ "--disable-more-warnings" ];

View File

@ -1,17 +1,18 @@
{ lib
, stdenv
, fetchFromGitHub
, boost
, cmake
, fftw
, fftwSinglePrec
, hdf5
, ilmbase
, libjpeg
, libpng
, libtiff
, openexr
, python3
{
lib,
stdenv,
fetchFromGitHub,
boost,
cmake,
fftw,
fftwSinglePrec,
hdf5,
ilmbase,
libjpeg,
libpng,
libtiff,
openexr,
python3,
}:
let
@ -44,11 +45,15 @@ stdenv.mkDerivation rec {
python
];
preConfigure = "cmakeFlags+=\" -DVIGRANUMPY_INSTALL_DIR=$out/${python.sitePackages}\"";
cmakeFlags = [ "-DWITH_OPENEXR=1" ]
++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux")
[ "-DCMAKE_CXX_FLAGS=-fPIC" "-DCMAKE_C_FLAGS=-fPIC" ];
cmakeFlags =
[
"-DWITH_OPENEXR=1"
"-DVIGRANUMPY_INSTALL_DIR=${placeholder "out"}/${python.sitePackages}"
]
++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
"-DCMAKE_CXX_FLAGS=-fPIC"
"-DCMAKE_C_FLAGS=-fPIC"
];
meta = with lib; {
description = "Novel computer vision C++ library with customizable algorithms and data structures";

View File

@ -49,13 +49,9 @@ buildPythonPackage rec {
"-DBUILD_HPMC=${onOffBool components.hpmc}"
"-DBUILD_MD=${onOffBool components.md}"
"-DBUILD_METAL=${onOffBool components.metal}"
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/${python.sitePackages}"
];
preConfigure = ''
# Since we can't expand $out in `cmakeFlags`
cmakeFlags="$cmakeFlags -DCMAKE_INSTALL_PREFIX=$out/${python.sitePackages}"
'';
# tests fail but have tested that package runs properly
doCheck = false;
checkTarget = "test";

View File

@ -100,10 +100,10 @@ buildPythonPackage rec {
preConfigure = ''
# Since we can't expand with bash in cmakeFlags
cmakeFlags="$cmakeFlags -DPYTHON_NUMPY_INCLUDE_PATH=$(${python}/bin/python -c 'import numpy; print(numpy.get_include())')"
cmakeFlags="$cmakeFlags -DFREESASA_DIR=$PWD/External/FreeSASA/freesasa"
cmakeFlags="$cmakeFlags -DFREESASA_SRC_DIR=$PWD/External/FreeSASA/freesasa"
cmakeFlags="$cmakeFlags -DAVALONTOOLS_DIR=$PWD/External/AvalonTools/avalon"
appendToVar cmakeFlags "-DPYTHON_NUMPY_INCLUDE_PATH=$(${python}/bin/python -c 'import numpy; print(numpy.get_include())')"
appendToVar cmakeFlags "-DFREESASA_DIR=$PWD/External/FreeSASA/freesasa"
appendToVar cmakeFlags "-DFREESASA_SRC_DIR=$PWD/External/FreeSASA/freesasa"
appendToVar cmakeFlags "-DAVALONTOOLS_DIR=$PWD/External/AvalonTools/avalon"
'';
cmakeFlags = [

View File

@ -28,10 +28,14 @@ stdenv.mkDerivation rec {
buildInputs = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf libGL boost libvorbis zlib curl python3 ];
preConfigure = ''
export cmakeFlags="$cmakeFlags -DCMAKE_INSTALL_PREFIX=$out -DSHAREDIR=$out/share"
export makeFlags="$makeFlags DESTDIR=$(out)"
'';
cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DSHAREDIR=${placeholder "out"}/share"
];
makeFlags = [
"DESTDIR=${placeholder "out"}"
];
nativeBuildInputs = [ cmake pkg-config ];

View File

@ -27,15 +27,13 @@
"-DCPACK_GENERATOR=TGZ"
"-DCMAKE_CXX_FLAGS=-I${lib.getDev libcxx}/include/c++/v1"
"-DPAM_LIBRARY=${pam}/lib/libpam.so"
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DIRODS_HOME_DIRECTORY=${placeholder "out"}"
"-DCMAKE_INSTALL_SBINDIR=${placeholder "out"}/sbin"
];
postPatch = ''
patchShebangs ./packaging ./scripts
export cmakeFlags="$cmakeFlags
-DCMAKE_INSTALL_PREFIX=$out
-DIRODS_HOME_DIRECTORY=$out
-DCMAKE_INSTALL_SBINDIR=$out/sbin
"
'';
meta = with lib; {

View File

@ -32,6 +32,12 @@ rec {
# fix build with recent llvm versions
env.NIX_CFLAGS_COMPILE = "-Wno-deprecated-register -Wno-deprecated-declarations";
cmakeFlags = common.cmakeFlags or [ ] ++ [
"-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,${placeholder "out"}/lib"
"-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-rpath,${placeholder "out"}/lib"
"-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath,${placeholder "out"}/lib"
];
postPatch = common.postPatch + ''
patchShebangs ./test
substituteInPlace plugins/database/CMakeLists.txt --replace-fail "COMMAND cpp" "COMMAND ${gcc.cc}/bin/cpp"
@ -39,11 +45,6 @@ rec {
do
substituteInPlace $file --replace-quiet "CATCH2}/include" "CATCH2}/include/catch2"
done
export cmakeFlags="$cmakeFlags
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,$out/lib
-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-rpath,$out/lib
-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath,$out/lib
"
substituteInPlace server/auth/CMakeLists.txt --replace-fail SETUID ""
'';