Wrap include-what-you-use for nix

This commit is contained in:
Rodrigo Arias 2023-03-22 19:05:48 +01:00 committed by Rodrigo Arias Mallo
parent d20483ed13
commit 5b240ce372
3 changed files with 17 additions and 2 deletions

View File

@ -67,6 +67,7 @@ find_program(IWYU NAMES include-what-you-use iwyu)
if(IWYU)
set(IWYU_CMD ${IWYU} -Xiwyu --no_comments)
set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_CMD})
message(STATUS "IWYU found")
else()
message(WARNING "IWYU not found, skipping")
endif()

View File

@ -2,13 +2,12 @@
stdenv
, cmake
, mpi
, include-what-you-use
}:
stdenv.mkDerivation rec {
name = "ovni";
buildInputs = [ cmake mpi include-what-you-use ];
buildInputs = [ cmake mpi ];
# Prevent accidental reutilization of previous builds, as we are taking the
# current directory as-is

View File

@ -11,6 +11,20 @@ let
mpi = last.impi;
#mpi = last.openmpi;
include-what-you-use = let
gcc = pkgs.gcc;
targetConfig = pkgs.stdenv.targetPlatform.config;
in pkgs.wrapCCWith rec {
cc = pkgs.include-what-you-use;
extraBuildCommands = ''
echo "--gcc-toolchain=${gcc}" >> $out/nix-support/cc-cflags
echo "-B${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}" >> $out/nix-support/cc-cflags
echo "-isystem${gcc.cc}/lib/gcc/${targetConfig}/${gcc.version}/include" >> $out/nix-support/cc-cflags
wrap include-what-you-use $wrapper $ccPath/include-what-you-use
substituteInPlace "$out/bin/include-what-you-use" --replace 'dontLink=0' 'dontLink=1'
'';
};
ovni = last.callPackage ./ovni.nix { };
# Use a fixed version to compile Nanos6 and nOS-V, so we don't need to
@ -132,6 +146,7 @@ let
}).overrideAttrs (old: {
__noChroot = true;
buildInputs = old.buildInputs ++ [
last.include-what-you-use
pkgs.gdb
last.nosv
last.nanos6