From c7c1eac070851068d7adc3a67ad2efd196145687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 6 Mar 2024 17:48:12 +0100 Subject: [PATCH 1/2] Make xbyak.py installation location arch-independent I was investigating an issue with the Fedora package build: builds on i686 would yield a package with /usr/lib/pkgconfig/xbyak.pc, while builds on amd64 would yield a package with /usr/lib64/pkgconfig/xbyak.pc. xbyak is arch-indepdent, in the sense of the installed payload being identical on all architectures and located in a non-arch-specific directory (/usr/inlude). The .pc file should be arch-independent too. Right now, if we install the package from a different architecture, we would find the files in /usr/include, but not the .pc file. (E.g. on amd64 the pkg-config search path is /usr/lib64/pkgconfig:/usr/share/pkgconfig, so /usr/lib/pkgconfig/xbyak.pc will not be found.) So install the file to $prefix/pkgconfig (usually /usr/share/pkgconfig) so it will be found properly. We need to specify 'includedir' in the variable list for pkgconfig.generate(), because by default meson does not include this variable when dataonly:true is used. The $prefix/include pattern is evaluated in meson, to handle the case where the user specified an include_dir as absolute path. --- meson.build | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 9e824202..9eb6794a 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,8 @@ project( default_options: 'b_ndebug=if-release' ) -install_subdir('xbyak', install_dir: get_option('includedir')) +include_dir = get_option('prefix') / get_option('includedir') +install_subdir('xbyak', install_dir: include_dir) xbyak_dep = declare_dependency(include_directories: include_directories('.')) @@ -22,7 +23,9 @@ import('pkgconfig').generate( name: meson.project_name(), description: 'JIT assembler for x86(IA32), x64(AMD64, x86-64)', version: meson.project_version(), - url: 'https://github.com/herumi/xbyak' + url: 'https://github.com/herumi/xbyak', + variables: ['includedir=@0@'.format(include_dir)], + dataonly: true, ) if meson.version().version_compare('>=0.50.0') From 9f535729159baf467c3bd8dc7ec017a40289a12c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 6 Mar 2024 18:15:57 +0100 Subject: [PATCH 2/2] Install cmake files into an arch-independent directory The justification is similar as for the .pc file: the include directory is arch-independent, so the cmake description should be too. --- meson.build | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 9eb6794a..e5a7c3d0 100644 --- a/meson.build +++ b/meson.build @@ -28,12 +28,14 @@ import('pkgconfig').generate( dataonly: true, ) +shared_cmake_dir = get_option('prefix') / 'share/cmake/xbyak' if meson.version().version_compare('>=0.50.0') cmake = import('cmake') cmake.write_basic_package_version_file( name: meson.project_name(), - version: meson.project_version() + version: meson.project_version(), + install_dir: shared_cmake_dir, ) cmake_conf = configuration_data() @@ -43,6 +45,7 @@ if meson.version().version_compare('>=0.50.0') cmake.configure_package_config_file( name: meson.project_name(), input: 'cmake'/'meson-config.cmake.in', - configuration: cmake_conf + configuration: cmake_conf, + install_dir: shared_cmake_dir, ) endif