nixpkgs/pkgs/build-support/release/default.nix

77 lines
1.7 KiB
Nix
Raw Normal View History

{pkgs}:
with pkgs;
rec {
sourceTarball = args: import ./source-tarball.nix (
{ inherit stdenv autoconf automake libtool;
} // args);
makeSourceTarball = sourceTarball; # compatibility
binaryTarball = args: import ./binary-tarball.nix (
{ inherit stdenv;
} // args);
antBuild = args: import ./ant-build.nix (
{ inherit pkgs;
} // args);
mvnBuild = args: import ./maven-build.nix (
{ inherit stdenv;
} // args);
nixBuild = args: import ./nix-build.nix (
{ inherit stdenv;
} // args);
coverageAnalysis = args: nixBuild (
{ inherit lcov enableGCOVInstrumentation makeGCOVReport;
doCoverageAnalysis = true;
} // args);
releaseTools: add {clang,coverity}Analysis tools These two expressions greatly simplify using the clang-analyzer or Coverity static analyzer on your C/C++ projects. In fact, they are identical to nixBuild in every way out of the box, and should 'Just Work' providing your code can be compiled with Clang already. The trick is that when running 'make', we actually just alias it to the appropriate scan build tool, and add a post-build hook that will bundle up the results appropriately and unalias it. For Clang, we put the results in $out/analysis and add an 'analysis' report to $out/nix-support/hydra-build-products pointing to the result HTML - this means that if the analyzer finds any bugs, the HTML results will automatically show up Hydra for easy viewing. For Coverity, it's slightly different. Instead we run the build tool and after we're done, we tar up the results in a format that Coverity Scan's service understands. We put the tarball in $out/tarballs under the name 'foo-cov-int.xz' and add an entry for the file to hydra-build-products as well for easy viewing. Of course for Coverity you must then upload the build. A Hydra plugin to do this is on the way, and it will automatically pick up the cov-int.tar.xz for uploading. Note that coverityAnalysis requires allowUnfree = true;, as well as the cov-build tools, which you can download from https://scan.coverity.com - they're not linked to your account or anything, it's just an annoying registration wall. Note this is a first draft. In particular, scan-build fixes the C/C++ compiler to be Clang, and it's perfectly reasonable to want to use Clang for the analyzer but have scan-build invoke GCC instead. Signed-off-by: Austin Seipp <aseipp@pobox.com>
2014-05-02 19:26:41 +01:00
clangAnalysis = args: nixBuild (
{ inherit clang-analyzer;
releaseTools: add {clang,coverity}Analysis tools These two expressions greatly simplify using the clang-analyzer or Coverity static analyzer on your C/C++ projects. In fact, they are identical to nixBuild in every way out of the box, and should 'Just Work' providing your code can be compiled with Clang already. The trick is that when running 'make', we actually just alias it to the appropriate scan build tool, and add a post-build hook that will bundle up the results appropriately and unalias it. For Clang, we put the results in $out/analysis and add an 'analysis' report to $out/nix-support/hydra-build-products pointing to the result HTML - this means that if the analyzer finds any bugs, the HTML results will automatically show up Hydra for easy viewing. For Coverity, it's slightly different. Instead we run the build tool and after we're done, we tar up the results in a format that Coverity Scan's service understands. We put the tarball in $out/tarballs under the name 'foo-cov-int.xz' and add an entry for the file to hydra-build-products as well for easy viewing. Of course for Coverity you must then upload the build. A Hydra plugin to do this is on the way, and it will automatically pick up the cov-int.tar.xz for uploading. Note that coverityAnalysis requires allowUnfree = true;, as well as the cov-build tools, which you can download from https://scan.coverity.com - they're not linked to your account or anything, it's just an annoying registration wall. Note this is a first draft. In particular, scan-build fixes the C/C++ compiler to be Clang, and it's perfectly reasonable to want to use Clang for the analyzer but have scan-build invoke GCC instead. Signed-off-by: Austin Seipp <aseipp@pobox.com>
2014-05-02 19:26:41 +01:00
doClangAnalysis = true;
} // args);
coverityAnalysis = args: nixBuild (
{ inherit cov-build xz;
doCoverityAnalysis = true;
} // args);
gcovReport = args: import ./gcov-report.nix (
{ inherit runCommand lcov rsync;
} // args);
rpmBuild = args: import ./rpm-build.nix (
{ inherit vmTools;
} // args);
debBuild = args: import ./debian-build.nix (
{ inherit stdenv vmTools checkinstall;
} // args);
aggregate =
{ name, constituents, meta ? { } }:
pkgs.runCommand name
{ inherit constituents meta;
preferLocalBuild = true;
_hydraAggregate = true;
}
''
2013-08-15 00:40:09 +01:00
mkdir -p $out/nix-support
touch $out/nix-support/hydra-build-products
echo $constituents > $out/nix-support/hydra-aggregate-constituents
2013-08-15 00:40:09 +01:00
# Propagate build failures.
for i in $constituents; do
2013-08-15 00:40:09 +01:00
if [ -e $i/nix-support/failed ]; then
touch $out/nix-support/failed
fi
done
'';
}