Commit d230ec6f authored by Dave Reisner's avatar Dave Reisner
Browse files

meson: add a wrapper to bootstrap scripts from within build dir

This doesn't do quite as good of a job of "hiding away" the real script
as we did with autotools, but it satisfies the need for being able to
run scripts which depend on libmakepkg with the local copy within the
repo. We do, however, improve upon the autotools script by ensuring that
the bash path used in configuring pacman is the interpreter used to run
the underlying script.
parent 51db8475
install -Dm755 "$built_script" "$DESTDIR/$dest_path"
# This script serves as a trampoline for running scripts which depend on
# libmakepkg with the libmakepkg within the build tree.
LIBRARY=@BUILDDIR@/libmakepkg exec @BASH@ -$- @REAL_PROGPATH@ "$@"
......@@ -33,6 +33,7 @@ SED = find_program('sed')
DU = find_program('du')
LDCONFIG = get_option('ldconfig')
MESON_MAKE_SYMLINK = join_paths(meson.source_root(), 'build-aux/')
MESON_INSTALL_SCRIPT = join_paths(meson.source_root(), 'build-aux/')
BASH = find_program('bash4', 'bash')
if BASH.found()
......@@ -24,14 +24,39 @@ m4_edit = generator(
capture : true)
foreach script : scripts
script_shortname = script.split('.')[0]
# 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(
input : m4_edit.process(script),
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@', '0755'],
output : script.split('.')[0],
output : script,
depend_files : library_files,
install : true,
install_dir : get_option('bindir'))
build_by_default : true)
# Create a wrapper script that bootstraps the real script within the build
# directory.
input : join_paths(meson.source_root(), 'build-aux', ''),
output : script_shortname,
build_by_default : true,
command : [
'-e', 's,@BASH@,"@0@",'.format(BASH.path()),
'-e', 's,@BUILDDIR@,"@0@",'.format(meson.current_build_dir()),
'-e', 's,@REAL_PROGPATH@,"@0@",'.format(internal_script.full_path()),
capture : true)
# Install the real script
join_paths(BINDIR, script_shortname))
foreach symlink : ['repo-remove', 'repo-elephant']
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment