* makeWrapper: new function that transparently takes care of creating

a wrapper script.  E.g.

    wrapProgram $out/bin/prog --set FOO bar

  will create a wrapper around "prog" so that the environment variable
  FOO is set to bar.  The original program is renamed to
  $out/bin/.wrapped-prog.
  
* Function makeSetupHook to convert a script into a setup hook which
  can be included in buildInputs.  This makes it easier to use scripts
  like makeWrapper.

* Added Bazaar, yet another distributed version management system.

svn path=/nixpkgs/trunk/; revision=10211
This commit is contained in:
Eelco Dolstra 2008-01-18 10:29:58 +00:00
parent 432c157293
commit b00839299f
3 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,22 @@
{stdenv, fetchurl, python, makeWrapper}:
stdenv.mkDerivation {
name = "bazaar-1.1";
src = fetchurl {
url = file:///home/eelco/Downloads/bzr-1.1.tar.gz;
sha256 = "1qpkw580r22yxybdghx2ha0kyk22brbhd1kg9wwjh209dqy2gqzc";
};
buildInputs = [python makeWrapper];
installPhase = ''
python setup.py install --prefix=$out
wrapProgram $out/bin/bzr --prefix PYTHONPATH : "$(toPythonPath $out)"
'';
meta = {
homepage = http://bazaar-vcs.org/;
description = "A distributed version control system that Just Works";
};
}

View File

@ -72,3 +72,11 @@ filterExisting() {
fi
done
}
# Syntax: wrapProgram <PROGRAM> <MAKE-WRAPPER FLAGS...>
wrapProgram() {
local prog="$1"
local hidden="$(dirname "$prog")/.wrapped-$(basename "$prog")"
mv $prog $hidden
makeWrapper $hidden $prog "$@"
}

View File

@ -288,8 +288,15 @@ rec {
inherit stdenv curl;
});
makeSetupHook = script: runCommand "hook" {} ''
ensureDir $out/nix-support
cp ${script} $out/nix-support/setup-hook
'';
makeWrapper = ../build-support/make-wrapper/make-wrapper.sh;
makeWrapperNew = makeSetupHook ../build-support/make-wrapper/make-wrapper.sh;
# Run the shell command `buildCommand' to produce a store object
# named `name'. The attributes in `env' are added to the
# environment prior to running the command.
@ -3807,6 +3814,11 @@ rec {
inherit fetchurl stdenv unzip;
};
bazaar = import ../applications/version-management/bazaar {
inherit fetchurl stdenv python;
makeWrapper = makeWrapperNew;
};
# commented out because it's using the new configuration style proposal which is unstable
#biew = import ../applications/misc/biew {
# inherit lib stdenv fetchurl ncurses;