From 960b3dbb6b107b75d853a45feed31e928c9dae21 Mon Sep 17 00:00:00 2001 From: Fred Morcos Date: Wed, 16 Aug 2023 00:04:51 +0200 Subject: [PATCH] Meson: Cleanup platform module --- meson.build | 3 ++- meson/platform/meson.build | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/meson.build b/meson.build index 95d1bfcf8b..da6992f3ec 100644 --- a/meson.build +++ b/meson.build @@ -33,12 +33,12 @@ subdir('meson' / 'compiler-setup') # Common compiler setup subdir('meson' / 'summary') # Print a system/project summary subdir('meson' / 'sysconfdir') # Sysconfdir subdir('meson' / 'libdir') # Libdir +subdir('meson' / 'platform') # Platform detection subdir('meson' / 'timet-size') # Check the size of time_t subdir('meson' / 'timet-sign') # Check the sign of time_t subdir('meson' / 'flex') # Find flex and create generator subdir('meson' / 'bison') # Find bison and create generator subdir('meson' / 'ragel') # Find ragel and create generator -subdir('meson' / 'platform') # Platform detection subdir('meson' / 'atomics') # Check atomics support subdir('meson' / 'pthread-headers') # Check pthread headers subdir('meson' / 'pthread-setname') # Pthread setname madness @@ -174,6 +174,7 @@ subdir('ext') deps = [ dep_pdns, + dep_platform, dep_atomic, dep_lua, dep_lua_records, diff --git a/meson/platform/meson.build b/meson/platform/meson.build index a77d4e1848..6b224538bc 100644 --- a/meson/platform/meson.build +++ b/meson/platform/meson.build @@ -1,17 +1,15 @@ -# Platform detection -# Inputs: deps conf system - platforms = [ - ['linux', [['HAVE_LINUX', 'We are on Linux']], [], []], - ['darwin', [['HAVE_DARWIN', 'We are on Darwin/MacOS']], [], ['__APPLE_USE_RFC_3542', '_XOPEN_SOURCE', '_DARWIN_C_SOURCE'], []], - ['openbsd', [['HAVE_OPENBSD', 'We are on OpenBSD']], [], []], - ['freebsd', [['HAVE_FREEBSD', 'We are on FreeBSD']], [], []], - ['sunos', [['HAVE_SOLARIS', 'We are on Solaris/SunOS'], + ['linux', [['HAVE_LINUX', 'On Linux']], [], []], + ['darwin', [['HAVE_DARWIN', 'On Darwin/MacOS']], [], ['__APPLE_USE_RFC_3542', '_XOPEN_SOURCE', '_DARWIN_C_SOURCE'], []], + ['openbsd', [['HAVE_OPENBSD', 'On OpenBSD']], [], []], + ['freebsd', [['HAVE_FREEBSD', 'On FreeBSD']], [], []], + ['sunos', [['HAVE_SOLARIS', 'On Solaris/SunOS'], ['NEED_POSIX_TYPEDEF', 'POSIX typedefs need to be defined'], ['NEED_INET_NTOP_PROTO', 'OS is so broken that it needs an additional prototype']], ['_REENTRANT'], ['posix4']], ] +platform_deps = [] foreach platform: platforms name = platform[0] defines = platform[1] @@ -23,7 +21,7 @@ foreach platform: platforms foreach define: defines define_name = define[0] define_desc = define[1] - conf.set10(define_name, true, description: define_desc) + conf.set(define_name, true, description: define_desc) platform_defines += define[0] endforeach @@ -32,11 +30,15 @@ foreach platform: platforms endforeach foreach lib: libs - deps += cxx.find_library(lib, required: true) + platform_deps += cxx.find_library(lib, required: true) endforeach - summary('Defines', ' '.join(platform_defines), section: 'System') + summary('Platform Defines', platform_defines, section: 'System') break endif endforeach + +dep_platform = declare_dependency( + dependencies: platform_deps, +) -- 2.47.2