summary refs log tree commit diff
path: root/pkgs/build-support/release
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-09-10 12:39:57 +0000
committerLudovic Courtès <ludo@gnu.org>2010-09-10 12:39:57 +0000
commit193799ec3d52993f0e38155fc67c067c3b4623d1 (patch)
tree2aa07c34ba4cb72b6a2f6eabccc79e6208a32a3c /pkgs/build-support/release
parent6021bcf0dc8b636a1706556dd51fcb9e5fc6e190 (diff)
downloadnixpkgs-193799ec3d52993f0e38155fc67c067c3b4623d1.tar
nixpkgs-193799ec3d52993f0e38155fc67c067c3b4623d1.tar.gz
nixpkgs-193799ec3d52993f0e38155fc67c067c3b4623d1.tar.bz2
nixpkgs-193799ec3d52993f0e38155fc67c067c3b4623d1.tar.lz
nixpkgs-193799ec3d52993f0e38155fc67c067c3b4623d1.tar.xz
nixpkgs-193799ec3d52993f0e38155fc67c067c3b4623d1.tar.zst
nixpkgs-193799ec3d52993f0e38155fc67c067c3b4623d1.zip
nixBuild: Add `buildOutOfSourceTree' option.
svn path=/nixpkgs/trunk/; revision=23717
Diffstat (limited to 'pkgs/build-support/release')
-rw-r--r--pkgs/build-support/release/nix-build.nix24
1 files changed, 23 insertions, 1 deletions
diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix
index d0acce96113..3a0d3a034ef 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 {})
 )