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" export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/gcc-cflags) $NIX_CFLAGS_COMPILE"
fi 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 if test -e @out@/nix-support/libc-ldflags; then
export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)" export NIX_LDFLAGS="$NIX_LDFLAGS $(cat @out@/nix-support/libc-ldflags)"
fi fi

View File

@ -51,6 +51,15 @@ else
if test -e "$gcc/lib64"; then if test -e "$gcc/lib64"; then
gccCFlags="$gccCFlags -B$gcc/lib64" gccCFlags="$gccCFlags -B$gcc/lib64"
fi 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 echo "$gccCFlags" > $out/nix-support/gcc-cflags
gccPath="$gcc/bin" gccPath="$gcc/bin"
@ -68,6 +77,8 @@ doSubstitute() {
-e "s^@shell@^$shell^g" \ -e "s^@shell@^$shell^g" \
-e "s^@gcc@^$gcc^g" \ -e "s^@gcc@^$gcc^g" \
-e "s^@gccProg@^$gccProg^g" \ -e "s^@gccProg@^$gccProg^g" \
-e "s^@gnatProg@^$gnatProg^g" \
-e "s^@gnatlinkProg@^$gnatlinkProg^g" \
-e "s^@binutils@^$binutils^g" \ -e "s^@binutils@^$binutils^g" \
-e "s^@coreutils@^$coreutils^g" \ -e "s^@coreutils@^$coreutils^g" \
-e "s^@libc@^$libc^g" \ -e "s^@libc@^$libc^g" \
@ -92,6 +103,34 @@ mkGccWrapper() {
chmod +x "$dst" 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 if mkGccWrapper $out/bin/gcc $gccPath/gcc
then then
ln -sv gcc $out/bin/cc ln -sv gcc $out/bin/cc
@ -110,6 +149,10 @@ fi
mkGccWrapper $out/bin/gcj $gccPath/gcj || true 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 # Create a symlink to as (the assembler). This is useful when a
# gcc-wrapper is installed in a user environment, as it ensures that # gcc-wrapper is installed in a user environment, as it ensures that

View File

@ -28,6 +28,8 @@ stdenv.mkDerivation {
builder = ./builder.sh; builder = ./builder.sh;
setupHook = ./setup-hook.sh; setupHook = ./setup-hook.sh;
gccWrapper = ./gcc-wrapper.sh; gccWrapper = ./gcc-wrapper.sh;
gnatWrapper = ./gnat-wrapper.sh;
gnatlinkWrapper = ./gnatlink-wrapper.sh;
ldWrapper = ./ld-wrapper.sh; ldWrapper = ./ld-wrapper.sh;
utils = ./utils.sh; utils = ./utils.sh;
addFlags = ./add-flags; addFlags = ./add-flags;
@ -41,6 +43,7 @@ stdenv.mkDerivation {
langC = if nativeTools then true else gcc.langC; langC = if nativeTools then true else gcc.langC;
langCC = if nativeTools then true else gcc.langCC; langCC = if nativeTools then true else gcc.langCC;
langFortran = if nativeTools then false else gcc ? langFortran; langFortran = if nativeTools then false else gcc ? langFortran;
langAda = if nativeTools then false else gcc ? langAda;
shell = if shell == "" then stdenv.shell else shell; shell = if shell == "" then stdenv.shell else shell;
meta = meta =

View File

@ -1982,7 +1982,7 @@ let
gnat = gnat44; gnat = gnat44;
gnat44 = wrapGNAT (gcc44_real.gcc.override { gnat44 = wrapGCC (gcc44_real.gcc.override {
name = "gnat"; name = "gnat";
langCC = false; langCC = false;
langC = true; langC = true;
@ -1995,7 +1995,7 @@ let
ppl = null; ppl = null;
}); });
gnatboot = wrapGNAT (import ../development/compilers/gnatboot { gnatboot = wrapGCC (import ../development/compilers/gnatboot {
inherit fetchurl stdenv; inherit fetchurl stdenv;
}); });
@ -2351,7 +2351,7 @@ let
inherit fetchurl stdenv visualcpp windowssdk; 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. # only one.
wrapGCCWith = gccWrapper: glibc: baseGCC: gccWrapper { wrapGCCWith = gccWrapper: glibc: baseGCC: gccWrapper {
nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools; nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools;
@ -2363,7 +2363,6 @@ let
}; };
wrapGCC = wrapGCCWith (import ../build-support/gcc-wrapper) glibc; wrapGCC = wrapGCCWith (import ../build-support/gcc-wrapper) glibc;
wrapGNAT = wrapGCCWith (import ../build-support/gnat-wrapper) glibc;
wrapGHDLWith = gccWrapper: glibc: baseGCC: gccWrapper { wrapGHDLWith = gccWrapper: glibc: baseGCC: gccWrapper {
nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools; nativeTools = stdenv ? gcc && stdenv.gcc.nativeTools;