| 1 |
cc = meson.get_compiler('c') |
| 2 |
pkg = import('pkgconfig') |
| 3 |
dir_liblastlog2 = include_directories('.', 'src') |
| 4 |
|
| 5 |
defs = configuration_data() |
| 6 |
defs.set('LIBLASTLOG2_VERSION', pc_version) |
| 7 |
defs.set('LIBLASTLOG2_MAJOR_VERSION', pc_version.split('.')[0]) |
| 8 |
defs.set('LIBLASTLOG2_MINOR_VERSION', pc_version.split('.')[1]) |
| 9 |
defs.set('LIBLASTLOG2_PATCH_VERSION', pc_version.split('.')[2]) |
| 10 |
|
| 11 |
configure_file( |
| 12 |
input : 'src/lastlog2.h.in', |
| 13 |
output : 'lastlog2.h', |
| 14 |
configuration : defs, |
| 15 |
install : build_liblastlog2, |
| 16 |
install_dir : get_option('includedir') / 'liblastlog2', |
| 17 |
) |
| 18 |
|
| 19 |
lib_lastlog2_sources = ''' |
| 20 |
src/lastlog2P.h |
| 21 |
src/lastlog2.c |
| 22 |
'''.split() |
| 23 |
|
| 24 |
subdir('man') |
| 25 |
|
| 26 |
liblastlog2_sym = 'src/liblastlog2.sym' |
| 27 |
liblastlog2_sym_path = '@0@/@1@'.format(meson.current_source_dir(), liblastlog2_sym) |
| 28 |
|
| 29 |
if build_liblastlog2 |
| 30 |
lib_lastlog2 = library( |
| 31 |
'lastlog2', |
| 32 |
lib_lastlog2_sources, |
| 33 |
include_directories : [dir_include], |
| 34 |
link_args : ['-Wl,--version-script=@0@'.format(liblastlog2_sym_path)], |
| 35 |
link_depends : liblastlog2_sym, |
| 36 |
dependencies : [lib_sqlite3], |
| 37 |
install : build_liblastlog2, |
| 38 |
version : liblastlog2_version, |
| 39 |
) |
| 40 |
|
| 41 |
lastlog2_dep = declare_dependency(link_with: lib_lastlog2, include_directories: dir_liblastlog2) |
| 42 |
|
| 43 |
lastlog2_tests = [ |
| 44 |
'dlopen', |
| 45 |
'pam_lastlog2_output', |
| 46 |
'remove_entry', |
| 47 |
'rename_user', |
| 48 |
'write_read_user', |
| 49 |
'y2038_ll2_read_all', |
| 50 |
'y2038_sqlite3_time', |
| 51 |
] |
| 52 |
libdl = cc.find_library('dl') |
| 53 |
|
| 54 |
pkg.generate( |
| 55 |
lib_lastlog2, |
| 56 |
description : 'library to manage last login data', |
| 57 |
subdirs : 'lastlog2', |
| 58 |
version : pc_version |
| 59 |
) |
| 60 |
meson.override_dependency('lastlog2', lastlog2_dep) |
| 61 |
|
| 62 |
foreach lastlog2_test: lastlog2_tests |
| 63 |
test_name = 'test_lastlog2_' + lastlog2_test |
| 64 |
exe = executable( |
| 65 |
test_name, |
| 66 |
'src/tests/tst_' + lastlog2_test + '.c', |
| 67 |
include_directories : [dir_include], |
| 68 |
link_with : [lib_common], |
| 69 |
dependencies : [libdl, lastlog2_dep], |
| 70 |
) |
| 71 |
# the test-setup expects the helpers in the toplevel build-directory |
| 72 |
link = meson.project_build_root() / test_name |
| 73 |
run_command('ln', '-srf', exe.full_path(), link, |
| 74 |
check : true) |
| 75 |
endforeach |
| 76 |
|
| 77 |
endif |