Merging the gnat-wrapper and gcc-wrapper into a single gcc-wrapper.

(I will remove the gnat-wrapper files if this works, later)


svn path=/nixpkgs/branches/stdenv-updates/; revision=19492
This commit is contained in:
Lluís Batlle i Rossell 2010-01-16 21:32:44 +00:00
parent 20e75e0cf0
commit e72908036f
4 changed files with 53 additions and 4 deletions

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

@ -51,6 +51,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,6 +77,8 @@ 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" \
@ -92,6 +103,34 @@ mkGccWrapper() {
chmod +x "$dst"
}
mkGnatWrapper() {
local dst=$1
local src=$2
if ! test -f "$src"; then
echo "$src does not exist (skipping)"
return 1
fi
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
@ -110,6 +149,10 @@ 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
# Create a symlink to as (the assembler). This is useful when a
# gcc-wrapper is installed in a user environment, as it ensures that

View File

@ -28,6 +28,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;
@ -41,6 +43,7 @@ stdenv.mkDerivation {
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;
shell = if shell == "" then stdenv.shell else shell;
meta =

View File

@ -1982,7 +1982,7 @@ let
gnat = gnat44;
gnat44 = wrapGNAT (gcc44_real.gcc.override {
gnat44 = wrapGCC (gcc44_real.gcc.override {
name = "gnat";
langCC = false;
langC = true;
@ -1995,7 +1995,7 @@ let
ppl = null;
});
gnatboot = wrapGNAT (import ../development/compilers/gnatboot {
gnatboot = wrapGCC (import ../development/compilers/gnatboot {
inherit fetchurl stdenv;
});
@ -2351,7 +2351,7 @@ let
inherit fetchurl stdenv visualcpp windowssdk;
};
# All these wrappers: GCC, GNAT, GHDL, should be once merged into
# All these wrappers: GCC, GHDL, should be once merged into
# only one.
wrapGCCWith = gccWrapper: glibc: baseGCC: gccWrapper {
nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools;
@ -2363,7 +2363,6 @@ let
};
wrapGCC = wrapGCCWith (import ../build-support/gcc-wrapper) glibc;
wrapGNAT = wrapGCCWith (import ../build-support/gnat-wrapper) glibc;
wrapGHDLWith = gccWrapper: glibc: baseGCC: gccWrapper {
nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools;