Author: viric
Date: Sun Aug 1 21:06:45 2010
New Revision: 22846
URL: https://svn.nixos.org/websvn/nix/?rev=22846&sc=1
Log:
Trying to make busybox more configurable
Modified:
nixpkgs/branches/stdenv-updates/pkgs/misc/busybox/default.nix
Modified: nixpkgs/branches/stdenv-updates/pkgs/misc/busybox/default.nix
==============================================================================
--- nixpkgs/branches/stdenv-updates/pkgs/misc/busybox/default.nix Sun Aug
1 21:05:32 2010 (r22845)
+++ nixpkgs/branches/stdenv-updates/pkgs/misc/busybox/default.nix Sun Aug
1 21:06:45 2010 (r22846)
@@ -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 @@
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 "");
};
}
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits