* Split downloading and unpacking.

* Add an MD5 hash for the downloaded files.
* Rename some files.

svn path=/nixpkgs/trunk/; revision=2267
This commit is contained in:
Eelco Dolstra 2005-02-22 09:55:03 +00:00
parent 31ff064352
commit 399d23373e
5 changed files with 36 additions and 17 deletions

View File

@ -23,47 +23,68 @@ rec {
cp = ./tools/cp;
curl = ./curl-static/curl-7.12.2-static.tar.bz2;
system = "i686-linux";
args = [ ./scripts/curl-unpack ];
args = [ ./scripts/unpack-curl.sh ];
};
# This function downloads a file.
download = {url, md5, pkgname}: derivation {
name = baseNameOf (toString url);
system = "i686-linux";
builder = ./tools/bash;
inherit curl url;
args = [ ./scripts/download.sh ];
# Nix 0.8 fixed-output derivations.
outputHashAlgo = "md5";
outputHash = md5;
# Compatibility with Nix <= 0.7.
id = md5;
};
# This function downloads and unpacks a file.
download =
{ url, pkgname, postProcess ? [], addToPath ? []
downloadAndUnpack =
{ url, md5, pkgname, postProcess ? [], addToPath ? []
, extra ? null, extra2 ? null
, extra3 ? null, extra4? null, patchelf ? null}:
derivation {
name = pkgname;
system = "i686-linux";
builder = ./tools/bash;
tar = ./tools/tar;
bunzip2 = ./tools/bunzip2;
cp = ./tools/cp;
inherit curl url;
system = "i686-linux";
args = [ ./scripts/download-script ];
args = [ ./scripts/unpack.sh ];
tarball = download {inherit url md5 pkgname;};
inherit postProcess addToPath extra extra2 extra3 extra4 patchelf;
};
# The various statically linked components that make up the standard
# environment.
staticTools = download {
url = http://catamaran.labs.cs.uu.nl/dist/tarballs/stdenv-linux/////static.tar.bz2;
staticTools = downloadAndUnpack {
url = http://catamaran.labs.cs.uu.nl/dist/tarballs/stdenv-linux/static-tools.tar.bz2;
pkgname = "static-tools";
md5 = "9419d3dcccbe1af10d9d0d7d54269785";
};
binutils = download {
binutils = downloadAndUnpack {
url = http://catamaran.labs.cs.uu.nl/dist/tarballs/stdenv-linux/binutils-2.15-static.tar.bz2;
pkgname = "binutils";
md5 = "9c134038b7f1894a4b307d600207047c";
};
gcc = (download {url = http://catamaran.labs.cs.uu.nl/dist/tarballs/stdenv-linux/gcc-3.4.2-static.tar.bz2;
gcc = (downloadAndUnpack {
url = http://catamaran.labs.cs.uu.nl/dist/tarballs/stdenv-linux/gcc-3.4.2-static.tar.bz2;
pkgname = "gcc";
md5 = "600452fac470a49a41ea81d39c209f35";
postProcess = [./scripts/fix-outpath.sh];
addToPath = [staticTools];
}) // { langC = true; langCC = false; langF77 = false; };
glibc = download {
glibc = downloadAndUnpack {
url = http://catamaran.labs.cs.uu.nl/dist/tarballs/stdenv-linux/glibc-2.3.3-static.tar.bz2;
pkgname = "glibc";
md5 = "36ff244e666c60784edfe1cc66f68e4c";
postProcess = [./scripts/fix-outpath.sh];
addToPath = [staticTools];
};

View File

@ -1,4 +1,3 @@
set -x
set -e
PATH=$coreutils/bin

View File

@ -0,0 +1,3 @@
set -e
echo "downloading $out from $url"
$curl/bin/curl --fail --location --max-redirs 20 "$url" > "$out"

View File

@ -1,10 +1,6 @@
set -e
echo "using curl executable $curl"
$curl/bin/curl "$url" > .tmp
$bunzip2 -d < .tmp | $tar xvf -
$bunzip2 -d < $tarball | $tar xvf -
$cp -prd * $out