* The stdenv setup script now defines a generic builder that allows

builders for typical Autoconf-style to be much shorten, e.g.,

    . $stdenv/setup
    genericBuild

  The generic builder does lots of stuff automatically:

  - Unpacks source archives specified by $src or $srcs (it knows about
    gzip, bzip2, tar, zip, and unpacked source trees).
  - Determines the source tree.
  - Applies patches specified by $patches.
  - Fixes libtool not to search for libraries in /lib etc.
  - Runs `configure'.
  - Runs `make'.
  - Runs `make install'.
  - Strips debug information from static libraries.
  - Writes nested log information (in the format accepted by
    `log2xml').

  There are also lots of hooks and variables to customise the generic
  builder.  See `stdenv/generic/docs.txt'.

* Adapted the base packages (i.e., the ones used by stdenv) to use the
  generic builder.

* We now use `curl' instead of `wget' to download files in `fetchurl'.

* Neither `curl' nor `wget' are part of stdenv.  We shouldn't
  encourage people to download stuff in builders (impure!).

* Updated some packages.

* `buildinputs' is now `buildInputs' (but the old name also works).

* `findInputs' in the setup script now prevents inputs from being
  processed multiple times (which could happen, e.g., if an input was
  a propagated input of several other inputs; this caused the size
  variables like $PATH to blow up exponentially in the worst case).

* Patched GNU Make to write nested log information in the format
  accepted by `log2xml'.  Also, prior to writing the build command,
  Make now writes a line `building X' to indicate what is being
  built.  This is unfortunately often obscured by the gigantic tool
  invocations in many Makefiles.  The actual build commands are marked
  `unimportant' so that they don't clutter pages generated by
  `log2html'.


svn path=/nixpkgs/trunk/; revision=845
gstqt5
Eelco Dolstra 2004-03-19 16:53:04 +00:00
parent 0fd59fd7a4
commit 5941f66f0e
59 changed files with 891 additions and 376 deletions

View File

@ -1,13 +1,15 @@
#! /bin/sh
#! /bin/sh -e
. $stdenv/setup
echo "downloading $url into $out..."
header "downloading $out from $url"
wget --passive-ftp "$url" -O "$out" || exit 1
curl "$url" > "$out"
actual=$(md5sum -b $out | cut -c1-32)
actual=$(md5sum -b "$out" | cut -c1-32)
if test "$actual" != "$md5"; then
echo "hash is $actual, expected $md5"
exit 1
fi
stopNext

View File

@ -1,9 +1,12 @@
{stdenv}: {url, md5}: derivation {
{stdenv, curl}: {url, md5}:
# Note that `curl' may be `null', in case of the native stdenv.
derivation {
name = baseNameOf (toString url);
system = stdenv.system;
builder = ./builder.sh;
stdenv = stdenv;
url = url;
md5 = md5;
buildInputs = [curl];
id = md5;
inherit stdenv url md5;
}

View File

@ -1,65 +1,74 @@
#! /bin/sh -e
buildinputs="$binutils"
. $stdenv/setup
tar xvfj $src
if test "$noSysDirs" = "1"; then
# Disable the standard include directories.
cd gcc-*
cat >> ./gcc/cppdefault.h <<EOF
preConfigure() {
if test "$noSysDirs" = "1"; then
# Disable the standard include directories.
cat >> ./gcc/cppdefault.h <<EOF
#undef LOCAL_INCLUDE_DIR
#undef SYSTEM_INCLUDE_DIR
#undef STANDARD_INCLUDE_DIR
EOF
cd ..
fi
fi
langs="c"
if test -n "$langCC"; then
langs="$langs,c++"
fi
if test -n "$langF77"; then
langs="$langs,f77"
fi
# Determine the frontends to build.
langs="c"
if test -n "$langCC"; then
langs="$langs,c++"
fi
if test -n "$langF77"; then
langs="$langs,f77"
fi
# Configure.
mkdir build
cd build
../gcc-*/configure --prefix=$out --enable-languages="$langs"
# Perform the build in a different directory.
mkdir ../build
cd ../build
if test "$noSysDirs" = "1"; then
# Patch some of the makefiles to force linking against our own glibc.
. $NIX_GCC/nix-support/add-flags # add glibc/gcc flags
extraflags="-Wl,-s $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK"
for i in $NIX_LDFLAGS; do
extraflags="$extraflags -Wl,$i"
done
configureScript=../$sourceRoot/configure
configureFlags="--enable-languages=$langs"
}
mf=Makefile
sed \
-e "s^FLAGS_FOR_TARGET =\(.*\)^FLAGS_FOR_TARGET = \1 $extraflags^" \
< $mf > $mf.tmp
mv $mf.tmp $mf
preConfigure=preConfigure
mf=gcc/Makefile
sed \
-e "s^X_CFLAGS =\(.*\)^X_CFLAGS = \1 $extraflags^" \
< $mf > $mf.tmp
mv $mf.tmp $mf
# Patch gcc/Makefile to prevent fixinc.sh from "fixing" system header files
# from /usr/include.
mf=gcc/Makefile
sed \
-e "s^NATIVE_SYSTEM_HEADER_DIR =\(.*\)^NATIVE_SYSTEM_HEADER_DIR = /fixinc-disabled^" \
< $mf > $mf.tmp
mv $mf.tmp $mf
fi
postConfigure() {
if test "$noSysDirs" = "1"; then
# Patch some of the makefiles to force linking against our own
# glibc.
. $NIX_GCC/nix-support/add-flags # add glibc/gcc flags
extraflags="-Wl,-s $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK"
for i in $NIX_LDFLAGS; do
extraflags="$extraflags -Wl,$i"
done
# Build and install.
make bootstrap
make install
mf=Makefile
sed \
-e "s^FLAGS_FOR_TARGET =\(.*\)^FLAGS_FOR_TARGET = \1 $extraflags^" \
< $mf > $mf.tmp
mv $mf.tmp $mf
find $out -name "*.a" -exec strip -S {} \;
mf=gcc/Makefile
sed \
-e "s^X_CFLAGS =\(.*\)^X_CFLAGS = \1 $extraflags^" \
< $mf > $mf.tmp
mv $mf.tmp $mf
# Patch gcc/Makefile to prevent fixinc.sh from "fixing" system
# header files from /usr/include.
mf=gcc/Makefile
sed \
-e "s^NATIVE_SYSTEM_HEADER_DIR =\(.*\)^NATIVE_SYSTEM_HEADER_DIR = /fixinc-disabled^" \
< $mf > $mf.tmp
mv $mf.tmp $mf
fi
}
postConfigure=postConfigure
makeFlags="bootstrap"
genericBuild

View File

@ -1,10 +1,7 @@
#! /bin/sh
#! /bin/sh -e
buildinputs="$aterm $sdf"
. $stdenv/setup || exit 1
buildInputs="$aterm $sdf"
. $stdenv/setup
tar zxf $src || exit 1
cd $dir* || exit 1
./configure --prefix=$out --with-aterm=$aterm --with-sdf=$sdf || exit 1
make || exit 1
make install || exit 1
configureFlags="--with-aterm=$aterm --with-sdf=$sdf"
genericBuild

View File

@ -1,14 +1,12 @@
{stdenv, fetchurl, aterm, sdf}: derivation {
name = "strategoxt-0.9.4-4626";
{stdenv, fetchurl, aterm, sdf}:
derivation {
name = "strategoxt-0.9.4";
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = http://losser.labs.cs.uu.nl/~mbravenb/dailydist/strategoxt/src/strategoxt-0.9.4-4626.tar.gz;
md5 = "f33ae9fdb9d8628ae01fa0f26bfa0429";
url = ftp://ftp.stratego-language.org/pub/stratego/StrategoXT/strategoxt-0.9.4.tar.gz;
md5 = "b61aee784cebac6cce0d96383bdb1b37";
};
stdenv = stdenv;
aterm = aterm;
sdf = sdf;
tarfile = "true";
dir = "strategoxt";
inherit stdenv aterm sdf;
}

View File

@ -1,10 +0,0 @@
{stdenv, fetchurl}: derivation {
name = "aterm-2.0.5";
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.5.tar.gz;
md5 = "68aefb0c10b2ab876b8d3c0b2d0cdb1b";
};
stdenv = stdenv;
}

View File

@ -1,10 +1,6 @@
#! /bin/sh
. $stdenv/setup || exit 1
. $stdenv/setup
tar xvfz $src || exit 1
cd aterm-* || exit 1
./configure --prefix=$out --with-gcc || exit 1
make || exit 1
make install || exit 1
strip -S $out/lib/*.a || exit 1
configureFlags="--with-gcc"
genericBuild

View File

@ -1,10 +1,12 @@
{stdenv, fetchurl}: derivation {
name = "aterm-2.0";
{stdenv, fetchurl}:
derivation {
name = "aterm-2.0.5";
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.tar.gz;
md5 = "853474e4bcf4a85f7d38a0676b36bded";
url = http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.5.tar.gz;
md5 = "68aefb0c10b2ab876b8d3c0b2d0cdb1b";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -10,7 +10,6 @@ export TZ=UTC
tar xvfz $src
cd fontconfig-*
./configure --prefix=$out --with-confdir=$out/etc/fonts \
--x-includes=$x11/include --x-libraries=$x11/lib \
--with-expat-includes=$expat/include --with-expat-lib=$expat/lib
make
make install

View File

@ -2,26 +2,36 @@
# glibc cannot have itself in its rpath.
export NIX_NO_SELF_RPATH=1
buildinputs="$patch"
. $stdenv/setup
tar xvfj $glibcSrc
(cd glibc-* && tar xvfj $linuxthreadsSrc) || false
(cd glibc-* && patch -p1 < $vaargsPatch) || false
postUnpack() {
cd $sourceRoot
unpackFile $linuxthreadsSrc
cd ..
}
mkdir build
cd build
../glibc-*/configure --prefix=$out --enable-add-ons --disable-profile
postUnpack=postUnpack
make
make install
make localedata/install-locales
strip -S $out/lib/*.a $out/lib/*.so $out/lib/gconv/*.so || true
strip -s $out/bin/* $out/sbin/* $out/libexec/* || true
rm $out/etc/ld.so.cache
preConfigure() {
mkdir ../build
cd ../build
configureScript=../$sourceRoot/configure
configureFlags="--enable-add-ons --disable-profile"
}
(cd $out/include && ln -s $kernelHeaders/include/* .) || false
preConfigure=preConfigure
exit 0
postInstall() {
make localedata/install-locales
rm $out/etc/ld.so.cache
(cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1
}
postInstall=postInstall
genericBuild

View File

@ -7,7 +7,7 @@ derivation {
system = stdenv.system;
builder = ./builder.sh;
glibcSrc = fetchurl {
src = fetchurl {
url = ftp://ftp.nl.net/pub/gnu/glibc/glibc-2.3.2.tar.bz2;
md5 = "ede969aad568f48083e413384f20753c";
};
@ -18,7 +18,8 @@ derivation {
# This is a patch to make glibc compile under GCC 3.3. Presumably
# later releases of glibc won't need this.
vaargsPatch = ./glibc-2.3.2-sscanf-1.patch;
patches = [./glibc-2.3.2-sscanf-1.patch];
inherit stdenv kernelHeaders patch;
buildInputs = [patch];
inherit stdenv kernelHeaders;
}

View File

@ -5,7 +5,7 @@ buildinputs="$x11 $glib"
tar xvfz $src
cd gtk+-*
./configure --prefix=$out --x-includes=$x11/include --x-libraries=$x11/lib
./configure --prefix=$out
make
make install

View File

@ -3,9 +3,19 @@
buildinputs="$pkgconfig $x11 $glib $atk $pango $perl $libtiff $libjpeg $libpng"
. $stdenv/setup
IFS=:
for i in $PATH; do echo $i; done
#exit 1
# A utility function for fixing up libtool scripts that scan in
# default directories like /usr. This is a bit of a hack. A better
# solution would be to fix libtool, but since it is included in so
# many packages that is not feasible right now.
tar xvfj $src
cd gtk+-*
./configure --prefix=$out --x-includes=$x11/include --x-libraries=$x11/lib
fixLibtool ltmain.sh
./configure --prefix=$out
make
make install

View File

@ -5,7 +5,7 @@ buildinputs="$pkgconfig $x11 $glib $xft"
tar xvfj $src
cd pango-*
./configure --prefix=$out --x-includes=$x11/include --x-libraries=$x11/lib
./configure --prefix=$out
make
make install

View File

@ -1,6 +1,6 @@
#! /bin/sh -e
buildinputs="$zlib"
buildInputs="$zlib"
. $stdenv/setup
tar xvfj $src

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfj $src || exit 1
cd pcre-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
#! /bin/sh -e
. $stdenv/setup
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "pcre-4.3";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-4.3.tar.bz2;
md5 = "7bc7d5b590a41e6f9ede30f272002a02";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,10 +1,4 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd zlib-* || exit 1
./configure --prefix=$out --shared || exit 1
make || exit 1
mkdir $out || exit 1
make install || exit 1
#! /bin/sh -e
. $stdenv/setup
configureFlags="--shared"
genericBuild

View File

@ -1,10 +1,12 @@
{stdenv, fetchurl}: derivation {
name = "zlib-1.1.4";
{stdenv, fetchurl}:
derivation {
name = "zlib-1.2.1";
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = http://www.gzip.org/zlib/zlib-1.1.4.tar.gz;
md5 = "abc405d0bdd3ee22782d7aa20e440f08";
url = http://www.gzip.org/zlib/zlib-1.2.1.tar.gz;
md5 = "ef1cb003448b4a53517b8f25adb12452";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfj $src || exit 1
cd make-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
#! /bin/sh -e
. $stdenv/setup
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl, patch}:
derivation {
name = "gnumake-3.80";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,7 @@
url = ftp://ftp.nluug.nl/pub/gnu/make/make-3.80.tar.bz2;
md5 = "0bbd1df101bc0294d440471e50feca71";
};
stdenv = stdenv;
patches = [./log.diff];
buildInputs = [patch];
inherit stdenv;
}

View File

@ -0,0 +1,125 @@
diff -rc make-3.80-orig/job.c make-3.80/job.c
*** make-3.80-orig/job.c 2002-08-10 03:27:17.000000000 +0200
--- make-3.80/job.c 2004-03-18 22:13:11.000000000 +0100
***************
*** 987,993 ****
appear. */
message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
! ? "%s" : (char *) 0, p);
/* Tell update_goal_chain that a command has been started on behalf of
this target. It is important that this happens here and not in
--- 987,993 ----
appear. */
message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
! ? "\e[3s\e[a%s\e[b" : (char *) 0, p);
/* Tell update_goal_chain that a command has been started on behalf of
this target. It is important that this happens here and not in
Only in make-3.80: job.c~
diff -rc make-3.80-orig/main.c make-3.80/main.c
*** make-3.80-orig/main.c 2002-08-10 03:27:17.000000000 +0200
--- make-3.80/main.c 2004-03-18 22:23:50.000000000 +0100
***************
*** 254,259 ****
--- 254,262 ----
they appear out of date or not. */
int always_make_flag = 0;
+
+ int logNesting = 0;
+
/* The usage output. We write it this way to make life easier for the
translators, especially those trying to translate to right-to-left
***************
*** 827,832 ****
--- 830,842 ----
}
+ static void closeNesting()
+ {
+ while (logNesting--)
+ printf("\e[q");
+ }
+
+
#ifndef _AMIGA
int
main (argc, argv, envp)
***************
*** 854,859 ****
--- 864,871 ----
no_default_sh_exe = 1;
#endif
+ atexit(closeNesting);
+
default_goal_file = 0;
reading_file = 0;
***************
*** 2782,2787 ****
--- 2794,2805 ----
/* Use entire sentences to give the translators a fighting chance. */
+ if (entering)
+ {
+ printf("\e[p");
+ logNesting++;
+ }
+
if (makelevel == 0)
if (starting_directory == 0)
if (entering)
***************
*** 2810,2813 ****
--- 2828,2837 ----
else
printf (_("%s[%u]: Leaving directory `%s'\n"),
program, makelevel, starting_directory);
+
+ if (!entering)
+ {
+ printf("\e[q");
+ logNesting--;
+ }
}
Only in make-3.80: main.c~
diff -rc make-3.80-orig/make.h make-3.80/make.h
*** make-3.80-orig/make.h 2002-09-11 18:55:44.000000000 +0200
--- make-3.80/make.h 2004-03-18 22:22:00.000000000 +0100
***************
*** 559,562 ****
--- 559,566 ----
extern int atomic_stat PARAMS ((const char *file, struct stat *buf));
extern struct dirent *atomic_readdir PARAMS ((DIR *dir));
+
#endif
+
+
+ extern int logNesting;
Only in make-3.80: make.h~
diff -rc make-3.80-orig/remake.c make-3.80/remake.c
*** make-3.80-orig/remake.c 2002-08-08 02:11:19.000000000 +0200
--- make-3.80/remake.c 2004-03-18 22:27:04.000000000 +0100
***************
*** 1049,1055 ****
--- 1049,1059 ----
/* The normal case: start some commands. */
if (!touch_flag || file->cmds->any_recurse)
{
+ message(0, "\e[pbuilding %s", file->name);
+ logNesting++;
execute_file_commands (file);
+ printf("\e[q");
+ logNesting--;
return;
}
Only in make-3.80: remake.c~

View File

@ -2,16 +2,13 @@
. $stdenv/setup
tar xvfj $src
cd binutils-*
patchConfigure() {
# Clear the default library search path.
if test "$noSysDirs" = "1"; then
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
fi
}
# Clear the default library search path.
if test "$noSysDirs" = "1"; then
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
fi
preConfigure=patchConfigure
./configure --prefix=$out
make
make install
strip -S $out/lib/*.a
genericBuild

View File

@ -5,7 +5,7 @@ derivation {
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = ftp://ftp.nluug.nl/pub/gnu/binutils/binutils-2.14.tar.bz2;
url = ftp://ftp.nl.net/pub/gnu/binutils/binutils-2.14.tar.bz2;
md5 = "2da8def15d28af3ec6af0982709ae90a";
};
inherit stdenv noSysDirs;

View File

@ -2,16 +2,24 @@
. $stdenv/setup
tar xvfj $src
cd linux-*
make include/linux/version.h
buildPhase() {
make include/linux/version.h
}
mkdir $out
mkdir $out/include
cp -prvd include/linux include/asm-i386 $out/include
cd $out/include
ln -s asm-i386 asm
buildPhase=buildPhase
# config.h includes autoconf.h, which doesn't exist.
echo -n > $out/include/linux/autoconf.h
installPhase() {
mkdir $out
mkdir $out/include
cp -prvd include/linux include/asm-i386 $out/include
cd $out/include
ln -s asm-i386 asm
echo -n > $out/include/linux/autoconf.h
}
installPhase=installPhase
genericBuild

View File

@ -1,10 +1,4 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd bash-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
(cd $out/bin; ln -s bash sh) || exit 1
#! /bin/sh -e
. $stdenv/setup
genericBuild
(cd $out/bin && ln -s bash sh) || exit 1

View File

@ -1,10 +1,12 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "bash-2.05b";
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = ftp://ftp.nluug.nl/pub/gnu/bash/bash-2.05b.tar.gz;
url = ftp://ftp.nl.net/pub/gnu/bash/bash-2.05b.tar.gz;
md5 = "5238251b4926d778dfe162f6ce729733";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -0,0 +1,93 @@
* genericBuild performs a generic build of (typically) autotool-style
packages
* unpack phase
** may be overriden by setting $unpackPhase to point at a function that
unpacks the source (which should set $sourceRoot)
** the generic unpacker unpacks all sources specified by $srcs, or
$src if $srcs is empty
** supports tar, bzipped tar, gzipped tar, compressed tar, zip
** zip must be in scope (in $buildinputs)
** additional file types may be supported by setting $findUnpacker,
which is called with a single argument specifying the file to be
unpacked
** $findUnpacker should set $unpackCmd, specifying the full command to
unpack the file (must include the file name)
** alternatively, $unpackCmd can be set before calling the generic
builder (e.g., 'unpackCmd="unrar x $src"'); this only works if
there is a single source file
** the generic unpacker then sets $sourceRoot to the name of the
directory created by unpacking the source archives
** the source archives should produce only one directory
** alternatively, $setSourceRoot may be set to a function that sets
$sourceRoot
* the generic builder then chdirs to $sourceRoot
* patch phase (skipped if neither $patchPhase nor $patches are set)
** may be overriden by setting $patchPhase to point at a function that
unpacks the source (which should set $sourceRoot)
** if the $patches variable is set, it runs `patch -p1 < ...' in
$sourceRoot for each element in $patches (the `patch' command
should be in $PATH; note that it isn't in the standard environment)
* configuration phase
** may be overriden by setting $configurePhase to point at a function
** calls $preConfigurer first, if set (useful for running
autoconf/automake)
** the configure script is specified by $configureScript, which
defaults to ./configure
** if no executable file exists at $configureScript, does nothing
** if a file ./ltmain.sh exists and $dontFixLibtool is not set, calls
function fixLibtool to remove its default search path (/usr etc.)
** adds "--prefix=$out" to $configureFlags unless $dontAddPrefix is
set
** calls $configureScript with $configureFlags
** calls $postConfigurer, if set (useful for any last-minute patches
prior to building)
* build phase
** may be overriden by setting $buildPhase to point at a function
** runs make with flags $makeFlags
* install phase
** may be overriden by setting $installPhase to point at a function
** runs make with flags $installFlags
** unless $dontStrip is set or $NIX_STRIP_DEBUG is not 1, finds all *.a
files in $out and runs "strip -S" on them (executables and dynamic
libraries can be stripped automatically by setting NIX_STRIP_DEBUG
to 1 (default))
** if $propagatedBuildInputs is set, its contents are written to
$out/nix-support/propagated-build-inputs

View File

@ -40,7 +40,14 @@ fi
findInputs()
{
local pkg=$1
pkgs=(${pkgs[@]} $pkg)
case $pkgs in
*\ $pkg\ *)
return 0
;;
esac
pkgs="$pkgs $pkg "
if test -f $pkg/nix-support/setup-hook; then
. $pkg/nix-support/setup-hook
@ -53,8 +60,11 @@ findInputs()
fi
}
pkgs=()
for i in $buildinputs; do
pkgs=""
if test -n "$buildinputs"; then
buildInputs="$buildinputs" # compatibility
fi
for i in $buildInputs; do
findInputs $i
done
@ -66,7 +76,7 @@ addToEnv()
local pkg=$1
if test -d $1/bin; then
export _PATH=$_PATH:$1/bin
export _PATH=$_PATH${_PATH:+:}$1/bin
fi
for i in "${envHooks[@]}"; do
@ -74,7 +84,7 @@ addToEnv()
done
}
for i in "${pkgs[@]}"; do
for i in $pkgs; do
addToEnv $i
done
@ -121,3 +131,285 @@ PATH=$_PATH${_PATH:+:}$PATH
if test "$NIX_DEBUG" = "1"; then
echo "Final path: $PATH"
fi
######################################################################
# What follows is the generic builder.
nestingLevel=0
startNest() {
nestingLevel=$(($nestingLevel + 1))
echo -en "\e[$1p"
}
stopNest() {
nestingLevel=$(($nestingLevel - 1))
echo -en "\e[q"
}
header() {
startNest "$2"
echo "$1"
}
# Make sure that even when we exit abnormally, the original nesting
# level is properly restored.
closeNest() {
while test $nestingLevel -gt 0; do
stopNest
done
}
trap "closeNest" EXIT
# Utility function: return the base name of the given path, with the
# prefix `HASH-' removed, if present.
stripHash() {
strippedName=$(basename $1);
if echo "$strippedName" | grep -q '^[a-f0-9]\{32\}-'; then
strippedName=$(echo "$strippedName" | cut -c34-)
fi
}
unpackFile() {
local file=$1
local cmd
case $file in
*.tar) cmd="tar xvf $file";;
*.tar.gz | *.tgz | *.tar.Z) cmd="tar xvfz $file";;
*.tar.bz2 | *.tbz2) cmd="tar xvfj $file";;
*.zip) cmd="unzip $file";;
*)
if test -d "$file"; then
stripHash $file
cmd="cp -prvd $file $strippedName"
else
if test -n "$findUnpacker"; then
$findUnpacker $1;
fi
if test -z "$unpackCmd"; then
echo "source archive $file has unknown type"
exit 1
fi
cmd=$unpackCmd
fi
;;
esac
header "unpacking source archive $file (using $cmd)" 3
$cmd
stopNest
}
unpackW() {
if test -n "$unpackPhase"; then
$unpackPhase
return
fi
if test -z "$srcs"; then
if test -z "$src"; then
echo 'variable $src or $srcs should point to the source'
exit 1
fi
srcs="$src"
fi
# To determine the source directory created by unpacking the
# source archives, we record the contents of the current
# directory, then look below which directory got added. Yeah,
# it's rather hacky.
local dirsBefore=""
for i in *; do
if test -d "$i"; then
dirsBefore="$dirsBefore $i "
fi
done
# Unpack all source archives.
for i in $srcs; do
unpackFile $i
done
# Find the source directory.
if test -n "$setSourceRoot"; then
$setSourceRoot
else
sourceRoot=
for i in *; do
if test -d "$i"; then
case $dirsBefore in
*\ $i\ *)
;;
*)
if test -n "$sourceRoot"; then
echo "unpacker produced multiple directories"
exit 1
fi
sourceRoot=$i
;;
esac
fi
done
fi
if test -z "$sourceRoot"; then
echo "unpacker appears to have produced no directories"
exit 1
fi
echo "source root is $sourceRoot"
if test -n "$postUnpack"; then
$postUnpack
fi
}
unpackPhase() {
header "unpacking sources"
unpackW
stopNest
}
patchW() {
if test -n "$patchPhase"; then
$patchPhase
return
fi
for i in $patches; do
header "applying patch $i" 3
patch -p1 < $i
stopNest
done
}
patchPhase() {
if test -z "$patchPhase" -a -z "$patches"; then return; fi
header "patching sources"
patchW
stopNest
}
fixLibtool () {
sed 's^eval sys_lib_.*search_path=.*^^' < $1 > $1.tmp
mv $1.tmp $1
}
configureW() {
if test -n "$configurePhase"; then
$configurePhase
stopNest
return
fi
if test -n "$preConfigure"; then
$preConfigure
fi
if test -z "$configureScript"; then
configureScript=./configure
fi
if ! test -x $configureScript; then
echo "no configure script, doing nothing"
return
fi
if test -z "$dontFixLibtool" -a -f ./ltmain.sh; then
fixLibtool ./ltmain.sh
fi
if test -z "$dontAddPrefix"; then
configureFlags="--prefix=$out $configureFlags"
fi
echo "configure flags: $configureFlags"
$configureScript $configureFlags
if test -n "$postConfigure"; then
$postConfigure
fi
}
configurePhase() {
header "configuring"
configureW
stopNest
}
buildW() {
if test -n "$buildPhase"; then
$buildPhase
return
fi
echo "make flags: $makeFlags"
make $makeFlags
}
buildPhase() {
header "building"
buildW
stopNest
}
installW() {
if test -n "$installPhase"; then
$installPhase
return
fi
if test -n "$preInstall"; then
$preInstall
fi
make install $installFlags
if test -z "$dontStrip" -a "$NIX_STRIP_DEBUG" = 1; then
find $out -name "*.a" -exec echo stripping {} \; -exec strip -S {} \;
fi
if test -n "$propagatedBuildInputs"; then
mkdir -f $out/nix-support
echo "$propagatedBuildInputs" > $out/nix-support/propagated-build-inputs
fi
if test -n "$postInstall"; then
$postInstall
fi
}
installPhase() {
header "installing"
installW
stopNest
}
genericBuild () {
header "building $out"
unpackPhase
cd $sourceRoot
patchPhase
configurePhase
buildPhase
installPhase
stopNest
}

View File

@ -1,13 +1,13 @@
{stdenv, glibc}:
{stdenv, glibc, genericStdenv, gccWrapper}:
(import ../generic) {
genericStdenv {
name = "stdenv-nix-linux-boot";
preHook = ./prehook-boot.sh;
initialPath = "/usr/local /usr /";
inherit stdenv;
gcc = (import ../../build-support/gcc-wrapper) {
gcc = gccWrapper {
name = "gcc-native";
nativeTools = true;
nativeGlibc = false;

View File

@ -8,7 +8,6 @@
pkgs.gnutar
pkgs.gzip
pkgs.bzip2
pkgs.wget
pkgs.binutils
pkgs.gnumake
pkgs.gcc

View File

@ -2,7 +2,7 @@
# identifier and a standard build environment, returns the set of all
# packages provided by the Nix Package Collection.
{stdenv, noSysDirs ? true}:
{stdenv, bootCurl, noSysDirs ? true}:
rec {
@ -13,6 +13,7 @@ rec {
fetchurl = (import ../build-support/fetchurl) {
inherit stdenv;
curl = bootCurl;
};
fetchsvn = (import ../build-support/fetchsvn) {
@ -86,6 +87,10 @@ rec {
inherit fetchurl stdenv;
};
curl = (import ../tools/networking/curl) {
inherit fetchurl stdenv zlib;
};
par2cmdline = (import ../tools/networking/par2cmdline) {
inherit fetchurl stdenv;
};
@ -176,6 +181,7 @@ rec {
gnumake = (import ../development/tools/build-managers/gnumake) {
inherit fetchurl stdenv;
patch = gnupatch;
};
bison = (import ../development/tools/parsing/bison) {

View File

@ -2,54 +2,54 @@ let {
pkgs = import ./i686-linux.nix;
body =
[
# pkgs.coreutils
# pkgs.findutils
# pkgs.diffutils
# pkgs.gnupatch
# pkgs.gnused
# pkgs.gnugrep
# pkgs.gawk
# pkgs.gnutar
# pkgs.zip
# pkgs.unzip
# pkgs.gzip
# pkgs.bzip2
# pkgs.wget
# pkgs.par2cmdline
# pkgs.cksfv
# pkgs.bittorrent
# pkgs.graphviz
# pkgs.bash
# pkgs.binutils
# pkgs.gnum4
# pkgs.valgrind
# pkgs.texinfo
pkgs.coreutils
pkgs.findutils
pkgs.diffutils
pkgs.gnupatch
pkgs.gnused
pkgs.gnugrep
pkgs.gawk
pkgs.gnutar
pkgs.zip
pkgs.unzip
pkgs.gzip
pkgs.bzip2
pkgs.wget
pkgs.par2cmdline
pkgs.cksfv
pkgs.bittorrent
pkgs.graphviz
pkgs.bash
pkgs.binutils
pkgs.gnum4
pkgs.valgrind
pkgs.texinfo
pkgs.octavefront
# pkgs.gnumake
# pkgs.bisonnew
# pkgs.flexnew
pkgs.gnumake
pkgs.bisonnew
pkgs.flexnew
pkgs.gcc
# pkgs.strategoxt093
# pkgs.ghc
# pkgs.helium
# pkgs.perl
# pkgs.python
# pkgs.libxml2
# pkgs.libxslt
# pkgs.docbook_xml_dtd
# pkgs.docbook_xml_xslt
pkgs.strategoxt093
pkgs.ghc
pkgs.helium
pkgs.perl
pkgs.python
pkgs.libxml2
pkgs.libxslt
pkgs.docbook_xml_dtd
pkgs.docbook_xml_xslt
pkgs.subversion
pkgs.pan
# pkgs.sylpheed
# pkgs.firefox
# pkgs.MPlayer
# pkgs.MPlayerPlugin
# pkgs.vlc
# pkgs.zapping
# pkgs.gqview
# pkgs.hello
# pkgs.nxml
# pkgs.uml
# pkgs.nix
pkgs.sylpheed
pkgs.firefox
pkgs.MPlayer
pkgs.MPlayerPlugin
pkgs.vlc
pkgs.zapping
pkgs.gqview
pkgs.hello
pkgs.nxml
pkgs.uml
pkgs.nix
];
}

View File

@ -25,7 +25,11 @@
# with it (e.g., because they require GNU Make).
stdenvNative = (import ../stdenv/native) {stdenv = stdenvInitial;};
stdenvNativePkgs = allPackages {stdenv = stdenvNative; noSysDirs = false;};
stdenvNativePkgs = allPackages {
stdenv = stdenvNative;
bootCurl = null;
noSysDirs = false;
};
# The Nix build environment.
@ -49,10 +53,14 @@
stdenvLinuxBoot1 = (import ../stdenv/nix-linux/boot.nix) {
stdenv = stdenvNative;
glibc = stdenvLinuxGlibc;
inherit genericStdenv gccWrapper;
};
# 3) Now we can build packages that will have the Nix glibc.
stdenvLinuxBoot1Pkgs = allPackages {stdenv = stdenvLinuxBoot1;};
stdenvLinuxBoot1Pkgs = allPackages {
stdenv = stdenvLinuxBoot1;
bootCurl = null;
};
# 4) However, since these packages are built by an native C compiler
# and linker, they may well pick up impure references (e.g., bash

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd tar-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
#! /bin/sh -e
. $stdenv/setup
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "gnutar-1.13.25";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = ftp://alpha.gnu.org/gnu/tar/tar-1.13.25.tar.gz;
md5 = "6ef8c906e81eee441f8335652670ac4a";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,8 +1,16 @@
#! /bin/sh
#! /bin/sh -e
. $stdenv/setup || exit 1
. $stdenv/setup
tar xvfz $src || exit 1
cd unzip-* || exit 1
make -f unix/Makefile generic || exit 1
make -f unix/Makefile prefix=$out install || exit 1
builder() {
make -f unix/Makefile generic
}
installer() {
make -f unix/Makefile prefix=$out install
}
buildPhase=builder
installPhase=installer
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "unzip-5.50";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = ftp://ftp.info-zip.org/pub/infozip/src/unzip550.tar.gz;
md5 = "798592d62e37f92571184236947122ed";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,8 +1,4 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd bzip2-* || exit 1
make || exit 1
make install PREFIX=$out || exit 1
#! /bin/sh -e
. $stdenv/setup
installFlags="PREFIX=$out"
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "bzip2-1.0.2";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = ftp://sources.redhat.com/pub/bzip2/v102/bzip2-1.0.2.tar.gz;
md5 = "ee76864958d568677f03db8afad92beb";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd gzip-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
#! /bin/sh -e
. $stdenv/setup
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "gzip-1.3.3";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = http://www.gzip.org/gzip-1.3.3.tar.gz;
md5 = "52eaf713673507d21f7abefee98ba662";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,10 +1,10 @@
#! /bin/sh
#! /bin/sh -e
buildinputs="$x11 $libpng $libjpeg $expat $freetype"
. $stdenv/setup || exit 1
. $stdenv/setup
tar xvfz $src || exit 1
cd graphviz-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
if test -z "$x11"; then
configureFlags="$configureFlags --without-x"
fi
genericBuild

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfj $src || exit 1
cd coreutils-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
#! /bin/sh -e
. $stdenv/setup
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "coreutils-5.0";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = ftp://ftp.nluug.nl/pub/gnu/coreutils/coreutils-5.0.tar.bz2;
md5 = "94e5558ee2a65723d4840bfde2d323f0";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd findutils-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
#! /bin/sh -e
. $stdenv/setup
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "findutils-4.1.20";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = ftp://alpha.gnu.org/pub/gnu/findutils/findutils-4.1.20.tar.gz;
md5 = "e90ce7222daadeb8616b8db461e17cbc";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -0,0 +1,4 @@
#! /bin/sh -e
. $stdenv/setup
configureFlags="--without-ssl"
genericBuild

View File

@ -0,0 +1,13 @@
{stdenv, fetchurl, zlib}:
derivation {
name = "curl-7.11.1";
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = http://curl.haxx.se/download/curl-7.11.1.tar.bz2;
md5 = "c2af7c3364a1a8839516f74961b6bd11";
};
buildInputs = [zlib];
inherit stdenv;
}

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd wget-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
#! /bin/sh -e
. $stdenv/setup
genericBuild

View File

@ -1,10 +1,12 @@
{stdenv, fetchurl}: derivation {
name = "wget-1.9";
{stdenv, fetchurl}:
derivation {
name = "wget-1.9.1";
system = stdenv.system;
builder = ./builder.sh;
src = fetchurl {
url = ftp://ftp.nluug.nl/pub/gnu/wget/wget-1.9.tar.gz;
md5 = "18ac093db70801b210152dd69b4ef08a";
url = ftp://ftp.nl.net/pub/gnu/wget/wget-1.9.1.tar.gz;
md5 = "e6051f1e1487ec0ebfdbda72bedc70ad";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd diffutils-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
. $stdenv/setup
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "diffutils-2.8.1";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = ftp://ftp.nluug.nl/pub/gnu/diffutils/diffutils-2.8.1.tar.gz;
md5 = "71f9c5ae19b60608f6c7f162da86a428";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfj $src || exit 1
cd gawk-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
#! /bin/sh -e
. $stdenv/setup
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "gawk-3.1.3";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = ftp://ftp.nluug.nl/pub/gnu/gawk/gawk-3.1.3.tar.bz2;
md5 = "a116eec17e7ba085febb74c7758823bd";
};
stdenv = stdenv;
inherit stdenv;
}

View File

@ -1,14 +1,3 @@
#! /bin/sh -e
set -x
export NIX_DEBUG=1
buildinputs="$pcre"
. $stdenv/setup
echo $NIX_LDFLAGS
tar xvfj $src
cd grep-*
./configure --prefix=$out
make
make install
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl, pcre}: derivation {
{stdenv, fetchurl, pcre}:
derivation {
name = "gnugrep-2.5.1";
system = stdenv.system;
builder = ./builder.sh;
@ -6,6 +8,6 @@
url = ftp://ftp.nluug.nl/pub/gnu/grep/grep-2.5.1.tar.bz2;
md5 = "ddd99e2d5d4f4611357e31e97f080cf2";
};
stdenv = stdenv;
pcre = pcre;
buildInputs = [pcre];
inherit stdenv;
}

View File

@ -1,9 +1,3 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfz $src || exit 1
cd sed-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
. $stdenv/setup
genericBuild

View File

@ -1,4 +1,6 @@
{stdenv, fetchurl}: derivation {
{stdenv, fetchurl}:
derivation {
name = "gnused-4.0.7";
system = stdenv.system;
builder = ./builder.sh;
@ -6,5 +8,5 @@
url = ftp://ftp.nluug.nl/pub/gnu/sed/sed-4.0.7.tar.gz;
md5 = "005738e7f97bd77d95b6907156c8202a";
};
stdenv = stdenv;
inherit stdenv;
}