Making the cross-builds work with uclibc. There is no easy way of switching
between uclibc/glibc still. I started the renaming from glibc to libc regarding the cross-toolchain, but I still have to finish. svn path=/nixpkgs/branches/stdenv-updates/; revision=18801
This commit is contained in:
parent
e9abf7bb0c
commit
4164de326a
|
@ -72,7 +72,7 @@ stdenv.mkDerivation ({
|
||||||
});
|
});
|
||||||
|
|
||||||
patches =
|
patches =
|
||||||
[./pass-cxxcpp.patch]
|
[./pass-cxxcpp.patch ./libmudflap-cpp.patch]
|
||||||
++ optional noSysDirs ./no-sys-dirs.patch
|
++ optional noSysDirs ./no-sys-dirs.patch
|
||||||
++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch
|
++ optional (noSysDirs && langFortran) ./no-sys-dirs-fortran.patch
|
||||||
++ optional langJava ./java-jvgenmain-link.patch;
|
++ optional langJava ./java-jvgenmain-link.patch;
|
||||||
|
|
|
@ -1,35 +1,66 @@
|
||||||
{stdenv, fetchurl, kernelHeaders}:
|
{stdenv, fetchurl, kernelHeaders, gccCross ? null}:
|
||||||
|
|
||||||
assert stdenv.isLinux;
|
assert stdenv.isLinux;
|
||||||
|
|
||||||
|
let
|
||||||
|
target = if (gccCross != null) then gccCross.target else null;
|
||||||
|
enableArmEABI = (target == null && stdenv.system "armv5tel-linux")
|
||||||
|
|| (target != null && target.arch == "arm");
|
||||||
|
|
||||||
|
configArmEABI = if enableArmEABI then
|
||||||
|
''-e 's/.*CONFIG_ARM_OABI.*//' \
|
||||||
|
-e 's/.*CONFIG_ARM_EABI.*/CONFIG_ARM_EABI=y/' '' else "";
|
||||||
|
|
||||||
|
enableBigEndian = (target != null && target.bigEndian);
|
||||||
|
|
||||||
|
configBigEndian = if enableBigEndian then ""
|
||||||
|
else
|
||||||
|
''-e 's/.*ARCH_BIG_ENDIAN.*/#ARCH_BIG_ENDIAN=y/' \
|
||||||
|
-e 's/.*ARCH_WANTS_BIG_ENDIAN.*/#ARCH_WANTS_BIG_ENDIAN=y/' \
|
||||||
|
-e 's/.*ARCH_WANTS_LITTLE_ENDIAN.*/ARCH_WANTS_LITTLE_ENDIAN=y/' '';
|
||||||
|
|
||||||
|
archMakeFlag = if (target != null) then "ARCH=${target.arch}" else "";
|
||||||
|
crossMakeFlag = if (target != null) then "CROSS=${target.config}-" else "";
|
||||||
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "uclibc-0.9.30.1";
|
name = "uclibc-0.9.30.1" + stdenv.lib.optionalString (target != null)
|
||||||
|
("-" + target.config);
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = http://www.uclibc.org/downloads/uClibc-0.9.30.1.tar.bz2;
|
url = http://www.uclibc.org/downloads/uClibc-0.9.30.1.tar.bz2;
|
||||||
sha256 = "132cf27hkgi0q4qlwbiyj4ffj76sja0jcxm0aqzzgks65jh6k5rd";
|
sha256 = "132cf27hkgi0q4qlwbiyj4ffj76sja0jcxm0aqzzgks65jh6k5rd";
|
||||||
};
|
};
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
make defconfig
|
make defconfig ${archMakeFlag}
|
||||||
sed -e s@/usr/include@${kernelHeaders}@ \
|
sed -e s@/usr/include@${kernelHeaders}/include@ \
|
||||||
-e 's@^RUNTIME_PREFIX.*@RUNTIME_PREFIX="/"@' \
|
-e 's@^RUNTIME_PREFIX.*@RUNTIME_PREFIX="/"@' \
|
||||||
-e 's@^DEVEL_PREFIX.*@DEVEL_PREFIX="/"@' \
|
-e 's@^DEVEL_PREFIX.*@DEVEL_PREFIX="/"@' \
|
||||||
${if stdenv.system=="armv5tel-linux" then
|
-e 's@.*UCLIBC_HAS_WCHAR.*@UCLIBC_HAS_WCHAR=y@' \
|
||||||
''-e 's/.*CONFIG_ARM_OABI.*//' \
|
-e 's@.*DO_C99_MATH.*@DO_C99_MATH=y@' \
|
||||||
-e 's/.*CONFIG_ARM_EABI.*/CONFIG_ARM_EABI=y/' \
|
${configArmEABI} \
|
||||||
-e 's/.*ARCH_BIG_ENDIAN.*/#ARCH_BIG_ENDIAN=y/' \
|
${configBigEndian} \
|
||||||
-e 's/.*ARCH_WANTS_BIG_ENDIAN.*/#ARCH_WANTS_BIG_ENDIAN=y/' \
|
|
||||||
-e 's/.*ARCH_WANTS_LITTLE_ENDIAN.*/ARCH_WANTS_LITTLE_ENDIAN=y/' '' else ""} \
|
|
||||||
-i .config
|
-i .config
|
||||||
make oldconfig
|
make oldconfig
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Cross stripping hurts.
|
||||||
|
dontStrip = if (target != null) then true else false;
|
||||||
|
|
||||||
|
makeFlags = [ crossMakeFlag "VERBOSE=1" ];
|
||||||
|
|
||||||
|
buildInputs = stdenv.lib.optional (gccCross != null) gccCross;
|
||||||
|
|
||||||
patches = [ ./unifdef-getline.patch ];
|
patches = [ ./unifdef-getline.patch ];
|
||||||
|
|
||||||
|
# This will allow the usual gcc-cross-wrapper strip phase work as usual
|
||||||
|
crossConfig = if (target != null) then target.config else null;
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
make PREFIX=$out install
|
make PREFIX=$out VERBOSE=1 install ${crossMakeFlag}
|
||||||
(cd $out/include && ln -s ${kernelHeaders}/include/* .) || exit 1
|
(cd $out/include && ln -s ${kernelHeaders}/include/* .) || exit 1
|
||||||
|
sed -i s@/lib/@$out/lib/@g $out/lib/libc.so
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -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 = glibcCross cross;
|
glibcCross = libcCross cross;
|
||||||
profiledCompiler = false;
|
profiledCompiler = false;
|
||||||
enableMultilib = true;
|
enableMultilib = true;
|
||||||
crossStageStatic = false;
|
crossStageStatic = false;
|
||||||
|
@ -1794,7 +1794,7 @@ 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 = glibcCross cross;
|
glibcCross = libcCross cross;
|
||||||
profiledCompiler = false;
|
profiledCompiler = false;
|
||||||
enableMultilib = true;
|
enableMultilib = true;
|
||||||
crossStageStatic = false;
|
crossStageStatic = false;
|
||||||
|
@ -1813,7 +1813,7 @@ let
|
||||||
|
|
||||||
gccCrossStageFinal = cross: wrapGCCCross {
|
gccCrossStageFinal = cross: wrapGCCCross {
|
||||||
gcc = forceBuildDrv (gcc43_realCross cross);
|
gcc = forceBuildDrv (gcc43_realCross cross);
|
||||||
libc = glibcCross cross;
|
libc = libcCross cross;
|
||||||
binutils = binutilsCross cross;
|
binutils = binutilsCross cross;
|
||||||
inherit cross;
|
inherit cross;
|
||||||
};
|
};
|
||||||
|
@ -3483,7 +3483,9 @@ let
|
||||||
installLocales = getPkgConfig "glibc" "locales" false;
|
installLocales = getPkgConfig "glibc" "locales" false;
|
||||||
});
|
});
|
||||||
|
|
||||||
glibcCross = cross: glibc211Cross cross;
|
# We can choose:
|
||||||
|
# glibcCross = cross: glibc211Cross cross;
|
||||||
|
libcCross = cross: uclibcCross cross;
|
||||||
|
|
||||||
eglibc = import ../development/libraries/eglibc {
|
eglibc = import ../development/libraries/eglibc {
|
||||||
inherit fetchsvn stdenv kernelHeaders;
|
inherit fetchsvn stdenv kernelHeaders;
|
||||||
|
@ -6029,6 +6031,12 @@ let
|
||||||
inherit fetchurl stdenv kernelHeaders;
|
inherit fetchurl stdenv kernelHeaders;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
uclibcCross = target: import ../os-specific/linux/uclibc {
|
||||||
|
inherit fetchurl stdenv;
|
||||||
|
kernelHeaders = kernelHeadersCross target;
|
||||||
|
gccCross = gccCrossStageStatic target;
|
||||||
|
};
|
||||||
|
|
||||||
udev = makeOverridable (import ../os-specific/linux/udev) {
|
udev = makeOverridable (import ../os-specific/linux/udev) {
|
||||||
inherit fetchurl stdenv gperf pkgconfig acl libusb usbutils pciutils glib;
|
inherit fetchurl stdenv gperf pkgconfig acl libusb usbutils pciutils glib;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue