Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, lib 3, docbook-xsl-nons 4, fetchurl 5, glib 6, gobject-introspection 7, gtk-doc 8, libgudev 9, libpcap 10, meson 11, mesonEmulatorHook 12, ninja 13, pkg-config 14, python3 15, systemd 16, usbutils 17, vala 18, which 19}: 20 21stdenv.mkDerivation (finalAttrs: { 22 pname = "umockdev"; 23 version = "0.17.18"; 24 25 outputs = [ "bin" "out" "dev" "devdoc" ]; 26 27 src = fetchurl { 28 url = "https://github.com/martinpitt/umockdev/releases/download/${finalAttrs.version}/umockdev-${finalAttrs.version}.tar.xz"; 29 sha256 = "sha256-RmrT4McV5W9Q6mqWUWWCPQc6hBN6y4oeObZlc2SKmF8="; 30 }; 31 32 patches = [ 33 # Hardcode absolute paths to libraries so that consumers 34 # do not need to set LD_LIBRARY_PATH themselves. 35 ./hardcode-paths.patch 36 ]; 37 38 nativeBuildInputs = [ 39 docbook-xsl-nons 40 gobject-introspection 41 gtk-doc 42 meson 43 ninja 44 pkg-config 45 vala 46 ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 47 mesonEmulatorHook 48 ]; 49 50 buildInputs = [ 51 glib 52 systemd 53 libpcap 54 ]; 55 56 checkInputs = lib.optionals finalAttrs.passthru.withGudev [ 57 libgudev 58 ]; 59 60 nativeCheckInputs = [ 61 python3 62 which 63 usbutils 64 ]; 65 66 mesonFlags = [ 67 "-Dgtk_doc=true" 68 ]; 69 70 doCheck = true; 71 72 postPatch = '' 73 # Substitute the path to this derivation in the patch we apply. 74 substituteInPlace src/umockdev-wrapper \ 75 --subst-var-by 'LIBDIR' "''${!outputLib}/lib" 76 ''; 77 78 preCheck = '' 79 # Our patch makes the path to the `LD_PRELOAD`ed library absolute. 80 # When running tests, the library is not yet installed, though, 81 # so we need to replace the absolute path with a local one during build. 82 # We are using a symlink that will be overridden during installation. 83 mkdir -p "$out/lib" 84 ln -s "$PWD/libumockdev-preload.so.0" "$out/lib/libumockdev-preload.so.0" 85 ''; 86 87 passthru = { 88 # libgudev is needed for an optional test but it itself relies on umockdev for testing. 89 withGudev = false; 90 91 tests = { 92 withGudev = finalAttrs.finalPackage.overrideAttrs (attrs: { 93 passthru = attrs.passthru // { 94 withGudev = true; 95 }; 96 }); 97 }; 98 }; 99 100 meta = with lib; { 101 homepage = "https://github.com/martinpitt/umockdev"; 102 changelog = "https://github.com/martinpitt/umockdev/releases/tag/${finalAttrs.version}"; 103 description = "Mock hardware devices for creating unit tests"; 104 license = licenses.lgpl21Plus; 105 maintainers = with maintainers; [ flokli ]; 106 platforms = with platforms; linux; 107 }; 108})