From 44d5f20a961a5bb57b64a37d09895241651ec4a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Thu, 18 May 2023 00:58:18 +0200 Subject: [PATCH] cmake: remove fixCmakeFiles Rewriting /usr and /opt to /var/empty is no longer necessary since the sandbox was introduced. It also introduced unexpected side effects and changes paths like $out/etc/opt/ to $out/etc/var/empty/ --- pkgs/applications/audio/munt/libmt32emu.nix | 2 -- pkgs/applications/audio/munt/mt32emu-qt.nix | 2 -- pkgs/applications/audio/munt/mt32emu-smf2wav.nix | 2 -- pkgs/applications/editors/vim/macvim.nix | 16 +--------------- pkgs/applications/emulators/darling/default.nix | 4 ---- .../coretoppings/0001-fix-install-phase.patch | 8 -------- .../cubocore-packages/coretoppings/default.nix | 5 ----- .../networking/sniffers/wireshark/default.nix | 1 - .../window-managers/jwm/jwm-settings-manager.nix | 5 ----- pkgs/by-name/cm/cmake/package.nix | 1 - pkgs/by-name/cm/cmake/setup-hook.sh | 14 -------------- pkgs/by-name/ne/neovim-unwrapped/package.nix | 2 -- .../compilers/swift/compiler/default.nix | 8 -------- pkgs/development/compilers/tvm/default.nix | 6 ------ pkgs/development/libraries/irrlicht/mac.nix | 1 - pkgs/development/libraries/liboqs/default.nix | 2 -- pkgs/kde/lib/mk-kde-derivation.nix | 1 - pkgs/servers/foundationdb/cmake.nix | 1 - pkgs/servers/nosql/arangodb/default.nix | 2 -- pkgs/tools/networking/mozillavpn/default.nix | 1 - pkgs/tools/package-management/dnf5/default.nix | 2 -- 21 files changed, 1 insertion(+), 85 deletions(-) delete mode 100644 pkgs/applications/misc/cubocore-packages/coretoppings/0001-fix-install-phase.patch diff --git a/pkgs/applications/audio/munt/libmt32emu.nix b/pkgs/applications/audio/munt/libmt32emu.nix index e011804944b53..443214671f52f 100644 --- a/pkgs/applications/audio/munt/libmt32emu.nix +++ b/pkgs/applications/audio/munt/libmt32emu.nix @@ -21,8 +21,6 @@ stdenv.mkDerivation rec { cmake ]; - dontFixCmake = true; - cmakeFlags = [ "-Dmunt_WITH_MT32EMU_SMF2WAV=OFF" "-Dmunt_WITH_MT32EMU_QT=OFF" diff --git a/pkgs/applications/audio/munt/mt32emu-qt.nix b/pkgs/applications/audio/munt/mt32emu-qt.nix index 9ebb59ddafdde..9ebc045cf0d4f 100644 --- a/pkgs/applications/audio/munt/mt32emu-qt.nix +++ b/pkgs/applications/audio/munt/mt32emu-qt.nix @@ -48,8 +48,6 @@ mkDerivation rec { ] ++ lib.optional withJack libjack2; - dontFixCmake = true; - cmakeFlags = [ "-Dmt32emu-qt_USE_PULSEAUDIO_DYNAMIC_LOADING=OFF" "-Dmunt_WITH_MT32EMU_QT=ON" diff --git a/pkgs/applications/audio/munt/mt32emu-smf2wav.nix b/pkgs/applications/audio/munt/mt32emu-smf2wav.nix index 3ebadcca91bec..f1eae4e301105 100644 --- a/pkgs/applications/audio/munt/mt32emu-smf2wav.nix +++ b/pkgs/applications/audio/munt/mt32emu-smf2wav.nix @@ -25,8 +25,6 @@ stdenv.mkDerivation rec { sed -i -e '/add_subdirectory(mt32emu)/d' CMakeLists.txt ''; - dontFixCmake = true; - nativeBuildInputs = [ cmake pkg-config diff --git a/pkgs/applications/editors/vim/macvim.nix b/pkgs/applications/editors/vim/macvim.nix index 64aa5b639a9b4..7cbc787a2dc3d 100644 --- a/pkgs/applications/editors/vim/macvim.nix +++ b/pkgs/applications/editors/vim/macvim.nix @@ -95,21 +95,7 @@ stdenv.mkDerivation { # passes arguments to ld that it meant for clang. + '' unset LD - '' - # When building with nix-daemon, we need to pass -derivedDataPath or else it tries to use - # a folder rooted in /var/empty and fails. Unfortunately we can't just pass -derivedDataPath - # by itself as this flag requires the use of -scheme or -xctestrun (not sure why), but MacVim - # by default just runs `xcodebuild -project src/MacVim/MacVim.xcodeproj`, relying on the default - # behavior to build the first target in the project. Experimentally, there seems to be a scheme - # called MacVim, so we'll explicitly select that. We also need to specify the configuration too - # as the scheme seems to have the wrong default. - + '' - configureFlagsArray+=( - XCODEFLAGS="-scheme MacVim -derivedDataPath $NIX_BUILD_TOP/derivedData" - --with-xcodecfg="Release" - ) - '' - ; + ''; # Because we're building with system clang, this means we're building against Xcode's SDK and # linking against system libraries. The configure script is picking up Nix Libsystem (via ruby) diff --git a/pkgs/applications/emulators/darling/default.nix b/pkgs/applications/emulators/darling/default.nix index a5fe1021e9171..b3d16c05eae8e 100644 --- a/pkgs/applications/emulators/darling/default.nix +++ b/pkgs/applications/emulators/darling/default.nix @@ -149,10 +149,6 @@ in stdenv.mkDerivation { stdenv.cc.libc.linuxHeaders ]; - # Breaks valid paths like - # Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include - dontFixCmake = true; - # src/external/objc4 forces OBJC_IS_DEBUG_BUILD=1, which conflicts with NDEBUG # TODO: Fix in a better way cmakeBuildType = " "; diff --git a/pkgs/applications/misc/cubocore-packages/coretoppings/0001-fix-install-phase.patch b/pkgs/applications/misc/cubocore-packages/coretoppings/0001-fix-install-phase.patch deleted file mode 100644 index 3c0c942ee43a1..0000000000000 --- a/pkgs/applications/misc/cubocore-packages/coretoppings/0001-fix-install-phase.patch +++ /dev/null @@ -1,8 +0,0 @@ ---- a/corepkit/CMakeLists.txt 2021-12-25 17:52:20.000000000 +0700 -+++ b/corepkit/CMakeLists.txt 2021-12-29 17:58:09.298024297 +0700 -@@ -32,4 +32,4 @@ - target_link_libraries( corepkit Qt5::Core ) - - install( TARGETS corepkit DESTINATION libexec/coreapps/ ) --install( FILES org.cubocore.coreapps.policy DESTINATION share/polkit-1/actions/ ) -+install( FILES org.cubocore.coreapps.policy DESTINATION ${CMAKE_INSTALL_PREFIX}/usr/share/polkit-1/actions/ ) diff --git a/pkgs/applications/misc/cubocore-packages/coretoppings/default.nix b/pkgs/applications/misc/cubocore-packages/coretoppings/default.nix index 1296c8f57564f..fac0be62d938c 100644 --- a/pkgs/applications/misc/cubocore-packages/coretoppings/default.nix +++ b/pkgs/applications/misc/cubocore-packages/coretoppings/default.nix @@ -39,11 +39,6 @@ mkDerivation rec { hash = "sha256-IYUkPGgFGI6889IyromMBobIoqSZtALVsSswQ7O1Bp0="; }; - patches = [ - # Fix file cannot create directory: /var/empty/share/polkit-1/actions - ./0001-fix-install-phase.patch - ]; - nativeBuildInputs = [ cmake ninja diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix index 81dd459f5cb06..2aa37ef05917a 100644 --- a/pkgs/applications/networking/sniffers/wireshark/default.nix +++ b/pkgs/applications/networking/sniffers/wireshark/default.nix @@ -149,7 +149,6 @@ stdenv.mkDerivation rec { # Avoid referencing -dev paths because of debug assertions. env.NIX_CFLAGS_COMPILE = toString [ "-DQT_NO_DEBUG" ]; - dontFixCmake = true; dontWrapGApps = true; shellHook = '' diff --git a/pkgs/applications/window-managers/jwm/jwm-settings-manager.nix b/pkgs/applications/window-managers/jwm/jwm-settings-manager.nix index d01e1bfdf9752..a9bdde42e884c 100644 --- a/pkgs/applications/window-managers/jwm/jwm-settings-manager.nix +++ b/pkgs/applications/window-managers/jwm/jwm-settings-manager.nix @@ -33,11 +33,6 @@ stdenv.mkDerivation rec { --replace 'DESTINATION usr/share' "DESTINATION share" ''; - postConfigure = '' - substituteInPlace cmake_install.cmake \ - --replace "/var/empty" "/usr" - ''; - meta = with lib; { description = "A full configuration manager for JWM"; homepage = "https://joewing.net/projects/jwm"; diff --git a/pkgs/by-name/cm/cmake/package.nix b/pkgs/by-name/cm/cmake/package.nix index ce5ec0803a902..27d2b76182f3b 100644 --- a/pkgs/by-name/cm/cmake/package.nix +++ b/pkgs/by-name/cm/cmake/package.nix @@ -104,7 +104,6 @@ stdenv.mkDerivation (finalAttrs: { propagatedBuildInputs = lib.optional stdenv.isDarwin ps; preConfigure = '' - fixCmakeFiles . substituteInPlace Modules/Platform/UnixPaths.cmake \ --subst-var-by libc_bin ${lib.getBin stdenv.cc.libc} \ --subst-var-by libc_dev ${lib.getDev stdenv.cc.libc} \ diff --git a/pkgs/by-name/cm/cmake/setup-hook.sh b/pkgs/by-name/cm/cmake/setup-hook.sh index b28ed42b6896b..e0fb88cff08a9 100755 --- a/pkgs/by-name/cm/cmake/setup-hook.sh +++ b/pkgs/by-name/cm/cmake/setup-hook.sh @@ -2,16 +2,6 @@ addCMakeParams() { addToSearchPath CMAKE_PREFIX_PATH $1 } -fixCmakeFiles() { - # Replace occurences of /usr and /opt by /var/empty. - echo "fixing cmake files..." - find "$1" \( -type f -name "*.cmake" -o -name "*.cmake.in" -o -name CMakeLists.txt \) -print | - while read fn; do - sed -e 's^/usr\([ /]\|$\)^/var/empty\1^g' -e 's^/opt\([ /]\|$\)^/var/empty\1^g' < "$fn" > "$fn.tmp" - mv "$fn.tmp" "$fn" - done -} - cmakeConfigurePhase() { runHook preConfigure @@ -23,10 +13,6 @@ cmakeConfigurePhase() { export CTEST_PARALLEL_LEVEL=$NIX_BUILD_CORES fi - if [ -z "${dontFixCmake-}" ]; then - fixCmakeFiles . - fi - if [ -z "${dontUseCmakeBuildDir-}" ]; then mkdir -p "$cmakeBuildDir" cd "$cmakeBuildDir" diff --git a/pkgs/by-name/ne/neovim-unwrapped/package.nix b/pkgs/by-name/ne/neovim-unwrapped/package.nix index bd25ac1c36f84..28a9fc2213942 100644 --- a/pkgs/by-name/ne/neovim-unwrapped/package.nix +++ b/pkgs/by-name/ne/neovim-unwrapped/package.nix @@ -84,8 +84,6 @@ in { ./system_rplugin_manifest.patch ]; - dontFixCmake = true; - inherit lua; treesitter-parsers = treesitter-parsers // { markdown = treesitter-parsers.markdown // { location = "tree-sitter-markdown"; }; } // diff --git a/pkgs/development/compilers/swift/compiler/default.nix b/pkgs/development/compilers/swift/compiler/default.nix index cef1358aed735..a650643c6bd1d 100644 --- a/pkgs/development/compilers/swift/compiler/default.nix +++ b/pkgs/development/compilers/swift/compiler/default.nix @@ -243,8 +243,6 @@ in stdenv.mkDerivation { done ''; - # We invoke cmakeConfigurePhase multiple times, but only need this once. - dontFixCmake = true; # We setup custom build directories. dontUseCmakeBuildDir = true; @@ -355,12 +353,6 @@ in stdenv.mkDerivation { rm swift/test/AutoDiff/compiler_crashers_fixed/issue-56649-missing-debug-scopes-in-pullback-trampoline.swift patchShebangs . - - ${lib.optionalString (!stdenv.isDarwin) '' - # NOTE: This interferes with ABI stability on Darwin, which uses the system - # libraries in the hardcoded path /usr/lib/swift. - fixCmakeFiles . - ''} ''; configurePhase = '' diff --git a/pkgs/development/compilers/tvm/default.nix b/pkgs/development/compilers/tvm/default.nix index 1f714f1b2dead..dea0d534305e4 100644 --- a/pkgs/development/compilers/tvm/default.nix +++ b/pkgs/development/compilers/tvm/default.nix @@ -13,12 +13,6 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ cmake ]; - # TVM CMake build uses some sources in the project's ./src/target/opt/ - # directory which errneously gets mangled by the eager `fixCmakeFiles` - # function in Nix's CMake setup-hook.sh to ./src/target/var/empty/, - # which then breaks the build. Toggling this flag instructs Nix to - # not mangle the legitimate use of the opt/ folder. - dontFixCmake = true; meta = with lib; { homepage = "https://tvm.apache.org/"; diff --git a/pkgs/development/libraries/irrlicht/mac.nix b/pkgs/development/libraries/irrlicht/mac.nix index b3ef27e38774e..4ed35e8f61451 100644 --- a/pkgs/development/libraries/irrlicht/mac.nix +++ b/pkgs/development/libraries/irrlicht/mac.nix @@ -21,7 +21,6 @@ stdenv.mkDerivation rec { ''; patches = [ ./mac_device.patch ]; - dontFixCmake = true; cmakeFlags = [ "-DIRRLICHT_STATIC_LIBRARY=ON" diff --git a/pkgs/development/libraries/liboqs/default.nix b/pkgs/development/libraries/liboqs/default.nix index e703dc3647faa..8bca5223e89bb 100644 --- a/pkgs/development/libraries/liboqs/default.nix +++ b/pkgs/development/libraries/liboqs/default.nix @@ -29,8 +29,6 @@ stdenv.mkDerivation rec { "-DOQS_BUILD_ONLY_LIB=ON" ]; - dontFixCmake = true; # fix CMake file will give an error - meta = with lib; { description = "C library for prototyping and experimenting with quantum-resistant cryptography"; homepage = "https://openquantumsafe.org"; diff --git a/pkgs/kde/lib/mk-kde-derivation.nix b/pkgs/kde/lib/mk-kde-derivation.nix index 2a983782a4170..013aa664fd969 100644 --- a/pkgs/kde/lib/mk-kde-derivation.nix +++ b/pkgs/kde/lib/mk-kde-derivation.nix @@ -114,7 +114,6 @@ in propagatedBuildInputs = deps ++ extraPropagatedBuildInputs; strictDeps = true; - dontFixCmake = true; cmakeFlags = ["-DQT_MAJOR_VERSION=6"] ++ extraCmakeFlags; separateDebugInfo = true; diff --git a/pkgs/servers/foundationdb/cmake.nix b/pkgs/servers/foundationdb/cmake.nix index bc0a17166631d..2425022ffe27f 100644 --- a/pkgs/servers/foundationdb/cmake.nix +++ b/pkgs/servers/foundationdb/cmake.nix @@ -43,7 +43,6 @@ let ++ lib.optionals useClang [ llvmPackages.lld ]; separateDebugInfo = true; - dontFixCmake = true; cmakeFlags = [ (lib.optionalString officialRelease "-DFDB_RELEASE=TRUE") diff --git a/pkgs/servers/nosql/arangodb/default.nix b/pkgs/servers/nosql/arangodb/default.nix index 52b9125e99d5d..dd5483dedf35e 100644 --- a/pkgs/servers/nosql/arangodb/default.nix +++ b/pkgs/servers/nosql/arangodb/default.nix @@ -46,8 +46,6 @@ gcc10Stdenv.mkDerivation rec { buildInputs = [ openssl zlib snappy lzo ]; - # prevent failing with "cmake-3.13.4/nix-support/setup-hook: line 10: ./3rdParty/rocksdb/RocksDBConfig.cmake.in: No such file or directory" - dontFixCmake = true; env.NIX_CFLAGS_COMPILE = "-Wno-error"; postPatch = '' diff --git a/pkgs/tools/networking/mozillavpn/default.nix b/pkgs/tools/networking/mozillavpn/default.nix index 8e677c806622d..d804b6be33117 100644 --- a/pkgs/tools/networking/mozillavpn/default.nix +++ b/pkgs/tools/networking/mozillavpn/default.nix @@ -142,7 +142,6 @@ stdenv.mkDerivation { "-DQT_LUPDATE_EXECUTABLE=${qttools.dev}/bin/lupdate" "-DQT_LRELEASE_EXECUTABLE=${qttools.dev}/bin/lrelease" ]; - dontFixCmake = true; qtWrapperArgs = [ "--prefix" "PATH" ":" (lib.makeBinPath [ wireguard-tools ]) ]; diff --git a/pkgs/tools/package-management/dnf5/default.nix b/pkgs/tools/package-management/dnf5/default.nix index 81c4a10c08c9a..fe5f321c63f62 100644 --- a/pkgs/tools/package-management/dnf5/default.nix +++ b/pkgs/tools/package-management/dnf5/default.nix @@ -103,8 +103,6 @@ stdenv.mkDerivation (finalAttrs: { --replace '/etc/bash_completion.d' "$out/etc/bash_completion.d" ''; - dontFixCmake = true; - passthru.tests = { version = testers.testVersion { package = finalAttrs.finalPackage; }; };