* Converting packages. This is the minimal Nix stdenv for building

the ATerm library.

svn path=/nixpkgs/trunk/; revision=459
This commit is contained in:
Eelco Dolstra 2003-11-02 17:42:19 +00:00
parent 30f2bf8a85
commit 1894a8b86c
42 changed files with 667 additions and 22 deletions

View file

@ -0,0 +1,9 @@
#! /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

View file

@ -0,0 +1,10 @@
{stdenv, fetchurl}: derivation
{ name = "gnutar-1.13.25"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://alpha.gnu.org/gnu/tar/tar-1.13.25.tar.gz
, md5 = "6ef8c906e81eee441f8335652670ac4a"
}
, stdenv = stdenv
}

View file

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

View file

@ -0,0 +1,10 @@
{stdenv, fetchurl}: derivation
{ name = "bzip2-1.0.2"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://sources.redhat.com/pub/bzip2/v102/bzip2-1.0.2.tar.gz
, md5 = "ee76864958d568677f03db8afad92beb"
}
, stdenv = stdenv
}

View file

@ -0,0 +1,9 @@
#! /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

View file

@ -0,0 +1,10 @@
{stdenv, fetchurl}: derivation
{ name = "gzip-1.3.3"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = http://www.gzip.org/gzip-1.3.3.tar.gz
, md5 = "52eaf713673507d21f7abefee98ba662"
}
, stdenv = stdenv
}

View file

@ -0,0 +1,56 @@
#! /bin/sh
buildinputs="$binutils"
. $stdenv/setup || exit 1
tar xvfj $src || exit 1
if test "$noSysDirs" == "1"; then
# Disable the standard include directories.
cd gcc-* || exit 1
cat >> ./gcc/cppdefault.h <<EOF
#undef LOCAL_INCLUDE_DIR
#undef SYSTEM_INCLUDE_DIR
#undef STANDARD_INCLUDE_DIR
EOF
cd .. || exit 1
fi
# Configure.
mkdir build || exit 1
cd build || exit 1
../gcc-*/configure --prefix=$out --enable-languages=c,c++ || exit 1
if test "$noSysDirs" == "1"; then
# Patch some of the makefiles to force linking against our own glibc.
extraflags="-Wl,-s $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK"
for i in $NIX_LDFLAGS; do
extraflags="$extraflags -Wl,$i"
done
mf=Makefile
sed \
-e "s^FLAGS_FOR_TARGET =\(.*\)^FLAGS_FOR_TARGET = \1 $extraflags^" \
< $mf > $mf.tmp || exit 1
mv $mf.tmp $mf
mf=gcc/Makefile
sed \
-e "s^X_CFLAGS =\(.*\)^X_CFLAGS = \1 $extraflags^" \
< $mf > $mf.tmp || exit 1
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 || exit 1
mv $mf.tmp $mf
fi
# Build and install.
make bootstrap || exit 1
make install || exit 1
find $out -name "*.a" -exec strip -S {} \; || exit 1

View file

@ -0,0 +1,12 @@
{stdenv, fetchurl, binutils}: derivation
{ name = "gcc-3.3.2"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://ftp.nluug.nl/pub/gnu/gcc/gcc-3.3.2/gcc-3.3.2.tar.bz2
, md5 = "65999f654102f5438ac8562d13a6eced"
}
, stdenv = stdenv
, binutils = binutils
, noSysDirs = stdenv.noSysDirs
}

View file

@ -0,0 +1,9 @@
#! /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

View file

@ -0,0 +1,10 @@
{stdenv, fetchurl}: derivation
{ name = "pcre-4.3"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-4.3.tar.bz2
, md5 = "7bc7d5b590a41e6f9ede30f272002a02"
}
, stdenv = stdenv
}

View file

@ -0,0 +1,17 @@
#! /bin/sh
. $stdenv/setup || exit 1
tar xvfj $src || exit 1
cd binutils-* || exit 1
# Clear the default library search path.
if test "$noSysDirs" == "1"; then
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt || exit 1
fi
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1
strip -S $out/lib/*.a || exit 1

View file

@ -0,0 +1,11 @@
{stdenv, fetchurl}: derivation
{ name = "binutils-2.14"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://ftp.nluug.nl/pub/gnu/binutils/binutils-2.14.tar.bz2
, md5 = "2da8def15d28af3ec6af0982709ae90a"
}
, stdenv = stdenv
, noSysDirs = stdenv.noSysDirs
}

View file

@ -0,0 +1,9 @@
#! /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

View file

@ -0,0 +1,10 @@
{stdenv, fetchurl}: derivation
{ name = "gnumake-3.80"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://ftp.nluug.nl/pub/gnu/make/make-3.80.tar.bz2
, md5 = "0bbd1df101bc0294d440471e50feca71"
}
, stdenv = stdenv
}

View file

@ -0,0 +1,21 @@
#! /bin/sh
. $stdenv/setup
echo "downloading $url into $out..."
#prefetch=@prefix@/store/nix-prefetch-url-$md5
prefetch=/nix/store/nix-prefetch-url-$md5
if test -f "$prefetch"; then
echo "using prefetched $prefetch";
mv $prefetch $out || exit 1
else
wget --passive-ftp "$url" -O "$out" || exit 1
fi
#actual=$(@bindir@/nix-hash --flat $out)
actual=$(/nix/bin/nix-hash --flat $out)
if test "$actual" != "$md5"; then
echo "hash is $actual, expected $md5"
exit 1
fi

View file

@ -1,8 +1,9 @@
{stdenv}: {url, md5}: derivation
{ name = "fetchurl"
{ name = baseNameOf (toString url)
, system = stdenv.system
, builder = ./builder.sh
, stdenv = stdenv
, url = url
, md5 = md5
, id = md5
}

10
pkgs-ng/shells/bash/builder.sh Executable file
View file

@ -0,0 +1,10 @@
#! /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

View file

@ -0,0 +1,10 @@
{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
, md5 = "5238251b4926d778dfe162f6ce729733"
}
, stdenv = stdenv
}

View file

@ -1,4 +0,0 @@
#! /bin/sh
echo BAR
exit 1

View file

@ -1,5 +0,0 @@
{system}: derivation
{ name = "stdenv"
, system = system
, builder = ./builder.sh
}

View file

@ -0,0 +1,41 @@
#! /bin/sh
# Set up the initial path.
for i in $initialPath; do
PATH=$PATH:$i/bin
done
# Make output directories.
mkdir $out || exit 1
mkdir $out/bin || exit 1
# Create the setup script.
sed \
-e "s^@OUT@^$out^g" \
-e "s^@PREHOOK@^$prehook^g" \
-e "s^@POSTHOOK@^$posthook^g" \
-e "s^@INITIALPATH@^$initialPath^g" \
-e "s^@PARAM1@^$param1^g" \
-e "s^@PARAM2@^$param2^g" \
-e "s^@PARAM3@^$param3^g" \
-e "s^@PARAM4@^$param4^g" \
-e "s^@PARAM5@^$param5^g" \
< $setup > $out/setup || exit 1
# Create the gcc wrapper.
sed \
-e 's^@GCC\@^$NIX_CC^g' \
< $gccwrapper > $out/bin/gcc || exit 1
chmod +x $out/bin/gcc || exit 1
ln -s gcc $out/bin/cc || exit 1
# Create the g++ wrapper.
sed \
-e 's^@GCC\@^$NIX_CXX^g' \
< $gccwrapper > $out/bin/g++ || exit 1
chmod +x $out/bin/g++ || exit 1
ln -s g++ $out/bin/c++ || exit 1
# Create the ld wrapper.
cp $ldwrapper $out/bin/ld || exit 1
chmod +x $out/bin/ld || exit 1

View file

@ -0,0 +1,22 @@
{system, name, noSysDirs, prehook, posthook, initialPath,
param1, param2, param3, param4, param5}: derivation
{ name = name
, system = system
, builder = ./builder.sh
, noSysDirs = noSysDirs
, setup = ./setup.sh
, gccwrapper = ./gcc-wrapper.sh
, ldwrapper = ./ld-wrapper.sh
, prehook = prehook
, posthook = posthook
, initialPath = initialPath
# TODO: make this more elegant.
, param1 = param1
, param2 = param2
, param3 = param3
, param4 = param4
, param5 = param5
}

View file

@ -0,0 +1,42 @@
#! /bin/sh
IFS=
justcompile=0
for i in $@; do
if test "$i" == "-c"; then
justcompile=1
elif test "$i" == "-S"; then
justcompile=1
elif test "$i" == "-E"; then
justcompile=1
elif test "$i" == "-E"; then
justcompile=1
elif test "$i" == "-M"; then
justcompile=1
elif test "$i" == "-MM"; then
justcompile=1
fi
done
IFS=" "
extra=($NIX_CFLAGS_COMPILE)
if test "$justcompile" != "1"; then
extra=(${extra[@]} $NIX_CFLAGS_LINK)
for i in $NIX_LDFLAGS; do
extra=(${extra[@]} "-Wl,$i")
done
if test "$NIX_STRIP_DEBUG" == "1"; then
extra=(${extra[@]} -g0 -Wl,-s)
fi
fi
if test "$NIX_DEBUG" == "1"; then
echo "extra flags to @GCC@:" >&2
for i in ${extra[@]}; do
echo " $i" >&2
done
fi
IFS=
exec @GCC@ $@ ${extra[@]}

View file

@ -0,0 +1,17 @@
#! /bin/sh
IFS=" "
extra=($NIX_CFLAGS_LINK $NIX_LDFLAGS)
if test "$NIX_STRIP_DEBUG" == "1"; then
extra=(${extra[@]} -s)
fi
if test "$NIX_DEBUG" == "1"; then
echo "extra flags to @LD@:" >&2
for i in ${extra[@]}; do
echo " $i" >&2
done
fi
IFS=
exec $NIX_LD $@ ${extra[@]}

View file

@ -0,0 +1,65 @@
# Set up the initial path.
for i in @INITIALPATH@; do
PATH=$PATH:$i/bin
done
echo $PATH
# Execute the pre-hook.
param1=@PARAM1@
param2=@PARAM2@
param3=@PARAM3@
param4=@PARAM4@
param5=@PARAM5@
. @PREHOOK@
# Add the directory containing the GCC wrappers to the PATH.
export PATH=@OUT@/bin:$PATH
# Recursively add all buildinputs to the relevant environment variables.
addtoenv()
{
pkgs="$buildinputs $1"
if test -d $1/bin; then
export PATH=$1/bin:$PATH
fi
if test -d $1/lib; then
export NIX_CFLAGS_LINK="-L$1/lib $NIX_CFLAGS_LINK"
export NIX_LDFLAGS="-rpath $1/lib $NIX_LDFLAGS"
fi
if test -d $1/lib/pkgconfig; then
export PKG_CONFIG_PATH=$1/lib/pkgconfig:$PKG_CONFIG_PATH
fi
if test -d $1/include; then
export NIX_CFLAGS_COMPILE="-I$1/include $NIX_CFLAGS_COMPILE"
fi
if test -f $1/propagated-build-inputs; then
for i in $(cat $1/propagated-build-inputs); do
addtoenv $i
done
fi
}
oldbuildinputs=$buildinputs
buildinputs=
for i in $oldbuildinputs; do
addtoenv $i
done
# Add the output as an rpath.
export NIX_LDFLAGS="-rpath $out/lib $NIX_LDFLAGS"
# Strip debug information by default.
export NIX_STRIP_DEBUG=1
# Execute the post-hook.
. @POSTHOOK@
if test "$NIX_DEBUG" == "1"; then
echo "Setup: PATH=$PATH"
fi

View file

@ -0,0 +1,13 @@
{system}: (import ../generic)
{ name = "stdenv-native"
, system = system
, prehook = ./prehook.sh
, posthook = ./posthook.sh
, initialPath = "/usr/local /usr /"
, param1 = ""
, param2 = ""
, param3 = ""
, param4 = ""
, param5 = ""
, noSysDirs = false
}

View file

View file

@ -0,0 +1,5 @@
export SHELL=/bin/sh
export NIX_CC=/usr/bin/gcc
export NIX_CXX=/usr/bin/g++
export NIX_LD=/usr/bin/ld

View file

@ -0,0 +1,23 @@
{bootStdenv, pkgs}: (import ../generic)
{ name = "stdenv-nix"
, system = bootStdenv.system
, prehook = ./prehook.sh
, posthook = ./posthook.sh
, initialPath =
[ pkgs.coreutils
, pkgs.findutils
, pkgs.gnused
, pkgs.gnugrep
, pkgs.gnutar
, pkgs.gzip
, pkgs.binutils
, pkgs.gnumake
, pkgs.gcc
]
, param1 = pkgs.bash
, param2 = pkgs.gcc
, param3 = pkgs.binutils
, param4 = ""
, param5 = ""
, noSysDirs = false
}

View file

View file

@ -0,0 +1,7 @@
export SHELL=$param1
echo "SHELL = $SHELL"
export NIX_CC=$param2/bin/gcc
export NIX_CXX=$param2/bin/g++
export NIX_LD=$param3/bin/ld

View file

@ -0,0 +1,9 @@
#! /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

View file

@ -0,0 +1,10 @@
{stdenv, fetchurl}: derivation
{ name = "coreutils-5.0"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://ftp.nluug.nl/pub/gnu/coreutils/coreutils-5.0.tar.bz2
, md5 = "94e5558ee2a65723d4840bfde2d323f0"
}
, stdenv = stdenv
}

View file

@ -0,0 +1,9 @@
#! /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

View file

@ -0,0 +1,10 @@
{stdenv, fetchurl}: derivation
{ name = "findutils-4.1.20"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://alpha.gnu.org/pub/gnu/findutils/findutils-4.1.20.tar.gz
, md5 = "e90ce7222daadeb8616b8db461e17cbc"
}
, stdenv = stdenv
}

View file

@ -0,0 +1,10 @@
#! /bin/sh
buildinputs="$pcre"
. $stdenv/setup || exit 1
tar xvfj $src || exit 1
cd grep-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make install || exit 1

View file

@ -0,0 +1,11 @@
{stdenv, fetchurl, pcre}: derivation
{ name = "gnugrep-2.5.1"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://ftp.nluug.nl/pub/gnu/grep/grep-2.5.1.tar.bz2
, md5 = "ddd99e2d5d4f4611357e31e97f080cf2"
}
, stdenv = stdenv
, pcre = pcre
}

View file

@ -0,0 +1,9 @@
#! /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

View file

@ -0,0 +1,10 @@
{stdenv, fetchurl}: derivation
{ name = "gnused-4.0.7"
, system = stdenv.system
, builder = ./builder.sh
, src = fetchurl
{ url = ftp://ftp.nluug.nl/pub/gnu/sed/sed-4.0.7.tar.gz
, md5 = "005738e7f97bd77d95b6907156c8202a"
}
, stdenv = stdenv
}

View file

@ -0,0 +1,82 @@
# This file evaluates to a function that, when supplied with a system
# identifier and a standard build environment, returns the set of all
# packages provided by the Nix Package Collection.
{system, stdenv}: rec
{ fetchurl = (import ../fetchurl)
{ stdenv = stdenv
}
# sys-utils/coreutils
, coreutils = (import ../sys-utils/coreutils)
{ fetchurl = fetchurl
, stdenv = stdenv
}
# sys-utils/findutils
, findutils = (import ../sys-utils/findutils)
{ fetchurl = fetchurl
, stdenv = stdenv
}
# sys-utils/gnused
, gnused = (import ../sys-utils/gnused)
{ fetchurl = fetchurl
, stdenv = stdenv
}
# sys-utils/gnugrep
, gnugrep = (import ../sys-utils/gnugrep)
{ fetchurl = fetchurl
, stdenv = stdenv
, pcre = pcre
}
# archivers/gnutar
, gnutar = (import ../archivers/gnutar)
{ fetchurl = fetchurl
, stdenv = stdenv
}
# compression/gzip
, gzip = (import ../compression/gzip)
{ fetchurl = fetchurl
, stdenv = stdenv
}
# shells/bash
, bash = (import ../shells/bash)
{ fetchurl = fetchurl
, stdenv = stdenv
}
# devel/tools/binutils
, binutils = (import ../devel/tools/binutils)
{ fetchurl = fetchurl
, stdenv = stdenv
}
# devel/tools/gnumake
, gnumake = (import ../devel/tools/gnumake)
{ fetchurl = fetchurl
, stdenv = stdenv
}
# devel/compilers/gcc
, gcc = (import ../devel/compilers/gcc)
{ fetchurl = fetchurl
, stdenv = stdenv
, binutils = binutils
}
# devel/libs/pcre
, pcre = (import ../devel/libs/pcre)
{ fetchurl = fetchurl
, stdenv = stdenv
}
, aterm = (import ../aterm)
{ fetchurl = fetchurl
, stdenv = stdenv
}
}

View file

@ -1,14 +1,41 @@
{system}: rec
{ stdenv = (import ../stdenv)
{ system = system
# This file evaluates to a function that, when supplied with a system
# identifier, returns the set of all packages provided by the Nix
# Package Collection. It does this by supplying
# `all-packages-generic.fix' with a standard build environment.
#
# On Linux systems, the standard build environment consists of
# Nix-built instances glibc and the `standard' Unix tools, i.e., the
# Posix utilities, the GNU C compiler, and so on. On other systems,
# we use the native C library.
{system}: let
{ allPackages = import ./all-packages-generic.fix
# The native (i.e., impure) build environment. This one uses the
# tools installed on the system outside of the Nix environment,
# i.e., the stuff in /bin, /usr/bin, etc. This environment should
# be used with care, since many Nix packages will not build properly
# with it (e.g., because they require GNU Make).
, stdenvNative = (import ../stdenv/native) {system = system}
# The Nix build environment.
, stdenvNixPkgs = allPackages {system = system, stdenv = stdenvNative}
, stdenvNix = (import ../stdenv/nix)
{ bootStdenv = stdenvNative
, pkgs = stdenvNixPkgs
}
, fetchurl = (import ../fetchurl)
{ stdenv = stdenv
}
# The Linux build environment consists of the Nix build environment
# built against the GNU C Library.
, stdenvLinux = (import ../stdenv/nix-linux) {baseStdenv = stdenvNix}
, aterm = (import ../aterm)
{ fetchurl = fetchurl
, stdenv = stdenv
}
}
# Select the right one.
, stdenv =
if system == "i686-suse-linux"
then stdenvNix
else stdenvNix
# Instantiate.
, body = allPackages {system = system, stdenv = stdenv}
}

View file

@ -5,4 +5,4 @@
, pkgs =
[ ((import ./all-packages.fix) {system = system}).aterm
]
}
}