udev: complete rework

- systemd puts all into one output now (except for man),
  because I wasn't able to fix all systemd/udev refernces
  for NixOS to work well
- libudev is now by default *copied* into another path,
  which is what most packages will use as build input :-)
- pkgs.udev = [ libudev.out libudev.dev ]; because there are too many
  references that just put `udev` into build inputs (to rewrite them all),
  also this made "${udev}/foo" fail at *evaluation* time
  so it's easier to catch and change to something more specific
This commit is contained in:
Vladimír Čunát
2015-10-03 20:52:03 +02:00
parent ec7a4ddd92
commit b44d846990
23 changed files with 115 additions and 62 deletions

View File

@@ -22,10 +22,15 @@ stdenv.mkDerivation rec {
sha256 = "07sc1x43j60d5jnps0d7bfka10fihnpgkdrfrh9iskgmc9qangjb";
};
patches = [ ./hwdb-location.diff ];
/* gave up for now!
outputs = [ "out" "libudev" "doc" ]; # TODO: "dev"
# note: there are many references to ${systemd}/...
outputDev = "out";
propagatedOutputs = "libudev";
*/
outputs = [ "out" "man" ];
buildInputs =
[ linuxHeaders pkgconfig intltool gperf libcap kmod xz pam acl
@@ -88,24 +93,26 @@ stdenv.mkDerivation rec {
--replace /sbin/fsck ${utillinux.bin}/sbin/fsck \
--replace /bin/echo ${coreutils}/bin/echo \
--replace /bin/cat ${coreutils}/bin/cat \
--replace /sbin/sulogin ${utillinux}/sbin/sulogin \
--replace /sbin/sulogin ${utillinux.bin}/sbin/sulogin \
--replace /usr/lib/systemd/systemd-fsck $out/lib/systemd/systemd-fsck
done
substituteInPlace src/journal/catalog.c \
--replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/
export NIX_CFLAGS_LINK+=" -Wl,-rpath,$libudev/lib"
configureFlagsArray+=("--with-ntp-servers=0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org")
#export NIX_CFLAGS_LINK+=" -Wl,-rpath,$libudev/lib"
'';
/*
makeFlags = [
"udevlibexecdir=$(libudev)/lib/udev"
# udev rules refer to $out, and anything but libs should probably go to $out
"udevrulesdir=$(out)/lib/udev/rules.d"
"udevhwdbdir=$(out)/lib/udev/hwdb.d"
];
*/
PYTHON_BINARY = "${coreutils}/bin/env python"; # don't want a build time dependency on Python
@@ -124,8 +131,6 @@ stdenv.mkDerivation rec {
"-USYSTEMD_BINARY_PATH" "-DSYSTEMD_BINARY_PATH=\"/run/current-system/systemd/lib/systemd/systemd\""
];
enableParallelBuilding = true;
installFlags =
[ "localstatedir=$(TMPDIR)/var"
"sysconfdir=$(out)/etc"
@@ -167,7 +172,8 @@ stdenv.mkDerivation rec {
# "kernel-install" shouldn't be used on NixOS.
find $out -name "*kernel-install*" -exec rm {} \;
''; # */
/*
# Move lib(g)udev to a separate output. TODO: maybe split them up
# to avoid libudev pulling glib
mkdir -p "$libudev/lib"
@@ -179,8 +185,10 @@ stdenv.mkDerivation rec {
for i in "$out"/lib/pkgconfig/{libudev,gudev-1.0}.pc; do
substituteInPlace $i --replace "libdir=$out" "libdir=$libudev"
done
''; # */
*/
enableParallelBuilding = true;
/*
# some libs fail to link to liblzma and/or libffi
postFixup = let extraLibs = stdenv.lib.makeLibraryPath [ xz.out libffi.out zlib.out ];
in ''
@@ -188,6 +196,7 @@ stdenv.mkDerivation rec {
patchelf --set-rpath `patchelf --print-rpath "$f"`':${extraLibs}' "$f"
done
'';
*/
# The interface version prevents NixOS from switching to an
# incompatible systemd at runtime. (Switching across reboots is
@@ -205,4 +214,3 @@ stdenv.mkDerivation rec {
};
}

View File

@@ -0,0 +1,19 @@
diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c
index 06c9831..e74825c 100644
--- a/src/libsystemd/sd-hwdb/sd-hwdb.c
+++ b/src/libsystemd/sd-hwdb/sd-hwdb.c
@@ -268,13 +268,8 @@ static int trie_search_f(sd_hwdb *hwdb, const char *search) {
}
static const char hwdb_bin_paths[] =
- "/etc/systemd/hwdb/hwdb.bin\0"
"/etc/udev/hwdb.bin\0"
- "/usr/lib/systemd/hwdb/hwdb.bin\0"
-#ifdef HAVE_SPLIT_USR
- "/lib/systemd/hwdb/hwdb.bin\0"
-#endif
- UDEVLIBEXECDIR "/hwdb.bin\0";
+ ;
_public_ int sd_hwdb_new(sd_hwdb **ret) {
_cleanup_hwdb_unref_ sd_hwdb *hwdb = NULL;

View File

@@ -0,0 +1,19 @@
{ stdenv, systemd }:
stdenv.mkDerivation {
name = "libudev-${systemd.version}";
unpackPhase = ":";
outputs = [ "dev" "out" ];
installPhase = ''
mkdir -p "$out/lib" "$dev/lib/pkgconfig" "$dev/include"
cp -P "${systemd}"/lib/libudev.* "$out/lib/"
cp -P "${systemd}"/lib/pkgconfig/libudev.pc "$dev/lib/pkgconfig/"
cp -P "${systemd}"/include/libudev.h "$dev/include/"
substituteInPlace "$dev"/lib/pkgconfig/*.pc \
--replace "${systemd}" "$out"
sed "/^includedir=/cincludedir=$dev/include" -i "$dev"/lib/pkgconfig/*.pc
'';
}