Skip to content

Commit e2bcbd9

Browse files
committed
add liburing-2.0 wrap
The meson build files for liburing-2.0 are taken from https://github.com/fischerling/liburing/tree/2.0-meson and are based upon axboe/liburing#297
1 parent ff91ca6 commit e2bcbd9

File tree

12 files changed

+416
-0
lines changed

12 files changed

+416
-0
lines changed

releases.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,14 @@
543543
"1.17-1"
544544
]
545545
},
546+
"liburing": {
547+
"dependency_names": [
548+
"uring"
549+
],
550+
"versions": [
551+
"2.0-1"
552+
]
553+
},
546554
"libuv": {
547555
"dependency_names": [
548556
"libuv"

subprojects/liburing.wrap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[wrap-file]
2+
directory = liburing-liburing-2.0
3+
source_url = https://github.com/axboe/liburing/archive/refs/tags/liburing-2.0.tar.gz
4+
source_filename = liburing-2.0.tar.gz
5+
source_hash = ca069ecc4aa1baf1031bd772e4e97f7e26dfb6bb733d79f70159589b22ab4dc0
6+
patch_directory = liburing
7+
8+
[provide]
9+
uring = uring
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2021 Florian Fischer
2+
Copyright (c) 2021 Peter Eszlari
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
executable('io_uring-cp',
2+
'io_uring-cp.c',
3+
dependencies: uring)
4+
5+
executable('io_uring-test',
6+
'io_uring-test.c',
7+
dependencies: uring)
8+
9+
executable('link-cp',
10+
'link-cp.c',
11+
dependencies: uring)
12+
13+
if has_ucontext
14+
executable('ucontext-cp',
15+
'ucontext-cp.c',
16+
dependencies: uring)
17+
endif
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
install_man('io_uring.7',
2+
'io_uring_enter.2',
3+
'io_uring_get_sqe.3',
4+
'io_uring_queue_exit.3',
5+
'io_uring_queue_init.3',
6+
'io_uring_register.2',
7+
'io_uring_setup.2')
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
project('liburing', ['c','cpp'],
2+
version: '2.0',
3+
license: ['MIT', 'LGPL-2.1-only', 'GPL-2.0-only WITH Linux-syscall-note'],
4+
meson_version: '>=0.53.0',
5+
default_options: ['default_library=both',
6+
'buildtype=debugoptimized',
7+
'c_std=c11',
8+
'cpp_std=c++11',
9+
'warning_level=2'])
10+
11+
add_project_arguments('-D_GNU_SOURCE',
12+
'-D__SANE_USERSPACE_TYPES__',
13+
'-include', meson.current_build_dir() + '/config-host.h',
14+
'-Wno-unused-parameter',
15+
'-Wno-sign-compare',
16+
'-fomit-frame-pointer',
17+
language: ['c', 'cpp'])
18+
19+
thread_dep = dependency('threads')
20+
21+
cc = meson.get_compiler('c')
22+
23+
has_stringop_overflow = cc.has_argument('-Wstringop-overflow')
24+
has_array_bounds = cc.has_argument('-Warray-bounds')
25+
26+
has__kernel_rwf_t = cc.has_type('__kernel_rwf_t', prefix: '#include <linux/fs.h>')
27+
28+
has__kernel_timespec = cc.has_members('struct __kernel_timespec',
29+
'tv_sec',
30+
'tv_nsec',
31+
prefix: '#include <linux/time.h>')
32+
33+
code = '''#include <sys/types.h>
34+
#include <sys/stat.h>
35+
#include <fcntl.h>
36+
#include <string.h>
37+
int main(int argc, char **argv)
38+
{
39+
struct open_how how;
40+
how.flags = 0;
41+
how.mode = 0;
42+
how.resolve = 0;
43+
return 0;
44+
}
45+
'''
46+
has_open_how = cc.compiles(code, name: 'open_how')
47+
48+
code = '''#include <sys/types.h>
49+
#include <sys/stat.h>
50+
#include <unistd.h>
51+
#include <fcntl.h>
52+
#include <string.h>
53+
#include <linux/stat.h>
54+
int main(int argc, char **argv)
55+
{
56+
struct statx x;
57+
58+
return memset(&x, 0, sizeof(x)) != NULL;
59+
}
60+
'''
61+
has_statx = cc.compiles(code, name: 'statx')
62+
63+
cpp = meson.get_compiler('cpp')
64+
65+
code = '''#include <iostream>
66+
int main(int argc, char **argv)
67+
{
68+
std::cout << "Test";
69+
return 0;
70+
}
71+
'''
72+
has_cxx = cpp.compiles(code, name: 'C++')
73+
74+
has_ucontext = cc.has_type('ucontext_t', prefix: '#include <ucontext.h>')
75+
76+
conf_data = configuration_data()
77+
conf_data.set('CONFIG_HAVE_KERNEL_RWF_T', has__kernel_rwf_t)
78+
conf_data.set('CONFIG_HAVE_KERNEL_TIMESPEC', has__kernel_timespec)
79+
conf_data.set('CONFIG_HAVE_OPEN_HOW', has_open_how)
80+
conf_data.set('CONFIG_HAVE_STATX', has_statx)
81+
conf_data.set('CONFIG_HAVE_CXX', has_cxx)
82+
conf_data.set('CONFIG_HAVE_UCONTEXT', has_ucontext)
83+
configure_file(output: 'config-host.h',
84+
configuration: conf_data)
85+
86+
subdir('src')
87+
subdir('man')
88+
89+
if get_option('examples')
90+
subdir('examples')
91+
endif
92+
93+
if get_option('tests')
94+
if get_option('default_library') != 'both'
95+
error('default_library=both required to build tests')
96+
endif
97+
subdir('test')
98+
endif
99+
100+
pkg_mod = import('pkgconfig')
101+
pkg_mod.generate(libraries: liburing,
102+
name: 'liburing',
103+
version: meson.project_version(),
104+
description: 'io_uring library',
105+
url: 'http://git.kernel.dk/cgit/liburing/')
106+
107+
summary({'bindir': get_option('bindir'),
108+
'libdir': get_option('libdir'),
109+
'datadir': get_option('datadir'),
110+
}, section: 'Directories')
111+
summary({'examples': get_option('examples'),
112+
'tests': get_option('tests')
113+
}, section: 'Configuration', bool_yn: true)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
option('examples',
2+
type : 'boolean',
3+
value : false,
4+
description : 'Build example programs')
5+
6+
option('tests',
7+
type : 'boolean',
8+
value : false,
9+
description : 'Build test programs')
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* SPDX-License-Identifier: MIT */
2+
#ifndef LIBURING_COMPAT_H
3+
#define LIBURING_COMPAT_H
4+
@__kernel_rwf_t_compat@
5+
@__kernel_timespec_compat@
6+
@open_how_compat@
7+
#endif
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
if has__kernel_rwf_t
2+
__kernel_rwf_t_compat = ''
3+
else
4+
__kernel_rwf_t_compat = '''typedef int __kernel_rwf_t;
5+
'''
6+
endif
7+
8+
if has__kernel_timespec
9+
__kernel_timespec_compat = '''#include <linux/time_types.h>
10+
'''
11+
else
12+
__kernel_timespec_compat = '''#include <stdint.h>
13+
14+
struct __kernel_timespec {
15+
int64_t tv_sec;
16+
long long tv_nsec;
17+
};
18+
'''
19+
endif
20+
21+
if has_open_how
22+
open_how_compat = ''
23+
else
24+
open_how_compat = '''#include <inttypes.h>
25+
26+
struct open_how {
27+
uint64_t flags;
28+
uint64_t mode;
29+
uint64_t resolve;
30+
};
31+
'''
32+
endif
33+
34+
conf_data = configuration_data()
35+
conf_data.set('__kernel_rwf_t_compat', __kernel_rwf_t_compat)
36+
conf_data.set('__kernel_timespec_compat', __kernel_timespec_compat)
37+
conf_data.set('open_how_compat', open_how_compat)
38+
configure_file(input: 'compat.h.in',
39+
output: 'compat.h',
40+
configuration: conf_data,
41+
install: true,
42+
install_dir: get_option('includedir') / 'liburing')
43+
44+
install_headers('barrier.h',
45+
'io_uring.h',
46+
subdir: 'liburing')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
install_headers('liburing.h')
2+
3+
subdir('liburing')
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
subdir('include')
2+
3+
inc = include_directories(['include'])
4+
5+
liburing = library('uring',
6+
'queue.c',
7+
'register.c',
8+
'setup.c',
9+
'syscall.c',
10+
include_directories: inc,
11+
link_args: '-Wl,--version-script=' + meson.current_source_dir() + '/liburing.map',
12+
link_depends: 'liburing.map',
13+
install: true)
14+
15+
uring = declare_dependency(link_with: liburing,
16+
include_directories: inc)

0 commit comments

Comments
 (0)