Updating the configuration system of uclibc to something more flexible than it was.
I copied what I had done in busybox. svn path=/nixpkgs/branches/stdenv-updates/; revision=23310
This commit is contained in:
parent
75a9a710fd
commit
745528b4e4
@ -1,54 +1,72 @@
|
|||||||
{stdenv, fetchurl, linuxHeaders, libiconv, cross ? null, gccCross ? null}:
|
{stdenv, fetchurl, linuxHeaders, libiconv, cross ? null, gccCross ? null,
|
||||||
|
extraConfig ? ""}:
|
||||||
|
|
||||||
assert stdenv.isLinux;
|
assert stdenv.isLinux;
|
||||||
assert cross != null -> gccCross != null;
|
assert cross != null -> gccCross != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
enableArmEABI = (cross == null && stdenv.platform.kernelArch == "arm")
|
configParser = ''
|
||||||
|| (cross != null && cross.arch == "arm");
|
function parseconfig {
|
||||||
|
set -x
|
||||||
|
while read LINE; do
|
||||||
|
NAME=`echo "$LINE" | cut -d \ -f 1`
|
||||||
|
OPTION=`echo "$LINE" | cut -d \ -f 2`
|
||||||
|
|
||||||
configArmEABI = if enableArmEABI then
|
if test -z "$NAME"; then
|
||||||
''-e 's/.*CONFIG_ARM_OABI.*//' \
|
continue
|
||||||
-e 's/.*CONFIG_ARM_EABI.*/CONFIG_ARM_EABI=y/' '' else "";
|
fi
|
||||||
|
|
||||||
enableBigEndian = (cross != null && cross.bigEndian);
|
if test "$NAME" == "CLEAR"; then
|
||||||
|
echo "parseconfig: CLEAR"
|
||||||
configBigEndian = if enableBigEndian then ""
|
echo > .config
|
||||||
else
|
fi
|
||||||
''-e 's/.*ARCH_BIG_ENDIAN.*/#ARCH_BIG_ENDIAN=y/' \
|
|
||||||
-e 's/.*ARCH_WANTS_BIG_ENDIAN.*/#ARCH_WANTS_BIG_ENDIAN=y/' \
|
echo "parseconfig: removing $NAME"
|
||||||
-e 's/.*ARCH_WANTS_LITTLE_ENDIAN.*/ARCH_WANTS_LITTLE_ENDIAN=y/' '';
|
sed -i /^$NAME=/d .config
|
||||||
|
|
||||||
|
if test "$OPTION" != n; then
|
||||||
|
echo "parseconfig: setting $NAME=$OPTION"
|
||||||
|
echo "$NAME=$OPTION" >> .config
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
set +x
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
archMakeFlag = if (cross != null) then "ARCH=${cross.arch}" else "";
|
||||||
|
crossMakeFlag = if (cross != null) then "CROSS=${cross.config}-" else "";
|
||||||
|
|
||||||
|
nixConfig = ''
|
||||||
|
RUNTIME_PREFIX "/"
|
||||||
|
DEVEL_PREFIX "/"
|
||||||
|
UCLIBC_HAS_WCHAR y
|
||||||
|
UCLIBC_HAS_FTW y
|
||||||
|
UCLIBC_HAS_RPC y
|
||||||
|
DO_C99_MATH y
|
||||||
|
UCLIBC_HAS_PROGRAM_INVOCATION_NAME y
|
||||||
|
KERNEL_HEADERS "${linuxHeaders}/include"
|
||||||
|
'';
|
||||||
|
|
||||||
archMakeFlag = if (cross != null) then "ARCH=${cross.arch}" else "";
|
|
||||||
crossMakeFlag = if (cross != null) then "CROSS=${cross.config}-" else "";
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "uclibc-0.9.30.3" + stdenv.lib.optionalString (cross != null)
|
name = "uclibc-0.9.31" + stdenv.lib.optionalString (cross != null)
|
||||||
("-" + cross.config);
|
("-" + cross.config);
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = http://www.uclibc.org/downloads/uClibc-0.9.30.3.tar.bz2;
|
url = http://www.uclibc.org/downloads/uClibc-0.9.31.tar.bz2;
|
||||||
sha256 = "0f1fpdwampbw7pf79i64ipj0azk4kbc9wl81ynlp19p92k4klz0h";
|
sha256 = "1yk328fnz0abgh2vm2r68y65ckfkx97rdp8hbg4xvmx5s94kblw0";
|
||||||
};
|
};
|
||||||
|
|
||||||
# 'ftw' needed to build acl, a coreutils dependency
|
# 'ftw' needed to build acl, a coreutils dependency
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
make defconfig ${archMakeFlag}
|
make defconfig ${archMakeFlag}
|
||||||
sed -e s@/usr/include@${linuxHeaders}/include@ \
|
${configParser}
|
||||||
-e 's@^RUNTIME_PREFIX.*@RUNTIME_PREFIX="/"@' \
|
cat << EOF | parseconfig
|
||||||
-e 's@^DEVEL_PREFIX.*@DEVEL_PREFIX="/"@' \
|
${nixConfig}
|
||||||
-e 's@.*UCLIBC_HAS_WCHAR.*@UCLIBC_HAS_WCHAR=y@' \
|
${extraConfig}
|
||||||
-e 's@.*UCLIBC_HAS_FTW.*@UCLIBC_HAS_FTW=y@' \
|
${if cross != null then cross.uclibc.extraConfig else ""}
|
||||||
-e 's@.*UCLIBC_HAS_RPC.*@UCLIBC_HAS_RPC=y@' \
|
$extraCrossConfig
|
||||||
-e 's@.*DO_C99_MATH.*@DO_C99_MATH=y@' \
|
EOF
|
||||||
-e 's@.*UCLIBC_HAS_PROGRAM_INVOCATION_NAME.*@UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y@' \
|
|
||||||
-e 's@.*CONFIG_MIPS_ISA_1.*@#CONFIG_MIPS_ISA_1=y@' \
|
|
||||||
-e 's@.*CONFIG_MIPS_ISA_3.*@CONFIG_MIPS_ISA_3=y@' \
|
|
||||||
-e 's@.*CONFIG_MIPS_O32_ABI.*@#CONFIG_MIPS_O32_ABI=y@' \
|
|
||||||
-e 's@.*CONFIG_MIPS_N32_ABI.*@CONFIG_MIPS_N32_ABI=y@' \
|
|
||||||
${configArmEABI} \
|
|
||||||
${configBigEndian} \
|
|
||||||
-i .config
|
|
||||||
make oldconfig
|
make oldconfig
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user