Fixing a bit the busybox expression and its new flexible config

svn path=/nixpkgs/branches/stdenv-updates/; revision=22852
This commit is contained in:
Lluís Batlle i Rossell 2010-08-01 21:25:37 +00:00
parent fb4a1baa45
commit 908c67b7ee

View File

@ -1,24 +1,27 @@
{stdenv, fetchurl, enableStatic ? false, extraConfig ? ""}: {stdenv, fetchurl, enableStatic ? false, extraConfig ? null}:
let let
configParser = '' configParser = ''
function parseconfig { function parseconfig {
set -x set -x
while read LINE; do while read LINE; do
NAME=`cut -d \ -f 1 $LINE` NAME=`echo "$LINE" | cut -d \ -f 1`
OPTION=`cut -d \ -f 2 $LINE` OPTION=`echo "$LINE" | cut -d \ -f 2`
if test -z "$NAME"; then if test -z "$NAME"; then
continue continue
fi fi
if test "$NAME" == "CLEAR"; then if test "$NAME" == "CLEAR"; then
echo "parseconfig: CLEAR"
echo > .config echo > .config
fi fi
echo "parseconfig: removing $NAME"
sed -i /^$NAME=/d .config sed -i /^$NAME=/d .config
if test "$OPTION" != n; then if test "$OPTION" != n; then
echo "parseconfig: setting $NAME=$OPTION"
echo "$NAME=$OPTION" >> .config echo "$NAME=$OPTION" >> .config
fi fi
done done
@ -32,7 +35,7 @@ let
''; '';
staticConfig = (if enableStatic then '' staticConfig = (if enableStatic then ''
sed -i 's,.*CONFIG_STATIC.*,CONFIG_STATIC=y,' .config CONFIG_STATIC y
'' else ""); '' else "");
in in
@ -46,20 +49,20 @@ stdenv.mkDerivation {
}; };
configurePhase = '' configurePhase = ''
set -x
make defconfig make defconfig
${configParser} ${configParser}
cat << EOF | parseconfig cat << EOF | parseconfig
${staticConfig}
${extraConfig} ${extraConfig}
${nixConfig} ${nixConfig}
$extraCrossConfig $extraCrossConfig
EOF EOF
set +x make oldconfig
''; '';
crossAttrs = { crossAttrs = {
extraCrossConfig = '' extraCrossConfig = ''
CONFIG_CROSS_COMPILER_PREFIX "$crossConfig-" CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cross.config}-"
'' + '' +
(if (stdenv.cross.platform.kernelMajor == "2.4") then '' (if (stdenv.cross.platform.kernelMajor == "2.4") then ''
CONFIG_IONICE n CONFIG_IONICE n