* A function `useKlibc' to build a package using klibc as the C

library.
* Removed devicemapperStatic, e2fsprogsDiet, lvm2Static since they're
  redundant (it's what you get when you use pkgsDiet/pkgsStatic).

svn path=/nixpkgs/trunk/; revision=12554
This commit is contained in:
Eelco Dolstra 2008-08-08 19:05:32 +00:00
parent e920df26c6
commit a9d19f45db
7 changed files with 39 additions and 83 deletions

View File

@ -1,4 +1,4 @@
{stdenv, fetchurl, static ? false}:
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "device-mapper-1.02.26";
@ -6,7 +6,7 @@ stdenv.mkDerivation {
url = ftp://sources.redhat.com/pub/dm/device-mapper.1.02.26.tgz;
sha256 = "0x905frw06s6k5p1rlc2hbgaphgalinarbdg82664sri0qmbkrfv";
};
configureFlags = if static then "--enable-static_link" else "";
configureFlags = if stdenv ? isStatic then "--enable-static_link" else "";
# To prevent make install from failing.
installFlags = "OWNER= GROUP=";
}

View File

@ -2,8 +2,9 @@ source $stdenv/setup
preBuild=preBuild
preBuild() {
mkdir -p linux/include
ln -s $kernel/lib/modules/*/build/include/* linux/include/
mkdir -p linux/include
cp -prd $kernel/lib/modules/*/build/include/* linux/include/
chmod -R u+w linux/include/
}
makeFlagsArray=(V=1 prefix=$out SHLIBDIR=$out/lib)

View File

@ -8,8 +8,10 @@ stdenv.mkDerivation {
src = fetchurl {
url = mirror://kernel/linux/libs/klibc/klibc-1.5.tar.bz2;
sha256 = "1izhf8kscjymsvsvhcqw9awnmp94vwv70zdj09srg9bkpjj0n017";
# url = mirror://kernel/linux/libs/klibc/Testing/klibc-1.5.14.tar.bz2;
# sha256 = "1cmrqpgamnv2ns7dlxjm61zc88dxm4ff0aya413ij1lmhp2h2sfc";
};
inherit kernel;
buildInputs = [perl bison mktemp];
patches = [./install.patch];
#patches = [./install.patch];
}

View File

@ -1,28 +0,0 @@
diff -rc klibc-1.4-orig/scripts/Kbuild.install klibc-1.4/scripts/Kbuild.install
*** klibc-1.4-orig/scripts/Kbuild.install 2006-06-19 03:17:15.000000000 +0200
--- klibc-1.4/scripts/Kbuild.install 2006-11-25 22:41:09.000000000 +0100
***************
*** 96,107 ****
$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
$(Q)set -e ; for d in linux scsi asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \
! mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \
! for r in $(KLIBCKERNELSRC)/include $(KLIBCKERNELOBJ)/include \
! $(KLIBCKERNELOBJ)/include2 ; do \
[ ! -d $$r/$$d ] || \
! cp -rfL $$r/$$d/. \
! $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \
done ; \
done
$(Q)cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(KLIBCARCH) asm
--- 96,105 ----
$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
$(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
$(Q)set -e ; for d in linux scsi asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \
! for r in $(KLIBCKERNELSRC)/include ; do \
[ ! -d $$r/$$d ] || \
! cp -rd $$r/$$d \
! $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d ; \
done ; \
done
$(Q)cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(KLIBCARCH) asm

View File

@ -1,4 +1,4 @@
{stdenv, fetchurl, devicemapper, static ? false}:
{stdenv, fetchurl, devicemapper}:
stdenv.mkDerivation {
name = "lvm2-2.02.38";
@ -7,7 +7,7 @@ stdenv.mkDerivation {
sha256 = "13nx6iqgga3ric51b36p15cxzhmh83s7spb2559iz3s24x4s0845";
};
buildInputs = [devicemapper];
configureFlags = if static then "--enable-static_link" else "";
configureFlags = if stdenv ? isStatic then "--enable-static_link" else "";
# To prevent make install from failing.
preInstall = "installFlags=\"OWNER= GROUP= confdir=$out/etc\"";
}

View File

@ -1,7 +1,5 @@
{stdenv, fetchurl}:
if stdenv.system != "x86_64-linux" || ! (stdenv ? isDietLibC) || !stdenv.isDietLibC then
stdenv.mkDerivation {
name = "udev-125";
@ -15,7 +13,7 @@ stdenv.mkDerivation {
preBuild = ''
makeFlagsArray=(prefix=$out usrbindir=$out/bin usrsbindir=$out/sbin usrlibdir=$out/lib \
mandir=$out/share/man includedir=$out/include \
EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id extras/floppy extras/path_id extras/scsi_id extras/usb_id extras/volume_id"
EXTRAS="extras/ata_id extras/edd_id extras/floppy extras/path_id extras/scsi_id extras/usb_id ${if stdenv ? isKlibc then "" else "extras/cdrom_id extras/volume_id"}"
INSTALL='install -c' DESTDIR=/)
substituteInPlace udev_rules.c --replace /lib/udev $out/lib/udev
@ -30,32 +28,3 @@ stdenv.mkDerivation {
description = "Udev manages the /dev filesystem";
};
}
else
# for now svn revision 10849 because this works fine with current dietlibc
# this should be fixed (maybe using klibc) or by patching udev somewhen
stdenv.mkDerivation {
name = "udev-118";
src = fetchurl {
url = mirror://kernel/linux/utils/kernel/hotplug/udev-118.tar.bz2;
sha256 = "1i488wqm7i6nz6gidbkxkb47hr427ika48i8imwrvvnpg1kzhska";
};
# "DESTDIR=/" is a hack to prevent "make install" from trying to
# mess with /dev.
preBuild = ''
makeFlagsArray=(etcdir=$out/etc sbindir=$out/sbin usrbindir=$out/bin usrsbindir=$out/sbin mandir=$out/share/man INSTALL='install -c' DESTDIR=/)
'';
preInstall = ''
installFlagsArray=(udevdir=$TMPDIR/dummy)
'';
meta = {
homepage = http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html;
description = "Udev manages the /dev filesystem";
};
}

View File

@ -103,6 +103,34 @@ let pkgs = rec {
isDietLibC = true;
} // {inherit fetchurl;};
# Return a modified stdenv that uses klibc to create small
# statically linked binaries.
useKlibc = stdenv: klibc: stdenv //
{ mkDerivation = args: stdenv.mkDerivation (args // {
NIX_CFLAGS_LINK = "-static";
# These are added *after* the command-line flags, so we'll
# always optimise for size.
NIX_CFLAGS_COMPILE =
(if args ? NIX_CFLAGS_COMPILE then args.NIX_CFLAGS_COMPILE else "")
+ " -Os -s";
configureFlags =
(if args ? configureFlags then args.configureFlags else "")
+ " --disable-shared"; # brrr...
NIX_GCC = runCommand "klibc-wrapper" {} ''
ensureDir $out/bin
ln -s ${klibc}/bin/klcc $out/bin/gcc
ln -s ${klibc}/bin/klcc $out/bin/cc
ensureDir $out/nix-support
echo 'PATH=$PATH:${stdenv.gcc.binutils}/bin' > $out/nix-support/setup-hook
'';
});
isKlibc = true;
isStatic = true;
} // {inherit fetchurl;};
# Return a modified stdenv that tries to build statically linked
# binaries.
makeStaticBinaries = stdenv: stdenv //
@ -4760,11 +4788,6 @@ let pkgs = rec {
inherit fetchurl stdenv;
};
devicemapperStatic = lowPrio (appendToName "static" (import ../os-specific/linux/device-mapper {
inherit fetchurl stdenv;
static = true;
}));
dmidecodeFun = lib.sumArgs (selectVersion ../os-specific/linux/dmidecode "2.9") {
inherit fetchurl stdenv builderDefs;
};
@ -4781,11 +4804,6 @@ let pkgs = rec {
inherit fetchurl stdenv;
};
e2fsprogsDiet = lowPrio (appendToName "diet" (import ../os-specific/linux/e2fsprogs {
inherit fetchurl;
stdenv = useDietLibC stdenv;
}));
e3cfsprogs = import ../os-specific/linux/e3cfsprogs {
inherit stdenv fetchurl gettext;
};
@ -5321,12 +5339,6 @@ let pkgs = rec {
inherit fetchurl stdenv devicemapper;
};
lvm2Static = lowPrio (appendToName "static" (import ../os-specific/linux/lvm2 {
inherit fetchurl stdenv;
static = true;
devicemapper = devicemapperStatic;
}));
mdadm = import ../os-specific/linux/mdadm {
inherit fetchurl stdenv groff;
};