Renamed some old glibcCross to libcCross (we can use uclibc in cross builds already).
Dealt with the gcc 4.4 expression for it to work well for a native and a cross compiler, adding a pair of patches to get the job done without much side effects. One (libtool problems on -B) comes from the gcc 4.3 expression, while the other fixes a bug already fixed in gcc 4.4.3. svn path=/nixpkgs/branches/stdenv-updates/; revision=18833
This commit is contained in:
parent
c73d5761de
commit
d0ae140f69
@ -42,8 +42,8 @@ if test "$noSysDirs" = "1"; then
|
|||||||
|
|
||||||
if test -n "$targetConfig"; then
|
if test -n "$targetConfig"; then
|
||||||
if test -z "$crossStageStatic"; then
|
if test -z "$crossStageStatic"; then
|
||||||
extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include"
|
extraXCFlags="-B${libcCross}/lib -idirafter ${libcCross}/include"
|
||||||
extraXLDFlags="-L${glibcCross}/lib"
|
extraXLDFlags="-L${libcCross}/lib"
|
||||||
export NIX_EXTRA_CFLAGS_TARGET=$extraXCFlags
|
export NIX_EXTRA_CFLAGS_TARGET=$extraXCFlags
|
||||||
for i in $extraXLDFlags; do
|
for i in $extraXLDFlags; do
|
||||||
export NIX_EXTRA_LDFLAGS_TARGET="$NIX_EXTRA_LDFLAGS_TARGET -Wl,$i"
|
export NIX_EXTRA_LDFLAGS_TARGET="$NIX_EXTRA_LDFLAGS_TARGET -Wl,$i"
|
||||||
|
@ -10,9 +10,9 @@ mkdir $NIX_FIXINC_DUMMY
|
|||||||
export CPP="gcc -E"
|
export CPP="gcc -E"
|
||||||
|
|
||||||
if test "$staticCompiler" = "1"; then
|
if test "$staticCompiler" = "1"; then
|
||||||
EXTRA_LDFLAGS="-static"
|
NIX_EXTRA_LDFLAGS="-static"
|
||||||
else
|
else
|
||||||
EXTRA_LDFLAGS=""
|
NIX_EXTRA_LDFLAGS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$noSysDirs" = "1"; then
|
if test "$noSysDirs" = "1"; then
|
||||||
@ -40,55 +40,47 @@ if test "$noSysDirs" = "1"; then
|
|||||||
export NIX_FIXINC_DUMMY=/usr/include
|
export NIX_FIXINC_DUMMY=/usr/include
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We should not allow gcc find the headers of the native glibc
|
extraCFlags="-g0 -O2 -I$NIX_FIXINC_DUMMY $extraCFlags"
|
||||||
# (Here I only think of c,c++ compilers)
|
extraLDFlags="--strip-debug -L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
|
||||||
if test -z "$targetConfig"; then
|
|
||||||
# Setting $CPATH makes sure both `gcc' and `xgcc' find the C
|
|
||||||
# library headers, regarless of the language being compiled.
|
|
||||||
export CPATH="$NIX_FIXINC_DUMMY${CPATH:+:}$CPATH"
|
|
||||||
|
|
||||||
# Likewise, to help it find `crti.o' and similar files.
|
|
||||||
export LIBRARY_PATH="$glibc_libdir${LIBRARY_PATH:+:}$LIBRARY_PATH"
|
|
||||||
|
|
||||||
echo "setting \$CPATH to \`$CPATH'"
|
|
||||||
echo "setting \$LIBRARY_PATH to \`$LIBRARY_PATH'"
|
|
||||||
fi
|
|
||||||
|
|
||||||
extraCFlags="-g0 $extraCFlags"
|
|
||||||
extraLDFlags="--strip-debug $extraLDFlags"
|
|
||||||
|
|
||||||
|
export NIX_EXTRA_CFLAGS="$extraCFlags"
|
||||||
for i in $extraLDFlags; do
|
for i in $extraLDFlags; do
|
||||||
export EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i"
|
export NIX_EXTRA_LDFLAGS="$NIX_EXTRA_LDFLAGS -Wl,$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
if test -n "$targetConfig"; then
|
if test -n "$targetConfig"; then
|
||||||
|
# Cross-compiling, we need gcc not to read ./specs in order to build
|
||||||
|
# the g++ compiler (after the specs for the cross-gcc are created).
|
||||||
|
# Having LIBRARY_PATH= makes gcc read the specs from ., and the build
|
||||||
|
# breaks. Having this variable comes from the default.nix code to bring
|
||||||
|
# gcj in.
|
||||||
|
unset LIBRARY_PATH
|
||||||
|
unset CPATH
|
||||||
if test -z "$crossStageStatic"; then
|
if test -z "$crossStageStatic"; then
|
||||||
extraXCFlags="-B${glibcCross}/lib -idirafter ${glibcCross}/include"
|
export NIX_EXTRA_CFLAGS_TARGET="-g0 -O2 -B${libcCross}/lib -idirafter ${libcCross}/include"
|
||||||
extraXLDFlags="-L${glibcCross}/lib"
|
export NIX_EXTRA_LDFLAGS_TARGET="-Wl,-L${libcCross}/lib"
|
||||||
export EXTRA_CFLAGS_TARGET=$extraXCFlags
|
|
||||||
for i in $extraXLDFlags; do
|
|
||||||
export EXTRA_LDFLAGS_TARGET="$EXTRA_LDFLAGS_TARGET -Wl,$i"
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
makeFlagsArray=( \
|
|
||||||
"${makeFlagsArray[@]}" \
|
|
||||||
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
|
||||||
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
|
||||||
CFLAGS_FOR_TARGET="$EXTRA_CFLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \
|
|
||||||
LDFLAGS_FOR_TARGET="$EXTRA_CFLAGS_TARGET $EXTRA_LDFLAGS_TARGET" \
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
export EXTRA_CFLAGS_TARGET=$EXTRA_CFLAGS
|
# To be read by configure scripts (libtool-glibc.patch)
|
||||||
export EXTRA_LDFLAGS_TARGET=$EXTRA_LDFLAGS
|
export NIX_EXTRA_CFLAGS_TARGET="$NIX_EXTRA_CFLAGS"
|
||||||
|
export NIX_EXTRA_LDFLAGS_TARGET="$NIX_EXTRA_LDFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
makeFlagsArray=( \
|
||||||
|
"${makeFlagsArray[@]}" \
|
||||||
|
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||||
|
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||||
|
CFLAGS_FOR_BUILD="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
||||||
|
CFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \
|
||||||
|
LDFLAGS_FOR_BUILD="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
||||||
|
LDFLAGS_FOR_TARGET="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \
|
||||||
|
)
|
||||||
|
|
||||||
|
if test -z "$targetConfig"; then
|
||||||
makeFlagsArray=( \
|
makeFlagsArray=( \
|
||||||
"${makeFlagsArray[@]}" \
|
"${makeFlagsArray[@]}" \
|
||||||
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
BOOT_CFLAGS="$NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS" \
|
||||||
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
BOOT_LDFLAGS="$NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET" \
|
||||||
CFLAGS_FOR_BUILD="$extraCflags $EXTRA_CFLAGS $EXTRA_LDFLAGS" \
|
|
||||||
CFLAGS_FOR_TARGET="$EXTRA_CFLAGS $EXTRA_LDFLAGS" \
|
|
||||||
LDFLAGS_FOR_BUILD="$extraCflags $EXTRA_CFLAGS $EXTRA_LDFLAGS" \
|
|
||||||
LDFLAGS_FOR_TARGET="$EXTRA_CFLAGS $EXTRA_LDFLAGS" \
|
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -119,6 +111,13 @@ preConfigure() {
|
|||||||
# Patch to get armvt5el working:
|
# Patch to get armvt5el working:
|
||||||
sed -i -e 's/ arm)/ arm*)/' newlib/configure.host
|
sed -i -e 's/ arm)/ arm*)/' newlib/configure.host
|
||||||
fi
|
fi
|
||||||
|
# Bug - they packaged zlib
|
||||||
|
if test -d "zlib"; then
|
||||||
|
# This breaks the build without-headers, which should build only
|
||||||
|
# the target libgcc as target libraries.
|
||||||
|
# See 'configure:5370'
|
||||||
|
rm -Rf zlib
|
||||||
|
fi
|
||||||
|
|
||||||
# Perform the build in a different directory.
|
# Perform the build in a different directory.
|
||||||
mkdir ../build
|
mkdir ../build
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
, name ? "gcc"
|
, name ? "gcc"
|
||||||
, cross ? null
|
, cross ? null
|
||||||
, binutilsCross ? null
|
, binutilsCross ? null
|
||||||
, glibcCross ? null
|
, libcCross ? null
|
||||||
, crossStageStatic ? true
|
, crossStageStatic ? true
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ let version = "4.4.2";
|
|||||||
" --disable-libgomp " +
|
" --disable-libgomp " +
|
||||||
" --disable-shared"
|
" --disable-shared"
|
||||||
else
|
else
|
||||||
" --with-headers=${glibcCross}/include" +
|
" --with-headers=${libcCross}/include" +
|
||||||
" --enable-__cxa_atexit" +
|
" --enable-__cxa_atexit" +
|
||||||
" --enable-long-long" +
|
" --enable-long-long" +
|
||||||
" --enable-threads=posix" +
|
" --enable-threads=posix" +
|
||||||
@ -87,10 +87,14 @@ stdenv.mkDerivation ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
patches =
|
patches =
|
||||||
[./pass-cxxcpp.patch]
|
[./pass-cxxcpp.patch
|
||||||
|
./libtool-glibc.patch # some libraries don't let the proper -Btargetglibcpath pass
|
||||||
|
./libstdc++-target.patch # (fixed in gcc 4.4.3) bad mixture of build/target flags
|
||||||
|
]
|
||||||
++ optional noSysDirs ./no-sys-dirs.patch;
|
++ optional noSysDirs ./no-sys-dirs.patch;
|
||||||
|
|
||||||
inherit noSysDirs profiledCompiler staticCompiler langJava;
|
inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic
|
||||||
|
libcCross;
|
||||||
|
|
||||||
buildInputs = [ texinfo gmp mpfr gettext which ]
|
buildInputs = [ texinfo gmp mpfr gettext which ]
|
||||||
++ (optional (ppl != null) ppl)
|
++ (optional (ppl != null) ppl)
|
||||||
|
15
pkgs/development/compilers/gcc-4.4/libstdc++-target.patch
Normal file
15
pkgs/development/compilers/gcc-4.4/libstdc++-target.patch
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
diff --git a/Makefile.in b/Makefile.in
|
||||||
|
index 245c770..8545b60 100644
|
||||||
|
--- a/Makefile.in
|
||||||
|
+++ b/Makefile.in
|
||||||
|
@@ -250,8 +250,8 @@ BASE_TARGET_EXPORTS = \
|
||||||
|
RAW_CXX_TARGET_EXPORTS = \
|
||||||
|
$(BASE_TARGET_EXPORTS) \
|
||||||
|
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
|
||||||
|
- CXX="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD)"; export CXX; \
|
||||||
|
- CXXCPP="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_BUILD) -E"; export CXXCPP;
|
||||||
|
+ CXX="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_TARGET)"; export CXX; \
|
||||||
|
+ CXXCPP="$(RAW_CXX_FOR_TARGET) $(CFLAGS_FOR_TARGET) -E"; export CXXCPP;
|
||||||
|
|
||||||
|
NORMAL_TARGET_EXPORTS = \
|
||||||
|
$(BASE_TARGET_EXPORTS) \
|
48
pkgs/development/compilers/gcc-4.4/libtool-glibc.patch
Normal file
48
pkgs/development/compilers/gcc-4.4/libtool-glibc.patch
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
diff --git a/libgomp/configure b/libgomp/configure
|
||||||
|
index deef673..9e4a790 100755
|
||||||
|
--- a/libgomp/configure
|
||||||
|
+++ b/libgomp/configure
|
||||||
|
@@ -23848,6 +23848,11 @@ old_archive_cmds=$lt_old_archive_cmds
|
||||||
|
# A language specific compiler.
|
||||||
|
CC=$lt_compiler
|
||||||
|
|
||||||
|
+# Ugly hack to get libmudflap (and other libraries) to build.
|
||||||
|
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||||
|
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
||||||
|
+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
|
||||||
|
+
|
||||||
|
# Is the compiler the GNU compiler?
|
||||||
|
with_gcc=$GCC
|
||||||
|
|
||||||
|
diff --git a/libmudflap/configure b/libmudflap/configure
|
||||||
|
index ae1be92..4ee1e18 100755
|
||||||
|
--- a/libmudflap/configure
|
||||||
|
+++ b/libmudflap/configure
|
||||||
|
@@ -15044,6 +15044,11 @@ old_archive_cmds=$lt_old_archive_cmds
|
||||||
|
# A language specific compiler.
|
||||||
|
CC=$lt_compiler
|
||||||
|
|
||||||
|
+# Ugly hack to get libmudflap (and other libraries) to build.
|
||||||
|
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||||
|
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
||||||
|
+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
|
||||||
|
+
|
||||||
|
# Is the compiler the GNU compiler?
|
||||||
|
with_gcc=$GCC
|
||||||
|
|
||||||
|
diff --git a/libssp/configure b/libssp/configure
|
||||||
|
index ee2a41f..7f3e1fd 100755
|
||||||
|
--- a/libssp/configure
|
||||||
|
+++ b/libssp/configure
|
||||||
|
@@ -12926,6 +12926,11 @@ old_archive_cmds=$lt_old_archive_cmds
|
||||||
|
# A language specific compiler.
|
||||||
|
CC=$lt_compiler
|
||||||
|
|
||||||
|
+# Ugly hack to get libmudflap (and other libraries) to build.
|
||||||
|
+# Libtool filters out \`-B' flags when linking (why?), so the \`-B' flag
|
||||||
|
+# to Glibc gets lost. Here we forcibly add it to any invocation.
|
||||||
|
+CC="\$CC $NIX_EXTRA_CFLAGS_TARGET $NIX_EXTRA_LDFLAGS_TARGET"
|
||||||
|
+
|
||||||
|
# Is the compiler the GNU compiler?
|
||||||
|
with_gcc=$GCC
|
||||||
|
|
@ -1784,7 +1784,7 @@ let
|
|||||||
gcc43_realCross = cross : makeOverridable (import ../development/compilers/gcc-4.3) {
|
gcc43_realCross = cross : makeOverridable (import ../development/compilers/gcc-4.3) {
|
||||||
inherit stdenv fetchurl texinfo gmp mpfr noSysDirs cross;
|
inherit stdenv fetchurl texinfo gmp mpfr noSysDirs cross;
|
||||||
binutilsCross = binutilsCross cross;
|
binutilsCross = binutilsCross cross;
|
||||||
glibcCross = libcCross cross;
|
libcCross = libcCross cross;
|
||||||
profiledCompiler = false;
|
profiledCompiler = false;
|
||||||
enableMultilib = true;
|
enableMultilib = true;
|
||||||
crossStageStatic = false;
|
crossStageStatic = false;
|
||||||
@ -1794,17 +1794,17 @@ let
|
|||||||
inherit stdenv fetchurl texinfo gmp mpfr ppl cloogppl noSysDirs cross
|
inherit stdenv fetchurl texinfo gmp mpfr ppl cloogppl noSysDirs cross
|
||||||
gettext which;
|
gettext which;
|
||||||
binutilsCross = binutilsCross cross;
|
binutilsCross = binutilsCross cross;
|
||||||
glibcCross = libcCross cross;
|
libcCross = libcCross cross;
|
||||||
profiledCompiler = false;
|
profiledCompiler = false;
|
||||||
enableMultilib = true;
|
enableMultilib = true;
|
||||||
crossStageStatic = false;
|
crossStageStatic = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
gccCrossStageStatic = cross: wrapGCCCross {
|
gccCrossStageStatic = cross: wrapGCCCross {
|
||||||
gcc = forceBuildDrv ((gcc43_realCross cross).override {
|
gcc = forceBuildDrv ((gcc44_realCross cross).override {
|
||||||
crossStageStatic = true;
|
crossStageStatic = true;
|
||||||
langCC = false;
|
langCC = false;
|
||||||
glibcCross = null;
|
libcCross = null;
|
||||||
});
|
});
|
||||||
libc = null;
|
libc = null;
|
||||||
binutils = binutilsCross cross;
|
binutils = binutilsCross cross;
|
||||||
@ -1812,7 +1812,7 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
gccCrossStageFinal = cross: wrapGCCCross {
|
gccCrossStageFinal = cross: wrapGCCCross {
|
||||||
gcc = forceBuildDrv (gcc43_realCross cross);
|
gcc = forceBuildDrv (gcc44_realCross cross);
|
||||||
libc = libcCross cross;
|
libc = libcCross cross;
|
||||||
binutils = binutilsCross cross;
|
binutils = binutilsCross cross;
|
||||||
inherit cross;
|
inherit cross;
|
||||||
@ -3484,8 +3484,8 @@ let
|
|||||||
});
|
});
|
||||||
|
|
||||||
# We can choose:
|
# We can choose:
|
||||||
# glibcCross = cross: glibc211Cross cross;
|
libcCross = cross: glibc211Cross cross;
|
||||||
libcCross = cross: uclibcCross cross;
|
# libcCross = cross: uclibcCross cross;
|
||||||
|
|
||||||
eglibc = import ../development/libraries/eglibc {
|
eglibc = import ../development/libraries/eglibc {
|
||||||
inherit fetchsvn stdenv kernelHeaders;
|
inherit fetchsvn stdenv kernelHeaders;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user