From e72908036f98bfae531affc34cc39397b554390d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sat, 16 Jan 2010 21:32:44 +0000 Subject: [PATCH] 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 --- pkgs/build-support/gcc-wrapper/add-flags | 4 ++ pkgs/build-support/gcc-wrapper/builder.sh | 43 ++++++++++++++++++++++ pkgs/build-support/gcc-wrapper/default.nix | 3 ++ pkgs/top-level/all-packages.nix | 7 ++-- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/gcc-wrapper/add-flags b/pkgs/build-support/gcc-wrapper/add-flags index 02755e445414..26e536f6d575 100644 --- a/pkgs/build-support/gcc-wrapper/add-flags +++ b/pkgs/build-support/gcc-wrapper/add-flags @@ -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 diff --git a/pkgs/build-support/gcc-wrapper/builder.sh b/pkgs/build-support/gcc-wrapper/builder.sh index dd64987ade2b..70e8498da7bb 100644 --- a/pkgs/build-support/gcc-wrapper/builder.sh +++ b/pkgs/build-support/gcc-wrapper/builder.sh @@ -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 diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix index 339aba74288e..700de9d20f49 100644 --- a/pkgs/build-support/gcc-wrapper/default.nix +++ b/pkgs/build-support/gcc-wrapper/default.nix @@ -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 = diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9d2ef35a4cdb..65350e041dd2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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;