]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: Separate dependency args from global option args
authorFred Morcos <fred.morcos@open-xchange.com>
Tue, 8 Aug 2023 10:54:47 +0000 (12:54 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 12:28:33 +0000 (13:28 +0100)
14 files changed:
meson.build
meson/auto-var-init/meson.build
meson/code-coverage/meson.build
meson/compiler-setup/meson.build
meson/hardening/fortify-source/meson.build
meson/hardening/global-offset-table/meson.build
meson/hardening/pie/meson.build
meson/hardening/stack-prot/meson.build
meson/hardening/stack-smashing-prot/meson.build
meson/libcrypto/meson.build
meson/libdecaf/meson.build
meson/platform/meson.build
meson/sanitizers/address-sanitizer/meson.build
meson/sanitizers/meson.build

index 7e6f7ffe0a2404ce6233b9713b93e12cd658b5f0..6db64c85f5d23a8452f432b2b94288808b2db6ef 100644 (file)
@@ -20,7 +20,7 @@ summary('Build Dir', product_build_dir, section: 'Build')
 fs = import('fs')
 
 # Create the configuration object and dependencies list.
-add_global_arguments('-DHAVE_CONFIG_H')
+add_global_arguments('-DHAVE_CONFIG_H', language: ['cpp'])
 conf = configuration_data()
 deps = []
 
index 5fc4d31bbf0dcf6df20118ea3d6426d309a44472..a3c5552e31aee0e0a2173425065f7cf378d907eb 100644 (file)
@@ -9,7 +9,7 @@ if auto_var_init != 'disabled'
     subdir_done()
   endif
 
-  add_global_arguments(arg)
+  add_global_arguments(arg, language: ['cpp'])
 endif
 
 summary('Auto Var Init', auto_var_init, section: 'Configuration')
index 7baf3a87ccf33f60240574e56432c3aad5110d2d..bdfbe842fb886ba1fd4bd64f0975c46bbee8b823 100644 (file)
@@ -1,7 +1,5 @@
 # Code coverage
-# Inputs: deps
 
-code_coverage_deps = []
 code_coverage = get_option('code-coverage')
 
 if code_coverage
@@ -12,9 +10,9 @@ if code_coverage
       error('Compiler does not support ' + arg + ', which is needed for code coverage')
       break
     endif
-
-    code_coverage_deps += declare_dependency(compile_args: [arg])
   endforeach
+
+  add_global_arguments(args, language: ['cpp'])
 endif
 
 summary('Code Coverage', code_coverage, bool_yn: true, section: 'Configuration')
index 3f12ef9b6dcb0cde68b8de7a77d750f1b312d888..994c611e31b254695d06c29039f497145365ca7f 100644 (file)
@@ -4,10 +4,10 @@
 # Don't limit the number of errors when using clang. This is useful to not cut out the
 # error output when using an LSP server like clangd.
 if meson.get_compiler('cpp').get_id() == 'clang'
-  add_global_arguments(['-ferror-limit=0'], language: 'cpp')
+  add_global_arguments('-ferror-limit=0', language: ['cpp'])
 endif
 
-add_global_arguments(['-Wshadow', '-Wmissing-declarations', '-Wredundant-decls'], language: 'cpp')
+add_global_arguments('-Wshadow', '-Wmissing-declarations', '-Wredundant-decls', language: ['cpp'])
 
 cxx = meson.get_compiler('cpp')
 system = target_machine.system()
index 1d9b61f6dc6f34dd80ffb9542a998af23cc080ee..a13cad11ea1da900a5852d49f91d3c9edcf654f4 100644 (file)
@@ -1,5 +1,5 @@
 # Fortify Source
-# Inputs: hardening_features deps
+# Inputs: hardening_features
 
 fortify_source_opt = get_option('fortify-source')
 
@@ -16,8 +16,7 @@ if fortify_source_opt != 'disabled'
     variant_str = variant.to_string()
     if fortify_source_level == variant
       if cxx.has_argument('-D_FORTIFY_SOURCE=' + variant_str)
-        dep_fortify = declare_dependency(compile_args: ['-U_FORTIFY_SOURCE', '-D_FORTIFY_SOURCE=' + variant_str])
-        deps += dep_fortify
+        add_global_arguments('-U_FORTIFY_SOURCE', '-D_FORTIFY_SOURCE=' + variant_str, language: ['cpp'])
         break
       else
         fortify_source_level = fortify_source_level - 1
index bef947ae80dd4c32173932e3b08c2ae7f2910309..24c35e3d51d87709311c64e31612315cf5fc1212 100644 (file)
@@ -1,5 +1,5 @@
 # Read-only Global Offset Table
-# Inputs: hardening_features deps
+# Inputs: hardening_features
 
 ld_help = run_command(cxx, '-Wl,-help', '2>&1', check: true).stdout().strip()
 variants = ['relro', 'now']
@@ -7,8 +7,7 @@ found_variant = false
 foreach variant: variants
   if ld_help.contains('-z ' + variant)
     found_variant = true
-    dep_relro = declare_dependency(link_args: ['-Wl,-z', '-Wl,' + variant])
-    deps += dep_relro
+    add_global_link_arguments('-Wl,-z', '-Wl,' + variant, language: ['cpp'])
   endif
 endforeach
 
index 1f0ffd2ea7cf7f5caf98aff3249d3aa02478a084..ceab528da14a1f8aa41a53281745663d501f93fb 100644 (file)
@@ -23,11 +23,10 @@ else
   foreach variant: pie_variants
     cflags = variant[0]
     ldflags = variant[1]
-    dep_pie = declare_dependency(compile_args: cflags, link_args: ldflags)
 
-    # if cxx.links(prog, dependencies: dep_pie, name: 'compiler can build Position Independent Executables')   # TODO Meson 0.57
     if cxx.links(prog, args: cflags + ldflags, name: 'compiler can build Position Independent Executables')
-      deps += dep_pie
+      add_global_arguments(cflags, language: ['cpp'])
+      add_global_link_arguments(ldflags, language: ['cpp'])
       found_variant = true
       break
     endif
index a6dd8780c6fa79b1fd5a23517a5efb4f9be0a807..90282b7d0872dcb1f938d5957e45bae826c50f7d 100644 (file)
@@ -1,11 +1,10 @@
 # Stack Protector
-# Inputs: hardening_features deps
+# Inputs: hardening_features
 
 support_stack_protector = cxx.has_argument('-fstack-protector')
 
 if support_stack_protector
-  dep_sp = declare_dependency(compile_args: ['-fstack-protector'])
-  deps += dep_sp
+  add_global_arguments('-fstack-protector', language: ['cpp'])
 endif
 
 hardening_features += [[support_stack_protector, 'Stack Protector']]
index cac77210b5c1700ced16df3c6e338d376c9433f4..e0440bc958a9df8e1aaf711439ddce34daaedcf6 100644 (file)
@@ -3,7 +3,7 @@
 
 support_stack_smashing_protector = cxx.has_argument('--param=ssp-buffer-size=4')
 if support_stack_smashing_protector
-  add_global_arguments(['--param=ssp-buffer-size=4'], language: ['c', 'cpp'])
+  add_global_arguments('--param=ssp-buffer-size=4', language: ['cpp'])
 endif
 
 hardening_features += [[support_stack_smashing_protector, 'Stack Smashing Protection']]
index 618a132a0b0d08e6db67703ccc65183e8ce7a5a0..91d97aaed3e27955207c213a7002c8b90eefbf78 100644 (file)
@@ -123,11 +123,11 @@ has = cxx.has_header_symbol('openssl/kdf.h', 'EVP_PKEY_CTX_set1_scrypt_salt', ar
 conf.set10('HAVE_EVP_PKEY_CTX_SET1_SCRYPT_SALT', has, description: 'Whether we have EVP_PKEY_CTX_set1_scrypt_salt')
 
 if libdir != ''
-  add_global_arguments(libcrypto_args + ['-I' + libdir / 'include'])
-else
-  deps += dep_libcrypto
+  dep_libcrypto = declare_dependency(compile_args: libcrypto_args + ['-I' + libdir / 'include'])
 endif
 
+deps += dep_libcrypto
+
 conf.set10('HAVE_LIBCRYPTO', have_libcrypto, description: 'Whether we build OpenSSL libcrypto-based signers')
 summary('OpenSSL libcrypto', have_libcrypto, bool_yn: true, section: 'Configuration')
 
index a52054f6d2b74a503b0bda96da8e479ac7078335..2e6c02e4410d9d9590812f31210653bad7d613ba 100644 (file)
@@ -24,7 +24,7 @@ if not opt_libdecaf.disabled()
         message('Libdecaf: Checking for ' + header_path)
         found_header = cxx.has_header(header, dependencies: dep_libdecaf, required: false, include_directories: dir)
         if found_header
-          add_global_arguments('-I' + dirname, language: 'cpp')
+          deps += declare_dependency(compile_args: ['-I' + dirname])
           do_break = true
           break
         endif
index ee64b6058358be383017c9dd386d281033d4e8d5..cff51b7a4096ab3679bd84cb63c16693d91d45cc 100644 (file)
@@ -28,8 +28,7 @@ foreach platform: platforms
     endforeach
 
     foreach arg: args
-      dep = declare_dependency(compile_args: ['-D' + arg])
-      deps += dep
+      add_global_arguments('-D' + arg, language: ['cpp'])
     endforeach
 
     foreach lib: libs
index 2cb3ec56a2d5db77a167c473dbd829c59da0d292..bf3d30a7d6b65f1bd7ce2240525516dee2a058ce 100644 (file)
@@ -55,6 +55,6 @@ conf.set10('HAVE_FIBER_SANITIZER', single_pointer or three_pointers, description
 conf.set10('HAVE_SANITIZER_FINISH_SWITCH_FIBER_SINGLE_PTR', single_pointer, description: 'Address Sanitizer: __sanitizer_finish_switch_fiber takes only a pointer')
 conf.set10('HAVE_SANITIZER_FINISH_SWITCH_FIBER_THREE_PTRS', three_pointers, description: 'Address Sanitizer: __sanitizer_finish_switch_fiber takes three pointers')
 
-add_global_arguments('-fsanitize=address')
+add_global_arguments('-fsanitize=address', language: ['cpp'])
 
 summary('address', opt_address_sanitizer, bool_yn: true, section: 'Sanitizers')
index 0d6f7d2998c9d0e763bc22b1a0220bd79289eccf..3850783e427cdac75038efce21d429968d35fe63 100644 (file)
@@ -21,7 +21,7 @@ foreach sanitizer, name: sanitizers
   if not cxx.has_argument(compiler_opt)
     error(name + ' Sanitizer requested but compiler does not support `' + compiler_opt + '`')
   endif
-  add_global_arguments(compiler_opt)
+  add_global_arguments(compiler_opt, language: ['cpp'])
   summary(name, get_variable(opt_name), bool_yn: true, section: 'Sanitizers')
 endforeach
 
@@ -42,5 +42,5 @@ if opt_memory_sanitizer and opt_thread_sanitizer
 endif
 
 if opt_address_sanitizer or opt_thread_sanitizer or opt_leak_sanitizer or opt_undefined_behavior_sanitizer or opt_memory_sanitizer
-  add_global_arguments('-fno-omit-frame-pointer')
+  add_global_arguments('-fno-omit-frame-pointer', language: ['cpp'])
 endif