From 193799ec3d52993f0e38155fc67c067c3b4623d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 10 Sep 2010 12:39:57 +0000 Subject: [PATCH] nixBuild: Add `buildOutOfSourceTree' option. svn path=/nixpkgs/trunk/; revision=23717 --- pkgs/build-support/release/nix-build.nix | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix index d0acce96113d..3a0d3a034ef1 100644 --- a/pkgs/build-support/release/nix-build.nix +++ b/pkgs/build-support/release/nix-build.nix @@ -5,7 +5,9 @@ # it turns on GCC's coverage analysis feature. It then runs `make # check' and produces a coverage analysis report using `lcov'. -{ doCoverageAnalysis ? false +{ buildOutOfSourceTree ? false +, preConfigure ? null +, doCoverageAnalysis ? false , lcovFilter ? [] , lcovExtraTraceFiles ? [] , src, stdenv @@ -94,4 +96,24 @@ stdenv.mkDerivation ( }; } + + // + + (if buildOutOfSourceTree + then { + preConfigure = + # Build out of source tree and make the source tree read-only. This + # helps catch violations of the GNU Coding Standards (info + # "(standards) Configuration"), like `make distcheck' does. + '' mkdir "../build" + cd "../build" + configureScript="../$sourceRoot/configure" + chmod -R a-w "../$sourceRoot" + + echo "building out of source tree, from \`$PWD'..." + + ${if preConfigure != null then preConfigure else ""} + ''; + } + else {}) )