Browse Source

meson: General visibility fixes/enhancement

Signed-off-by: Mobin "Hojjat" Aydinfar <mobin@mobintestserver.ir>
Mobin Aydinfar 3 months ago
parent
commit
cbd9d8d4a4
6 changed files with 100 additions and 108 deletions
  1. 13 13
      doc/manpages/meson.build
  2. 2 3
      meson.build
  3. 46 46
      src/igr-tests/meson.build
  4. 12 17
      src/meson.build
  5. 18 20
      src/tests/cptests/meson.build
  6. 9 9
      src/tests/meson.build

+ 13 - 13
doc/manpages/meson.build

@@ -10,21 +10,21 @@ foreach man: ['dinit-service.5', 'dinit.8', 'dinitcheck.8', 'dinitctl.8', 'dinit
         output: man,
         command: [
             'm4',
-            '-DVERSION='+version,
-            '-DMONTH='+month,
-            '-DYEAR='+year,
-            '-DSHUTDOWN_PREFIX='+shutdown_prefix,
-            '-DDEFAULT_AUTO_RESTART='+default_auto_restart,
-            '-DDEFAULT_START_TIMEOUT='+default_start_timeout,
-            '-DDEFAULT_STOP_TIMEOUT='+default_stop_timeout,
+            '-DVERSION=' + version,
+            '-DMONTH=' + month,
+            '-DYEAR=' + year,
+            '-DSHUTDOWN_PREFIX=' + shutdown_prefix,
+            '-DDEFAULT_AUTO_RESTART=' + default_auto_restart,
+            '-DDEFAULT_START_TIMEOUT=' + default_start_timeout,
+            '-DDEFAULT_STOP_TIMEOUT=' + default_stop_timeout,
             '@INPUT@'
         ],
         capture: true,
         install: true,
-        install_dir: join_paths(get_option('mandir'), section),
+        install_dir: join_paths(mandir, section),
     )
 endforeach
-if shutdown_build
+if shutdown_built
     foreach shutdown_man: ['shutdown.8', 'reboot.8', 'halt.8']
         custom_target(
             shutdown_man,
@@ -32,10 +32,10 @@ if shutdown_build
             output: shutdown_prefix + shutdown_man,
             command: [
                 'm4',
-                '-DVERSION='+version,
-                '-DMONTH='+month,
-                '-DYEAR='+year,
-                '-DSHUTDOWN_PREFIX='+shutdown_prefix,
+                '-DVERSION=' + version,
+                '-DMONTH=' + month,
+                '-DYEAR=' + year,
+                '-DSHUTDOWN_PREFIX=' + shutdown_prefix,
                 '@INPUT@'
             ],
             capture: true,

+ 2 - 3
meson.build

@@ -3,7 +3,7 @@ project(
     'dinit', 
     'cpp', 
     version : run_command('grep', '^VERSION=', 'build/version.conf',
-        check : true).stdout().strip().split('=')[1],
+        check: true).stdout().strip().split('=')[1],
     license : 'Apache-2.0',
     meson_version : '>= 0.56.0',
     default_options : [
@@ -14,8 +14,7 @@ project(
 )
 
 ## Import variables from build/version.conf
-kv = import('keyval')
-version_conf = kv.load('build/version.conf')
+version_conf = import('keyval').load('build/version.conf')
 
 ## General Defines
 compiler = meson.get_compiler('cpp')

+ 46 - 46
src/igr-tests/meson.build

@@ -33,144 +33,144 @@ offlineenable_test_script = files(meson.current_source_dir() + '/offline-enable/
 test(
      'basic',
      basic_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'environ',
      environ_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'environ2',
      environ2_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'ps-environ',
      psenviron_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'chain-to',
      chainto_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'force-stop',
      forcestop_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'restart',
      restart_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'check-basic',
      checkbasic_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'check-cycle',
      checkcycle_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'check-cycle2',
      checkcycle2_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'check-lint',
      checklint_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'reload1',
      reload1_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'reload2',
      reload2_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'no-command-error',
      nocommanderror_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'add-rm-dep',
      addrmdep_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'var-subst',
      varsubst_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'svc-start-fail',
      svcstartfail_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'dep-not-found',
      depnotfound_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
      'pseudo-cycle',
      pseudocycle_test_script,
-     env : igr_tests_env,
+     env: igr_tests_env,
      suite: 'igr_tests'
 )
 test(
      'before-after',
      beforeafter_test_script,
-     env : igr_tests_env,
+     env: igr_tests_env,
      suite: 'igr_tests'
 )
 test(
      'before-after2',
      beforeafter2_test_script,
-     env : igr_tests_env,
-     suite : 'igr_tests'
+     env: igr_tests_env,
+     suite: 'igr_tests'
 )
 test(
     'log-via-pipe',
     logviapipe_test_script,
-    env : igr_tests_env,
-    suite : 'igr_tests'
+    env: igr_tests_env,
+    suite: 'igr_tests'
 )
 test(
     'catlog',
     catlog_test_script,
-    env : igr_tests_env,
-    suite : 'igr_tests'
+    env: igr_tests_env,
+    suite: 'igr_tests'
 )
 test(
     'offline-enable',
     offlineenable_test_script,
-    env : igr_tests_env,
-    suite : 'igr_tests'
+    env: igr_tests_env,
+    suite: 'igr_tests'
 )

+ 12 - 17
src/meson.build

@@ -22,7 +22,12 @@ dinit_source_files = [
 ]
 
 ## src/'s Defines
-shutdown_build = false
+shutdown_built = false
+misc_args = {
+    'include_directories': default_incdir,
+    'install': true,
+    'install_dir': sbindir
+}
 
 ## src/'s defines for igr-tests/
 if igr_tests
@@ -34,43 +39,33 @@ endif
 executable(
     'dinit',
     dinit_source_files,
-    include_directories : default_incdir,
-    install : true,
-    install_dir : sbindir
+    kwargs: misc_args
 )
 executable(
     'dinitctl',
     'dinitctl.cc',
     'options-processing.cc',
-    include_directories : default_incdir,
-    install : true,
-    install_dir : sbindir
+    kwargs: misc_args
 )
 executable(
     'dinitcheck',
     'dinitcheck.cc',
     'options-processing.cc',
-    include_directories : default_incdir,
-    install : true,
-    install_dir : sbindir
+    kwargs: misc_args
 )
 executable(
     'dinit-monitor',
     'dinit-monitor.cc',
-    include_directories : default_incdir,
-    install : true,
-    install_dir : sbindir
+    kwargs: misc_args
 )
 # Shutdown/reboot/halt
 if build_shutdown.auto() and platform == 'linux' or build_shutdown.enabled()
-    shutdown_build = true
+    shutdown_built = true
     foreach exec: ['shutdown', 'reboot', 'halt']
         executable(
             shutdown_prefix + exec,
             'shutdown.cc',
-            include_directories : default_incdir,
-            install : true,
-            install_dir : sbindir
+            kwargs: misc_args
         )
     endforeach
 endif

+ 18 - 20
src/tests/cptests/meson.build

@@ -7,20 +7,18 @@ incdir = include_directories(
     '../../includes/',
     '../../../dasynq/include/'
 )
-if fuzzer or unit_tests
-    sources = [
-        '../test-bpsys.cc',
-        '../test-dinit.cc',
-        '../test-run-child-proc.cc',
-        '../../control.cc',
-        '../../dinit-log.cc',
-        '../../service.cc',
-        '../../load-service.cc',
-        '../../proc-service.cc',
-        '../../baseproc-service.cc',
-        '../../dinit-env.cc'
-    ]
-endif
+sources = [
+    '../test-bpsys.cc',
+    '../test-dinit.cc',
+    '../test-run-child-proc.cc',
+    '../../control.cc',
+    '../../dinit-log.cc',
+    '../../service.cc',
+    '../../load-service.cc',
+    '../../proc-service.cc',
+    '../../baseproc-service.cc',
+    '../../dinit-env.cc'
+]
 
 ## dinit with libfuzzer can't be compiled without clang/clang++. For some reasons, Meson don't support set default compiler in default_options.
 if fuzzer and compiler.get_id() != 'clang'
@@ -34,9 +32,9 @@ if unit_tests
         'cptests',
         'cptests.cc',
         sources,
-        include_directories : incdir
+        include_directories: incdir
     )
-    test('cptests', cptests_exec, suite : 'unit_tests')
+    test('cptests', cptests_exec, suite: 'unit_tests')
 endif
 # LLVM's Libfuzzer
 if fuzzer
@@ -44,9 +42,9 @@ if fuzzer
         'fuzz',
         'fuzz.cc',
         sources,
-        include_directories : incdir,
-        install : false,
-        cpp_args : '-fsanitize=address,undefined,fuzzer-no-link,leak',
-        link_args : '-fsanitize=fuzzer,address,undefined,leak'
+        include_directories: incdir,
+        install: false,
+        cpp_args: '-fsanitize=address,undefined,fuzzer-no-link,leak',
+        link_args: '-fsanitize=fuzzer,address,undefined,leak'
     )
 endif

+ 9 - 9
src/tests/meson.build

@@ -29,7 +29,7 @@ run_command([
     meson.current_source_dir() + '/test-services',
     meson.current_build_dir()
     ],
-    check : true
+    check: true
 )
 
 ## Outputs
@@ -39,30 +39,30 @@ tests_exec = executable(
     'tests.cc',
     for_tests_general_sources,
     for_tests_dinit_sources,
-    include_directories : for_tests_incdir
+    include_directories: for_tests_incdir
 )
 proctests_exec = executable(
     'proctests',
     'proctests.cc',
     for_tests_general_sources,
     for_tests_dinit_sources,
-    include_directories : for_tests_incdir
+    include_directories: for_tests_incdir
 )
 loadtests_exec = executable(
     'loadtests',
     'loadtests.cc',
     for_tests_general_sources,
     for_tests_dinit_sources,
-    include_directories : for_tests_incdir
+    include_directories: for_tests_incdir
 )
 envtests_exec = executable(
     'envtests',
     'envtests.cc',
     for_tests_general_sources,
     for_tests_dinit_sources, 
-    include_directories : for_tests_incdir
+    include_directories: for_tests_incdir
 )
-test('tests', tests_exec, suite : 'unit_tests')
-test('proctests', proctests_exec, suite : 'unit_tests')
-test('loadtests', loadtests_exec, workdir : meson.current_build_dir(), suite : 'unit_tests')
-test('envtests', envtests_exec, suite : 'unit_tests')
+test('tests', tests_exec, suite: 'unit_tests')
+test('proctests', proctests_exec, suite: 'unit_tests')
+test('loadtests', loadtests_exec, workdir: meson.current_build_dir(), suite: 'unit_tests')
+test('envtests', envtests_exec, suite: 'unit_tests')