3
0
Fork 0
forked from mirrors/nixpkgs

Dropped gcc-wrapper

svn path=/nixpkgs/trunk/; revision=6141
This commit is contained in:
Martin Bravenboer 2006-08-17 00:55:03 +00:00
parent 688fff92de
commit bda8fc5621
3 changed files with 0 additions and 205 deletions

View file

@ -1,91 +0,0 @@
source $STDENV/setup
source $SUBSTITUTE
if test -z "$out"; then
out="$OUT"
shell="$SHELL"
gcc="$GCC"
binutils="$BINUTILS"
fi
# Force gcc to use ld-wrapper.sh when calling ld.
# cflagsCompile="-B $OUT/bin/"
# 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 $MINGWRUNTIME/lib/ -B $W32API/lib/ -isystem $MINGWRUNTIME/include -isystem $W32API/include"
# ldflags="$ldflags -L$MINGWRUNTIME/lib -L$W32API"
# ldflagsBefore="-dynamic-linker $glibc/lib/ld-linux.so.2" Martin: no idea what to do with this on mingw.
ldflags="$ldflags -L$gcc/lib"
gccPath="$gcc/bin"
ldPath="$BINUTILS/bin"
mkdir $out
mkdir $out/bin
mkdir $out/nix-support
doSubstitute() {
local src=$1
local dst=$2
substitute "$src" "$dst" \
--subst-var "out" \
--subst-var "shell" \
--subst-var "gcc" \
--subst-var "gccProg" \
--subst-var "binutils" \
--subst-var "cflagsCompile" \
--subst-var "cflagsLink" \
--subst-var "ldflags" \
--subst-var "ldflagsBefore" \
--subst-var-by "ld" "$ldPath/ld"
}
# Make wrapper scripts around gcc, g++, and g77. 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"
}
echo "gccpath: $gccPath"
mkGccWrapper $out/bin/gcc $gccPath/gcc.exe
ln -s $out/bin/gcc $out/bin/cc
# mkGccWrapper $out/bin/g++ $gccPath/g++.exe
# ln -s $out/bin/g++ $out/bin/c++
# mkGccWrapper $out/bin/g77 $gccPath/g77.exe
# ln -s $out/bin/g77 $out/bin/f77
# 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 "$glibc" && echo $glibc > $out/nix-support/orig-glibc
doSubstitute "$ADDFLAGS" "$out/nix-support/add-flags"
doSubstitute "$SETUPHOOK" "$out/nix-support/setup-hook"
cp -p $UTILS $out/nix-support/utils

View file

@ -1,23 +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".
{stdenv, gcc, mingwRuntime, w32api, binutils, shell}:
stdenv.mkDerivation {
name = "mingw-gcc-wrapper";
builder = ./builder.sh;
substitute = ../../../build-support/substitute/substitute.sh;
setupHook = ../../../build-support/gcc-wrapper/setup-hook.sh;
gccWrapper = ../../../build-support/gcc-wrapper/gcc-wrapper.sh;
ldWrapper = ../../../build-support/gcc-wrapper/ld-wrapper.sh;
utils = ../../../build-support/gcc-wrapper/utils.sh;
addFlags = ../../../build-support/gcc-wrapper/add-flags;
inherit gcc mingwRuntime w32api binutils shell;
langC = gcc.langC;
langCC = gcc.langCC;
langF77 = gcc.langF77;
}

View file

@ -1,91 +0,0 @@
#! @shell@ -e
params="$@"
if test -n "$NIX_GCC_WRAPPER_START_HOOK"; then
source "$NIX_GCC_WRAPPER_START_HOOK"
fi
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
source @out@/nix-support/utils
# Figure out if linker flags should be passed. GCC prints annoying
# warnings when they are not needed.
dontLink=0
if test "$*" = "-v" -o -z "$*"; then
dontLink=1
else
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
fi
done
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
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