From 0a884b25f9f6825d5cadc8ef0cae5319687f5ed5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 Aug 2008 15:27:50 +0000 Subject: [PATCH] * util-linux: added an option to build just mount/umount, and an option to set the path to the mount helpers programs (mount.) to something other than /sbin. Needed in NixOS to get the mount command to work for NTFS-3G, CIFS, etc. svn path=/nixpkgs/trunk/; revision=12514 --- pkgs/os-specific/linux/util-linux/default.nix | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix index 8aed357d54c..d9fd0028c79 100644 --- a/pkgs/os-specific/linux/util-linux/default.nix +++ b/pkgs/os-specific/linux/util-linux/default.nix @@ -1,7 +1,15 @@ -{stdenv, fetchurl, ncurses ? null}: +{ stdenv, fetchurl, ncurses ? null + +, # Build mount/umount only. + buildMountOnly ? false + +, # A directory containing mount helpers programs + # (i.e. `mount.') to be used instead of /sbin. + mountHelpers ? null +}: stdenv.mkDerivation { - name = "util-linux-2.13-pre7"; + name = (if buildMountOnly then "mount-" else "") + "util-linux-2.13-pre7"; src = fetchurl { url = mirror://kernel/linux/utils/util-linux/testing/util-linux-2.13-pre7.tar.bz2; @@ -21,10 +29,28 @@ stdenv.mkDerivation { buildInputs = stdenv.lib.optional (ncurses != null) ncurses; - preBuild = '' + inherit mountHelpers; + + preConfigure = '' makeFlagsArray=(usrbinexecdir=$out/bin usrsbinexecdir=$out/sbin datadir=$out/share exampledir=$out/share/getopt) + if test -n "$mountHelpers"; then + substituteInPlace mount/mount.c --replace /sbin/mount. $mountHelpers/mount. + substituteInPlace mount/umount.c --replace /sbin/umount. $mountHelpers/umount. + fi ''; + buildPhase = + if buildMountOnly then '' + make "''${makeFlagsArray[@]}" -C lib + make "''${makeFlagsArray[@]}" -C mount + '' else ""; + + installPhase = + if buildMountOnly then '' + make "''${makeFlagsArray[@]}" -C lib install + make "''${makeFlagsArray[@]}" -C mount install + '' else ""; + # Hack to get static builds to work. NIX_CFLAGS_COMPILE = "-DHAVE___PROGNAME=1"; }