]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - libsmartcols/meson.build
Merge branch 'PR/libmount-exec-errors' of github.com:karelzak/util-linux-work
[thirdparty/util-linux.git] / libsmartcols / meson.build
index 47113092b957c0fd7f8e43d094887ff6248bca67..bedd6da9769fbb510f4a8c273dae99639227ed92 100644 (file)
@@ -1,12 +1,27 @@
 dir_libsmartcols = include_directories('.', 'src')
 
 defs = configuration_data()
-defs.set('LIBSMARTCOLS_VERSION', libsmartcols_version)
+defs.set('LIBSMARTCOLS_VERSION', pc_version)
 
-libsmartcols_h = configure_file(
+configure_file(
   input : 'src/libsmartcols.h.in',
   output : 'libsmartcols.h',
-  configuration : defs)
+  configuration : defs,
+  install : build_libsmartcols,
+  install_dir : join_paths(get_option('includedir'), 'libsmartcols'),
+)
+
+scols_bison = generator(
+  bison,
+  output : ['@BASENAME@.c', '@BASENAME@.h'],
+  arguments : ['@INPUT@', '--output=@OUTPUT0@', '--defines=@OUTPUT1@'])
+scols_parser_c = scols_bison.process('src/filter-parser.y')
+
+scols_flex = generator(
+  flex,
+  output : ['@BASENAME@.c', '@BASENAME@.h'],
+  arguments : ['--outfile=@OUTPUT0@', '--header-file=@OUTPUT1@', '@INPUT@'])
+scols_scanner_c = scols_flex.process('src/filter-scanner.l')
 
 lib_smartcols_sources = '''
   src/smartcolsP.h
@@ -23,7 +38,12 @@ lib_smartcols_sources = '''
   src/grouping.c
   src/walk.c
   src/init.c
-'''.split()
+  src/filter.c
+  src/filter-param.c
+  src/filter-expr.c
+'''.split() \
+  + scols_parser_c + scols_scanner_c
+
 
 libsmartcols_sym = 'src/libsmartcols.sym'
 libsmartcols_sym_path = '@0@/@1@'.format(meson.current_source_dir(), libsmartcols_sym)
@@ -39,10 +59,18 @@ lib_smartcols = both_libraries(
   link_with : lib_common,
   dependencies : build_libsmartcols ? [] : disabler(),
   install : build_libsmartcols)
+smartcols_dep = declare_dependency(link_with: lib_smartcols, include_directories: '.')
 
 lib_smartcols_static = lib_smartcols.get_static_lib()
 
-pkgconfig.generate(lib_smartcols,
-                   description : 'table or tree library',
-                   subdirs : 'libsmartcols',
-                   version : pc_version)
+if build_libsmartcols
+  pkgconfig.generate(lib_smartcols,
+                     description : 'table or tree library',
+                     subdirs : 'libsmartcols',
+                     version : pc_version)
+  if meson.version().version_compare('>=0.54.0')
+    meson.override_dependency('smartcols', smartcols_dep)
+  endif
+endif
+
+manadocs += ['libsmartcols/scols-filter.5.adoc']