Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2018-10-28 02:42:53 -0400
committerDave Reisner <dreisner@archlinux.org>2018-11-02 03:16:34 -0400
commitd230ec6f17a2b64ed61936013234414c74e7c29f (patch)
tree397a8d6cba41ee56722309fdeed540e269d2ece5 /scripts
parent51db84750ece4de58923d4ce43cb0638ef150f5f (diff)
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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/meson.build33
1 files changed, 29 insertions, 4 deletions
diff --git a/scripts/meson.build b/scripts/meson.build
index 1fe3fb78..535eccba 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -24,14 +24,39 @@ m4_edit = generator(
capture : true)
foreach script : scripts
- custom_target(
+ 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(
script,
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.
+ custom_target(
+ 'wrap_@0@'.format(script_shortname),
+ input : join_paths(meson.source_root(), 'build-aux', 'script-wrapper.sh.in'),
+ output : script_shortname,
+ build_by_default : true,
+ command : [
+ SED,
+ '-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()),
+ '@INPUT@',
+ ],
+ capture : true)
+
+ # Install the real script
+ meson.add_install_script(MESON_INSTALL_SCRIPT,
+ internal_script.full_path(),
+ join_paths(BINDIR, script_shortname))
endforeach
foreach symlink : ['repo-remove', 'repo-elephant']