diff --git a/meson.build b/meson.build index 069e1b4..66f0097 100644 --- a/meson.build +++ b/meson.build @@ -19,12 +19,13 @@ project( # Check just in case downstream decides to edit the source # and add a project version version = meson.project_version() -python = import('python').find_installation('python3') +python3 = find_program('python3') if version == 'undefined' # Meson doesn't have regular expressions, but since it is implemented # in python we can be sure we can use it to parse the file manually version = run_command( - python, '-c', 'import re; raw_version = re.search("User\-Agent.*cpp\-httplib/([0-9]+\.?)+", open("httplib.h").read()).group(0); print(re.search("([0-9]+\\.?)+", raw_version).group(0))' + python3, '-c', 'import re; raw_version = re.search("User\-Agent.*cpp\-httplib/([0-9]+\.?)+", open("httplib.h").read()).group(0); print(re.search("([0-9]+\\.?)+", raw_version).group(0))', + check: true ).stdout().strip() endif @@ -68,7 +69,7 @@ if get_option('cpp-httplib_compile') 'split', input: 'httplib.h', output: ['httplib.cc', 'httplib.h'], - command: [python, files('split.py'), '--out', meson.current_build_dir()], + command: [python3, files('split.py'), '--out', meson.current_build_dir()], install: true, install_dir: [false, get_option('includedir')] ) @@ -92,6 +93,14 @@ if get_option('cpp-httplib_compile') else install_headers('httplib.h') cpp_httplib_dep = declare_dependency(compile_args: args, dependencies: deps, include_directories: include_directories('.')) + + import('pkgconfig').generate( + name: 'cpp-httplib', + description: 'A C++ HTTP/HTTPS server and client library', + install_dir: join_paths(get_option('datadir'), 'pkgconfig'), + url: 'https://github.com/yhirose/cpp-httplib', + version: version + ) endif if meson.version().version_compare('>=0.54.0') diff --git a/meson_options.txt b/meson_options.txt index 0a14d2d..6f6d924 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,5 +5,5 @@ option('cpp-httplib_openssl', type: 'feature', value: 'auto', description: 'Enable OpenSSL support') option('cpp-httplib_zlib', type: 'feature', value: 'auto', description: 'Enable zlib support') option('cpp-httplib_brotli', type: 'feature', value: 'auto', description: 'Enable Brotli support') -option('cpp-httplib_compile', type: 'boolean', value: false, description: 'Split the header into a compilable header & source file (requires Python 3)') +option('cpp-httplib_compile', type: 'boolean', value: false, description: 'Split the header into a compilable header & source file') option('cpp-httplib_test', type: 'boolean', value: false, description: 'Build tests')