Trying to make busybox more configurable

svn path=/nixpkgs/branches/stdenv-updates/; revision=22846
This commit is contained in:
Lluís Batlle i Rossell 2010-08-01 21:06:45 +00:00
parent 212161482f
commit fbad1b3a56

View File

@ -1,12 +1,37 @@
{stdenv, fetchurl, enableStatic ? false}:
{stdenv, fetchurl, enableStatic ? false, extraConfig ? ""}:
let
basicConfigure = ''
make defconfig
sed -i 's,.*CONFIG_PREFIX.*,CONFIG_PREFIX="'$out'",' .config
sed -i 's,.*CONFIG_INSTALL_NO_USR.*,CONFIG_INSTALL_NO_USR=y,' .config
'' +
(if enableStatic then ''
configParser = ''
function parseconfig {
set -x
while read LINE; do
NAME=`cut -d \ -f 1 $LINE`
OPTION=`cut -d \ -f 2 $LINE`
if test -z "$NAME"; then
continue
fi
if test "$NAME" == "CLEAR"; then
echo > .config
fi
sed -i /^$NAME=/d .config
if test "$OPTION" != n; then
echo "$NAME=$OPTION" >> .config
fi
done
set +x
}
'';
nixConfig = ''
CONFIG_PREFIX "$out"
CONFIG_INSTALL_NO_USR n
'';
staticConfig = (if enableStatic then ''
sed -i 's,.*CONFIG_STATIC.*,CONFIG_STATIC=y,' .config
'' else "");
@ -20,14 +45,24 @@ stdenv.mkDerivation {
sha256 = "1n738zk01yi2sjrx2y36hpzxbslas8b91vzykcifr0p1j7ym0lim";
};
configurePhase = basicConfigure;
configurePhase = ''
set -x
make defconfig
${configParser}
cat << EOF | parseconfig
${extraConfig}
${nixConfig}
$extraCrossConfig
EOF
set +x
'';
crossAttrs = {
configurePhase = basicConfigure + ''
sed -i 's,.*CONFIG_CROSS_COMPILER_PREFIX.*,CONFIG_CROSS_COMPILER_PREFIX="'$crossConfig-'",' .config
extraCrossConfig = ''
CONFIG_CROSS_COMPILER_PREFIX "$crossConfig-"
'' +
(if (stdenv.cross.platform.kernelMajor == "2.4") then ''
sed -i 's,.*CONFIG_IONICE.*,CONFIG_IONICE=n,' .config
CONFIG_IONICE n
'' else "");
};
}