From: Fred Morcos Date: Tue, 5 Sep 2023 10:01:49 +0000 (+0200) Subject: Meson: Move mmap, geoip and maxminddb detection to geoipbackend X-Git-Tag: rec-5.1.0-alpha1~80^2~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=309424855751a8b0e12dc4ad6403ba5b4d040710;p=thirdparty%2Fpdns.git Meson: Move mmap, geoip and maxminddb detection to geoipbackend --- diff --git a/meson/geoip/meson.build b/meson-archive/geoip/meson.build similarity index 100% rename from meson/geoip/meson.build rename to meson-archive/geoip/meson.build diff --git a/meson/mmap/meson.build b/meson-archive/mmap/meson.build similarity index 100% rename from meson/mmap/meson.build rename to meson-archive/mmap/meson.build diff --git a/meson.build b/meson.build index 80f926c65a..e5a04f2380 100644 --- a/meson.build +++ b/meson.build @@ -49,7 +49,6 @@ subdir('meson' / 'hardening') # Hardening subdir('meson' / 'kiss-rng') # Unsafe KISS RNG subdir('meson' / 'net-libs') # Network Libraries subdir('meson' / 'tm-gmtoff') # Check for tm_gmtoff field in struct tm -subdir('meson' / 'mmap') # Check for mmap subdir('meson' / 'libsodium') # Libsodium-based signers subdir('meson' / 'libdecaf') # Libdecaf-based signers subdir('meson' / 'libcrypto') # OpenSSL-based signers @@ -132,7 +131,7 @@ all_modules = { 'lua2': {'deps': [], 'exts': []}, 'remote': {'deps': ['prog-curl', 'zeromq'], 'exts': []}, 'tinydns': {'deps': ['cdb'], 'exts': []}, - 'geoip': {'deps': ['geoip'], 'exts': []}, + 'geoip': {'deps': [], 'exts': []}, 'lmdb': {'deps': ['lmdb', 'boost-serialization'], 'exts': ['lmdb-safe']}, } diff --git a/modules/geoipbackend/meson.build b/modules/geoipbackend/meson.build index f480e9e15f..8ff436d88a 100644 --- a/modules/geoipbackend/meson.build +++ b/modules/geoipbackend/meson.build @@ -1,3 +1,38 @@ +# Detect mmap +have_mmap = cxx.has_function('mmap') +mman_h = cxx.has_header('sys/mman.h', required: false) +if not have_mmap + have_mmap = mman_h and cxx.has_function('mmap', prefix: '''#include ''') +endif +conf.set('HAVE_MMAP', have_mmap, description: 'GeoIP Backend: mmap') +summary('Have ', mman_h, bool_yn: true, section: 'GeoIP Backend') +summary('mmap', have_mmap, bool_yn: true, section: 'GeoIP Backend') + +# Detect GeoIP +dep_geoip = dependency('geoip', required: false) +conf.set('HAVE_GEOIP', dep_geoip.found(), description: 'GeoIP Backend: GeoIP Library') +summary('GeoIP', dep_geoip.found(), bool_yn: true, section: 'GeoIP Backend') +if dep_geoip.found() + summary('GeoIP Name', dep_geoip.name(), section: 'GeoIP Backend') + summary('GeoIP Version', dep_geoip.version(), section: 'GeoIP Backend') +endif + +# Detect MaxMindDB +dep_mmdb = dependency('libmaxminddb', required: false) +conf.set('HAVE_MMDB', dep_mmdb.found(), description: 'GeoIP Backend: MaxMindDB Library') +summary('MaxMindDB', dep_mmdb.found(), bool_yn: true, section: 'GeoIP Backend') +if dep_mmdb.found() + summary('MaxMindDB Name', dep_mmdb.name(), section: 'GeoIP Backend') + summary('MaxMindDB Version', dep_mmdb.version(), section: 'GeoIP Backend') +endif + +# Detect YAML-cpp +dep_yaml_cpp = dependency('yaml-cpp', version: '>= 0.5', required: true) +summary('YAML-CPP', dep_yaml_cpp.found(), bool_yn: true, section: 'GeoIP Backend') +summary('YAML-CPP Name', dep_yaml_cpp.name(), section: 'GeoIP Backend') +summary('YAML-CPP Version', dep_yaml_cpp.version(), section: 'GeoIP Backend') + +# Build the backend sources = [ 'geoipbackend.cc', 'geoipinterface-dat.cc', @@ -10,7 +45,7 @@ extras = [ 'geoipinterface.hh', ] -module_deps = [deps, dep_geoip] +module_deps = [deps, dep_geoip, dep_mmdb, dep_yaml_cpp] lib = static_library( module_backend_name,