build/emscripten: work around mesonbuild/meson#12638
This commit is contained in:
parent
955ab5c411
commit
67bf19ff4a
3 changed files with 75 additions and 1 deletions
|
@ -140,3 +140,6 @@ res_index_install_command = [res_index_install_script, common_taiseilib_args]
|
|||
macos_install_dylibs_script = find_program(files('macos-install-dylibs.py'))
|
||||
# NOTE/FIXME: script doesn't use taiseilib
|
||||
macos_install_dylibs_command = [macos_install_dylibs_script]
|
||||
|
||||
post_install_remove_script = find_program(files('post-install-remove.py'))
|
||||
post_install_remove_command = [post_install_remove_script, common_taiseilib_args]
|
||||
|
|
53
scripts/post-install-remove.py
Executable file
53
scripts/post-install-remove.py
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from taiseilib.common import (
|
||||
add_common_args,
|
||||
run_main,
|
||||
)
|
||||
|
||||
def main(args):
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser(description='Install resources from res-index', prog=args[0])
|
||||
|
||||
parser.add_argument('remove_items',
|
||||
type=Path,
|
||||
help='the files and/or directories to remove (relative to install destdir + prefix)',
|
||||
nargs='*',
|
||||
)
|
||||
|
||||
add_common_args(parser)
|
||||
|
||||
args = parser.parse_args(args[1:])
|
||||
|
||||
install_root = Path(os.environ['MESON_INSTALL_DESTDIR_PREFIX'])
|
||||
quiet = bool(os.environ.get('MESON_INSTALL_QUIET', False))
|
||||
dryrun = bool(os.environ.get('MESON_INSTALL_DRY_RUN', False))
|
||||
|
||||
def log(*s):
|
||||
if not quiet:
|
||||
print(*s)
|
||||
|
||||
for item in args.remove_items:
|
||||
itempath = (install_root / item)
|
||||
|
||||
if dryrun:
|
||||
log(f'Would remove {itempath}')
|
||||
elif itempath.exists():
|
||||
if itempath.is_dir():
|
||||
log(f'Removing directory {itempath}')
|
||||
itempath.rmdir()
|
||||
else:
|
||||
log(f'Removing file {itempath}')
|
||||
itempath.unlink()
|
||||
else:
|
||||
log(f'Skipping non-existent file {itempath}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run_main(main)
|
|
@ -354,13 +354,31 @@ if host_machine.system() == 'emscripten'
|
|||
em_link_outputs += ['@0@.@1@'.format(taisei_basename, suffix)]
|
||||
endforeach
|
||||
|
||||
meson_link_whole_is_broken = meson.version().version_compare('>1.1.0')
|
||||
|
||||
if meson_link_whole_is_broken
|
||||
warning('Installing private static library to work around a Meson bug: https://github.com/mesonbuild/meson/issues/12638')
|
||||
endif
|
||||
|
||||
libtaisei = static_library(taisei_basename, taisei_src, version_deps,
|
||||
dependencies : taisei_deps,
|
||||
c_pch : 'pch/taisei_pch.h',
|
||||
c_args : [em_common_args, taisei_c_args],
|
||||
install : false,
|
||||
install : meson_link_whole_is_broken,
|
||||
install_dir : '.',
|
||||
install_tag : 'trash',
|
||||
# Explicitly give it a predictable name, in case we have to remove it via install script
|
||||
name_prefix : 'lib',
|
||||
name_suffix : 'a',
|
||||
)
|
||||
|
||||
if meson_link_whole_is_broken
|
||||
meson.add_install_script(
|
||||
post_install_remove_command, 'lib' + libtaisei.name() + '.a',
|
||||
install_tag : 'trash',
|
||||
)
|
||||
endif
|
||||
|
||||
taisei = static_library(taisei_basename + '-full',
|
||||
link_whole : libtaisei,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue