1{ lib, stdenv, fetchgit
2, fetchpatch
3}:
4
5stdenv.mkDerivation rec {
6 pname = "liburing";
7 version = "2.3";
8
9 src = fetchgit {
10 url = "http://git.kernel.dk/${pname}";
11 rev = "liburing-${version}";
12 sha256 = "sha256-vN6lLb5kpgHTKDxwibJPS61sdelILETVtJE2BYgp79k=";
13 };
14
15 patches = [
16 # Backported portability fixes from liburing master, needed for pkgsMusl.liburing
17 ./0001-Add-custom-error-function-for-tests.patch
18 ./0002-test-Use-t_error-instead-of-glibc-s-error.patch
19 ./0003-examples-Use-t_error-instead-of-glibc-s-error.patch
20
21 # More portability fixes, in the process of being upstreamed
22 (fetchpatch {
23 url = "https://github.com/axboe/liburing/pull/798/commits/0fbcc44fe1fb2dc6807660b2cff1c2995add095b.patch";
24 hash = "sha256-xOMsw0VpYGst/+Isd2Tmq8CmBDK+uyLw3KNKPnsCSoA=";
25 })
26 ];
27
28 separateDebugInfo = true;
29 enableParallelBuilding = true;
30 # Upstream's configure script is not autoconf generated, but a hand written one.
31 setOutputFlags = false;
32 preConfigure =
33 # We cannot use configureFlags or configureFlagsArray directly, since we
34 # don't have structuredAttrs yet and using placeholder causes permissions
35 # denied errors. Using $dev / $man in configureFlags causes bash evaluation
36 # errors
37 ''
38 configureFlagsArray+=(
39 "--includedir=$dev/include"
40 "--mandir=$man/share/man"
41 )
42 '';
43
44 # Doesn't recognize platform flags
45 configurePlatforms = [];
46
47 outputs = [ "out" "bin" "dev" "man" ];
48
49 postInstall = ''
50 # Copy the examples into $bin. Most reverse dependency of this package should
51 # reference only the $out output
52 mkdir -p $bin/bin
53 cp ./examples/io_uring-cp examples/io_uring-test $bin/bin
54 cp ./examples/link-cp $bin/bin/io_uring-link-cp
55 '' + lib.optionalString stdenv.hostPlatform.isGnu ''
56 cp ./examples/ucontext-cp $bin/bin/io_uring-ucontext-cp
57 '';
58
59 meta = with lib; {
60 description = "Userspace library for the Linux io_uring API";
61 homepage = "https://git.kernel.dk/cgit/liburing/";
62 license = licenses.lgpl21;
63 platforms = platforms.linux;
64 maintainers = with maintainers; [ thoughtpolice ];
65 };
66}