diff options
-rw-r--r-- | pkgs/build-support/gcc-wrapper/add-flags | 4 | ||||
-rw-r--r-- | pkgs/build-support/gcc-wrapper/builder.sh | 43 | ||||
-rw-r--r-- | pkgs/build-support/gcc-wrapper/default.nix | 3 | ||||
-rw-r--r-- | 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 02755e4454148..26e536f6d575f 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 dd64987ade2bc..70e8498da7bba 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 339aba74288ef..700de9d20f49b 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 9d2ef35a4cdb7..65350e041dd2f 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; |