diff --git a/cpp/meson.build b/cpp/meson.build index 8e781c9ca6d42..078cabb025936 100644 --- a/cpp/meson.build +++ b/cpp/meson.build @@ -48,12 +48,12 @@ add_project_arguments(cpp_args, language: 'cpp') git_id = get_option('git_id') if git_id == '' - git_id = run_command('git', 'log', '-n1', '--format=%H').stdout().strip() + git_id = run_command('git', 'log', '-n1', '--format=%H', check: true).stdout().strip() endif git_description = get_option('git_description') if git_description == '' - git_description = run_command('git', 'describe', '--tags').stdout().strip() + git_description = run_command('git', 'describe', '--tags', check: true).stdout().strip() endif subdir('src/arrow') diff --git a/cpp/src/arrow/meson.build b/cpp/src/arrow/meson.build index c9f84e1168f60..c691540c6a42e 100644 --- a/cpp/src/arrow/meson.build +++ b/cpp/src/arrow/meson.build @@ -247,8 +247,87 @@ arrow_lib = library( sources: [arrow_srcs], objects: objlibs, include_directories: [include_dir], + install: true, # compute/expression.cc may have undefined IPC symbols in non-IPC builds override_options: {'b_lundef': 'false'}, ) +# Meson does not allow you to glob for headers to install. See also +# https://mesonbuild.com/FAQ.html#why-cant-i-specify-target-files-with-a-wildcard +# install_subdir would be usable if the directory only contained headers +install_headers( + [ + 'api.h', + 'array.h', + 'buffer_builder.h', + 'buffer.h', + 'builder.h', + 'chunked_array.h', + 'chunk_resolver.h', + 'compare.h', + 'config.h', + 'datum.h', + 'device_allocation_type_set.h', + 'device.h', + 'extension_type.h', + 'memory_pool.h', + 'memory_pool_test.h', + 'pch.h', + 'pretty_print.h', + 'record_batch.h', + 'result.h', + 'scalar.h', + 'sparse_tensor.h', + 'status.h', + 'stl_allocator.h', + 'stl.h', + 'stl_iterator.h', + 'table_builder.h', + 'table.h', + 'tensor.h', + 'type_fwd.h', + 'type.h', + 'type_traits.h', + 'visit_array_inline.h', + 'visit_data_inline.h', + 'visitor_generate.h', + 'visitor.h', + 'visit_scalar_inline.h', + 'visit_type_inline.h', + ], + install_dir: 'arrow', +) + +version = meson.project_version() +# Remove any pre-release / build identifiers +version_no_pre_release = version.split('-')[0] +version_no_build = version_no_pre_release.split('+')[0] +components = version_no_build.split('.') +assert( + components.length() >= 3, + 'The version does not contain major, minor and patch', +) +ver_major = components[0] +ver_minor = components[1] +ver_patch = components[2] + +arrow_version = ver_major.to_int() * 1000 + ver_minor.to_int() * 1000 + ver_patch.to_int() +arrow_so_version = (ver_major.to_int() * 100 + ver_minor.to_int()).to_string() +arrow_full_so_version = '@0@.@1@.@2@'.format(arrow_so_version, ver_patch, 0) + +# TODO: The Meson generated .pc file does not include the Apache license +# header that the CMake arrow.pc includes +pkg = import('pkgconfig') +pkg.generate( + arrow_lib, + filebase: 'arrow', + name: 'Apache Arrow', + description: 'Arrow is a set of technologies that enable big-data systems to process and move data fast.', + variables: { + 'so_version': arrow_so_version, + 'abi_version': arrow_so_version, + 'full_so_version': arrow_full_so_version, + }, +) + subdir('util') diff --git a/cpp/src/arrow/util/meson.build b/cpp/src/arrow/util/meson.build index bbf87cfc3aeaa..28c400feda7e6 100644 --- a/cpp/src/arrow/util/meson.build +++ b/cpp/src/arrow/util/meson.build @@ -15,37 +15,16 @@ # specific language governing permissions and limitations # under the License. -# arrow_install_all_headers - conf_data = configuration_data() -version = meson.project_version() -# Remove any pre-release / build identifiers -version_no_pre_release = version.split('-')[0] -version_no_build = version_no_pre_release.split('+')[0] -components = version_no_build.split('.') -assert( - components.length() >= 3, - 'The version does not contain major, minor and patch', -) -ver_major = components[0] -ver_minor = components[1] -ver_patch = components[2] conf_data.set('ARROW_VERSION_MAJOR', ver_major) conf_data.set('ARROW_VERSION_MINOR', ver_minor) conf_data.set('ARROW_VERSION_PATCH', ver_patch) -# TODO: While the CMake configuration substitutes the @ARROW_VERSION@ -# macro directly in the configuration file, the Meson wrapper to the -# CMake configuration file seems to still want to include that -# variable as part of the configuration data -arrow_version = ver_major.to_int() * 1000 + ver_minor.to_int() * 1000 + ver_patch.to_int() conf_data.set('ARROW_VERSION', arrow_version) conf_data.set('ARROW_VERSION_STRING', arrow_version) -arrow_so_version = ver_major.to_int() * 100 + ver_minor.to_int() conf_data.set('ARROW_SO_VERSION', arrow_so_version) -arrow_full_so_version = '@0@.@1@.@2@'.format(arrow_so_version, ver_patch, 0) conf_data.set('ARROW_FULL_SO_VERSION', arrow_full_so_version) # TODO: we may want to give Meson its own configuration file rather @@ -106,7 +85,7 @@ configure_file( configuration: conf_data, format: 'cmake@', install: true, - install_dir: '.', + install_dir: 'arrow', ) internal_conf_data = configuration_data() @@ -120,5 +99,5 @@ configure_file( configuration: internal_conf_data, format: 'cmake@', install: true, - install_dir: '.', + install_dir: 'arrow', )