ghc: move gcc-clang-wrapper.sh script into the ghc directory tree since it's the only user of that script

This commit is contained in:
Peter Simons
2015-06-12 10:54:02 +02:00
parent 33e70ad68a
commit 85ae0cb070
7 changed files with 6 additions and 6 deletions

View File

@@ -90,7 +90,7 @@ stdenv.mkDerivation rec {
configurePhase = ''
./configure --prefix=$out \
--with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include \
${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"}
${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"}
'';
# Stripping combined with patchelf breaks the executables (they die

View File

@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
export NIX_LDFLAGS+=" -no_dtrace_dof"
'';
configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"
configureFlags = if stdenv.isDarwin then "--with-gcc=${./gcc-clang-wrapper.sh}"
else "--with-gcc=${stdenv.cc}/bin/gcc";
NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";

View File

@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
export NIX_LDFLAGS+=" -no_dtrace_dof"
'';
configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"
configureFlags = if stdenv.isDarwin then "--with-gcc=${./gcc-clang-wrapper.sh}"
else "--with-gcc=${stdenv.cc}/bin/gcc";
NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";

View File

@@ -90,7 +90,7 @@ stdenv.mkDerivation rec {
configurePhase = ''
./configure --prefix=$out \
--with-gmp-libraries=${gmp}/lib --with-gmp-includes=${gmp}/include \
${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"}
${stdenv.lib.optionalString stdenv.isDarwin "--with-gcc=${./gcc-clang-wrapper.sh}"}
'';
# Stripping combined with patchelf breaks the executables (they die

View File

@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
export NIX_LDFLAGS+=" -no_dtrace_dof"
'';
configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"
configureFlags = if stdenv.isDarwin then "--with-gcc=${./gcc-clang-wrapper.sh}"
else "--with-gcc=${stdenv.cc}/bin/gcc";
# required, because otherwise all symbols from HSffi.o are stripped, and

View File

@@ -52,7 +52,7 @@ in stdenv.mkDerivation rec {
export NIX_LDFLAGS+=" -no_dtrace_dof"
'';
configureFlags = if stdenv.isDarwin then "--with-gcc=${../../haskell-modules/gcc-clang-wrapper.sh}"
configureFlags = if stdenv.isDarwin then "--with-gcc=${./gcc-clang-wrapper.sh}"
else "--with-gcc=${stdenv.cc}/bin/gcc";
postInstall = ''

View File

@@ -0,0 +1,46 @@
#!/bin/sh
inPreprocessorMode () {
hasE=0
hasU=0
hasT=0
for arg in "$@"
do
if [ 'x-E' = "x$arg" ]; then hasE=1; fi
if [ 'x-undef' = "x$arg" ]; then hasU=1; fi
if [ 'x-traditional' = "x$arg" ]; then hasT=1; fi
done
[ "$hasE$hasU$hasT" = '111' ]
}
extraClangArgs="-Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs"
adjustPreprocessorLanguage () {
newArgs=''
while [ $# -gt 0 ]
do
newArgs="$newArgs $1"
if [ "$1" = '-x' ]
then
shift
if [ $# -gt 0 ]
then
if [ "$1" = 'c' ]
then
newArgs="$newArgs assembler-with-cpp"
else
newArgs="$newArgs $1"
fi
fi
fi
shift
done
echo $newArgs
}
if inPreprocessorMode "$@"
then
exec clang $extraClangArgs `adjustPreprocessorLanguage "$@"`
else
exec clang $extraClangArgs "${@/-nodefaultlibs/}"
fi