Wrap include-what-you-use for nix
This commit is contained in:
		
							parent
							
								
									d20483ed13
								
							
						
					
					
						commit
						5b240ce372
					
				| @ -67,6 +67,7 @@ find_program(IWYU NAMES include-what-you-use iwyu) | |||||||
| if(IWYU) | if(IWYU) | ||||||
|   set(IWYU_CMD ${IWYU} -Xiwyu --no_comments) |   set(IWYU_CMD ${IWYU} -Xiwyu --no_comments) | ||||||
|   set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_CMD}) |   set(CMAKE_C_INCLUDE_WHAT_YOU_USE ${IWYU_CMD}) | ||||||
|  |   message(STATUS "IWYU found") | ||||||
| else() | else() | ||||||
|   message(WARNING "IWYU not found, skipping") |   message(WARNING "IWYU not found, skipping") | ||||||
| endif() | endif() | ||||||
|  | |||||||
| @ -2,13 +2,12 @@ | |||||||
|   stdenv |   stdenv | ||||||
| , cmake | , cmake | ||||||
| , mpi | , mpi | ||||||
| , include-what-you-use |  | ||||||
| }: | }: | ||||||
| 
 | 
 | ||||||
| stdenv.mkDerivation rec { | stdenv.mkDerivation rec { | ||||||
|   name = "ovni"; |   name = "ovni"; | ||||||
| 
 | 
 | ||||||
|   buildInputs = [ cmake mpi include-what-you-use ]; |   buildInputs = [ cmake mpi ]; | ||||||
| 
 | 
 | ||||||
|   # Prevent accidental reutilization of previous builds, as we are taking the |   # Prevent accidental reutilization of previous builds, as we are taking the | ||||||
|   # current directory as-is |   # current directory as-is | ||||||
|  | |||||||
							
								
								
									
										15
									
								
								nix/rt.nix
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								nix/rt.nix
									
									
									
									
									
								
							| @ -11,6 +11,20 @@ let | |||||||
|     mpi = last.impi; |     mpi = last.impi; | ||||||
|     #mpi = last.openmpi; |     #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 { }; |     ovni = last.callPackage ./ovni.nix { }; | ||||||
| 
 | 
 | ||||||
|     # Use a fixed version to compile Nanos6 and nOS-V, so we don't need to |     # Use a fixed version to compile Nanos6 and nOS-V, so we don't need to | ||||||
| @ -132,6 +146,7 @@ let | |||||||
|     }).overrideAttrs (old: { |     }).overrideAttrs (old: { | ||||||
|       __noChroot = true; |       __noChroot = true; | ||||||
|       buildInputs = old.buildInputs ++ [ |       buildInputs = old.buildInputs ++ [ | ||||||
|  |         last.include-what-you-use | ||||||
|         pkgs.gdb |         pkgs.gdb | ||||||
|         last.nosv |         last.nosv | ||||||
|         last.nanos6 |         last.nanos6 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user