Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creae meson build system #3

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ task:
install_script:
- sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf
- pkg upgrade -y

script: |
make -j 4
- pkg install -y meson ninja
meson_script:
- meson _build
- ninja -C _build
8 changes: 0 additions & 8 deletions CMakeLists.txt

This file was deleted.

17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

3 changes: 2 additions & 1 deletion Version.map
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
signalfd;
timerfd_create;
timerfd_settime;
local: *;
local:
*;
};
76 changes: 76 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
project('epoll-shim', 'c',
version : '0.0.1',
license : 'MIT',
default_options : [
'buildtype=debugoptimized',
'warning_level=3',
'c_std=c11',
'werror=true' ],
meson_version : '>=0.46.0' )

libepollshim_version = meson.project_version().split('.')

dir_data = join_paths(get_option('prefix'), get_option('datadir'))
dir_sysconf = join_paths(get_option('prefix'), get_option('sysconfdir'))
dir_libexec = join_paths(get_option('prefix'), get_option('libexecdir'))
dir_lib = join_paths(get_option('prefix'), get_option('libdir'))
dir_include = join_paths(get_option('prefix'), get_option('includedir'), 'libepoll-shim/sys')
dir_src_test = join_paths(meson.source_root(), 'test')
dir_src = join_paths(meson.source_root(), 'src')

# Compiler setup
cc = meson.get_compiler('c')

libepollshim_so_version = '0.0.0'

# Dependencies
thread_dep = dependency('threads')
pkgconfig = import('pkgconfig')
rt_dep = cc.find_library('rt')

# Include directories
includes_include = include_directories('include')

# Symbol map
libepollshim_sym_path = meson.current_source_dir() + '/Version.map'
libepollshim_sym_ldflag = '-Wl,--version-script=' + libepollshim_sym_path

if cc.links('', name: '-Wl,--version-script', args: ['-shared', libepollshim_sym_ldflag])
link_args = [libepollshim_sym_ldflag]
else
error('Linker doesn\'t support --version-script')
endif

header_libepollshim = [ 'include/sys/epoll.h',
'include/sys/timerfd.h',
'include/sys/signalfd.h'
]

install_headers(header_libepollshim, subdir : 'libepoll-shim/sys')

src_libepollshim = [ 'src/epoll.c',
'src/timerfd.c',
'src/signalfd.c',
'src/common.c'
]

src_libepollshim += header_libepollshim

deps_libepollshim = [ thread_dep,
rt_dep
]

lib_libepollshim = both_libraries('epoll-shim',
src_libepollshim,
include_directories : includes_include,
dependencies : deps_libepollshim,
version : libepollshim_so_version,
link_args : '-Wl,--version-script=' + libepollshim_sym_path,
install : true
)

pkgconfig.generate(lib_libepollshim,
url : 'https://github.com/FreeBSDDesktop/epoll-shim',
description : 'small epoll implementation using kqueue',
subdirs : 'libepoll-shim'
)
9 changes: 0 additions & 9 deletions test/CMakeLists.txt

This file was deleted.