diff options
author | Colin Walters <walters@verbum.org> | 2019-10-11 11:57:33 +0000 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2019-10-11 11:57:33 +0000 |
commit | 41ecc5441f573b9b06d8dd360313e78047c11c45 (patch) | |
tree | 51ccb545b85b5f6c366bac3fe46c306cb4dfa967 /meson.build | |
parent | 2eeb8a7512be6755307cb21ccde4384016c6771f (diff) | |
parent | 4fca08e26808824b1f2a9866968eb245ce1da603 (diff) | |
download | libglnx-41ecc5441f573b9b06d8dd360313e78047c11c45.tar.gz |
Merge branch 'meson-older-compilers' into 'master'
Add Meson build system and Gitlab-CI
See merge request GNOME/libglnx!8
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..74ee36a --- /dev/null +++ b/meson.build @@ -0,0 +1,84 @@ +project('libglnx', 'c') + +add_project_arguments('-D_GNU_SOURCE', language: 'c') +add_project_arguments('-std=gnu99', language: 'c') +add_project_arguments('-Wno-unused-local-typedefs', language: 'c') + +cc = meson.get_compiler('c') + + +check_functions = [ + 'renameat2', + 'memfd_create', + 'copy_file_range', +] +conf = configuration_data() +foreach check_function : check_functions + have_it = cc.compiles(''' + #include <sys/types.h> + #include <unistd.h> + #include <stdio.h> + #include <sys/mount.h> + #include <fcntl.h> + #include <sched.h> + #include <linux/loop.h> + #include <linux/random.h> + #include <sys/mman.h> + + int func (void) { + (void) ''' + check_function + '''; + } + ''', + args : '-D_GNU_SOURCE', + name : check_function + '() is declared', + ) + conf.set10('HAVE_DECL_' + check_function.underscorify().to_upper(), have_it) +endforeach +config_h = configure_file( + output : 'config.h', + configuration : conf, +) + +libglnx_deps = [ + dependency('gio-2.0'), + dependency('gio-unix-2.0'), +] +libglnx_inc = include_directories('.') +libglnx_sources = [ + 'glnx-backport-autocleanups.h', + 'glnx-backport-autoptr.h', + 'glnx-backports.c', + 'glnx-backports.h', + 'glnx-console.c', + 'glnx-console.h', + 'glnx-dirfd.c', + 'glnx-dirfd.h', + 'glnx-errors.c', + 'glnx-errors.h', + 'glnx-fdio.c', + 'glnx-fdio.h', + 'glnx-local-alloc.c', + 'glnx-local-alloc.h', + 'glnx-lockfile.c', + 'glnx-lockfile.h', + 'glnx-macros.h', + 'glnx-missing.h', + 'glnx-missing-syscall.h', + 'glnx-shutil.c', + 'glnx-shutil.h', + 'glnx-xattrs.c', + 'glnx-xattrs.h', + 'libglnx.h', +] + +libglnx = static_library('glnx', + libglnx_sources, + dependencies : libglnx_deps, + include_directories : libglnx_inc, + install : false) +libglnx_dep = declare_dependency( + include_directories : libglnx_inc, + link_with : libglnx) + +subdir('tests') + |