From 0627e392dcdf333a916ee144277be68289685e56 Mon Sep 17 00:00:00 2001 From: ZUO Zhihua Date: Thu, 6 Jul 2023 20:45:16 +0800 Subject: [PATCH] meson: use install_subdir --- config/install-mod.py | 30 ------------------------------ meson.build | 21 ++++++++++++++++++--- 2 files changed, 18 insertions(+), 33 deletions(-) delete mode 100644 config/install-mod.py diff --git a/config/install-mod.py b/config/install-mod.py deleted file mode 100644 index f638c48..0000000 --- a/config/install-mod.py +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python - -from os import environ, listdir, makedirs -from os.path import join, isdir, exists -from sys import argv -from shutil import copy - -build_dir = environ["MESON_BUILD_ROOT"] -if "MESON_INSTALL_DESTDIR_PREFIX" in environ: - install_dir = environ["MESON_INSTALL_DESTDIR_PREFIX"] -else: - install_dir = environ["MESON_INSTALL_PREFIX"] - -include_dir = argv[1] if len(argv) > 1 else "include" -module_dir = join(install_dir, include_dir) - -modules = [] -for d in listdir(build_dir): - bd = join(build_dir, d) - if isdir(bd): - for f in listdir(bd): - if f.endswith(".mod"): - modules.append(join(bd, f)) - -if not exists(module_dir): - makedirs(module_dir) - -for mod in modules: - print("Installing", mod, "to", module_dir) - copy(mod, module_dir) diff --git a/meson.build b/meson.build index cdeece5..a061b44 100644 --- a/meson.build +++ b/meson.build @@ -54,9 +54,24 @@ if get_option('api') endif module_id = meson.project_name() -meson.add_install_script( - find_program(files('config'/'install-mod.py')), - get_option('includedir') / module_id, +if host_machine.system() == 'windows' + symbols_file = 'lib'+module_id+'.dll.symbols' + obj_suffix = '.obj' +else + symbols_file = 'lib'+module_id+'.so.symbols' + obj_suffix = '.o' +endif +install_subdir(minpack_lib.full_path()+'.p', + install_dir: 'include'/module_id, + strip_directory: true, + exclude_files: [ + 'depscan.dd', + module_id+'-deps.json', + symbols_file, + module_id+'.dat', + 'src_minpack.f90'+obj_suffix, + 'src_minpack_capi.f90'+obj_suffix, + ], ) pkg = import('pkgconfig')