* Merged the stdenv branch. Enjoy! :-)

svn path=/nixpkgs/trunk/; revision=19851
This commit is contained in:
Eelco Dolstra 2010-02-05 23:27:49 +00:00
commit a1be21e057
226 changed files with 7190 additions and 1625 deletions

View File

@ -22,6 +22,8 @@ stdenv.mkDerivation rec {
# Don't set PAM_RHOST to "localhost", it confuses ConsoleKit
# (which assumes that a non-empty string means a remote session).
./pam2.patch
./slim-1.3.1-gcc4.4.patch
];
buildInputs = [x11 libjpeg libpng libXmu freetype pam];

View File

@ -0,0 +1,17 @@
Patch to allow compilation with gcc-4.4
Notified by Daniel J. - from Debian bug tracker
http://bugs.gentoo.org/252745
--- a/switchuser.h 2008-11-11 19:40:18.000000000 +0000
+++ a/switchuser.h 2008-11-11 19:40:28.000000000 +0000
@@ -18,6 +18,7 @@
#include <pwd.h>
#include <grp.h>
#include <paths.h>
+#include <cstdio>
#include <iostream>
#include "const.h"
#include "cfg.h"

View File

@ -4,14 +4,12 @@ stdenv.mkDerivation (rec {
name = "pqiv-0.8";
src = fetchurl {
url = "http://www.pberndt.com/raw//Programme/Linux/pqiv/_download/pqiv-0.8.tbz";
url = "http://www.pberndt.com/raw/Programme/Linux/pqiv/_download/${name}.tbz";
sha256 = "365332bab4b13ca56da6935e7155af20658e67d323808942dce23e880466f66d";
};
buildInputs = [ getopt which pkgconfig gtk ];
unpackCmd="bzip2 -d < $src | tar xvf - || fail";
preConfigure=''
substituteInPlace configure --replace /bin/bash "$shell"
sed -i -e 's|$(tempfile -s.*)|temp.c|' -e 's|tempfile|mktemp|' configure

View File

@ -1,41 +1,36 @@
args : with args; let localDefs = builderDefs.passthru.function (args // rec {
version = lib.attrByPath ["version"] "5.10" args;
src = /* put a fetchurl here */
fetchurl {
url = "http://www.jwz.org/xscreensaver/xscreensaver-${version}.tar.gz";
sha256 = "07zy157wqwgcapqycyv89yabxa8byk4p8jn3zlvhf7lx5w1xmval";
};
useConfig = true;
reqsList = [
["true" "libX11" "pkgconfig" "bc" "perl" "intltool" "libXmu"]
["GL" "mesa"]
["GUI" "gtk" "libxml2" "libglade"]
["jpeg" "libjpeg"]
["false"]
];
configFlags = [
"GL" " --with-gl "
"gdkpixbuf" " --with-pixbuf "
"DPMS" " --with-dpms "
"true" (" --with-x-app-defaults=\$out/share/xscreensaver/app-defaults "+
" --with-hackdir=\$out/share/xscreensaver-hacks ")
];
});
in with localDefs;
let
preConfigure = fullDepEntry ("
sed -e 's%@GTK_DATADIR@%@datadir@% ; s%@PO_DATADIR@%@datadir@%' "+
"-i driver/Makefile.in po/Makefile.in.in;
") ["minInit" "doUnpack"];
in
{ stdenv, fetchurl, pkgconfig, bc, perl, xlibs, libjpeg, mesa, gtk
, libxml2, libglade }:
stdenv.mkDerivation rec {
name = "xscreensaver-5.10";
buildCommand = textClosure localDefs
[preConfigure doConfigure doMakeInstall doForceShare doPropagate];
meta = {
description = "A set of screensavers";
inherit src;
maintainers = [stdenv.lib.maintainers.raskin];
platforms = stdenv.lib.platforms.allBut "i686-cygwin";
};
name = "xscreensaver-5.10";
src = fetchurl {
url = "http://www.jwz.org/xscreensaver/${name}.tar.gz";
sha256 = "07zy157wqwgcapqycyv89yabxa8byk4p8jn3zlvhf7lx5w1xmval";
};
buildInputs =
[ pkgconfig bc perl libjpeg mesa gtk libxml2 libglade
xlibs.xlibs xlibs.libXmu
];
configureFlags =
[ "--with-gl"
"--with-dpms"
"--with-pixbuf"
"--with-x-app-defaults=\$out/share/xscreensaver/app-defaults"
"--with-hackdir=\$out/share/xscreensaver-hacks"
];
preConfigure =
''
sed -e 's%@GTK_DATADIR@%@datadir@% ; s%@PO_DATADIR@%@datadir@%' \
-i driver/Makefile.in po/Makefile.in.in
'';
meta = {
description = "A set of screensavers";
maintainers = [ stdenv.lib.maintainers.raskin ];
platforms = stdenv.lib.platforms.allBut "i686-cygwin";
};
}

View File

@ -1,6 +1,6 @@
{ stdenv, fetchurl, glibc, mesa, freetype, glib, libSM, libICE, libXi, libXv,
libXrender, libXrandr, libXfixes, libXcursor, libXinerama, libXext, libX11,
zlib, patchelf05 }:
zlib }:
/* I haven't found any x86_64 package from them */
assert stdenv.system == "i686-linux";
@ -55,12 +55,12 @@ stdenv.mkDerivation {
fullPath=$fullPath:$i/lib
done
${patchelf05}/bin/patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
--set-rpath $fullPath \
$out/opt/googleearth/googleearth-bin
for a in $out/opt/googleearth/*.so* ; do
${patchelf05}/bin/patchelf --set-rpath $fullPath $a
patchelf --set-rpath $fullPath $a
done
'';

View File

@ -6,14 +6,18 @@ assert sslSupport -> openssl != null;
stdenv.mkDerivation {
name = "lynx-2.8.7";
src = fetchurl {
url = http://lynx.isc.org/lynx2.8.7/lynx2.8.7.tar.bz2;
sha256 = "1baxwpdvak6nalr943g22z67r1d3fbibbkqvkvvar9xlvrs9gv20";
};
configureFlags = (if sslSupport then "--with-ssl" else "");
buildInputs = [ncurses (if sslSupport then openssl else null)];
configureFlags = if sslSupport then "--with-ssl" else "";
buildInputs = [ ncurses ] ++ stdenv.lib.optional sslSupport openssl;
meta = {
homepage = http://lynx.isc.org/;
description = "A text-mode web browser";
};
}

View File

@ -13,6 +13,14 @@ stdenv.mkDerivation {
sha1 = "a0bd98ea1ba174800896611e3305a6b6d8dbde2f";
};
patches =
[ # Build on GCC 4.4.
(fetchurl {
url = "http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/net-nntp/pan/files/pan-0.133-gcc44.patch?rev=1.1";
sha256 = "05xmgvcpl1gjcfab8xsdy400p55j59hp52fwa4qbwlqy3c35qv1v";
})
];
buildInputs = [pkgconfig gtk perl pcre gmime gettext]
++ stdenv.lib.optional spellChecking gtkspell;

View File

@ -1,10 +1,10 @@
{stdenv, fetchurl, ocaml, zlib, bzip2, ncurses, file, gd, libpng }:
stdenv.mkDerivation {
stdenv.mkDerivation (rec {
name = "mldonkey-3.0.1";
src = fetchurl {
url = "mirror://sourceforge/mldonkey/mldonkey-3.0.1.tar.bz2";
url = "mirror://sourceforge/mldonkey/${name}.tar.bz2";
sha256 = "09zk53rfdkjipf5sl37rypzi2mx0a5v57vsndj22zajkqr4l0zds";
};
@ -14,5 +14,16 @@ stdenv.mkDerivation {
};
buildInputs = [ ocaml zlib ncurses bzip2 file gd libpng ];
configureFlags = [ "--disable-gui" "--enable-ocamlver=3.11.1" ];
}
configureFlags = [ "--disable-gui" ];
} // (if (stdenv.system != "i686-linux" && stdenv.system != "x86_64-linux") then
{
# Byte code compilation (the ocaml opt compiler is not supported in many platforms)
buildPhase = "make mlnet.byte";
installPhase = ''
ensureDir $out/bin
cp mlnet.byte $out/bin/mlnet
'';
# ocaml bytecode selfcontained binaries loose the bytecode if stripped
dontStrip = true;
} else {}))

View File

@ -2,11 +2,22 @@
stdenv.mkDerivation {
name = "xplanet-1.2.1";
src = fetchurl {
url = mirror://sourceforge/xplanet/xplanet-1.2.1.tar.gz;
sha256 = "1pp55a1rgjkfcrwc00y3l48fhpqcp3qagd1zbym6zg27fzi5fbgm";
};
patches =
[ # Build on GCC 4.4.
(fetchurl {
url = "http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/x11-misc/xplanet/files/xplanet-1.2.1-gentoo.patch?rev=1.1";
sha256 = "0mmagjizj4hj057qmpi45w95zlrqda32x96xy44f6126xzj02yd5";
})
];
buildInputs = [ pkgconfig freetype pango libpng libtiff giflib libjpeg ];
meta = {
description = "Renders an image of the earth or other planets into the X root window";
homepage = http://xplanet.sourceforge.net;

View File

@ -1,5 +1,5 @@
export NIX_CFLAGS_COMPILE="@cflagsCompile@ $NIX_CFLAGS_COMPILE"
export NIX_CFLAGS_LINK="@cflagsLink@ $NIX_CFLAGS_LINK"
export NIX_LDFLAGS="@ldflags@ $NIX_LDFLAGS"
export NIX_LDFLAGS_BEFORE="@ldflagsBefore@ $NIX_LDFLAGS_BEFORE"
export NIX_GLIBC_FLAGS_SET=1
export NIX_CROSS_CFLAGS_COMPILE="@cflagsCompile@ $NIX_CROSS_CFLAGS_COMPILE"
export NIX_CROSS_CFLAGS_LINK="@cflagsLink@ $NIX_CROSS_CFLAGS_LINK"
export NIX_CROSS_LDFLAGS="@ldflags@ $NIX_CROSS_LDFLAGS"
export NIX_CROSS_LDFLAGS_BEFORE="@ldflagsBefore@ $NIX_CROSS_LDFLAGS_BEFORE"
export NIX_CROSS_GLIBC_FLAGS_SET=1

View File

@ -5,17 +5,10 @@ source $stdenv/setup
cflagsCompile="-B$out/bin/"
if test -z "$nativeLibc"; then
# The "-B$glibc/lib/" flag is a quick hack to force gcc to link
# against the crt1.o from our own glibc, rather than the one in
# /usr/lib. The real solution is of course to prevent those paths
# from being used by gcc in the first place.
# The dynamic linker is passed in `ldflagsBefore' to allow
# explicit overrides of the dynamic linker by callers to gcc/ld
# (the *last* value counts, so ours should come first).
cflagsCompile="$cflagsCompile -B$libc/usr/lib/ -isystem $libc/usr/include"
ldflags="$ldflags -L$libc/usr/lib"
#ldflagsBefore="-dynamic-linker $libc/lib/ld-linux.so.2"
ldflagsBefore="-dynamic-linker $libc/lib/ld-uClibc.so.0"
cflagsCompile="$cflagsCompile -B$libc/lib/ -isystem $libc/include"
ldflags="$ldflags -L$libc/lib"
ldflagsBefore="-dynamic-linker $libc/lib/ld-linux.so.?"
#ldflagsBefore="-dynamic-linker $libc/lib/ld-uClibc.so.0"
fi
if test -n "$nativeTools"; then
@ -24,7 +17,7 @@ if test -n "$nativeTools"; then
else
ldflags="$ldflags -L$gcc/lib"
gccPath="$gcc/bin"
ldPath="$binutils/bin"
ldPath="$binutils/$crossConfig/bin"
fi
@ -47,6 +40,7 @@ doSubstitute() {
--subst-var "cflagsLink" \
--subst-var "ldflags" \
--subst-var "ldflagsBefore" \
--subst-var "ldPath" \
--subst-var-by "ld" "$ldPath/ld"
}
@ -67,24 +61,24 @@ mkGccWrapper() {
chmod +x "$dst"
}
mkGccWrapper $out/bin/$cross-gcc $gccPath/$cross-gcc
mkGccWrapper $out/bin/$crossConfig-gcc $gccPath/$crossConfig-gcc
#ln -s gcc $out/bin/cc
mkGccWrapper $out/bin/g++ $gccPath/g++
ln -s g++ $out/bin/c++
mkGccWrapper $out/bin/$crossConfig-g++ $gccPath/$crossConfig-g++
ln -s $crossConfig-g++ $out/bin/$crossConfig-c++
mkGccWrapper $out/bin/g77 $gccPath/g77
ln -s g77 $out/bin/f77
mkGccWrapper $out/bin/$crossConfig-g77 $gccPath/$crossConfig-g77
ln -s $crossConfig-g77 $out/bin/$crossConfig-f77
ln -s $binutils/bin/$cross-ar $out/bin/$cross-ar
ln -s $binutils/bin/$cross-as $out/bin/$cross-as
ln -s $binutils/bin/$cross-nm $out/bin/$cross-nm
ln -s $binutils/bin/$cross-strip $out/bin/$cross-strip
ln -s $binutils/bin/$crossConfig-ar $out/bin/$crossConfig-ar
ln -s $binutils/bin/$crossConfig-as $out/bin/$crossConfig-as
ln -s $binutils/bin/$crossConfig-nm $out/bin/$crossConfig-nm
ln -s $binutils/bin/$crossConfig-strip $out/bin/$crossConfig-strip
# Make a wrapper around the linker.
doSubstitute "$ldWrapper" "$out/bin/$cross-ld"
chmod +x "$out/bin/$cross-ld"
doSubstitute "$ldWrapper" "$out/bin/$crossConfig-ld"
chmod +x "$out/bin/$crossConfig-ld"
# Emit a setup hook. Also store the path to the original GCC and

View File

@ -5,13 +5,13 @@
# stdenv.mkDerivation provides a wrapper that sets up the right environment
# variables so that the compiler and the linker just "work".
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
, gcc ? null, libc ? null, binutils ? null, shell ? "", cross ? ""
{ name ? "", stdenv, nativeTools, nativeLibc, noLibc ? false, nativePrefix ? ""
, gcc ? null, libc ? null, binutils ? null, shell ? "", cross
}:
assert nativeTools -> nativePrefix != "";
assert !nativeTools -> gcc != null && binutils != null;
assert !nativeLibc -> libc != null;
assert !noLibc -> (!nativeLibc -> libc != null);
stdenv.mkDerivation {
builder = ./builder.sh;
@ -20,13 +20,18 @@ stdenv.mkDerivation {
ldWrapper = ./ld-wrapper.sh;
utils = ./utils.sh;
addFlags = ./add-flags;
inherit nativeTools nativeLibc nativePrefix gcc libc binutils cross;
inherit nativeTools nativeLibc nativePrefix gcc libc binutils;
crossConfig = if (cross != null) then cross.config else null;
name = if name == "" then gcc.name else name;
langC = if nativeTools then true else gcc.langC;
langCC = if nativeTools then true else gcc.langCC;
langF77 = if nativeTools then false else gcc.langF77;
langF77 = if nativeTools then false else gcc ? langFortran;
shell = if shell == "" then stdenv.shell else shell;
meta = if gcc != null then gcc.meta else
{ description = "System C compiler wrapper";
};
passthru = {
target = cross;
};
}

View File

@ -4,7 +4,7 @@ if test -n "$NIX_GCC_WRAPPER_START_HOOK"; then
source "$NIX_GCC_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GLIBC_FLAGS_SET"; then
if test -z "$NIX_CROSS_GLIBC_FLAGS_SET"; then
source @out@/nix-support/add-flags
fi
@ -63,28 +63,28 @@ fi
# Add the flags for the C compiler proper.
extraAfter=($NIX_CFLAGS_COMPILE)
extraAfter=($NIX_CROSS_CFLAGS_COMPILE)
extraBefore=()
if test "$dontLink" != "1"; then
# Add the flags that should only be passed to the compiler when
# linking.
extraAfter=(${extraAfter[@]} $NIX_CFLAGS_LINK)
extraAfter=(${extraAfter[@]} $NIX_CROSS_CFLAGS_LINK)
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
for i in $NIX_LDFLAGS_BEFORE; do
# `ld-wrapper' from adding NIX_CROSS_LDFLAGS again).
for i in $NIX_CROSS_LDFLAGS_BEFORE; do
extraBefore=(${extraBefore[@]} "-Wl,$i")
done
for i in $NIX_LDFLAGS; do
for i in $NIX_CROSS_LDFLAGS; do
if test "${i:0:3}" = "-L/"; then
extraAfter=(${extraAfter[@]} "$i")
else
extraAfter=(${extraAfter[@]} "-Wl,$i")
fi
done
export NIX_LDFLAGS_SET=1
export NIX_CROSS_LDFLAGS_SET=1
if test "$NIX_STRIP_DEBUG" = "1"; then
# Add executable-stripping flags.
@ -112,6 +112,8 @@ if test -n "$NIX_GCC_WRAPPER_EXEC_HOOK"; then
source "$NIX_GCC_WRAPPER_EXEC_HOOK"
fi
# We want gcc to call the wrapper linker, not that of binutils.
export PATH="@ldPath@:$PATH"
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to

View File

@ -4,7 +4,7 @@ if test -n "$NIX_LD_WRAPPER_START_HOOK"; then
source "$NIX_LD_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GLIBC_FLAGS_SET"; then
if test -z "$NIX_CROSS_GLIBC_FLAGS_SET"; then
source @out@/nix-support/add-flags
fi
@ -14,7 +14,7 @@ source @out@/nix-support/utils
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE" \
-a \( -z "$NIX_IGNORE_LD_THROUGH_GCC" -o -z "$NIX_LDFLAGS_SET" \); then
-a \( -z "$NIX_IGNORE_LD_THROUGH_GCC" -o -z "$NIX_CROSS_LDFLAGS_SET" \); then
rest=()
n=0
while test $n -lt ${#params[*]}; do
@ -44,9 +44,9 @@ fi
extra=()
extraBefore=()
if test -z "$NIX_LDFLAGS_SET"; then
extra=(${extra[@]} $NIX_LDFLAGS)
extraBefore=(${extraBefore[@]} $NIX_LDFLAGS_BEFORE)
if test -z "$NIX_CROSS_LDFLAGS_SET"; then
extra=(${extra[@]} $NIX_CROSS_LDFLAGS)
extraBefore=(${extraBefore[@]} $NIX_CROSS_LDFLAGS_BEFORE)
fi
@ -121,7 +121,7 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
# Finally, add `-rpath' switches.
for i in $rpath; do
extra=(${extra[@]} -rpath $i)
extra=(${extra[@]} -rpath $i -rpath-link $i)
done
fi

View File

@ -1,14 +1,57 @@
addCVars () {
NIX_CROSS_CFLAGS_COMPILE=""
NIX_CROSS_LDFLAGS=""
crossAddCVars () {
if test -d $1/include; then
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$1/include"
export NIX_CROSS_CFLAGS_COMPILE="$NIX_CROSS_CFLAGS_COMPILE -I$1/include"
fi
if test -d $1/lib; then
export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib"
export NIX_CROSS_LDFLAGS="$NIX_CROSS_LDFLAGS -L$1/lib -rpath-link $1/lib"
fi
}
envHooks=(${envHooks[@]} addCVars)
crossEnvHooks=(${crossEnvHooks[@]} crossAddCVars)
crossStripDirs() {
local dirs="$1"
local stripFlags="$2"
local dirsNew=
for d in ${dirs}; do
if test -d "$prefix/$d"; then
dirsNew="${dirsNew} $prefix/$d "
fi
done
dirs=${dirsNew}
if test -n "${dirs}"; then
header "stripping (with flags $stripFlags) in $dirs"
# libc_nonshared.a should never be stripped, or builds will break.
find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $crossConfig-strip $stripFlags || true
stopNest
fi
}
crossStrip () {
# In cross_renaming we may rename dontCrossStrip to dontStrip, and
# dontStrip to dontNativeStrip.
# TODO: strip _only_ ELF executables, and return || fail here...
if test -z "$dontCrossStrip"; then
stripDebugList=${stripDebugList:-lib lib64 libexec bin sbin}
if test -n "$stripDebugList"; then
crossStripDirs "$stripDebugList" "${stripDebugFlags:--S}"
fi
stripAllList=${stripAllList:-}
if test -n "$stripAllList"; then
crossStripDirs "$stripAllList" "${stripAllFlags:--s}"
fi
fi
}
preDistPhases=(${preDistPhases[@]} crossStrip)
# Note: these come *after* $out in the PATH (see setup.sh).
@ -20,6 +63,20 @@ if test -n "@binutils@"; then
PATH=$PATH:@binutils@/bin
fi
if test -n "@glibc@"; then
PATH=$PATH:@glibc@/bin
if test -n "@libc@"; then
PATH=$PATH:@libc@/bin
crossAddCVars @libc@
fi
configureFlags="$configureFlags --build=$system --host=$crossConfig"
# Disabling the tests when cross compiling, as usually the tests are meant for
# native compilations.
doCheck=""
# Add the output as an rpath.
if test "$NIX_NO_SELF_RPATH" != "1"; then
export NIX_CROSS_LDFLAGS="-rpath $out/lib -rpath-link $out/lib $NIX_CROSS_LDFLAGS"
if test -n "$NIX_LIB64_IN_SELF_RPATH"; then
export NIX_CROSS_LDFLAGS="-rpath $out/lib64 -rpath-link $out/lib $NIX_CROSS_LDFLAGS"
fi
fi

View File

@ -9,6 +9,10 @@ if test -e @out@/nix-support/gcc-cflags; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/gcc-cflags) $NIX_CFLAGS_COMPILE"
fi
if test -e @out@/nix-support/gnat-cflags; then
export NIX_GNATFLAGS_COMPILE="$(cat @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE"
fi
if test -e @out@/nix-support/libc-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)"
fi

View File

@ -42,6 +42,9 @@ else
gccLDFlags="$gccLDFlags -L$gcc/lib64"
fi
gccLDFlags="$gccLDFlags -L$gcc/lib"
if [ -n "$langVhdl" ]; then
gccLDFlags="$gccLDFlags -L$zlib/lib"
fi
echo "$gccLDFlags" > $out/nix-support/gcc-ldflags
# GCC shows $gcc/lib in `gcc -print-search-dirs', but not
@ -51,6 +54,15 @@ else
if test -e "$gcc/lib64"; then
gccCFlags="$gccCFlags -B$gcc/lib64"
fi
# Find the gcc libraries path (may work only without multilib)
if [ -n "$langAda" ]; then
basePath=`echo $gcc/lib/*/*/*`
gccCFlags="$gccCFlags -B$basePath -I$basePath/adainclude"
gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
echo "$gnatCFlags" > $out/nix-support/gnat-cflags
fi
echo "$gccCFlags" > $out/nix-support/gcc-cflags
gccPath="$gcc/bin"
@ -68,7 +80,10 @@ doSubstitute() {
-e "s^@shell@^$shell^g" \
-e "s^@gcc@^$gcc^g" \
-e "s^@gccProg@^$gccProg^g" \
-e "s^@gnatProg@^$gnatProg^g" \
-e "s^@gnatlinkProg@^$gnatlinkProg^g" \
-e "s^@binutils@^$binutils^g" \
-e "s^@coreutils@^$coreutils^g" \
-e "s^@libc@^$libc^g" \
-e "s^@ld@^$ldPath/ld^g" \
< "$src" > "$dst"
@ -83,7 +98,7 @@ mkGccWrapper() {
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return
return 1
fi
gccProg="$src"
@ -91,16 +106,59 @@ mkGccWrapper() {
chmod +x "$dst"
}
mkGccWrapper $out/bin/gcc $gccPath/gcc
ln -s gcc $out/bin/cc
mkGnatWrapper() {
local dst=$1
local src=$2
mkGccWrapper $out/bin/g++ $gccPath/g++
ln -s g++ $out/bin/c++
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
if test -e $gccPath/gfortran; then
mkGccWrapper $out/bin/gfortran $gccPath/gfortran
ln -s gfortran $out/bin/g77
ln -s gfortran $out/bin/f77
gnatProg="$src"
doSubstitute "$gnatWrapper" "$dst"
chmod +x "$dst"
}
mkGnatLinkWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
gnatlinkProg="$src"
doSubstitute "$gnatlinkWrapper" "$dst"
chmod +x "$dst"
}
if mkGccWrapper $out/bin/gcc $gccPath/gcc
then
ln -sv gcc $out/bin/cc
fi
if mkGccWrapper $out/bin/g++ $gccPath/g++
then
ln -sv g++ $out/bin/c++
fi
if mkGccWrapper $out/bin/gfortran $gccPath/gfortran
then
ln -sv gfortran $out/bin/g77
ln -sv gfortran $out/bin/f77
fi
mkGccWrapper $out/bin/gcj $gccPath/gcj || true
mkGccWrapper $out/bin/gnatgcc $gccPath/gnatgcc || true
mkGnatWrapper $out/bin/gnatmake $gccPath/gnatmake || true
mkGnatWrapper $out/bin/gnatbind $gccPath/gnatbind || true
mkGnatLinkWrapper $out/bin/gnatlink $gccPath/gnatlink || true
if [ -f $gccPath/ghdl ]; then
ln -sf $gccPath/ghdl $out/bin/ghdl
fi

View File

@ -6,13 +6,17 @@
# variables so that the compiler and the linker just "work".
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
, gcc ? null, libc ? null, binutils ? null, shell ? ""
, gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
, zlib ? null
}:
assert nativeTools -> nativePrefix != "";
assert !nativeTools -> gcc != null && binutils != null;
assert !nativeTools -> gcc != null && binutils != null && coreutils != null;
assert !nativeLibc -> libc != null;
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper
assert (gcc != null && gcc ? langVhdl && gcc.langVhdl) -> zlib != null;
let
gccVersion = (builtins.parseDrvName gcc.name).version;
@ -28,6 +32,8 @@ stdenv.mkDerivation {
builder = ./builder.sh;
setupHook = ./setup-hook.sh;
gccWrapper = ./gcc-wrapper.sh;
gnatWrapper = ./gnat-wrapper.sh;
gnatlinkWrapper = ./gnatlink-wrapper.sh;
ldWrapper = ./ld-wrapper.sh;
utils = ./utils.sh;
addFlags = ./add-flags;
@ -35,10 +41,15 @@ stdenv.mkDerivation {
inherit nativeTools nativeLibc nativePrefix gcc;
libc = if nativeLibc then null else libc;
binutils = if nativeTools then null else binutils;
# The wrapper scripts use 'cat', so we may need coreutils
coreutils = if nativeTools then null else coreutils;
langC = if nativeTools then true else gcc.langC;
langCC = if nativeTools then true else gcc.langCC;
langFortran = if nativeTools then false else gcc ? langFortran;
langAda = if nativeTools then false else gcc ? langAda && gcc.langAda;
langVhdl = if nativeTools then false else gcc ? langVhdl && gcc.langVhdl;
zlib = if (gcc != null && gcc ? langVhdl) then zlib else null;
shell = if shell == "" then stdenv.shell else shell;
meta =
@ -54,6 +65,7 @@ stdenv.mkDerivation {
if !nativeLibc then
(if stdenv.system == "i686-linux" then "ld-linux.so.2" else
if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
if stdenv.system == "armv5tel-linux" then "ld-linux.so.3" else
if stdenv.system == "powerpc-linux" then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform")
else "";

View File

@ -30,6 +30,10 @@ for i in "$@"; do
dontLink=1
elif test "$i" = "-MM"; then
dontLink=1
elif test "$i" = "-x"; then
# At least for the cases c-header or c++-header we should set dontLink.
# I expect no one use -x other than making precompiled headers.
dontLink=1
elif test "${i:0:1}" != "-"; then
nonFlagArgs=1
elif test "$i" = "-m32"; then

View File

@ -0,0 +1,113 @@
#! @shell@ -e
if test -n "$NIX_GNAT_WRAPPER_START_HOOK"; then
source "$NIX_GNAT_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GNAT_WRAPPER_FLAGS_SET"; then
source @out@/nix-support/add-flags.sh
fi
source @out@/nix-support/utils.sh
# Figure out if linker flags should be passed. GCC prints annoying
# warnings when they are not needed.
dontLink=0
getVersion=0
nonFlagArgs=0
for i in "$@"; do
if test "$i" = "-c"; then
dontLink=1
elif test "$i" = "-M"; then
dontLink=1
elif test "${i:0:1}" != "-"; then
nonFlagArgs=1
elif test "$i" = "-m32"; then
if test -e @out@/nix-support/dynamic-linker-m32; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
done
# If we pass a flag like -Wl, then gcc will call the linker unless it
# can figure out that it has to do something else (e.g., because of a
# "-c" flag). So if no non-flag arguments are given, don't pass any
# linker flags. This catches cases like "gcc" (should just print
# "gcc: no input files") and "gcc -v" (should print the version).
if test "$nonFlagArgs" = "0"; then
dontLink=1
fi
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
rest=()
n=0
while test $n -lt ${#params[*]}; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
skip $p
elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
skip $p
elif test "${p:0:4}" = "-aI/" && badPath "${p:3}"; then
skip $p
elif test "${p:0:4}" = "-aO/" && badPath "${p:3}"; then
skip $p
else
rest=("${rest[@]}" "$p")
fi
n=$((n + 1))
done
params=("${rest[@]}")
fi
# Add the flags for the GNAT compiler proper.
extraAfter=($NIX_GNATFLAGS_COMPILE)
extraBefore=()
if [ "`basename $0`x" = "gnatmakex" ]; then
extraBefore=("--GNATBIND=@out@/bin/gnatbind --GNATLINK=@out@/bin/gnatlink ")
fi
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
#for i in $NIX_LDFLAGS_BEFORE; do
# extraBefore=(${extraBefore[@]} "-largs $i")
#done
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @gnatProg@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extraBefore flags to @gnatProg@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @gnatProg@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_GNAT_WRAPPER_EXEC_HOOK"; then
source "$NIX_GNAT_WRAPPER_EXEC_HOOK"
fi
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_GNAT_NEEDS_GREP"; then
@gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
else
(@gnatProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi

View File

@ -0,0 +1,43 @@
#! @shell@ -e
# Add the flags for the GNAT compiler proper.
extraAfter="--GCC=@out@/bin/gcc"
extraBefore=()
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
#for i in $NIX_LDFLAGS_BEFORE; do
# extraBefore=(${extraBefore[@]} "-largs $i")
#done
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @gnatlinkProg@:" >&2
for i in "$@"; do
echo " $i" >&2
done
echo "extraBefore flags to @gnatlinkProg@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @gnatlinkProg@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_GNAT_WRAPPER_EXEC_HOOK"; then
source "$NIX_GNAT_WRAPPER_EXEC_HOOK"
fi
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_GNAT_NEEDS_GREP"; then
@gnatlinkProg@ ${extraBefore[@]} "$@" ${extraAfter[@]}
else
(@gnatlinkProg@ ${extraBefore[@]} "$@" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi

View File

@ -53,8 +53,6 @@ fi
# Add all used dynamic libraries to the rpath.
if test "$NIX_DONT_SET_RPATH" != "1"; then
# First, find all -L... switches.
allParams=("${params[@]}" ${extra[@]})
libPath=""
addToLibPath() {
local path="$1"
@ -72,23 +70,6 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
esac
libPath="$libPath $path "
}
n=0
while test $n -lt ${#allParams[*]}; do
p=${allParams[n]}
p2=${allParams[$((n+1))]}
if test "${p:0:3}" = "-L/"; then
addToLibPath ${p:2}
elif test "$p" = "-L"; then
addToLibPath ${p2}
n=$((n + 1))
fi
n=$((n + 1))
done
# Second, for each directory in the library search path (-L...),
# see if it contains a dynamic library used by a -l... flag. If
# so, add the directory to the rpath.
rpath=""
addToRPath() {
# If the path is not in the store, don't add it to the rpath.
@ -101,6 +82,31 @@ if test "$NIX_DONT_SET_RPATH" != "1"; then
rpath="$rpath $1 "
}
# First, find all -L... switches.
allParams=("${params[@]}" ${extra[@]})
n=0
while test $n -lt ${#allParams[*]}; do
p=${allParams[n]}
p2=${allParams[$((n+1))]}
if test "${p:0:3}" = "-L/"; then
addToLibPath ${p:2}
elif test "$p" = "-L"; then
addToLibPath ${p2}
n=$((n + 1))
elif [[ "$p" =~ ^[^-].*\.so($|\.) ]]; then
# This is a direct reference to a shared library, so add
# its directory to the rpath.
path="$(dirname "$p")";
addToRPath "${path}"
fi
n=$((n + 1))
done
# Second, for each directory in the library search path (-L...),
# see if it contains a dynamic library used by a -l... flag. If
# so, add the directory to the rpath.
rpath=""
for i in $libPath; do
n=0
while test $n -lt ${#allParams[*]}; do

View File

@ -27,3 +27,7 @@ fi
if test -n "@libc@"; then
addToSearchPath PATH @libc@/bin
fi
if test -n "@coreutils@"; then
addToSearchPath PATH @coreutils@/bin
fi

View File

@ -1,6 +0,0 @@
To be removed after we merge stdenv-updates in.
stdenv-updates should have this gcc-wrapper2 as gcc-wrapper.
Changelog against gcc-wrapper:
- Support for linking shared objects with direct mention of the /path/libxxx.so object,
thus, adding its path to the rpath.

View File

@ -1,24 +0,0 @@
# `-B@out@/bin' forces gcc to use ld-wrapper.sh when calling ld.
export NIX_CFLAGS_COMPILE="-B@out@/bin/ $NIX_CFLAGS_COMPILE"
if test -e @out@/nix-support/libc-cflags; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE"
fi
if test -e @out@/nix-support/gcc-cflags; then
export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/gcc-cflags) $NIX_CFLAGS_COMPILE"
fi
if test -e @out@/nix-support/libc-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)"
fi
if test -e @out@/nix-support/gcc-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/gcc-ldflags)"
fi
if test -e @out@/nix-support/libc-ldflags-before; then
export NIX_LDFLAGS_BEFORE="$(cat @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE"
fi
export NIX_GCC_WRAPPER_FLAGS_SET=1

View File

@ -1,135 +0,0 @@
source $stdenv/setup
ensureDir $out/bin
ensureDir $out/nix-support
if test -z "$nativeLibc"; then
dynamicLinker="$libc/lib/$dynamicLinker"
echo $dynamicLinker > $out/nix-support/dynamic-linker
if test -e $libc/lib/32/ld-linux.so.2; then
echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
fi
# The "-B$libc/lib/" flag is a quick hack to force gcc to link
# against the crt1.o from our own glibc, rather than the one in
# /usr/lib. (This is only an issue when using an `impure'
# compiler/linker, i.e., one that searches /usr/lib and so on.)
#
# Unfortunately, setting -B appears to override the default search
# path. Thus, the gcc-specific "../includes-fixed" directory is
# now longer searched and glibc's <limits.h> header fails to
# compile, because it uses "#include_next <limits.h>" to find the
# limits.h file in ../includes-fixed. To remedy the problem,
# another -idirafter is necessary to add that directory again.
echo "-B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
echo "-L$libc/lib" > $out/nix-support/libc-ldflags
# The dynamic linker is passed in `ldflagsBefore' to allow
# explicit overrides of the dynamic linker by callers to gcc/ld
# (the *last* value counts, so ours should come first).
echo "-dynamic-linker $dynamicLinker" > $out/nix-support/libc-ldflags-before
fi
if test -n "$nativeTools"; then
gccPath="$nativePrefix/bin"
ldPath="$nativePrefix/bin"
else
if test -e "$gcc/lib64"; then
gccLDFlags="$gccLDFlags -L$gcc/lib64"
fi
gccLDFlags="$gccLDFlags -L$gcc/lib"
echo "$gccLDFlags" > $out/nix-support/gcc-ldflags
# GCC shows $gcc/lib in `gcc -print-search-dirs', but not
# $gcc/lib64 (even though it does actually search there...)..
# This confuses libtool. So add it to the compiler tool search
# path explicitly.
if test -e "$gcc/lib64"; then
gccCFlags="$gccCFlags -B$gcc/lib64"
fi
echo "$gccCFlags" > $out/nix-support/gcc-cflags
gccPath="$gcc/bin"
ldPath="$binutils/bin"
fi
doSubstitute() {
local src=$1
local dst=$2
# Can't use substitute() here, because replace may not have been
# built yet (in the bootstrap).
sed \
-e "s^@out@^$out^g" \
-e "s^@shell@^$shell^g" \
-e "s^@gcc@^$gcc^g" \
-e "s^@gccProg@^$gccProg^g" \
-e "s^@binutils@^$binutils^g" \
-e "s^@libc@^$libc^g" \
-e "s^@ld@^$ldPath/ld^g" \
< "$src" > "$dst"
}
# Make wrapper scripts around gcc, g++, and gfortran. Also make symlinks
# cc, c++, and f77.
mkGccWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return
fi
gccProg="$src"
doSubstitute "$gccWrapper" "$dst"
chmod +x "$dst"
}
mkGccWrapper $out/bin/gcc $gccPath/gcc
ln -s gcc $out/bin/cc
mkGccWrapper $out/bin/g++ $gccPath/g++
ln -s g++ $out/bin/c++
if test -e $gccPath/gfortran; then
mkGccWrapper $out/bin/gfortran $gccPath/gfortran
ln -s gfortran $out/bin/g77
ln -s gfortran $out/bin/f77
fi
# Create a symlink to as (the assembler). This is useful when a
# gcc-wrapper is installed in a user environment, as it ensures that
# the right assembler is called.
ln -s $ldPath/as $out/bin/as
# Make a wrapper around the linker.
doSubstitute "$ldWrapper" "$out/bin/ld"
chmod +x "$out/bin/ld"
# Emit a setup hook. Also store the path to the original GCC and
# Glibc.
test -n "$gcc" && echo $gcc > $out/nix-support/orig-gcc
test -n "$libc" && echo $libc > $out/nix-support/orig-libc
doSubstitute "$addFlags" "$out/nix-support/add-flags.sh"
doSubstitute "$setupHook" "$out/nix-support/setup-hook"
cp -p $utils $out/nix-support/utils.sh
# Propagate the wrapped gcc so that if you install the wrapper, you get
# tools like gcov, the manpages, etc. as well (including for binutils
# and Glibc).
if test -z "$nativeTools"; then
echo $gcc $binutils $libc > $out/nix-support/propagated-user-env-packages
fi

View File

@ -1,61 +0,0 @@
# The Nix `gcc' stdenv.mkDerivation is not directly usable, since it doesn't
# know where the C library and standard header files are. Therefore
# the compiler produced by that package cannot be installed directly
# in a user environment and used from the command line. This
# stdenv.mkDerivation provides a wrapper that sets up the right environment
# variables so that the compiler and the linker just "work".
{ name ? "", stdenv, nativeTools, nativeLibc, nativePrefix ? ""
, gcc ? null, libc ? null, binutils ? null, shell ? ""
}:
assert nativeTools -> nativePrefix != "";
assert !nativeTools -> gcc != null && binutils != null;
assert !nativeLibc -> libc != null;
assert gcc != null;
let
gccVersion = (builtins.parseDrvName gcc.name).version;
gccName = (builtins.parseDrvName gcc.name).name;
in
stdenv.mkDerivation {
name =
(if name != "" then name else gccName + "-wrapper") +
(if gcc != null && gccVersion != "" then "-" + gccVersion else "");
builder = ./builder.sh;
setupHook = ./setup-hook.sh;
gccWrapper = ./gcc-wrapper.sh;
ldWrapper = ./ld-wrapper.sh;
utils = ./utils.sh;
addFlags = ./add-flags;
inherit nativeTools nativeLibc nativePrefix gcc;
libc = if nativeLibc then null else libc;
binutils = if nativeTools then null else binutils;
langC = if nativeTools then true else gcc.langC;
langCC = if nativeTools then true else gcc.langCC;
langFortran = if nativeTools then false else gcc ? langFortran;
shell = if shell == "" then stdenv.shell else shell;
meta =
let gcc_ = if gcc != null then gcc else {}; in
(if gcc_ ? meta then removeAttrs gcc.meta ["priority"] else {}) //
{ description =
stdenv.lib.attrByPath ["meta" "description"] "System C compiler" gcc_
+ " (wrapper script)";
};
# The dynamic linker has different names on different Linux platforms.
dynamicLinker =
if !nativeLibc then
(if stdenv.system == "i686-linux" then "ld-linux.so.2" else
if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
if stdenv.system == "powerpc-linux" then "ld.so.1" else
abort "don't know the name of the dynamic linker for this platform")
else "";
}

View File

@ -1,148 +0,0 @@
#! @shell@ -e
if test -n "$NIX_GCC_WRAPPER_START_HOOK"; then
source "$NIX_GCC_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GCC_WRAPPER_FLAGS_SET"; then
source @out@/nix-support/add-flags.sh
fi
source @out@/nix-support/utils.sh
# Figure out if linker flags should be passed. GCC prints annoying
# warnings when they are not needed.
dontLink=0
getVersion=0
nonFlagArgs=0
for i in "$@"; do
if test "$i" = "-c"; then
dontLink=1
elif test "$i" = "-S"; then
dontLink=1
elif test "$i" = "-E"; then
dontLink=1
elif test "$i" = "-E"; then
dontLink=1
elif test "$i" = "-M"; then
dontLink=1
elif test "$i" = "-MM"; then
dontLink=1
elif test "${i:0:1}" != "-"; then
nonFlagArgs=1
elif test "$i" = "-m32"; then
if test -e @out@/nix-support/dynamic-linker-m32; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
done
# If we pass a flag like -Wl, then gcc will call the linker unless it
# can figure out that it has to do something else (e.g., because of a
# "-c" flag). So if no non-flag arguments are given, don't pass any
# linker flags. This catches cases like "gcc" (should just print
# "gcc: no input files") and "gcc -v" (should print the version).
if test "$nonFlagArgs" = "0"; then
dontLink=1
fi
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE"; then
rest=()
n=0
while test $n -lt ${#params[*]}; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
skip $p
elif test "$p" = "-L" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "${p:0:3}" = "-I/" && badPath "${p:2}"; then
skip $p
elif test "$p" = "-I" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-isystem" && badPath "$p2"; then
n=$((n + 1)); skip $p2
else
rest=("${rest[@]}" "$p")
fi
n=$((n + 1))
done
params=("${rest[@]}")
fi
# Add the flags for the C compiler proper.
extraAfter=($NIX_CFLAGS_COMPILE)
extraBefore=()
if test "$dontLink" != "1"; then
# Add the flags that should only be passed to the compiler when
# linking.
extraAfter=(${extraAfter[@]} $NIX_CFLAGS_LINK)
# Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_LDFLAGS again).
for i in $NIX_LDFLAGS_BEFORE; do
extraBefore=(${extraBefore[@]} "-Wl,$i")
done
for i in $NIX_LDFLAGS; do
if test "${i:0:3}" = "-L/"; then
extraAfter=(${extraAfter[@]} "$i")
else
extraAfter=(${extraAfter[@]} "-Wl,$i")
fi
done
export NIX_LDFLAGS_SET=1
if test "$NIX_STRIP_DEBUG" = "1"; then
# Add executable-stripping flags.
extraAfter=(${extraAfter[@]} $NIX_CFLAGS_STRIP)
fi
fi
# As a very special hack, if the arguments are just `-v', then don't
# add anything. This is to prevent `gcc -v' (which normally prints
# out the version number and returns exit code 0) from printing out
# `No input files specified' and returning exit code 1.
if test "$*" = "-v"; then
extraAfter=()
extraBefore=()
fi
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @gccProg@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extraBefore flags to @gccProg@:" >&2
for i in ${extraBefore[@]}; do
echo " $i" >&2
done
echo "extraAfter flags to @gccProg@:" >&2
for i in ${extraAfter[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_GCC_WRAPPER_EXEC_HOOK"; then
source "$NIX_GCC_WRAPPER_EXEC_HOOK"
fi
# Call the real `gcc'. Filter out warnings from stderr about unused
# `-B' flags, since they confuse some programs. Deep bash magic to
# apply grep to stderr (by swapping stdin/stderr twice).
if test -z "$NIX_GCC_NEEDS_GREP"; then
@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]}
else
(@gccProg@ ${extraBefore[@]} "${params[@]}" ${extraAfter[@]} 3>&2 2>&1 1>&3- \
| (grep -v 'file path prefix' || true); exit ${PIPESTATUS[0]}) 3>&2 2>&1 1>&3-
exit $?
fi

View File

@ -1,155 +0,0 @@
#! @shell@ -e
if test -n "$NIX_LD_WRAPPER_START_HOOK"; then
source "$NIX_LD_WRAPPER_START_HOOK"
fi
if test -z "$NIX_GCC_WRAPPER_FLAGS_SET"; then
source @out@/nix-support/add-flags.sh
fi
source @out@/nix-support/utils.sh
# Optionally filter out paths not refering to the store.
params=("$@")
if test "$NIX_ENFORCE_PURITY" = "1" -a -n "$NIX_STORE" \
-a \( -z "$NIX_IGNORE_LD_THROUGH_GCC" -o -z "$NIX_LDFLAGS_SET" \); then
rest=()
n=0
while test $n -lt ${#params[*]}; do
p=${params[n]}
p2=${params[$((n+1))]}
if test "${p:0:3}" = "-L/" && badPath "${p:2}"; then
skip $p
elif test "$p" = "-L" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-rpath" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "$p" = "-dynamic-linker" && badPath "$p2"; then
n=$((n + 1)); skip $p2
elif test "${p:0:1}" = "/" && badPath "$p"; then
# We cannot skip this; barf.
echo "impure path \`$p' used in link" >&2
exit 1
else
rest=("${rest[@]}" "$p")
fi
n=$((n + 1))
done
params=("${rest[@]}")
fi
extra=()
extraBefore=()
if test -z "$NIX_LDFLAGS_SET"; then
extra=(${extra[@]} $NIX_LDFLAGS)
extraBefore=(${extraBefore[@]} $NIX_LDFLAGS_BEFORE)
fi
# Add all used dynamic libraries to the rpath.
if test "$NIX_DONT_SET_RPATH" != "1"; then
# First, find all -L... switches.
allParams=("${params[@]}" ${extra[@]})
libPath=""
addToLibPath() {
local path="$1"
if test "${path:0:1}" != "/"; then return 0; fi
case "$path" in
*..*|*./*|*/.*|*//*)
local path2
if path2=$(readlink -f "$path"); then
path="$path2"
fi
;;
esac
case $libPath in
*\ $path\ *) return 0 ;;
esac
libPath="$libPath $path "
}
n=0
while test $n -lt ${#allParams[*]}; do
p=${allParams[n]}
p2=${allParams[$((n+1))]}
if test "${p:0:3}" = "-L/"; then
addToLibPath ${p:2}
elif test "$p" = "-L"; then
addToLibPath ${p2}
n=$((n + 1))
elif $(echo "$p" | grep -q '\.so\($\|\.\)'); then
path="$(dirname "$p")";
addToLibPath "${path}"
fi
n=$((n + 1))
done
# Second, for each directory in the library search path (-L...),
# see if it contains a dynamic library used by a -l... flag. If
# so, add the directory to the rpath.
rpath=""
addToRPath() {
# If the path is not in the store, don't add it to the rpath.
# This typically happens for libraries in /tmp that are later
# copied to $out/lib. If not, we're screwed.
if test "${1:0:${#NIX_STORE}}" != "$NIX_STORE"; then return 0; fi
case $rpath in
*\ $1\ *) return 0 ;;
esac
rpath="$rpath $1 "
}
for i in $libPath; do
n=0
while test $n -lt ${#allParams[*]}; do
p=${allParams[n]}
p2=${allParams[$((n+1))]}
if test "${p:0:2}" = "-l" -a -f "$i/lib${p:2}.so"; then
addToRPath $i
break
elif test "$p" = "-l" -a -f "$i/lib${p2}"; then
# I haven't seen `-l foo', but you never know...
addToRPath $i
break
elif $(echo "$p" | grep -q '\.so\($\|\.\)'); then
path="$(dirname "$p")";
if test "$path" == "$i"; then
addToRPath $i
break;
fi
fi
n=$((n + 1))
done
done
# Finally, add `-rpath' switches.
for i in $rpath; do
extra=(${extra[@]} -rpath $i)
done
fi
# Optionally print debug info.
if test "$NIX_DEBUG" = "1"; then
echo "original flags to @ld@:" >&2
for i in "${params[@]}"; do
echo " $i" >&2
done
echo "extra flags to @ld@:" >&2
for i in ${extra[@]}; do
echo " $i" >&2
done
fi
if test -n "$NIX_LD_WRAPPER_EXEC_HOOK"; then
source "$NIX_LD_WRAPPER_EXEC_HOOK"
fi
exec @ld@ ${extraBefore[@]} "${params[@]}" ${extra[@]}

View File

@ -1,29 +0,0 @@
addCVars () {
if test -d $1/include; then
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$1/include"
fi
if test -d $1/lib64; then
export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib64"
fi
if test -d $1/lib; then
export NIX_LDFLAGS="$NIX_LDFLAGS -L$1/lib"
fi
}
envHooks=(${envHooks[@]} addCVars)
# Note: these come *after* $out in the PATH (see setup.sh).
if test -n "@gcc@"; then
addToSearchPath PATH @gcc@/bin
fi
if test -n "@binutils@"; then
addToSearchPath PATH @binutils@/bin
fi
if test -n "@libc@"; then
addToSearchPath PATH @libc@/bin
fi

View File

@ -1,23 +0,0 @@
skip () {
if test "$NIX_DEBUG" = "1"; then
echo "skipping impure path $1" >&2
fi
}
# Checks whether a path is impure. E.g., `/lib/foo.so' is impure, but
# `/nix/store/.../lib/foo.so' isn't.
badPath() {
local p=$1
# Relative paths are okay (since they're presumably relative to
# the temporary build directory).
if test "${p:0:1}" != "/"; then return 1; fi
# Otherwise, the path should refer to the store or some temporary
# directory (including the build directory).
test \
"${p:0:${#NIX_STORE}}" != "$NIX_STORE" -a \
"${p:0:4}" != "/tmp" -a \
"${p:0:${#NIX_BUILD_TOP}}" != "$NIX_BUILD_TOP"
}

View File

@ -12,12 +12,15 @@
# `contents = {object = ...; symlink = /init;}' is a typical
# argument.
{stdenv, perl, cpio, contents}:
{stdenv, perl, cpio, contents, platform}:
stdenv.mkDerivation {
name = "initrd";
builder = ./make-initrd.sh;
buildInputs = [perl cpio];
buildInputs = [perl cpio]
++ stdenv.lib.optional (platform.uboot != null) [ platform.uboot ];
makeUInitrd = if (platform.uboot != null) then true else false;
# !!! should use XML.
objects = map (x: x.object) contents;

View File

@ -37,3 +37,8 @@ storePaths=$(perl $pathsFromGraph closure-*)
# Put the closure in a gzipped cpio archive.
ensureDir $out
(cd root && find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd)
if [ -n "$makeUInitrd" ]; then
mv $out/initrd $out/initrd.gz
mkimage -A arm -O linux -T ramdisk -C gzip -d $out/initrd.gz $out/initrd
fi

View File

@ -22,7 +22,7 @@ for module in $rootModules; do
done
echo "closure:"
ensureDir $out
ensureDir $out/lib/modules/"$version"
for module in $closure; do
target=$(echo $module | sed "s^/nix/store/.*/lib/modules/^$out/lib/modules/^")
if test -e "$target"; then continue; fi

View File

@ -5,7 +5,7 @@ with pkgs;
rec {
inherit (kernelPackages_2_6_32) kernel;
inherit (linuxPackages_2_6_32) kernel;
klibcShrunk = pkgs.klibcShrunk.override { klibc = klibc_15; };

View File

@ -1,19 +1,26 @@
{ stdenv, fetchurl, lib, cmake, qt4, pkgconfig, perl, python
, sip, pyqt4, pycups, system_config_printer, rhpl
, sip, pyqt4, pycups, system_config_printer
, kdelibs, kdepimlibs, kdebindings, automoc4, phonon}:
stdenv.mkDerivation {
name = "kdeadmin-4.3.4";
src = fetchurl {
url = mirror://kde/stable/4.3.4/src/kdeadmin-4.3.4.tar.bz2;
sha1 = "8f61aeb2ff9d51712d72cd77dad837c8902b6a5d";
};
builder = ./builder.sh;
inherit system_config_printer;
includeAllQtDirs=true;
CMAKE_PREFIX_PATH=kdepimlibs;
buildInputs = [ cmake qt4 pkgconfig perl python sip pyqt4 pycups system_config_printer rhpl
buildInputs = [ cmake qt4 pkgconfig perl python sip pyqt4 pycups system_config_printer
kdelibs kdepimlibs kdebindings automoc4 phonon ];
meta = {
description = "KDE Administration Utilities";
license = "GPL";

View File

@ -102,7 +102,7 @@ pkgs.recurseIntoAttrs (rec {
};
kdeadmin = import ./admin {
inherit (pkgs) stdenv fetchurl lib cmake qt4 pkgconfig perl python sip pyqt4 pycups system_config_printer rhpl;
inherit (pkgs) stdenv fetchurl lib cmake qt4 pkgconfig perl python sip pyqt4 pycups system_config_printer;
inherit kdelibs kdepimlibs kdebindings;
inherit automoc4 phonon;
};
@ -185,7 +185,7 @@ pkgs.recurseIntoAttrs (rec {
};
kdeutils = import ./utils {
inherit (pkgs) stdenv fetchurl lib cmake qt4 perl python gmp libzip libarchive xz sip pyqt4 pycups system_config_printer rhpl;
inherit (pkgs) stdenv fetchurl lib cmake qt4 perl python gmp libzip libarchive xz sip pyqt4 pycups system_config_printer;
inherit kdelibs kdelibs_experimental kdepimlibs kdebase kdebindings;
inherit automoc4 phonon qimageblitz qca2;
};

View File

@ -1,19 +1,26 @@
{ stdenv, fetchurl, lib, cmake, qt4, perl, gmp, python, libzip, libarchive, xz
, sip, pyqt4, pycups, system_config_printer, rhpl
, sip, pyqt4, pycups, system_config_printer
, kdelibs, kdelibs_experimental, kdepimlibs, kdebase, kdebindings, automoc4, phonon, qimageblitz, qca2}:
stdenv.mkDerivation {
name = "kdeutils-4.3.4";
src = fetchurl {
url = mirror://kde/stable/4.3.4/src/kdeutils-4.3.4.tar.bz2;
sha1 = "2d5e26055e364af2df7459cdbc3aebdc3a8abdea";
};
builder = ./builder.sh;
inherit system_config_printer;
includeAllQtDirs=true;
CMAKE_PREFIX_PATH=kdepimlibs;
buildInputs = [ cmake qt4 perl gmp python libzip libarchive xz sip pyqt4 pycups system_config_printer rhpl
buildInputs = [ cmake qt4 perl gmp python libzip libarchive xz sip pyqt4 pycups system_config_printer
kdelibs kdelibs_experimental kdepimlibs kdebase kdebindings automoc4 phonon qimageblitz qca2 ];
meta = {
description = "KDE Utilities";
license = "GPL";

View File

@ -31,6 +31,7 @@ if test "$noSysDirs" = "1"; then
export NIX_FIXINC_DUMMY=/usr/include
fi
extraCFlags="-g0 -I$gmp/include -I$mpfr/include $extraCFlags"
extraLDFlags="--strip-debug $extraLDFlags"
@ -39,17 +40,56 @@ if test "$noSysDirs" = "1"; then
export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
done
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
LIMITS_H_TEST=true \
X_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
LDFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
)
if test -n "$targetConfig"; then
if test -z "$crossStageStatic"; then
extraXCFlags="-B${libcCross}/lib -idirafter ${libcCross}/include"
extraXLDFlags="-L${libcCross}/lib"
export NIX_EXTRA_CFLAGS_TARGET=$extraXCFlags
for i in $extraXLDFlags; do
export NIX_EXTRA_LDFLAGS_TARGET="$NIX_EXTRA_LDFLAGS_TARGET -Wl,$i"
done
fi
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
CFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \
LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \
)
else
export NIX_EXTRA_CFLAGS_TARGET=$NIX_EXTRA_CFLAGS
export NIX_EXTRA_LDFLAGS_TARGET=$NIX_EXTRA_LDFLAGS
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
CFLAGS_FOR_BUILD="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
CFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
LDFLAGS_FOR_BUILD="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
)
fi
if test -n "$targetConfig" -a "$crossStageStatic" == 1; then
# We don't want the gcc build to assume there will be a libc providing
# limits.h in this stagae
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
LIMITS_H_TEST=false \
)
else
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
LIMITS_H_TEST=true \
)
fi
fi
if test -n "$targetConfig"; then
# The host strip will destroy everything in the target binaries otherwise
dontStrip=1
fi
preConfigure() {
# Perform the build in a different directory.
@ -84,13 +124,21 @@ postInstall() {
ln -sfn g++ $i
fi
done
eval "$postInstallGhdl"
}
if test -z "$profiledCompiler"; then
buildFlags="bootstrap $buildFlags"
else
buildFlags="profiledbootstrap $buildFlags"
if test -z "$targetConfig"; then
if test -z "$profiledCompiler"; then
buildFlags="bootstrap $buildFlags"
else
buildFlags="profiledbootstrap $buildFlags"
fi
else
:
# buildFlags="all-gcc all-target-libgcc $buildFlags"
# installTargets="install-gcc install-target-libgcc"
fi
genericBuild

View File

@ -1,61 +1,102 @@
{ stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false, langTreelang ? false
, langJava ? false
, langVhdl ? false
, profiledCompiler ? false
, staticCompiler ? false
, enableShared ? true
, texinfo ? null
, gmp, mpfr
, bison ? null, flex ? null
, zlib ? null, boehmgc ? null
, enableMultilib ? false
, name ? "gcc"
, cross ? null
, binutilsCross ? null
, libcCross ? null
, crossStageStatic ? true
, gnat ? null
}:
assert langTreelang -> bison != null && flex != null;
assert cross != null -> profiledCompiler == false && enableMultilib == true;
assert (cross != null && crossStageStatic) -> (langCC == false && langFortran
== false && langTreelang == false);
assert langVhdl -> gnat != null;
with stdenv.lib;
let version = "4.3.3"; in
let
version = "4.3.4";
crossConfigureFlags =
"--target=${cross.config}" +
(if crossStageStatic then
" --disable-libssp --disable-nls" +
" --without-headers" +
" --disable-threads " +
" --disable-libmudflap " +
" --disable-libgomp " +
" --disable-shared"
else
" --with-headers=${libcCross}/include" +
" --enable-__cxa_atexit" +
" --enable-long-long" +
" --enable-threads=posix" +
" --enable-nls"
);
stageNameAddon = if (crossStageStatic) then "-stage-static" else
"-stage-final";
crossNameAddon = if (cross != null) then "-${cross.config}" + stageNameAddon else "";
in
stdenv.mkDerivation ({
name = "${name}-${version}";
name = "${name}-${version}" + crossNameAddon;
builder = ./builder.sh;
src =
optional /*langC*/ true (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
sha256 = "08yksvipnqmqbmif30rwjkg3y0m6ray5r84wa2argv8q0bpz9426";
sha256 = "1yk80nwyw8vkpw8d3x7lkg3zrv3ngjqlvj0i8zslzgj7a27q729i";
}) ++
optional langCC (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
sha256 = "12z2zh03yq214qs2cqzh8c64jjfz544nk1lzi9rygjwm8yjsvzm9";
sha256 = "0d8pyk5c9zmph25f4fl63vd8vhljj6ildbxpz2hr594g5i6pplpq";
}) ++
optional langFortran (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2";
sha256 = "1b2wbysviyh7l9fqbd6zy5y6y89xgysy99gr8wx8xkc1hy2nwdsq";
sha256 = "1xf2njykv1qcgxiqwj693dxjf77ss1rcxirylvnsp5hs89mdlj12";
}) ++
optional langJava (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2";
sha256 = "1mlazpydd9qv7zwxkbb5sw3clfawfndhcc3f5lzycminvn6qmfkb";
sha256 = "1v3krhxi3zyaqfj0x8dbxvg67fjp29cr1psyf71r9zf757p3vqsw";
});
patches =
[./pass-cxxcpp.patch]
[./pass-cxxcpp.patch ./libmudflap-cpp.patch]
++ optional noSysDirs ./no-sys-dirs.patch
++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch
++ optional langJava ./java-jvgenmain-link.patch;
++ optional langJava ./java-jvgenmain-link.patch
++ optional langVhdl ./ghdl-ortho-cflags.patch;
inherit noSysDirs profiledCompiler staticCompiler;
inherit noSysDirs profiledCompiler staticCompiler crossStageStatic
binutilsCross libcCross;
targetConfig = if (cross != null) then cross.config else null;
buildInputs = [texinfo gmp mpfr]
++ (optionals langTreelang [bison flex])
++ (optional (zlib != null) zlib)
++ (optional (boehmgc != null) boehmgc)
++ (optionals (cross != null) [binutilsCross])
++ (optionals langVhdl [gnat])
;
configureFlags = "
${if enableMultilib then "" else "--disable-multilib"}
${if enableShared then "" else "--disable-shared"}
--disable-libstdcxx-pch
--with-system-zlib
--enable-languages=${
@ -65,27 +106,73 @@ stdenv.mkDerivation ({
++ optional langFortran "fortran"
++ optional langJava "java"
++ optional langTreelang "treelang"
++ optional langVhdl "vhdl"
)
)
}
${if stdenv.isi686 then "--with-arch=i686" else ""}
${if cross != null then crossConfigureFlags else ""}
";
#Above I added a hack on making the build different than the host.
# Needed for the cross compilation to work
AR = "ar";
LD = "ld";
CC = "gcc";
NIX_EXTRA_LDFLAGS = if staticCompiler then "-static" else "";
inherit gmp mpfr;
passthru = { inherit langC langCC langFortran langTreelang enableMultilib; };
passthru = { inherit langC langCC langFortran langVhdl langTreelang
enableMultilib; };
meta = {
homepage = "http://gcc.gnu.org/";
license = "GPL/LGPL";
description = "GNU Compiler Collection, 4.3.x";
maintainers = with stdenv.lib.maintainers; [viric ludo];
platforms = with stdenv.lib.platforms; linux;
};
} // (if langJava then {
postConfigure = ''
make configure-gcc
sed -i gcc/Makefile -e 's@^CFLAGS = .*@& -I${zlib}/include@ ; s@^LDFLAGS = .*@& -L${zlib}/lib@'
sed -i gcc/Makefile -e 's@^CFLAGS = .*@& -I${boehmgc}/include@ ; s@^LDFLAGS = .*@& -L${boehmgc}/lib -lgc@'
'';
} else {})
// (if langVhdl then rec {
name = "ghdl-0.29";
ghdlSrc = fetchurl {
url = "http://ghdl.free.fr/ghdl-0.29.tar.bz2";
sha256 = "15mlinr1lwljwll9ampzcfcrk9bk0qpdks1kxlvb70xf9zhh2jva";
};
# Ghdl has some timestamps checks, storing file timestamps in '.cf' files.
# As we will change the timestamps to 1970-01-01 00:00:01, we also set the
# content of that .cf to that value. This way ghdl does not complain on
# the installed object files from the basic libraries (ieee, ...)
postInstallGhdl = ''
pushd $out
find . -name "*.cf" -exec \
sed 's/[0-9]*\.000" /19700101000001.000" /g' -i {} \;
popd
'';
postUnpack = ''
tar xvf ${ghdlSrc}
mv ghdl-*/vhdl gcc*/gcc
rm -Rf ghdl-*
'';
meta = {
homepage = "http://ghdl.free.fr/";
license = "GPLv2+";
description = "Complete VHDL simulator, using the GCC technology";
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
} else {}))

View File

@ -0,0 +1,36 @@
diff --git a/gcc/vhdl/Make-lang.in b/gcc/vhdl/Make-lang.in
index 8f481df..681ac59 100644
--- a/gcc/vhdl/Make-lang.in
+++ b/gcc/vhdl/Make-lang.in
@@ -96,7 +96,7 @@ AGCC_GCCOBJ_DIR=../
AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \
-I$(AGCC_GCCSRC_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/gcc/config \
-I$(AGCC_GCCSRC_DIR)/libcpp/include
-AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS)
+AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS) $(CFLAGS)
AGCC_LOCAL_OBJS=ortho-lang.o
@@ -140,7 +140,7 @@ ghdl$(exeext): force
# Ghdl libraries.
ghdllib: ghdl$(exeext) $(GCC_PASSES) force
- $(MAKE_IN_VHDL) GRT_FLAGS="-O -g" ghdllib
+ $(MAKE_IN_VHDL) GRT_FLAGS="-O -g $(CFLAGS)" ghdllib
# Build hooks:
diff --git a/gcc/vhdl/Makefile.in b/gcc/vhdl/Makefile.in
index d754c6c..07abc4a 100644
--- a/gcc/vhdl/Makefile.in
+++ b/gcc/vhdl/Makefile.in
@@ -80,7 +80,8 @@ T_CPPFLAGS =
X_ADAFLAGS =
T_ADAFLAGS =
-ADAC = $(CC)
+# Never use the bootstrapped compiler, as it may not be built for ada
+ADAC = gcc
ECHO = echo
CHMOD = chmod

View File

@ -0,0 +1,12 @@
diff --git a/Makefile.in b/Makefile.in
index d24c1af..b86e522 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -230,6 +229,7 @@ RAW_CXX_TARGET_EXPORTS = \
NORMAL_TARGET_EXPORTS = \
$(BASE_TARGET_EXPORTS) \
+ CPP="$(CC_FOR_TARGET) -E"; export CPP; \
CXX="$(CXX_FOR_TARGET)"; export CXX;
# Where to find GMP

View File

@ -74,7 +74,7 @@ diff -ru gcc-4.3.1-orig/libgomp/configure gcc-4.3.1/libgomp/configure
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
+# to Glibc gets lost. Here we forcibly add it to any invocation.
+CC="\$CC $NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS"
+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
+
# Is the compiler the GNU compiler?
with_gcc=$GCC
@ -90,7 +90,7 @@ diff -ru gcc-4.3.1-orig/libmudflap/configure gcc-4.3.1/libmudflap/configure
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
+# to Glibc gets lost. Here we forcibly add it to any invocation.
+CC="\$CC $NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS"
+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
+
# Is the compiler the GNU compiler?
with_gcc=$GCC
@ -106,7 +106,7 @@ diff -ru gcc-4.3.1-orig/libssp/configure gcc-4.3.1/libssp/configure
+# Ugly hack to get libmudflap (and possibly other libraries) to build.
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
+# to Glibc gets lost. Here we forcibly add it to any invocation.
+CC="\$CC $NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS"
+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
+
# Is the compiler the GNU compiler?
with_gcc=$GCC
@ -120,10 +120,10 @@ diff -ru gcc-4.3.1-orig/Makefile.in gcc-4.3.1/Makefile.in
###
+CFLAGS += $(NIX_EXTRA_CFLAGS)
+CPPFLAGS_FOR_TARGET += $(NIX_EXTRA_CFLAGS)
+CPPFLAGS_FOR_TARGET += $(NIX_EXTRA_CFLAGS_TARGET)
+CXXFLAGS += $(NIX_EXTRA_CFLAGS)
+LDFLAGS += $(NIX_EXTRA_LDFLAGS)
+LDFLAGS_FOR_TARGET += $(NIX_EXTRA_LDFLAGS)
+LDFLAGS_FOR_TARGET += $(NIX_EXTRA_LDFLAGS_TARGET)
+BOOT_CFLAGS += $(NIX_EXTRA_CFLAGS)
+BOOT_LDFLAGS += $(NIX_EXTRA_LDFLAGS)
+

View File

@ -21,7 +21,7 @@ if test "$noSysDirs" = "1"; then
# Figure out what extra flags to pass to the gcc compilers
# being generated to make sure that they use our glibc.
extraCFlags="$(cat $NIX_GCC/nix-support/libc-cflags)"
extraFlags="$(cat $NIX_GCC/nix-support/libc-cflags)"
extraLDFlags="$(cat $NIX_GCC/nix-support/libc-ldflags) $(cat $NIX_GCC/nix-support/libc-ldflags-before)"
# Use *real* header files, otherwise a limits.h is generated
@ -29,48 +29,100 @@ if test "$noSysDirs" = "1"; then
# SSIZE_MAX, which breaks the build).
export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include
# The path to the Glibc binaries such as `crti.o'.
glibc_libdir="$(cat $NIX_GCC/nix-support/orig-libc)/lib"
# The path to the Glibc binaries such as `crti.o'.
glibc_libdir="$(cat $NIX_GCC/nix-support/orig-libc)/lib"
else
# Hack: support impure environments.
extraCFlags="-isystem /usr/include"
extraFlags="-isystem /usr/include"
extraLDFlags="-L/usr/lib64 -L/usr/lib"
glibc_libdir="/usr/lib"
glibc_libdir="/usr/lib"
export NIX_FIXINC_DUMMY=/usr/include
fi
# Setting $CPATH makes sure both `gcc' and `xgcc' find the C
# library headers, regarless of the language being compiled.
export CPATH="$NIX_FIXINC_DUMMY${CPATH:+:}$CPATH"
# Likewise, to help it find `crti.o' and similar files.
export LIBRARY_PATH="$glibc_libdir${LIBRARY_PATH:+:}$LIBRARY_PATH"
echo "setting \$CPATH to \`$CPATH'"
echo "setting \$LIBRARY_PATH to \`$LIBRARY_PATH'"
extraCFlags="-g0 $extraCFlags"
extraLDFlags="--strip-debug $extraLDFlags"
extraFlags="-g0 -O2 -I$NIX_FIXINC_DUMMY $extraFlags"
extraLDFlags="--strip-debug -L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
EXTRA_FLAGS="$extraFlags"
for i in $extraLDFlags; do
export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i"
done
if test -n "$targetConfig"; then
# Cross-compiling, we need gcc not to read ./specs in order to build
# the g++ compiler (after the specs for the cross-gcc are created).
# Having LIBRARY_PATH= makes gcc read the specs from ., and the build
# breaks. Having this variable comes from the default.nix code to bring
# gcj in.
unset LIBRARY_PATH
unset CPATH
if test -z "$crossStageStatic"; then
EXTRA_FLAGS_TARGET="-g0 -O2 -B${libcCross}/lib -idirafter ${libcCross}/include"
EXTRA_LDFLAGS_TARGET="-Wl,-L${libcCross}/lib"
fi
else
EXTRA_FLAGS_TARGET="$EXTRA_FLAGS"
EXTRA_LDFLAGS_TARGET="$EXTRA_LDFLAGS"
fi
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
# the startfiles.
# FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
# for the startfiles.
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
LIMITS_H_TEST=true \
X_CFLAGS="$extraCflags $EXTRA_LDFLAGS" \
LDFLAGS="$extraCflags $EXTRA_LDFLAGS" \
LDFLAGS_FOR_TARGET="$extraCflags $EXTRA_LDFLAGS" \
CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
CFLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \
FLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \
LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
LDFLAGS_FOR_TARGET="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \
)
if test -z "$targetConfig"; then
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
BOOT_LDFLAGS="$EXTRA_FLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \
)
fi
if test -n "$targetConfig" -a "$crossStageStatic" == 1; then
# We don't want the gcc build to assume there will be a libc providing
# limits.h in this stagae
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
LIMITS_H_TEST=false \
)
else
makeFlagsArray=( \
"${makeFlagsArray[@]}" \
LIMITS_H_TEST=true \
)
fi
fi
if test -n "$targetConfig"; then
# The host strip will destroy some important details of the objects
dontStrip=1
fi
preConfigure() {
if test -n "$newlibSrc"; then
tar xvf "$newlibSrc" -C ..
ln -s ../newlib-*/newlib newlib
# Patch to get armvt5el working:
sed -i -e 's/ arm)/ arm*)/' newlib/configure.host
fi
# Bug - they packaged zlib
if test -d "zlib"; then
# This breaks the build without-headers, which should build only
# the target libgcc as target libraries.
# See 'configure:5370'
rm -Rf zlib
fi
# Perform the build in a different directory.
mkdir ../build
cd ../build
@ -103,13 +155,17 @@ postInstall() {
ln -sfn g++ $i
fi
done
eval "$postInstallGhdl"
}
if test -z "$profiledCompiler"; then
buildFlags="bootstrap $buildFlags"
else
buildFlags="profiledbootstrap $buildFlags"
if test -z "$targetConfig"; then
if test -z "$profiledCompiler"; then
buildFlags="bootstrap $buildFlags"
else
buildFlags="profiledbootstrap $buildFlags"
fi
fi
genericBuild

View File

@ -1,8 +1,11 @@
{ stdenv, fetchurl, noSysDirs
, langC ? true, langCC ? true, langFortran ? false, langTreelang ? false
, langJava ? false
, langAda ? false
, langVhdl ? false
, profiledCompiler ? false
, staticCompiler ? false
, enableShared ? true
, texinfo ? null
, gmp, mpfr, gettext, which
, ppl ? null, cloogppl ? null # used by the Graphite optimization framework
@ -12,17 +15,25 @@
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
, gnatboot ? null
, enableMultilib ? false
, name ? "gcc"
, cross ? null
, binutilsCross ? null
, libcCross ? null
, crossStageStatic ? true
, gnat ? null
}:
assert langTreelang -> bison != null && flex != null;
assert langJava -> zip != null && unzip != null
&& zlib != null && boehmgc != null;
assert langAda -> gnatboot != null;
assert langVhdl -> gnat != null;
with stdenv.lib;
let version = "4.4.2";
let version = "4.4.3";
javaEcj = fetchurl {
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
# `configure' time.
@ -46,26 +57,60 @@ let version = "4.4.2";
javaAwtGtk = langJava && gtk != null;
crossConfigureFlags =
"--target=${cross.config}" +
(if crossStageStatic then
" --disable-libssp --disable-nls" +
" --without-headers" +
" --disable-threads " +
" --disable-libmudflap " +
" --disable-libgomp " +
" --disable-shared"
else
" --with-headers=${libcCross}/include" +
" --enable-__cxa_atexit" +
" --enable-long-long" +
" --enable-threads=posix" +
" --enable-nls"
);
stageNameAddon = if (crossStageStatic) then "-stage-static" else
"-stage-final";
crossNameAddon = if (cross != null) then "-${cross.config}" + stageNameAddon else "";
in
# We need all these X libraries when building AWT with GTK+.
assert gtk != null -> (filter (x: x == null) xlibs) == [];
stdenv.mkDerivation ({
name = "${name}-${version}";
name = "${name}-${version}" + crossNameAddon;
builder = ./builder.sh;
src = (import ./sources.nix) {
inherit fetchurl optional version;
inherit langC langCC langFortran langJava;
inherit langC langCC langFortran langJava langAda;
};
patches =
[./pass-cxxcpp.patch]
++ optional noSysDirs ./no-sys-dirs.patch;
[./pass-cxxcpp.patch
inherit noSysDirs profiledCompiler staticCompiler langJava;
# libmudflap and libstdc++ receive the build CPP,
# and not the target.
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42279
./target-cpp.patch
# Bad mixture of build/target flags
./libstdc++-target.patch
]
++ optional noSysDirs ./no-sys-dirs.patch
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
# target libraries and tools.
++ optional langAda ./gnat-cflags.patch
++ optional langVhdl ./ghdl-ortho-cflags.patch;
inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic
libcCross;
buildInputs = [ texinfo gmp mpfr gettext which ]
++ (optional (ppl != null) ppl)
@ -75,10 +120,14 @@ stdenv.mkDerivation ({
++ (optional (boehmgc != null) boehmgc)
++ (optionals langJava [zip unzip])
++ (optionals javaAwtGtk [gtk pkgconfig libart_lgpl] ++ xlibs)
++ (optionals (cross != null) [binutilsCross])
++ (optionals langAda [gnatboot])
++ (optionals langVhdl [gnat])
;
configureFlags = "
${if enableMultilib then "" else "--disable-multilib"}
${if enableShared then "" else "--disable-shared"}
${if ppl != null then "--with-ppl=${ppl}" else ""}
${if cloogppl != null then "--with-cloog=${cloogppl}" else ""}
${if langJava then "--with-ecj-jar=${javaEcj}" else ""}
@ -96,12 +145,23 @@ stdenv.mkDerivation ({
++ optional langFortran "fortran"
++ optional langJava "java"
++ optional langTreelang "treelang"
++ optional langAda "ada"
++ optional langVhdl "vhdl"
)
)
}
${if stdenv.isi686 then "--with-arch=i686" else ""}
${if langAda then " --enable-libada" else ""}
${if (cross == null && stdenv.isi686) then "--with-arch=i686" else ""}
${if cross != null then crossConfigureFlags else ""}
";
targetConfig = if (cross != null) then cross.config else null;
# Needed for the cross compilation to work
AR = "ar";
LD = "ld";
CC = "gcc";
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
# the library headers and binaries, regarless of the language being
# compiled.
@ -124,7 +184,8 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ])));
passthru = { inherit langC langCC langFortran langTreelang enableMultilib; };
passthru = { inherit langC langCC langAda langFortran langTreelang langVhdl
enableMultilib; };
meta = {
homepage = http://gcc.gnu.org/;
@ -143,9 +204,44 @@ stdenv.mkDerivation ({
maintainers = [
# Add your name here!
stdenv.lib.maintainers.ludo
stdenv.lib.maintainers.viric
];
# Volunteers needed for the {Cyg,Dar}win ports.
platforms = stdenv.lib.platforms.linux;
};
})
}
// (if langVhdl then rec {
name = "ghdl-0.29";
ghdlSrc = fetchurl {
url = "http://ghdl.free.fr/ghdl-0.29.tar.bz2";
sha256 = "15mlinr1lwljwll9ampzcfcrk9bk0qpdks1kxlvb70xf9zhh2jva";
};
# Ghdl has some timestamps checks, storing file timestamps in '.cf' files.
# As we will change the timestamps to 1970-01-01 00:00:01, we also set the
# content of that .cf to that value. This way ghdl does not complain on
# the installed object files from the basic libraries (ieee, ...)
postInstallGhdl = ''
pushd $out
find . -name "*.cf" -exec \
sed 's/[0-9]*\.000" /19700101000001.000" /g' -i {} \;
popd
'';
postUnpack = ''
tar xvf ${ghdlSrc}
mv ghdl-*/vhdl gcc*/gcc
rm -Rf ghdl-*
'';
meta = {
homepage = "http://ghdl.free.fr/";
license = "GPLv2+";
description = "Complete VHDL simulator, using the GCC technology (gcc ${version})";
maintainers = with stdenv.lib.maintainers; [viric];
platforms = with stdenv.lib.platforms; linux;
};
} else {}))

View File

@ -0,0 +1,111 @@
diff --git a/gcc/vhdl/Make-lang.in b/gcc/vhdl/Make-lang.in
index 8f481df..681ac59 100644
--- a/gcc/vhdl/Make-lang.in
+++ b/gcc/vhdl/Make-lang.in
@@ -96,7 +96,7 @@ AGCC_GCCOBJ_DIR=../
AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \
-I$(AGCC_GCCSRC_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/gcc/config \
-I$(AGCC_GCCSRC_DIR)/libcpp/include
-AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS)
+AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS) $(CFLAGS) $(INCLUDES)
AGCC_LOCAL_OBJS=ortho-lang.o
@@ -140,7 +140,7 @@ ghdl$(exeext): force
# Ghdl libraries.
ghdllib: ghdl$(exeext) $(GCC_PASSES) force
- $(MAKE_IN_VHDL) GRT_FLAGS="-O -g" ghdllib
+ $(MAKE_IN_VHDL) GRT_FLAGS="-O -g $(CFLAGS)" ghdllib
# Build hooks:
diff --git a/gcc/vhdl/Makefile.in b/gcc/vhdl/Makefile.in
index d754c6c..07abc4a 100644
--- a/gcc/vhdl/Makefile.in
+++ b/gcc/vhdl/Makefile.in
@@ -80,7 +80,8 @@ T_CPPFLAGS =
X_ADAFLAGS =
T_ADAFLAGS =
-ADAC = $(CC)
+# Never use the bootstrapped compiler, as it may not be built for ada
+ADAC = gcc
ECHO = echo
CHMOD = chmod
diff --git a/gcc/vhdl/ortho-lang.c b/gcc/vhdl/ortho-lang.c
index 84aeb92..8eddd42 100644
--- a/gcc/vhdl/ortho-lang.c
+++ b/gcc/vhdl/ortho-lang.c
@@ -16,6 +16,7 @@
#include "options.h"
#include "real.h"
-#include "tree-gimple.h"
+#include "gimple.h"
+#include "tree.h"
#include "function.h"
#include "cgraph.h"
#include "target.h"
@@ -680,38 +681,10 @@ type_for_mode (enum machine_mode mode, int unsignedp)
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
-/* Tree code classes. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-
-const enum tree_code_class tree_code_type[] = {
-#include "tree.def"
- 'x'
-};
-#undef DEFTREECODE
-
-/* Table indexed by tree code giving number of expression
- operands beyond the fixed part of the node structure.
- Not used for types or decls. */
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
-
-const unsigned char tree_code_length[] = {
-#include "tree.def"
- 0
-};
-#undef DEFTREECODE
-
-#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) NAME,
-const char * const tree_code_name[] = {
-#include "tree.def"
- "@@dummy"
-};
-#undef DEFTREECODE
union lang_tree_node
GTY((desc ("0"),
- chain_next ("(union lang_tree_node *) GENERIC_NEXT (&%h.generic)")))
+ chain_next ("(union lang_tree_node *) TREE_CHAIN (&%h.generic)")))
{
union tree_node GTY ((tag ("0"))) generic;
};
@@ -1162,7 +1135,7 @@ new_access_type (tree dtype)
res = make_node (POINTER_TYPE);
TREE_TYPE (res) = NULL_TREE;
/* Seems necessary. */
- TYPE_MODE (res) = Pmode;
+ SET_TYPE_MODE (res, Pmode);
layout_type (res);
return res;
}
diff --git a/gcc/vhdl/Make-lang.in b/gcc/vhdl/Make-lang.in
index e201f64..f36fb97 100644
--- a/gcc/vhdl/Make-lang.in
+++ b/gcc/vhdl/Make-lang.in
@@ -132,7 +132,7 @@ ghdl1$(exeext): $(AGCC_OBJS) $(AGCC_DEPS) force
-cargs $(CFLAGS) $(GHDL_ADAFLAGS)
$(GNATMAKE) -o $@ -aI$(srcdir)/vhdl -aOvhdl ortho_gcc-main \
-bargs -E -cargs $(CFLAGS) $(GHDL_ADAFLAGS) \
- -largs $(AGCC_OBJS) $(LIBS) $(GMPLIBS)
+ -largs $(AGCC_OBJS) $(LIBS) $(GMPLIBS) $(CLOOGLIBS) $(PPLLIBS)
# The driver for ghdl.
ghdl$(exeext): force

View File

@ -0,0 +1,33 @@
diff --git a/libada/Makefile.in b/libada/Makefile.in
index f5057a0..337e0c6 100644
--- a/libada/Makefile.in
+++ b/libada/Makefile.in
@@ -55,7 +55,7 @@ GCC_WARN_CFLAGS = $(LOOSE_WARN)
WARN_CFLAGS = @warn_cflags@
TARGET_LIBGCC2_CFLAGS=
-GNATLIBCFLAGS= -g -O2
+GNATLIBCFLAGS= -g -O2 $(CFLAGS)
GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
-DIN_RTS @have_getipinfo@
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -105,7 +105,7 @@ ADAFLAGS = -W -Wall -gnatpg -gnata
SOME_ADAFLAGS =-gnata
FORCE_DEBUG_ADAFLAGS = -g
GNATLIBFLAGS = -gnatpg -nostdinc
-GNATLIBCFLAGS = -g -O2
+GNATLIBCFLAGS = -g -O2 $(CFLAGS_FOR_TARGET)
# Pretend that _Unwind_GetIPInfo is available for the target by default. This
# should be autodetected during the configuration of libada and passed down to
# here, but we need something for --disable-libada and hope for the best.
@@ -1838,7 +1838,7 @@ ADA_INCLUDE_SRCS =\
LIBGNAT=../$(RTSDIR)/libgnat.a
-GCC_LINK=$(CC) -static-libgcc $(ADA_INCLUDES)
+GCC_LINK=$(CC) -static-libgcc $(CFLAGS_FOR_TARGET) $(ADA_INCLUDES)
# when compiling the tools, the runtime has to be first on the path so that
# it hides the runtime files lying with the rest of the sources

View File

@ -0,0 +1,15 @@
diff --git a/Makefile.in b/Makefile.in
index 245c770..8545b60 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -250,8 +250,8 @@ BASE_TARGET_EXPORTS = \
RAW_CXX_TARGET_EXPORTS = \
$(BASE_TARGET_EXPORTS) \
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
- CXX="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD)"; export CXX; \
- CXXCPP="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD) -E"; export CXXCPP;
+ CXX="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_TARGET)"; export CXX; \
+ CXXCPP="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_TARGET) -E"; export CXXCPP;
NORMAL_TARGET_EXPORTS = \
$(BASE_TARGET_EXPORTS) \

View File

@ -1,22 +1,26 @@
/* Automatically generated by `update-gcc.sh', do not edit.
For GCC 4.4.2. */
{ fetchurl, optional, version, langC, langCC, langFortran, langJava }:
{ fetchurl, optional, version, langC, langCC, langFortran, langJava, langAda }:
assert version == "4.4.2";
assert version == "4.4.3";
optional /* langC */ true (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
sha256 = "03cgv3b9bqhap4bks5wfg7nyj64l5c3qyn1igpqc6gk60bxm9wym";
sha256 = "0ml360nwkf95w0ykn19zlyxmdvvzpmrbxj2vfrn0k8i2pvk13wwj";
}) ++
optional langCC (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
sha256 = "0al23gnx4v50j1y6xb23by34m2qhavm2xxn3f1v8kis7ajlbm1j1";
sha256 = "1s5zy8pfn4rgfm2l1dpfzrrdhi2l5zhphqk0h3gsbn1pdw751kkv";
}) ++
optional langFortran (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2";
sha256 = "0zk3j5r1cc5ahm0njxba1xfvv2h39d17aqakgg354pig4hpjkidc";
sha256 = "0iivw5kgwxdlqamwgaw5zhw48jajsmg09fgynyxkrxsa702s74sw";
}) ++
optional langJava (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2";
sha256 = "0ydk0qyhi1fdyz2xvj6m6l7cav4wg3962a1jxpf2j3nppm0p1dvp";
sha256 = "13r0yxz6sif3i6sxh7b3fa5m1ygynvsg1bf6ssq6njp1fzp9a2kq";
}) ++
optional langAda (fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-ada-${version}.tar.bz2";
sha256 = "146jfkwgg7gdgfqnrm04133amk8k9vr51wc01rwp2bcjai9c3kk7";
}) ++
[]

View File

@ -0,0 +1,12 @@
diff --git a/Makefile.in b/Makefile.in
index 8545b60..1fab64d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -231,6 +231,7 @@ BASE_TARGET_EXPORTS = \
CC="$(CC_FOR_TARGET)"; export CC; \
CFLAGS="$(CFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
+ CPP="$(CC_FOR_TARGET) -E"; export CPP; \
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET)"; export CXXFLAGS; \
GCJ="$(GCJ_FOR_TARGET)"; export GCJ; \

View File

@ -0,0 +1,48 @@
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "gentoo-gnatboot-4.1";
src = if (stdenv.system == "i686-linux") then
fetchurl {
url = "mirror://gentoo/distfiles/gnatboot-4.1-i386.tar.bz2";
sha256 = "0665zk71598204bf521vw68i5y6ccqarq9fcxsqp7ccgycb4lysr";
}
else if (stdenv.system == "x86_64-linux") then
fetchurl {
url = "mirror://gentoo/distfiles/gnatboot-4.1-amd64.tar.bz2";
sha256 = "1li4d52lmbnfs6llcshlbqyik2q2q4bvpir0f7n38nagp0h6j0d4";
} else throw "Platform not supported";
dontStrip=1;
installPhase = ''
ensureDir $out
cp -R * $out
set +e
for a in $out/bin/* ; do
patchelf --interpreter $(cat $NIX_GCC/nix-support/dynamic-linker) \
--set-rpath $(cat $NIX_GCC/nix-support/orig-libc)/lib:$(cat $NIX_GCC/nix-support/orig-gcc)/lib64:$(cat $NIX_GCC/nix-support/orig-gcc)/lib $a
done
set -e
mv $out/bin/gnatgcc_2wrap $out/bin/gnatgcc
ln -s $out/bin/gnatgcc $out/bin/gcc
'';
passthru = {
langC = true; /* TRICK for gcc-wrapper to wrap it */
langCC = false;
langFortran = false;
langAda = true;
};
meta = {
homepage = http://gentoo.org;
license = "GPLv3+"; # runtime support libraries are typically LGPLv3+
maintainers = [
stdenv.lib.maintainers.viric
];
platforms = stdenv.lib.platforms.linux;
};
}

View File

@ -1,5 +1,10 @@
args: with args;
let
useX11 = (stdenv.system != "armv5tel-linux");
useNativeCompilers = (stdenv.system != "armv5tel-linux");
inherit (stdenv.lib) optionals optionalString;
in
stdenv.mkDerivation (rec {
name = "ocaml-3.11.1";
@ -10,10 +15,10 @@ stdenv.mkDerivation (rec {
};
prefixKey = "-prefix ";
configureFlags = ["-no-tk" "-x11lib" x11];
buildFlags = "world bootstrap world.opt";
buildInputs = [x11 ncurses];
installTargets = "install installopt";
configureFlags = ["-no-tk"] ++ optionals useX11 [ "-x11lib" x11 ];
buildFlags = "world" + optionalString useNativeCompilers " bootstrap world.opt";
buildInputs = [ncurses] ++ optionals useX11 [ x11 ];
installTargets = "install" + optionalString useNativeCompilers " installopt";
patchPhase = ''
CAT=$(type -tp cat)
sed -e "s@/bin/cat@$CAT@" -i config/auto-aux/sharpbang

View File

@ -0,0 +1,31 @@
args: with args;
stdenv.mkDerivation (rec {
name = "ocaml-cvs-2009-09-24";
src = fetchcvs {
cvsRoot = ":pserver:anoncvs@camlcvs.inria.fr:/caml";
module = "ocaml";
date = "2009-09-24";
sha256 = "3909bffebc9ce36ca51711d7d95596cba94376ebb1975c6ed46b09c9892c3ef1";
};
prefixKey = "-prefix ";
configureFlags = ["-no-tk"];
buildFlags = "world" +
(if (stdenv.system != "armv5tel-linux") then "bootstrap world.opt" else "");
buildInputs = [ncurses];
installTargets = "install" + (if (stdenv.system != "armv5tel-linux") then "installopt" else "");
patchPhase = ''
CAT=$(type -tp cat)
sed -e "s@/bin/cat@$CAT@" -i config/auto-aux/sharpbang
'';
meta = {
homepage = http://caml.inria.fr/ocaml;
license = "QPL, LGPL2 (library part)";
desctiption = "Most popular variant of the Caml language";
};
})

View File

@ -3,13 +3,15 @@
stdenv.mkDerivation rec {
name = "guile-1.8.7";
src = fetchurl {
url = "mirror://gnu/guile/" + name + ".tar.gz";
sha256 = "1czhcrn6l63xhsw3fjmv88djflqxbdpxjhgmwwvscm8rv4wn7vmz";
};
buildInputs = [ makeWrapper ];
propagatedBuildInputs = [readline libtool gmp gawk];
buildNativeInputs = [ makeWrapper gawk ];
propagatedBuildInputs = [ readline gmp libtool ];
selfBuildNativeInput = true;
postInstall = ''
wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"
@ -19,7 +21,17 @@ stdenv.mkDerivation rec {
sed -e '/lt_dlinit/a lt_dladdsearchdir("'$out/lib'");' -i libguile/dynl.c
'';
doCheck = true;
# Guile needs patching to preset results for the configure tests
# about pthreads, which work only in native builds.
preConfigure = ''
if test -n "$crossConfig"; then
configureFlags="--with-threads=no $configureFlags"
fi
'';
# One test fails.
# ERROR: file: "libtest-asmobs", message: "file not found"
doCheck = false;
setupHook = ./setup-hook.sh;

View File

@ -2,26 +2,34 @@
stdenv.mkDerivation rec {
name = "maude-2.4";
meta = {
homepage = "http://maude.cs.uiuc.edu/";
description = "Maude -- a high-level specification language";
license = "GPLv2";
};
src = fetchurl {
url = "http://maude.cs.uiuc.edu/download/current/Maude-2.4.tar.gz";
sha256 = "0bydkf8fd5v267bfak4mm5lmm3vvnr6ir1jr7gimgyzqygdk0in2";
};
fullMaude = fetchurl {
url = "http://maude.cs.uiuc.edu/download/current/FM2.4/full-maude24.maude";
sha256 = "9e4ebdc717dc968d0b6c1179f360e60b3a39ea8cecc1a7fa49f2105bbddc48c4";
};
docs = fetchurl {
url = "http://mirror.switch.ch/mirror/gentoo/distfiles/maude-2.3.0-extras.tar.bz2";
sha256 = "0kd5623k1wwj1rk4b6halrm3sdvd9kbiwg1hi2c3qim1nlfdgl0d";
};
buildInputs = [flex bison ncurses buddy tecla gmpxx libsigsegv makeWrapper];
configurePhase = ''./configure --disable-dependency-tracking --prefix=$out --datadir=$out/share/maude TECLA_LIBS="-ltecla -lncursesw" CFLAGS="-O3" CXXFLAGS="-O3"'';
doCheck = true;
postInstall =
''
for n in $out/bin/*; do wrapProgram "$n" --suffix MAUDE_LIB ':' "$out/share/maude"; done

View File

@ -1,33 +1,39 @@
{ stdenv, fetchurl
, impureLibcPath ? null
}:
{ stdenv, fetchurl }:
stdenv.mkDerivation {
name = "perl-5.10.0";
let
libc = if stdenv ? gcc && stdenv.gcc.libc != null then stdenv.gcc.libc else "/usr";
in
stdenv.mkDerivation rec {
name = "perl-5.10.1";
src = fetchurl {
url = mirror://cpan/src/perl-5.10.0.tar.gz;
sha256 = "0bivbz15x02m02gqs6hs77cgjr2msfrhnvp5xqk359jg6w6llill";
url = "mirror://cpan/src/${name}.tar.gz";
sha256 = "0dagnhjgmslfx1jawz986nvc3jh1klk7mn2l8djdca1b9gm2czyb";
};
patches = [
# This patch does the following:
# 1) Do use the PATH environment variable to find the `pwd' command.
# By default, Perl will only look for it in /lib and /usr/lib.
# !!! what are the security implications of this?
# 2) Force the use of <errno.h>, not /usr/include/errno.h, on Linux
# systems. (This actually appears to be due to a bug in Perl.)
./no-sys-dirs.patch
];
patches =
[ # Do not look in /usr etc. for dependencies.
./no-sys-dirs.patch
];
# Build a thread-safe Perl with a dynamic libperls.o. We need the
# "installstyle" option to ensure that modules are put under
# $out/lib/perl5 - this is the general default, but because $out
# contains the string "perl", Configure would select $out/lib.
configureFlags = ''
-de -Dcc=gcc -Uinstallusrbinperl -Dinstallstyle=lib/perl5 -Duseshrplib
${if stdenv ? glibc then "-Dusethreads" else ""}
'';
# Miniperl needs -lm. perl needs -lrt.
configureFlags =
[ "-de"
"-Dcc=gcc"
"-Uinstallusrbinperl"
"-Dinstallstyle=lib/perl5"
"-Duseshrplib"
"-Dlocincpth=${libc}/include"
"-Dloclibpth=${libc}/lib"
]
++ stdenv.lib.optional (stdenv ? glibc) "-Dusethreads";
configureScript = "${stdenv.shell} ./Configure";
@ -37,18 +43,15 @@ stdenv.mkDerivation {
''
configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
if test "${if impureLibcPath == null then "$NIX_ENFORCE_PURITY" else "1"}" = "1"; then
GLIBC=${if impureLibcPath == null then "$(cat $NIX_GCC/nix-support/orig-libc)" else impureLibcPath}
configureFlags="$configureFlags -Dlocincpth=$GLIBC/include -Dloclibpth=$GLIBC/lib"
fi
${stdenv.lib.optionalString (stdenv.system == "armv5tel-linux") ''
configureFlagsArray=(-Dldflags="-lm -lrt")
''}
'';
preBuild =
preBuild = stdenv.lib.optionalString (!(stdenv ? gcc && stdenv.gcc.nativeTools))
''
# Make Cwd work on NixOS (where we don't have a /bin/pwd).
${if (stdenv.isDarwin || stdenv.system == "i686-gnu/kfreebsd")
then ""
else "substituteInPlace lib/Cwd.pm --replace \"'/bin/pwd'\" \"'$(type -tP pwd)'\""}
substituteInPlace lib/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
'';
setupHook = ./setup-hook.sh;

View File

@ -1,8 +1,8 @@
diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
*** perl-5.10.0-orig/Configure 2007-12-18 11:47:07.000000000 +0100
--- perl-5.10.0/Configure 2008-02-21 17:00:40.000000000 +0100
diff -rc -x '*~' perl-5.10.1-orig/Configure perl-5.10.1/Configure
*** perl-5.10.1-orig/Configure 2009-08-18 21:03:53.000000000 +0200
--- perl-5.10.1/Configure 2010-01-26 19:08:32.933792254 +0100
***************
*** 104,118 ****
*** 103,117 ****
fi
: Proper PATH setting
@ -18,7 +18,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
for p in $paths
do
--- 104,110 ----
--- 103,109 ----
fi
: Proper PATH setting
@ -27,8 +27,8 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
for p in $paths
do
***************
*** 1271,1287 ****
groupstype=''
*** 1301,1317 ****
archname=''
libnames=''
: change the next line if compiling for Xenix/286 on Xenix/386
! xlibpth='/usr/lib/386 /lib/386'
@ -45,8 +45,8 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
: Private path used by Configure to find libraries. Its value
: is prepended to libpth. This variable takes care of special
--- 1263,1274 ----
groupstype=''
--- 1293,1304 ----
archname=''
libnames=''
: change the next line if compiling for Xenix/286 on Xenix/386
! xlibpth=''
@ -59,7 +59,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
: Private path used by Configure to find libraries. Its value
: is prepended to libpth. This variable takes care of special
***************
*** 1302,1309 ****
*** 1329,1336 ****
: Possible local include directories to search.
: Set locincpth to "" in a hint file to defeat local include searches.
@ -68,7 +68,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
:
: no include file wanted by default
inclwanted=''
--- 1289,1295 ----
--- 1316,1322 ----
: Possible local include directories to search.
: Set locincpth to "" in a hint file to defeat local include searches.
@ -77,7 +77,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
: no include file wanted by default
inclwanted=''
***************
*** 1331,1338 ****
*** 1358,1365 ****
libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
: We probably want to search /usr/shlib before most other libraries.
: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
@ -86,9 +86,9 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
: Do not use vfork unless overridden by a hint file.
usevfork=false
--- 1317,1322 ----
--- 1344,1349 ----
***************
*** 2340,2346 ****
*** 2366,2372 ****
zip
"
pth=`echo $PATH | sed -e "s/$p_/ /g"`
@ -96,9 +96,9 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
for file in $loclist; do
eval xxx=\$$file
case "$xxx" in
--- 2324,2329 ----
--- 2350,2355 ----
***************
*** 8155,8167 ****
*** 8361,8373 ****
echo " "
case "$sysman" in
'')
@ -112,7 +112,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
;;
esac
if $test -d "$sysman"; then
--- 8138,8145 ----
--- 8344,8351 ----
echo " "
case "$sysman" in
'')
@ -122,7 +122,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
esac
if $test -d "$sysman"; then
***************
*** 19005,19013 ****
*** 19476,19484 ****
case "$full_ar" in
'') full_ar=$ar ;;
esac
@ -132,7 +132,7 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
: see what type gids are declared as in the kernel
echo " "
--- 18983,18992 ----
--- 19454,19463 ----
case "$full_ar" in
'') full_ar=$ar ;;
esac
@ -143,11 +143,11 @@ diff -rc perl-5.10.0-orig/Configure perl-5.10.0/Configure
: see what type gids are declared as in the kernel
echo " "
diff -rc perl-5.10.0-orig/ext/Errno/Errno_pm.PL perl-5.10.0/ext/Errno/Errno_pm.PL
*** perl-5.10.0-orig/ext/Errno/Errno_pm.PL 2007-12-18 11:47:07.000000000 +0100
--- perl-5.10.0/ext/Errno/Errno_pm.PL 2008-02-21 17:00:02.000000000 +0100
diff -rc -x '*~' perl-5.10.1-orig/ext/Errno/Errno_pm.PL perl-5.10.1/ext/Errno/Errno_pm.PL
*** perl-5.10.1-orig/ext/Errno/Errno_pm.PL 2009-06-27 18:09:45.000000000 +0200
--- perl-5.10.1/ext/Errno/Errno_pm.PL 2010-01-26 18:08:09.552792021 +0100
***************
*** 140,150 ****
*** 144,154 ****
if ($dep =~ /(\S+errno\.h)/) {
$file{$1} = 1;
}
@ -159,7 +159,7 @@ diff -rc perl-5.10.0-orig/ext/Errno/Errno_pm.PL perl-5.10.0/ext/Errno/Errno_pm.P
# Some Linuxes have weird errno.hs which generate
# no #file or #line directives
my $linux_errno_h = -e '/usr/include/errno.h' ?
--- 140,146 ----
--- 144,150 ----
if ($dep =~ /(\S+errno\.h)/) {
$file{$1} = 1;
}
@ -167,3 +167,35 @@ diff -rc perl-5.10.0-orig/ext/Errno/Errno_pm.PL perl-5.10.0/ext/Errno/Errno_pm.P
# Some Linuxes have weird errno.hs which generate
# no #file or #line directives
my $linux_errno_h = -e '/usr/include/errno.h' ?
diff -rc -x '*~' perl-5.10.1-orig/hints/freebsd.sh perl-5.10.1/hints/freebsd.sh
*** perl-5.10.1-orig/hints/freebsd.sh 2009-02-12 23:58:12.000000000 +0100
--- perl-5.10.1/hints/freebsd.sh 2010-01-26 18:30:01.181854620 +0100
***************
*** 118,130 ****
objformat=`/usr/bin/objformat`
if [ x$objformat = xaout ]; then
if [ -e /usr/lib/aout ]; then
! libpth="/usr/lib/aout /usr/local/lib /usr/lib"
! glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
fi
lddlflags='-Bshareable'
else
! libpth="/usr/lib /usr/local/lib"
! glibpth="/usr/lib /usr/local/lib"
ldflags="-Wl,-E "
lddlflags="-shared "
fi
--- 118,130 ----
objformat=`/usr/bin/objformat`
if [ x$objformat = xaout ]; then
if [ -e /usr/lib/aout ]; then
! libpth=""
! glibpth=""
fi
lddlflags='-Bshareable'
else
! libpth=""
! glibpth=""
ldflags="-Wl,-E "
lddlflags="-shared "
fi

View File

@ -12,6 +12,12 @@ stdenv.mkDerivation {
# Fix for http://bugzilla.sen.cwi.nl:8080/show_bug.cgi?id=841
./max-long.patch
];
# There are apparently still some aliasing bugs left in
# aterm-2.4.2-fixes-r2 (in AT_setAnnotations to be precise), but
# under my reading of the C standard it should be fine. Anyway, just
# disable strict aliasing.
NIX_CFLAGS_COMPILE = "-fno-strict-aliasing";
doCheck = true;

View File

@ -8,7 +8,8 @@ stdenv.mkDerivation rec {
sha256 = "0mjxliarzcy7iksh6v1npxsqdpc9sjj3q4wcl567asbdzdpbd803";
};
buildInputs = [pkgconfig perl];
buildNativeInputs = [perl];
buildInputs = [pkgconfig];
propagatedBuildInputs = [glib];
meta = {

View File

@ -1,11 +1,11 @@
{ fetchurl, stdenv, ppl }:
stdenv.mkDerivation rec {
name = "cloog-ppl-0.15.4";
name = "cloog-ppl-0.15.7";
src = fetchurl {
url = "mirror://gcc/infrastructure/${name}.tar.gz";
sha256 = "133b6ayi6wmvbmvd4y1w1xh01qy38kp59n87j7apkm2ig8avfnmm";
sha256 = "0zb96524jk2l78gr5gw0wq3dnvdsmyr2av59v89zv5xcps417q55";
};
propagatedBuildInputs = [ ppl ];

View File

@ -0,0 +1,21 @@
diff -up cyrus-sasl-2.1.22/plugins/digestmd5.c.elif cyrus-sasl-2.1.22/plugins/digestmd5.c
--- cyrus-sasl-2.1.22/plugins/digestmd5.c.elif 2009-01-23 09:40:31.000000000 +0100
+++ cyrus-sasl-2.1.22/plugins/digestmd5.c 2009-02-06 15:20:15.000000000 +0100
@@ -2743,7 +2743,7 @@ static sasl_server_plug_t digestmd5_serv
"DIGEST-MD5", /* mech_name */
#ifdef WITH_RC4
128, /* max_ssf */
-#elif WITH_DES
+#elif defined(WITH_DES)
112,
#else
1,
@@ -4071,7 +4071,7 @@ static sasl_client_plug_t digestmd5_clie
"DIGEST-MD5",
#ifdef WITH_RC4 /* mech_name */
128, /* max ssf */
-#elif WITH_DES
+#elif defined(WITH_DES)
112,
#else
1,

View File

@ -9,4 +9,5 @@ stdenv.mkDerivation {
};
configureFlags="--with-openssl=${openssl} --with-plugindir=\${out}/lib/sasl2 --with-configdir=\${out}/lib/sasl2";
buildInputs = [ openssl db4 gettext ];
patches = [ ./cyrus-sasl-2.1.22-bad-elif.patch ];
}

View File

@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
sha256 = "0nv4gxcbpa9f0907dmzmfm222w8y45z19cx27l85f5qknf8hncxm";
};
buildInputs = [pkgconfig expat gettext];
buildInputs = [pkgconfig expat gettext libiconv];
propagatedBuildInputs = [dbus.libs glib];

View File

@ -0,0 +1,63 @@
# Glibc cannot have itself in its RPATH.
export NIX_NO_SELF_RPATH=1
source $stdenv/setup
# Explicitly tell glibc to use our pwd, not /bin/pwd.
export PWD_P=$(type -tP pwd)
# Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to
# prevent a retained dependency on the bootstrap tools in the
# stdenv-linux bootstrap.
export BASH_SHELL=/bin/sh
preConfigure() {
for i in libc/configure libc/io/ftwtest-sh; do
# Can't use substituteInPlace here because replace hasn't been
# built yet in the bootstrap.
sed -i "$i" -e "s^/bin/pwd^$PWD_P^g"
done
# Include source for debugging
ensureDir $out/src
cp -R libc ports $out/src
ln -s $out/src/ports $out/src/libc/ports
# glibc wants -O2 minimum
export CFLAGS="-pipe -g -O2"
mkdir $NIX_BUILD_TOP/build
cd $NIX_BUILD_TOP/build
configureScript=$out/src/libc/configure
}
postConfigure() {
# Hack: get rid of the `-static' flag set by the bootstrap stdenv.
# This has to be done *after* `configure' because it builds some
# test binaries.
export NIX_CFLAGS_LINK=
export NIX_LDFLAGS_BEFORE=
export NIX_DONT_SET_RPATH=1
unset CFLAGS
}
postInstall() {
if test -n "$installLocales"; then
make localedata/install-locales
fi
rm $out/etc/ld.so.cache
(cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1
# Fix for NIXOS-54 (ldd not working on x86_64). Make a symlink
# "lib64" to "lib".
if test -n "$is64bit"; then
ln -s lib $out/lib64
fi
}
genericBuild

View File

@ -0,0 +1,32 @@
{ stdenv, fetchsvn, kernelHeaders
, installLocales ? true
, profilingLibraries ? false
}:
stdenv.mkDerivation rec {
name = "eglibc-2.10";
src = fetchsvn {
url = svn://svn.eglibc.org/branches/eglibc-2_10;
rev = 8690;
sha256 = "029hklrx2rlhsb5r2csd0gapjm0rbr8n28ib6jnnhms12x302viq";
};
inherit kernelHeaders installLocales;
configureFlags = [
"--with-headers=${kernelHeaders}/include"
"--without-fp"
"--enable-add-ons=libidn,ports,nptl"
"--disable-profile"
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
];
builder = ./builder.sh;
meta = {
homepage = http://www.gnu.org/software/libc/;
description = "The GNU C Library";
};
}

View File

@ -13,6 +13,17 @@ stdenv.mkDerivation rec {
configureFlags = "--with-confdir=/etc/fonts --with-cache-dir=/var/cache/fontconfig --disable-docs --with-default-fonts=";
# We should find a better way to access the arch reliably.
crossArch = if (stdenv ? cross && stdenv.cross != null)
then stdenv.cross.arch else null;
preConfigure = ''
if test -n "$crossConfig"; then
configureFlags="$configureFlags --with-arch=$crossArch";
fi
'';
# Don't try to write to /etc/fonts or /var/cache/fontconfig at install time.
installFlags = "CONFDIR=$(out)/etc/fonts RUN_FC_CACHE_TEST=false fc_cachedir=$(TMPDIR)/dummy";

View File

@ -1,5 +1,4 @@
{ stdenv, fetchurl
, # FreeType supports hinting using a TrueType bytecode interpreter,
# as well as sub-pixel rendering. These are patented by Apple and
# Microsoft, respectively, so they are disabled by default. This
@ -8,7 +7,7 @@
useEncumberedCode ? false
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (rec {
name = "freetype-2.3.11";
src = fetchurl {
@ -26,4 +25,7 @@ stdenv.mkDerivation rec {
homepage = http://www.freetype.org/;
license = "GPLv2+"; # or the FreeType License (BSD + advertising clause)
};
}
} //
# The asm for armel is written with the 'asm' keyword.
(if (stdenv.system == "armv5tel-linux") then
{CFLAGS = "-std=gnu99";} else {}))

View File

@ -10,6 +10,17 @@ stdenv.mkDerivation (rec {
configureFlags = "--disable-csharp";
# On cross building, gettext supposes that the wchar.h from libc
# does not fulfill gettext needs, so it tries to work with its
# own wchar.h file, which does not cope well with the system's
# wchar.h and stddef.h (gcc-4.3 - glibc-2.9)
preConfigure = ''
if test -n "$crossConfig"; then
echo gl_cv_func_wcwidth_works=yes > cachefile
configureFlags="$configureFlags --cache-file=`pwd`/cachefile"
fi
'';
meta = {
description = "GNU gettext, a well integrated set of translation tools and documentation";

View File

@ -8,7 +8,8 @@ stdenv.mkDerivation rec {
sha256 = "0ndgshcqzpj3piwmag3vrsv3rg4pnr12y70knl7z0k2i03cy5bav";
};
buildInputs = [pkgconfig gettext perl];
buildNativeInputs = [perl];
buildInputs = [pkgconfig gettext];
# The nbd package depends on a static version of this library; hence
# the default configure flag --disable-static is switched off.

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, pkgconfig, gettext, perl }:
{ stdenv, fetchurl, pkgconfig, gettext, perl, libiconv ? null}:
stdenv.mkDerivation rec {
name = "glib-2.22.4";
@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
sha256 = "055dv2hymbyzwpcd39r97x747vsvlkyywa826zr75dzambw6n7qd";
};
buildInputs = [pkgconfig gettext perl];
buildInputs = [pkgconfig gettext perl libiconv];
# The nbd package depends on a static version of this library; hence
# the default configure flag --disable-static is switched off.

View File

@ -0,0 +1,42 @@
Support GNU Binutils 2.20 and beyond. Patch from
http://sourceware.org/ml/libc-alpha/2009-09/msg00009.html .
diff --git a/configure b/configure
index 48e6952..b1d84d7 100755
--- a/configure
+++ b/configure
@@ -4841,7 +4841,7 @@ $as_echo_n "checking version of $AS... " >&6; }
ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|[2-9].[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
@@ -4904,7 +4904,7 @@ $as_echo_n "checking version of $LD... " >&6; }
ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|[2-9].[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff --git a/configure.in b/configure.in
index 4584afe..7c4f71f 100644
--- a/configure.in
+++ b/configure.in
@@ -897,10 +897,10 @@ AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
# Accept binutils 2.13 or newer.
AC_CHECK_PROG_VER(AS, $AS, --version,
[GNU assembler.* \([0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
+ [2.1[3-9]*|[2-9].[2-9]*], AS=: critic_missing="$critic_missing as")
AC_CHECK_PROG_VER(LD, $LD, --version,
[GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
+ [2.1[3-9]*|[2-9].[2-9]*], LD=: critic_missing="$critic_missing ld")
# We need the physical current working directory. We cannot use the
# "pwd -P" shell builtin since that's not portable. Instead we try to

View File

@ -0,0 +1,33 @@
# Glibc cannot have itself in its RPATH.
export NIX_NO_SELF_RPATH=1
source $stdenv/setup
postConfigure() {
# Hack: get rid of the `-static' flag set by the bootstrap stdenv.
# This has to be done *after* `configure' because it builds some
# test binaries.
export NIX_CFLAGS_LINK=
export NIX_LDFLAGS_BEFORE=
export NIX_DONT_SET_RPATH=1
unset CFLAGS
}
postInstall() {
if test -n "$installLocales"; then
make localedata/install-locales
fi
test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
(cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1
# Fix for NIXOS-54 (ldd not working on x86_64). Make a symlink
# "lib64" to "lib".
if test -n "$is64bit"; then
ln -s lib $out/lib64
fi
}
genericBuild

View File

@ -0,0 +1,164 @@
/* Build configuration used to build glibc, Info files, and locale
information. */
cross : { name, fetchurl, stdenv, installLocales ? false
, gccCross ? null, kernelHeaders ? null
, profilingLibraries ? false, meta, ... }@args :
let version = "2.10.1";
in
assert (cross != null) -> (gccCross != null);
stdenv.mkDerivation ({
inherit kernelHeaders installLocales;
# The host/target system.
crossConfig = if (cross != null) then cross.config else null;
inherit (stdenv) is64bit;
patches = [
/* Fix for NIXPKGS-79: when doing host name lookups, when
nsswitch.conf contains a line like
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
don't return an error when mdns4_minimal can't be found. This
is a bug in Glibc: when a service can't be found, NSS should
continue to the next service unless "UNAVAIL=return" is set.
("NOTFOUND=return" refers to the service returning a NOTFOUND
error, not the service itself not being found.) The reason is
that the "status" variable (while initialised to UNAVAIL) is
outside of the loop that iterates over the services, the
"files" service sets status to NOTFOUND. So when the call to
find "mdns4_minimal" fails, "status" will still be NOTFOUND,
and it will return instead of continuing to "dns". Thus, the
line
hosts: mdns4_minimal [NOTFOUND=return] dns mdns4
does work because "status" will contain UNAVAIL after the
failure to find mdns4_minimal. */
./nss-skip-unavail.patch
/* Make it possible to override the locale-archive in NixOS. */
./locale-override.patch
/* Have rpcgen(1) look for cpp(1) in $PATH. */
./rpcgen-path.patch
/* Make sure `nscd' et al. are linked against `libssp'. */
./stack-protector-link.patch
/* Allow binutils 2.20 to be used (patch on its version checking) */
./binutils-2.20.patch
];
configureFlags = [
"-C"
"--enable-add-ons"
(if kernelHeaders != null
then "--with-headers=${kernelHeaders}/include"
else "--without-headers")
(if profilingLibraries
then "--enable-profile"
else "--disable-profile")
] ++ stdenv.lib.optionals (cross != null) [
"--with-tls"
"--enable-kernel=2.6.0"
"--without-fp"
"--with-__thread"
] ++ (if (stdenv.system == "armv5tel-linux") then [
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
"--without-fp"
] else []);
buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ];
# Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to
# prevent a retained dependency on the bootstrap tools in the stdenv-linux
# bootstrap.
BASH_SHELL = "/bin/sh";
}
//
(if (stdenv.system == "i686-linux")
then {
# Workaround for this bug:
# http://sourceware.org/bugzilla/show_bug.cgi?id=411
# I.e. when gcc is compiled with --with-arch=i686, then the
# preprocessor symbol `__i686' will be defined to `1'. This causes
# the symbol __i686.get_pc_thunk.dx to be mangled.
NIX_CFLAGS_COMPILE = "-U__i686";
}
else {})
//
args
//
{
name = args.name + "-${version}" +
stdenv.lib.optionalString (cross != null) "-${cross.config}";
src = fetchurl {
url = "mirror://gnu/glibc/glibc-${version}.tar.bz2";
sha256 = "0rz67p3zy3hj1pbcx8qjwnh926d412zs51ss82232qdbgrikxbfb";
};
srcPorts = fetchurl {
url = "mirror://gnu/glibc/glibc-ports-${version}.tar.bz2";
sha256 = "0wa0mdsfv0b97a0vbmc3l1258lq2y7p7i14bb4rklsh342byrwdi";
};
# `fetchurl' is a function and thus should not be passed to the
# `derivation' primitive.
fetchurl = null;
# Remove absolute paths from `configure' & co.; build out-of-tree.
preConfigure = ''
export PWD_P=$(type -tP pwd)
for i in configure io/ftwtest-sh; do
# Can't use substituteInPlace here because replace hasn't been
# built yet in the bootstrap.
sed -i "$i" -e "s^/bin/pwd^$PWD_P^g"
done
tar xvjf "$srcPorts"
mkdir ../build
cd ../build
configureScript="../$sourceRoot/configure"
${if args ? preConfigure
then args.preConfigure
else ""}
'';
meta = ({
homepage = http://www.gnu.org/software/libc/;
description = "The GNU C Library";
longDescription =
'' Any Unix-like operating system needs a C library: the library which
defines the "system calls" and other basic facilities such as
open, malloc, printf, exit...
The GNU C library is used as the C library in the GNU system and
most systems with the Linux kernel.
'';
license = "LGPLv2+";
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.linux;
}
//
args.meta
);
})

View File

@ -0,0 +1,51 @@
{ stdenv, fetchurl, kernelHeaders
, installLocales ? true
, profilingLibraries ? false
, gccCross ? null
}:
let
build = import ./common.nix;
cross = if gccCross != null then gccCross.target else null;
in
build cross ({
name = "glibc";
inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries
gccCross;
builder = ./builder.sh;
preInstall = ''
ensureDir $out/lib
ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
'';
postInstall = ''
rm $out/lib/libgcc_s.so.1
'';
meta.description = "The GNU C Library";
}
//
(if cross != null
then {
preConfigure = ''
sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig"
cat > config.cache << "EOF"
libc_cv_forced_unwind=yes
libc_cv_c_cleanup=yes
libc_cv_gnu89_inline=yes
EOF
export BUILD_CC=gcc
export CC="$crossConfig-gcc"
export AR="$crossConfig-ar"
export RANLIB="$crossConfig-ranlib"
dontStrip=1
'';
}
else {}))

View File

@ -0,0 +1,25 @@
{ stdenv, fetchurl, texinfo, perl }:
let build = import ./common.nix;
in
build {
name = "glibc-info";
inherit fetchurl stdenv;
configureFlags = [ "--enable-add-ons" ];
buildInputs = [ texinfo perl ];
buildPhase = "make info";
# I don't know why the info is not generated in 'build'
# Somehow building the info still does not work, because the final
# libc.info hasn't a Top node.
installPhase = ''
ensureDir "$out/share/info"
cp -v "../$sourceRoot/manual/"*.info* "$out/share/info"
'';
meta.description = "GNU Info manual of the GNU C Library";
}

View File

@ -0,0 +1,72 @@
diff -rc glibc-2.9-20081208-orig/locale/loadarchive.c glibc-2.9-20081208/locale/loadarchive.c
*** glibc-2.9-20081208-orig/locale/loadarchive.c 2005-09-09 18:56:52.000000000 +0200
--- glibc-2.9-20081208/locale/loadarchive.c 2009-04-19 13:54:26.000000000 +0200
***************
*** 124,129 ****
--- 124,142 ----
}
+ static int
+ open_locale_archive ()
+ {
+ int fd = -1;
+ char *path = getenv ("LOCALE_ARCHIVE");
+ if (path)
+ fd = open_not_cancel_2 (path, O_RDONLY|O_LARGEFILE);
+ if (fd < 0)
+ fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
+ return fd;
+ }
+
+
/* Find the locale *NAMEP in the locale archive, and return the
internalized data structure for its CATEGORY data. If this locale has
already been loaded from the archive, just returns the existing data
***************
*** 203,209 ****
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 216,222 ----
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_locale_archive ();
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
***************
*** 394,400 ****
if (fd == -1)
{
struct stat64 st;
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 407,413 ----
if (fd == -1)
{
struct stat64 st;
! fd = open_locale_archive ();
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
diff -rc glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h glibc-2.9-20081208/sysdeps/generic/unsecvars.h
*** glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h 2006-10-11 18:24:05.000000000 +0200
--- glibc-2.9-20081208/sysdeps/generic/unsecvars.h 2009-04-19 13:55:34.000000000 +0200
***************
*** 16,21 ****
--- 16,22 ----
"LD_SHOW_AUXV\0" \
"LD_USE_LOAD_BIAS\0" \
"LOCALDOMAIN\0" \
+ "LOCALE_ARCHIVE\0" \
"LOCPATH\0" \
"MALLOC_TRACE\0" \
"NIS_PATH\0" \

View File

@ -0,0 +1,42 @@
/* This function builds just the `lib/locale/locale-archive' file from
Glibc and nothing else. If `allLocales' is true, all supported
locales are included; otherwise, just the locales listed in
`locales'. See localedata/SUPPORTED in the Glibc source tree for
the list of all supported locales:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc
*/
{ stdenv, fetchurl, allLocales ? true, locales ? ["en_US.UTF-8/UTF-8"] }:
let build = import ./common.nix;
in
build null {
name = "glibc-locales";
inherit fetchurl stdenv;
installLocales = true;
builder = ./localesbuilder.sh;
# Awful hack: `localedef' doesn't allow the path to `locale-archive'
# to be overriden, but you *can* specify a prefix, i.e. it will use
# <prefix>/<path-to-glibc>/lib/locale/locale-archive. So we use
# $TMPDIR as a prefix, meaning that the locale-archive is placed in
# $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
buildPhase =
''
mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
make localedata/install-locales \
LOCALEDEF="localedef --prefix=$TMPDIR" \
localedir=$out/lib/locale \
${if allLocales then "" else "SUPPORTED-LOCALES=\"${toString locales}\""}
'';
installPhase =
''
ensureDir "$out/lib/locale"
cp -v "$TMPDIR/nix/store/"*"/lib/locale/locale-archive" "$out/lib/locale"
'';
meta.description = "Locale information for the GNU C Library";
}

View File

@ -0,0 +1,17 @@
# Glibc cannot have itself in its RPATH.
export NIX_NO_SELF_RPATH=1
source $stdenv/setup
postConfigure() {
# Hack: get rid of the `-static' flag set by the bootstrap stdenv.
# This has to be done *after* `configure' because it builds some
# test binaries.
export NIX_CFLAGS_LINK=
export NIX_LDFLAGS_BEFORE=
export NIX_DONT_SET_RPATH=1
unset CFLAGS
}
genericBuild

View File

@ -0,0 +1,25 @@
diff -rc glibc-2.9-20081208-orig/sysdeps/posix/getaddrinfo.c glibc-2.9-20081208/sysdeps/posix/getaddrinfo.c
*** glibc-2.9-20081208-orig/sysdeps/posix/getaddrinfo.c 2008-07-30 21:14:22.000000000 +0200
--- glibc-2.9-20081208/sysdeps/posix/getaddrinfo.c 2008-12-10 11:39:32.000000000 +0100
***************
*** 505,512 ****
int no_data = 0;
int no_inet6_data = 0;
service_user *nip = NULL;
- enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
- enum nss_status status = NSS_STATUS_UNAVAIL;
int no_more;
int old_res_options;
--- 505,510 ----
***************
*** 702,707 ****
--- 700,707 ----
while (!no_more)
{
+ enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
+ enum nss_status status = NSS_STATUS_UNAVAIL;
nss_gethostbyname4_r fct4
= __nss_lookup_function (nip, "gethostbyname4_r");
if (fct4 != NULL)

View File

@ -0,0 +1,72 @@
By default, rpcgen(1) looks for cpp(1) from a list of fixed absolute paths
(`/lib/cpp', etc.), which may only be overrided with the `-Y' option. This
patch makes it run any `cpp' command found in $PATH.
--- glibc-2.7/sunrpc/rpc_main.c 2006-11-10 21:54:46.000000000 +0100
+++ glibc-2.7/sunrpc/rpc_main.c 2009-04-22 14:32:10.000000000 +0200
@@ -79,7 +79,7 @@ static const char *cmdname;
static const char *svcclosetime = "120";
static int cppDefined; /* explicit path for C preprocessor */
-static const char *CPP = SUNOS_CPP;
+static const char *CPP = "cpp";
static const char CPPFLAGS[] = "-C";
static char *pathbuf;
static int cpp_pid;
@@ -108,7 +108,6 @@ static char *extendfile (const char *fil
static void open_output (const char *infile, const char *outfile);
static void add_warning (void);
static void clear_args (void);
-static void find_cpp (void);
static void open_input (const char *infile, const char *define);
static int check_nettype (const char *name, const char *list_to_check[]);
static void c_output (const char *infile, const char *define,
@@ -327,31 +326,6 @@ clear_args (void)
argcount = FIXEDARGS;
}
-/* make sure that a CPP exists */
-static void
-find_cpp (void)
-{
- struct stat buf;
-
- if (stat (CPP, &buf) < 0)
- { /* /lib/cpp or explicit cpp does not exist */
- if (cppDefined)
- {
- fprintf (stderr, _ ("cannot find C preprocessor: %s \n"), CPP);
- crash ();
- }
- else
- { /* try the other one */
- CPP = SVR4_CPP;
- if (stat (CPP, &buf) < 0)
- { /* can't find any cpp */
- fputs (_ ("cannot find any C preprocessor (cpp)\n"), stdout);
- crash ();
- }
- }
- }
-}
-
/*
* Open input file with given define for C-preprocessor
*/
@@ -370,7 +344,6 @@ open_input (const char *infile, const ch
switch (cpp_pid)
{
case 0:
- find_cpp ();
putarg (0, CPP);
putarg (1, CPPFLAGS);
addarg (define);
@@ -380,7 +353,7 @@ open_input (const char *infile, const ch
close (1);
dup2 (pd[1], 1);
close (pd[0]);
- execv (arglist[0], (char **) arglist);
+ execvp (arglist[0], (char **) arglist);
perror ("execv");
exit (1);
case -1:

View File

@ -0,0 +1,12 @@
Make sure `nscd' et al. are linked against `libssp'.
--- glibc-2.11/nscd/Makefile 2009-10-30 18:17:08.000000000 +0100
+++ glibc-2.11/nscd/Makefile 2009-11-22 01:19:37.000000000 +0100
@@ -126,6 +126,7 @@ CFLAGS-res_hconf.c += $(nscd-cflags)
ifeq (yesyes,$(have-fpie)$(build-shared))
relro-LDFLAGS += -Wl,-z,now
+$(objpfx)nscd: LDFLAGS += -lssp
$(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
$(+link-pie)
endif

View File

@ -0,0 +1,41 @@
# Glibc cannot have itself in its RPATH.
export NIX_NO_SELF_RPATH=1
source $stdenv/setup
postConfigure() {
# Hack: get rid of the `-static' flag set by the bootstrap stdenv.
# This has to be done *after* `configure' because it builds some
# test binaries.
export NIX_CFLAGS_LINK=
export NIX_LDFLAGS_BEFORE=
export NIX_DONT_SET_RPATH=1
unset CFLAGS
}
postInstall() {
if test -n "$installLocales"; then
make localedata/install-locales
fi
test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
# Include the Linux kernel headers in Glibc, except the `scsi'
# subdirectory, which Glibc provides itself.
(cd $out/include && ln -s $(ls -d $kernelHeaders/include/* | grep -v 'scsi$') .)
# Fix for NIXOS-54 (ldd not working on x86_64). Make a symlink
# "lib64" to "lib".
if test -n "$is64bit"; then
ln -s lib $out/lib64
fi
# This file, that should not remain in the glibc derivation,
# may have not been created during the preInstall
rm -f $out/lib/libgcc_s.so.1
}
genericBuild

View File

@ -0,0 +1,152 @@
/* Build configuration used to build glibc, Info files, and locale
information. */
cross :
{ name, fetchurl, stdenv, installLocales ? false
, gccCross ? null, kernelHeaders ? null
, profilingLibraries ? false, meta
, preConfigure ? "", ... }@args :
let version = "2.11.1"; in
assert (cross != null) -> (gccCross != null);
stdenv.mkDerivation ({
inherit kernelHeaders installLocales;
# The host/target system.
crossConfig = if (cross != null) then cross.config else null;
inherit (stdenv) is64bit;
patches = [
/* Fix for NIXPKGS-79: when doing host name lookups, when
nsswitch.conf contains a line like
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
don't return an error when mdns4_minimal can't be found. This
is a bug in Glibc: when a service can't be found, NSS should
continue to the next service unless "UNAVAIL=return" is set.
("NOTFOUND=return" refers to the service returning a NOTFOUND
error, not the service itself not being found.) The reason is
that the "status" variable (while initialised to UNAVAIL) is
outside of the loop that iterates over the services, the
"files" service sets status to NOTFOUND. So when the call to
find "mdns4_minimal" fails, "status" will still be NOTFOUND,
and it will return instead of continuing to "dns". Thus, the
line
hosts: mdns4_minimal [NOTFOUND=return] dns mdns4
does work because "status" will contain UNAVAIL after the
failure to find mdns4_minimal. */
./nss-skip-unavail.patch
/* Make it possible to override the locale-archive in NixOS. */
./locale-override.patch
/* Have rpcgen(1) look for cpp(1) in $PATH. */
./rpcgen-path.patch
/* Make sure `nscd' et al. are linked against `libssp'. */
./stack-protector-link.patch
/* MOD_NANO definition, for ntp (taken from glibc upstream) */
./mod_nano.patch
];
configureFlags = [
"-C"
"--enable-add-ons"
(if kernelHeaders != null
then "--with-headers=${kernelHeaders}/include"
else "--without-headers")
(if profilingLibraries
then "--enable-profile"
else "--disable-profile")
] ++ stdenv.lib.optionals (cross != null) [
"--with-tls"
"--enable-kernel=2.6.0"
"--without-fp"
"--with-__thread"
] ++ stdenv.lib.optionals (stdenv.system == "armv5tel-linux") [
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
"--without-fp"
];
buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ];
# Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to
# prevent a retained dependency on the bootstrap tools in the stdenv-linux
# bootstrap.
BASH_SHELL = "/bin/sh";
# Workaround for this bug:
# http://sourceware.org/bugzilla/show_bug.cgi?id=411
# I.e. when gcc is compiled with --with-arch=i686, then the
# preprocessor symbol `__i686' will be defined to `1'. This causes
# the symbol __i686.get_pc_thunk.dx to be mangled.
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.system == "i686-linux") "-U__i686";
}
// args //
{
name = name + "-${version}" +
stdenv.lib.optionalString (cross != null) "-${cross.config}";
src = fetchurl {
url = "mirror://gnu/glibc/glibc-${version}.tar.bz2";
sha256 = "18azb6518ryqhkfmddr25p0h1s2msrmx7dblij58sjlnzh61vq34";
};
srcPorts = fetchurl {
url = "mirror://gnu/glibc/glibc-ports-2.11.tar.bz2";
sha256 = "12b53f5k4gcr8rr1kg2ycf2701rygqsyf9r8gz4j3l9flaqi5liq";
};
# `fetchurl' is a function and thus should not be passed to the
# `derivation' primitive.
fetchurl = null;
# Remove absolute paths from `configure' & co.; build out-of-tree.
preConfigure = ''
export PWD_P=$(type -tP pwd)
for i in configure io/ftwtest-sh; do
# Can't use substituteInPlace here because replace hasn't been
# built yet in the bootstrap.
sed -i "$i" -e "s^/bin/pwd^$PWD_P^g"
done
tar xvjf "$srcPorts"
mkdir ../build
cd ../build
configureScript="../$sourceRoot/configure"
${preConfigure}
'';
meta = {
homepage = http://www.gnu.org/software/libc/;
description = "The GNU C Library";
longDescription =
'' Any Unix-like operating system needs a C library: the library which
defines the "system calls" and other basic facilities such as
open, malloc, printf, exit...
The GNU C library is used as the C library in the GNU system and
most systems with the Linux kernel.
'';
license = "LGPLv2+";
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.linux;
} // meta;
})

View File

@ -0,0 +1,56 @@
{ stdenv, fetchurl, kernelHeaders
, installLocales ? true
, profilingLibraries ? false
, gccCross ? null
}:
let
build = import ./common.nix;
cross = if gccCross != null then gccCross.target else null;
in
build cross ({
name = "glibc";
inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries
gccCross;
builder = ./builder.sh;
# When building glibc from bootstrap-tools, we need libgcc_s at RPATH for
# any program we run, because the gcc will have been placed at a new
# store path than that determined when built (as a source for the
# bootstrap-tools tarball)
# Building from a proper gcc staying in the path where it was installed,
# libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found without
# any special hack.
preInstall = ''
if [ -f ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 ]; then
ensureDir $out/lib
ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
fi
'';
meta.description = "The GNU C Library";
}
//
(if cross != null
then {
preConfigure = ''
sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig"
cat > config.cache << "EOF"
libc_cv_forced_unwind=yes
libc_cv_c_cleanup=yes
libc_cv_gnu89_inline=yes
EOF
export BUILD_CC=gcc
export CC="$crossConfig-gcc"
export AR="$crossConfig-ar"
export RANLIB="$crossConfig-ranlib"
dontStrip=1
'';
}
else {}))

View File

@ -0,0 +1,25 @@
{ stdenv, fetchurl, texinfo, perl }:
let build = import ./common.nix;
in
build {
name = "glibc-info";
inherit fetchurl stdenv;
configureFlags = [ "--enable-add-ons" ];
buildInputs = [ texinfo perl ];
buildPhase = "make info";
# I don't know why the info is not generated in 'build'
# Somehow building the info still does not work, because the final
# libc.info hasn't a Top node.
installPhase = ''
ensureDir "$out/share/info"
cp -v "../$sourceRoot/manual/"*.info* "$out/share/info"
'';
meta.description = "GNU Info manual of the GNU C Library";
}

View File

@ -0,0 +1,72 @@
diff -rc glibc-2.9-20081208-orig/locale/loadarchive.c glibc-2.9-20081208/locale/loadarchive.c
*** glibc-2.9-20081208-orig/locale/loadarchive.c 2005-09-09 18:56:52.000000000 +0200
--- glibc-2.9-20081208/locale/loadarchive.c 2009-04-19 13:54:26.000000000 +0200
***************
*** 124,129 ****
--- 124,142 ----
}
+ static int
+ open_locale_archive ()
+ {
+ int fd = -1;
+ char *path = getenv ("LOCALE_ARCHIVE");
+ if (path)
+ fd = open_not_cancel_2 (path, O_RDONLY|O_LARGEFILE);
+ if (fd < 0)
+ fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
+ return fd;
+ }
+
+
/* Find the locale *NAMEP in the locale archive, and return the
internalized data structure for its CATEGORY data. If this locale has
already been loaded from the archive, just returns the existing data
***************
*** 203,209 ****
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 216,222 ----
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_locale_archive ();
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
***************
*** 394,400 ****
if (fd == -1)
{
struct stat64 st;
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 407,413 ----
if (fd == -1)
{
struct stat64 st;
! fd = open_locale_archive ();
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
diff -rc glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h glibc-2.9-20081208/sysdeps/generic/unsecvars.h
*** glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h 2006-10-11 18:24:05.000000000 +0200
--- glibc-2.9-20081208/sysdeps/generic/unsecvars.h 2009-04-19 13:55:34.000000000 +0200
***************
*** 16,21 ****
--- 16,22 ----
"LD_SHOW_AUXV\0" \
"LD_USE_LOAD_BIAS\0" \
"LOCALDOMAIN\0" \
+ "LOCALE_ARCHIVE\0" \
"LOCPATH\0" \
"MALLOC_TRACE\0" \
"NIS_PATH\0" \

View File

@ -0,0 +1,17 @@
# Glibc cannot have itself in its RPATH.
export NIX_NO_SELF_RPATH=1
source $stdenv/setup
postConfigure() {
# Hack: get rid of the `-static' flag set by the bootstrap stdenv.
# This has to be done *after* `configure' because it builds some
# test binaries.
export NIX_CFLAGS_LINK=
export NIX_LDFLAGS_BEFORE=
export NIX_DONT_SET_RPATH=1
unset CFLAGS
}
genericBuild

View File

@ -0,0 +1,42 @@
/* This function builds just the `lib/locale/locale-archive' file from
Glibc and nothing else. If `allLocales' is true, all supported
locales are included; otherwise, just the locales listed in
`locales'. See localedata/SUPPORTED in the Glibc source tree for
the list of all supported locales:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc
*/
{ stdenv, fetchurl, allLocales ? true, locales ? ["en_US.UTF-8/UTF-8"] }:
let build = import ./common.nix;
in
build null {
name = "glibc-locales";
inherit fetchurl stdenv;
installLocales = true;
builder = ./locales-builder.sh;
# Awful hack: `localedef' doesn't allow the path to `locale-archive'
# to be overriden, but you *can* specify a prefix, i.e. it will use
# <prefix>/<path-to-glibc>/lib/locale/locale-archive. So we use
# $TMPDIR as a prefix, meaning that the locale-archive is placed in
# $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
buildPhase =
''
mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
make localedata/install-locales \
LOCALEDEF="localedef --prefix=$TMPDIR" \
localedir=$out/lib/locale \
${if allLocales then "" else "SUPPORTED-LOCALES=\"${toString locales}\""}
'';
installPhase =
''
ensureDir "$out/lib/locale"
cp -v "$TMPDIR/nix/store/"*"/lib/locale/locale-archive" "$out/lib/locale"
'';
meta.description = "Locale information for the GNU C Library";
}

View File

@ -0,0 +1,31 @@
commit 89b432d7a5befb85048c97e881b2106e8df58e43
Author: Ulrich Drepper <drepper@redhat.com>
Date: Sun Nov 22 10:23:12 2009 -0800
Fix up <sys/timex.h> a bit more for recent API changes.
diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h
index 5f10c7f..88b87f1 100644
--- a/sysdeps/unix/sysv/linux/sys/timex.h
+++ b/sysdeps/unix/sysv/linux/sys/timex.h
@@ -85,6 +85,9 @@ struct timex
#define MOD_TIMECONST ADJ_TIMECONST
#define MOD_CLKB ADJ_TICK
#define MOD_CLKA ADJ_OFFSET_SINGLESHOT /* 0x8000 in original */
+#define MOD_TAI ADJ_TAI
+#define MOD_MICRO ADJ_MICRO
+#define MOD_NANO ADJ_NANO
/* Status codes (timex.status) */
@@ -108,8 +111,9 @@ struct timex
#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
+/* Read-only bits */
#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
- STA_PPSERROR | STA_CLOCKERR) /* read-only bits */
+ STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
/* Clock states (time_state) */
#define TIME_OK 0 /* clock synchronized, no leap second */

View File

@ -0,0 +1,25 @@
diff -rc glibc-2.9-20081208-orig/sysdeps/posix/getaddrinfo.c glibc-2.9-20081208/sysdeps/posix/getaddrinfo.c
*** glibc-2.9-20081208-orig/sysdeps/posix/getaddrinfo.c 2008-07-30 21:14:22.000000000 +0200
--- glibc-2.9-20081208/sysdeps/posix/getaddrinfo.c 2008-12-10 11:39:32.000000000 +0100
***************
*** 505,512 ****
int no_data = 0;
int no_inet6_data = 0;
service_user *nip = NULL;
- enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
- enum nss_status status = NSS_STATUS_UNAVAIL;
int no_more;
int old_res_options;
--- 505,510 ----
***************
*** 702,707 ****
--- 700,707 ----
while (!no_more)
{
+ enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
+ enum nss_status status = NSS_STATUS_UNAVAIL;
nss_gethostbyname4_r fct4
= __nss_lookup_function (nip, "gethostbyname4_r");
if (fct4 != NULL)

View File

@ -0,0 +1,72 @@
By default, rpcgen(1) looks for cpp(1) from a list of fixed absolute paths
(`/lib/cpp', etc.), which may only be overrided with the `-Y' option. This
patch makes it run any `cpp' command found in $PATH.
--- glibc-2.7/sunrpc/rpc_main.c 2006-11-10 21:54:46.000000000 +0100
+++ glibc-2.7/sunrpc/rpc_main.c 2009-04-22 14:32:10.000000000 +0200
@@ -79,7 +79,7 @@ static const char *cmdname;
static const char *svcclosetime = "120";
static int cppDefined; /* explicit path for C preprocessor */
-static const char *CPP = SUNOS_CPP;
+static const char *CPP = "cpp";
static const char CPPFLAGS[] = "-C";
static char *pathbuf;
static int cpp_pid;
@@ -108,7 +108,6 @@ static char *extendfile (const char *fil
static void open_output (const char *infile, const char *outfile);
static void add_warning (void);
static void clear_args (void);
-static void find_cpp (void);
static void open_input (const char *infile, const char *define);
static int check_nettype (const char *name, const char *list_to_check[]);
static void c_output (const char *infile, const char *define,
@@ -327,31 +326,6 @@ clear_args (void)
argcount = FIXEDARGS;
}
-/* make sure that a CPP exists */
-static void
-find_cpp (void)
-{
- struct stat buf;
-
- if (stat (CPP, &buf) < 0)
- { /* /lib/cpp or explicit cpp does not exist */
- if (cppDefined)
- {
- fprintf (stderr, _ ("cannot find C preprocessor: %s \n"), CPP);
- crash ();
- }
- else
- { /* try the other one */
- CPP = SVR4_CPP;
- if (stat (CPP, &buf) < 0)
- { /* can't find any cpp */
- fputs (_ ("cannot find any C preprocessor (cpp)\n"), stdout);
- crash ();
- }
- }
- }
-}
-
/*
* Open input file with given define for C-preprocessor
*/
@@ -370,7 +344,6 @@ open_input (const char *infile, const ch
switch (cpp_pid)
{
case 0:
- find_cpp ();
putarg (0, CPP);
putarg (1, CPPFLAGS);
addarg (define);
@@ -380,7 +353,7 @@ open_input (const char *infile, const ch
close (1);
dup2 (pd[1], 1);
close (pd[0]);
- execv (arglist[0], (char **) arglist);
+ execvp (arglist[0], (char **) arglist);
perror ("execv");
exit (1);
case -1:

View File

@ -0,0 +1,12 @@
Make sure `nscd' et al. are linked against `libssp'.
--- glibc-2.11/nscd/Makefile 2009-10-30 18:17:08.000000000 +0100
+++ glibc-2.11/nscd/Makefile 2009-11-22 01:19:37.000000000 +0100
@@ -126,6 +126,7 @@ CFLAGS-res_hconf.c += $(nscd-cflags)
ifeq (yesyes,$(have-fpie)$(build-shared))
relro-LDFLAGS += -Wl,-z,now
+$(objpfx)nscd: LDFLAGS += -lssp
$(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
$(+link-pie)
endif

View File

@ -0,0 +1,42 @@
Support GNU Binutils 2.20 and beyond. Patch from
http://sourceware.org/ml/libc-alpha/2009-09/msg00009.html .
diff --git a/configure b/configure
index 48e6952..b1d84d7 100755
--- a/configure
+++ b/configure
@@ -4841,7 +4841,7 @@ $as_echo_n "checking version of $AS... " >&6; }
ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|[2-9].[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
@@ -4904,7 +4904,7 @@ $as_echo_n "checking version of $LD... " >&6; }
ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|[2-9].[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff --git a/configure.in b/configure.in
index 4584afe..7c4f71f 100644
--- a/configure.in
+++ b/configure.in
@@ -897,10 +897,10 @@ AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
# Accept binutils 2.13 or newer.
AC_CHECK_PROG_VER(AS, $AS, --version,
[GNU assembler.* \([0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
+ [2.1[3-9]*|[2-9].[2-9]*], AS=: critic_missing="$critic_missing as")
AC_CHECK_PROG_VER(LD, $LD, --version,
[GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
+ [2.1[3-9]*|[2-9].[2-9]*], LD=: critic_missing="$critic_missing ld")
# We need the physical current working directory. We cannot use the
# "pwd -P" shell builtin since that's not portable. Instead we try to

View File

@ -0,0 +1,33 @@
From 7c8a67320e26b8c11108bf0a3410d3aef9cf3486 Mon Sep 17 00:00:00 2001
From: Ulrich Drepper <drepper@redhat.com>
Date: Sat, 31 Jan 2009 00:21:15 +0000
Subject: [PATCH] * elf/Makefile (ld.so): Adjust the sed script to insert _begin in to
newer linker scripts.
---
ChangeLog | 5 +++++
elf/Makefile | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/elf/Makefile b/elf/Makefile
index 8079fe9..e44ff1d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 1995-2007, 2008, 2009 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -304,7 +304,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
$(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 | \
LC_ALL=C \
sed -e '/^=========/,/^=========/!d;/^=========/d' \
- -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
+ -e 's/\. = .* + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
> $@.lds
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
$(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \
--
1.6.4

View File

@ -26,11 +26,32 @@ preConfigure() {
# don't want as a dependency in the Nixpkgs bootstrap. So force
# the output file to be newer.
touch locale/C-translit.h
tar xvjf "$srcPorts"
mkdir ../build
cd ../build
if test -n "$crossConfig"; then
sed -i s/-lgcc_eh//g Makeconfig
fi
mkdir build
cd build
configureScript=../$sourceRoot/configure
configureScript=../configure
if test -n "$crossConfig"; then
cat > config.cache << "EOF"
libc_cv_forced_unwind=yes
libc_cv_c_cleanup=yes
libc_cv_gnu89_inline=yes
EOF
export BUILD_CC=gcc
export CC="${crossConfig}-gcc"
export AR="${crossConfig}-ar"
export RANLIB="${crossConfig}-ranlib"
configureFlags="${configureFlags} --cache-file=config.cache"
# Disable the native stripping, because it breaks libc_nonshared.a
dontStrip=1
fi
}
@ -42,6 +63,7 @@ postConfigure() {
export NIX_LDFLAGS_BEFORE=
export NIX_DONT_SET_RPATH=1
unset CFLAGS
}
@ -49,7 +71,7 @@ postInstall() {
if test -n "$installLocales"; then
make localedata/install-locales
fi
rm $out/etc/ld.so.cache
test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
(cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1
# Fix for NIXOS-54 (ldd not working on x86_64). Make a symlink

View File

@ -1,19 +1,29 @@
{ stdenv, fetchurl, kernelHeaders
, installLocales ? true
, profilingLibraries ? false
, gccCross ? null
}:
let
cross = if gccCross != null then gccCross.target else null;
in
stdenv.mkDerivation rec {
name = "glibc-2.9";
name = "glibc-2.9" +
stdenv.lib.optionalString (cross != null) "-${cross.config}";
builder = ./builder.sh;
src = fetchurl {
url = http://nixos.org/tarballs/glibc-2.9-20081208.tar.bz2;
sha256 = "0zhxbgcsl97pf349m0lz8d5ljvvzrcqc23yf08d888xlk4ms8m3h";
url = http://ftp.gnu.org/gnu/glibc/glibc-2.9.tar.bz2;
sha256 = "0v53m7flx6qcx7cvrvvw6a4dx4x3y6k8nvpc4wfv5xaaqy2am2q9";
};
srcPorts = fetchurl {
url = http://ftp.gnu.org/gnu/glibc/glibc-ports-2.9.tar.bz2;
sha256 = "0r2sn527wxqifi63di7ns9wbjh1cainxn978w178khhy7yw9fk42";
};
inherit kernelHeaders installLocales;
crossConfig = if (cross != null) then cross.config else null;
inherit (stdenv) is64bit;
@ -46,13 +56,38 @@ stdenv.mkDerivation rec {
/* Have rpcgen(1) look for cpp(1) in $PATH. */
./rpcgen-path.patch
/* Support GNU Binutils 2.20 and above. */
./binutils-2.20.patch
./binutils-ld.patch
];
configureFlags = ''
--enable-add-ons
--with-headers=${kernelHeaders}/include
${if profilingLibraries then "--enable-profile" else "--disable-profile"}
'';
configureFlags = [
"--enable-add-ons"
"--with-headers=${kernelHeaders}/include"
(if profilingLibraries then "--enable-profile" else "--disable-profile")
] ++ stdenv.lib.optionals (cross != null) [
"--with-tls"
"--enable-kernel=2.6.0"
"--without-fp"
"--with-__thread"
] ++ (if (stdenv.system == "armv5tel-linux") then [
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
"--without-fp"
] else []);
buildNativeInputs = stdenv.lib.optionals (cross != null) [ gccCross ];
preInstall = if (cross != null) then ''
ensureDir $out/lib
ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
'' else "";
postInstall = if (cross != null) then ''
rm $out/lib/libgcc_s.so.1
'' else "";
# Workaround for this bug:
# http://sourceware.org/bugzilla/show_bug.cgi?id=411

View File

@ -0,0 +1,63 @@
{ stdenv, fetchurl, kernelHeaders
, profilingLibraries ? false
}:
stdenv.mkDerivation rec {
name = "glibc-headers-2.9";
builder = ./headersbuilder.sh;
src = fetchurl {
url = http://ftp.gnu.org/gnu/glibc/glibc-2.9.tar.bz2;
sha256 = "0v53m7flx6qcx7cvrvvw6a4dx4x3y6k8nvpc4wfv5xaaqy2am2q9";
};
srcPorts = fetchurl {
url = http://ftp.gnu.org/gnu/glibc/glibc-ports-2.9.tar.bz2;
sha256 = "0r2sn527wxqifi63di7ns9wbjh1cainxn978w178khhy7yw9fk42";
};
inherit kernelHeaders;
inherit (stdenv) is64bit;
patches = [
/* Support GNU Binutils 2.20 and above. */
./binutils-2.20.patch
];
configureFlags = [
"--enable-add-ons"
"--with-headers=${kernelHeaders}/include"
"--disable-sanity-checks"
"--enable-hacker-mode"
(if profilingLibraries then "--enable-profile" else "--disable-profile")
] ++ (if (stdenv.system == "armv5tel-linux") then [
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
"--without-fp"
] else []);
buildPhase = "true";
# I took some tricks from crosstool-0.43
installPhase = ''
make cross-compiling=yes CFLAGS=-DBOOTSTRAP_GCC install-headers
mkdir -p $out/include/gnu
touch $out/include/gnu/stubs.h
cp ../include/features.h $out/include/features.h
(cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1
'';
# Workaround for this bug:
# http://sourceware.org/bugzilla/show_bug.cgi?id=411
# I.e. when gcc is compiled with --with-arch=i686, then the
# preprocessor symbol `__i686' will be defined to `1'. This causes
# the symbol __i686.get_pc_thunk.dx to be mangled.
NIX_CFLAGS_COMPILE = "-U__i686";
meta = {
homepage = http://www.gnu.org/software/libc/;
description = "The GNU C Library";
};
}

View File

@ -0,0 +1,38 @@
# Glibc cannot have itself in its RPATH.
export NIX_NO_SELF_RPATH=1
source $stdenv/setup
# Explicitly tell glibc to use our pwd, not /bin/pwd.
export PWD_P=$(type -tP pwd)
# Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to
# prevent a retained dependency on the bootstrap tools in the
# stdenv-linux bootstrap.
export BASH_SHELL=/bin/sh
preConfigure() {
for i in configure io/ftwtest-sh; do
# Can't use substituteInPlace here because replace hasn't been
# built yet in the bootstrap.
sed -i "$i" -e "s^/bin/pwd^$PWD_P^g"
done
# In the glibc 2.6/2.7 tarballs C-translit.h is a little bit older
# than C-translit.h.in, forcing Make to rebuild it unnecessarily.
# This wouldn't be problem except that it requires Perl, which we
# don't want as a dependency in the Nixpkgs bootstrap. So force
# the output file to be newer.
touch locale/C-translit.h
tar xvjf "$srcPorts"
mkdir build
cd build
configureScript=../configure
}
genericBuild

View File

@ -8,6 +8,11 @@ stdenv.mkDerivation rec {
sha256 = "0zhxbgcsl97pf349m0lz8d5ljvvzrcqc23yf08d888xlk4ms8m3h";
};
patches = [
/* Support GNU Binutils 2.20 and above. */
./binutils-2.20.patch
];
preConfigure = ''
export PWD_P=$(type -tP pwd)
for i in configure io/ftwtest-sh; do

View File

@ -10,13 +10,35 @@
stdenv.mkDerivation rec {
name = "glibc-locales-2.9";
builder = ./localesbuilder.sh;
src = fetchurl {
url = http://nixos.org/tarballs/glibc-2.9-20081208.tar.bz2;
sha256 = "0zhxbgcsl97pf349m0lz8d5ljvvzrcqc23yf08d888xlk4ms8m3h";
url = http://ftp.gnu.org/gnu/glibc/glibc-2.9.tar.bz2;
sha256 = "0v53m7flx6qcx7cvrvvw6a4dx4x3y6k8nvpc4wfv5xaaqy2am2q9";
};
configurePhase = "true";
srcPorts = fetchurl {
url = http://ftp.gnu.org/gnu/glibc/glibc-ports-2.9.tar.bz2;
sha256 = "0r2sn527wxqifi63di7ns9wbjh1cainxn978w178khhy7yw9fk42";
};
inherit (stdenv) is64bit;
configureFlags = [
"--enable-add-ons"
"--without-headers"
"--disable-profile"
] ++ (if (stdenv.system == "armv5tel-linux") then [
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
"--without-fp"
] else []);
patches = [
/* Support GNU Binutils 2.20 and above. */
./binutils-2.20.patch
];
# Awful hack: `localedef' doesn't allow the path to `locale-archive'
# to be overriden, but you *can* specify a prefix, i.e. it will use
@ -25,8 +47,6 @@ stdenv.mkDerivation rec {
# $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
buildPhase =
''
touch config.make
touch config.status
mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
make localedata/install-locales \
LOCALEDEF="localedef --prefix=$TMPDIR" \

Some files were not shown because too many files have changed in this diff Show More