2018-11-03 19:58:31 -04:00
|
|
|
wrapped_scripts = [
|
2018-07-07 10:29:48 -04:00
|
|
|
'makepkg.sh.in',
|
|
|
|
'pacman-db-upgrade.sh.in',
|
|
|
|
'pacman-key.sh.in',
|
|
|
|
'repo-add.sh.in'
|
|
|
|
]
|
|
|
|
|
2018-11-03 19:58:31 -04:00
|
|
|
scripts = [
|
|
|
|
'makepkg-template.pl.in',
|
|
|
|
]
|
|
|
|
|
2018-07-07 10:29:48 -04:00
|
|
|
SCRIPT_EDITOR = find_program(configure_file(
|
|
|
|
input : join_paths(meson.source_root(), 'build-aux/edit-script.sh.in'),
|
|
|
|
output : 'edit-script.sh',
|
|
|
|
configuration : substs))
|
|
|
|
|
|
|
|
m4_edit = generator(
|
|
|
|
M4,
|
|
|
|
arguments : ['-P', '-I', meson.current_source_dir(), '@INPUT@'],
|
|
|
|
output : '@PLAINNAME@',
|
|
|
|
capture : true)
|
|
|
|
|
|
|
|
foreach script : scripts
|
2018-10-28 02:42:53 -04:00
|
|
|
script_shortname = script.split('.')[0]
|
|
|
|
|
2018-11-03 19:58:31 -04:00
|
|
|
custom_target(
|
|
|
|
script,
|
|
|
|
input : m4_edit.process(script),
|
|
|
|
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@', '0755'],
|
|
|
|
output : script_shortname,
|
|
|
|
install : true,
|
|
|
|
install_dir : get_option('bindir'))
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
foreach script : wrapped_scripts
|
|
|
|
script_shortname = script.split('.')[0]
|
|
|
|
|
2018-10-28 02:42:53 -04:00
|
|
|
# Build the script, but don't install it. We want to keep it as a "private"
|
|
|
|
# artifact that we reference from a wrapper script in order to bootstrap it
|
|
|
|
# the build directory.
|
|
|
|
internal_script = custom_target(
|
2018-07-07 10:29:48 -04:00
|
|
|
script,
|
|
|
|
input : m4_edit.process(script),
|
|
|
|
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@', '0755'],
|
2018-10-28 02:42:53 -04:00
|
|
|
output : script,
|
|
|
|
build_by_default : true)
|
|
|
|
|
2018-11-13 23:17:02 -05:00
|
|
|
cdata = configuration_data()
|
|
|
|
cdata.set_quoted('BASH', BASH.path())
|
|
|
|
cdata.set_quoted('BUILDDIR', meson.current_build_dir())
|
|
|
|
cdata.set_quoted('REAL_PROGPATH', internal_script.full_path())
|
|
|
|
|
2018-10-28 02:42:53 -04:00
|
|
|
# Create a wrapper script that bootstraps the real script within the build
|
2018-11-13 23:17:02 -05:00
|
|
|
# directory. Use configure_file instead of a custom_target to ensure that
|
|
|
|
# permissions on the input script wrapper are preserved.
|
|
|
|
configure_file(
|
2018-10-28 02:42:53 -04:00
|
|
|
input : join_paths(meson.source_root(), 'build-aux', 'script-wrapper.sh.in'),
|
|
|
|
output : script_shortname,
|
2018-11-13 23:17:02 -05:00
|
|
|
configuration : cdata)
|
2018-10-28 02:42:53 -04:00
|
|
|
|
|
|
|
# Install the real script
|
|
|
|
meson.add_install_script(MESON_INSTALL_SCRIPT,
|
|
|
|
internal_script.full_path(),
|
|
|
|
join_paths(BINDIR, script_shortname))
|
2018-07-07 10:29:48 -04:00
|
|
|
endforeach
|
|
|
|
|
|
|
|
foreach symlink : ['repo-remove', 'repo-elephant']
|
|
|
|
meson.add_install_script(MESON_MAKE_SYMLINK,
|
|
|
|
'repo-add',
|
|
|
|
join_paths(BINDIR, symlink))
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
subdir('libmakepkg')
|
|
|
|
|
2019-05-07 21:55:03 -04:00
|
|
|
configure_file(
|
|
|
|
configuration : { 'libmakepkgdir': LIBMAKEPKGDIR, 'PACKAGE_VERSION': PACKAGE_VERSION },
|
|
|
|
input : 'libmakepkg.pc.in',
|
|
|
|
output : '@BASENAME@',
|
|
|
|
install_dir : join_paths(DATAROOTDIR, 'pkgconfig'))
|
|
|
|
|
2018-07-07 10:29:48 -04:00
|
|
|
custom_target(
|
|
|
|
'bash_completion',
|
|
|
|
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
|
|
|
input : 'completion/bash_completion.in',
|
|
|
|
output : 'pacman',
|
|
|
|
install : true,
|
|
|
|
install_dir : BASHCOMPDIR)
|
|
|
|
|
|
|
|
foreach symlink : ['pacman-key', 'makepkg']
|
|
|
|
meson.add_install_script(MESON_MAKE_SYMLINK,
|
|
|
|
'pacman',
|
|
|
|
join_paths(BASHCOMPDIR, symlink))
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
zsh_completion_dir = join_paths(DATAROOTDIR, 'zsh/site-functions')
|
|
|
|
custom_target(
|
|
|
|
'zsh_completion',
|
|
|
|
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
|
|
|
input : 'completion/zsh_completion.in',
|
|
|
|
output : '_pacman',
|
|
|
|
install : true,
|
|
|
|
install_dir : zsh_completion_dir)
|