diff options
author | Lluís Batlle i Rossell <viric@vicerveza.homeunix.net> | 2009-12-04 13:35:58 +0000 |
---|---|---|
committer | Lluís Batlle i Rossell <viric@vicerveza.homeunix.net> | 2009-12-04 13:35:58 +0000 |
commit | 4164de326abf88b35bbd3f2799599fa6f9f72446 (patch) | |
tree | 5f479447947c9075af16b33ede435fd938e1d7cd /pkgs/os-specific/linux/uclibc | |
parent | e9abf7bb0cdc5bb93c4641372f2ae907691b05a4 (diff) | |
download | nixpkgs-4164de326abf88b35bbd3f2799599fa6f9f72446.tar nixpkgs-4164de326abf88b35bbd3f2799599fa6f9f72446.tar.gz nixpkgs-4164de326abf88b35bbd3f2799599fa6f9f72446.tar.bz2 nixpkgs-4164de326abf88b35bbd3f2799599fa6f9f72446.tar.lz nixpkgs-4164de326abf88b35bbd3f2799599fa6f9f72446.tar.xz nixpkgs-4164de326abf88b35bbd3f2799599fa6f9f72446.tar.zst nixpkgs-4164de326abf88b35bbd3f2799599fa6f9f72446.zip |
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
Diffstat (limited to 'pkgs/os-specific/linux/uclibc')
-rw-r--r-- | pkgs/os-specific/linux/uclibc/default.nix | 53 |
1 files changed, 42 insertions, 11 deletions
diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix index 33914eea3d6..92cc4e99721 100644 --- a/pkgs/os-specific/linux/uclibc/default.nix +++ b/pkgs/os-specific/linux/uclibc/default.nix @@ -1,35 +1,66 @@ -{stdenv, fetchurl, kernelHeaders}: +{stdenv, fetchurl, kernelHeaders, gccCross ? null}: 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 { - name = "uclibc-0.9.30.1"; + name = "uclibc-0.9.30.1" + stdenv.lib.optionalString (target != null) + ("-" + target.config); + src = fetchurl { url = http://www.uclibc.org/downloads/uClibc-0.9.30.1.tar.bz2; sha256 = "132cf27hkgi0q4qlwbiyj4ffj76sja0jcxm0aqzzgks65jh6k5rd"; }; configurePhase = '' - make defconfig - sed -e s@/usr/include@${kernelHeaders}@ \ + make defconfig ${archMakeFlag} + sed -e s@/usr/include@${kernelHeaders}/include@ \ -e 's@^RUNTIME_PREFIX.*@RUNTIME_PREFIX="/"@' \ -e 's@^DEVEL_PREFIX.*@DEVEL_PREFIX="/"@' \ - ${if stdenv.system=="armv5tel-linux" then - ''-e 's/.*CONFIG_ARM_OABI.*//' \ - -e 's/.*CONFIG_ARM_EABI.*/CONFIG_ARM_EABI=y/' \ - -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/' '' else ""} \ + -e 's@.*UCLIBC_HAS_WCHAR.*@UCLIBC_HAS_WCHAR=y@' \ + -e 's@.*DO_C99_MATH.*@DO_C99_MATH=y@' \ + ${configArmEABI} \ + ${configBigEndian} \ -i .config 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 ]; + # This will allow the usual gcc-cross-wrapper strip phase work as usual + crossConfig = if (target != null) then target.config else null; + installPhase = '' mkdir -p $out - make PREFIX=$out install + make PREFIX=$out VERBOSE=1 install ${crossMakeFlag} (cd $out/include && ln -s ${kernelHeaders}/include/* .) || exit 1 + sed -i s@/lib/@$out/lib/@g $out/lib/libc.so ''; meta = { |