summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-11-12 07:34:30 +0100
committerAllan McRae <allan@archlinux.org>2019-11-26 01:49:57 +0100
commit49a8e90bc78c17600eb4903ba00be26341df9161 (patch)
tree355273950891ab3af5fac440aa3a7efa38299cae
parent349c22d043290ccd0cce9f30981f5415e295442a (diff)
downloadpacman-49a8e90bc78c17600eb4903ba00be26341df9161.tar.gz
pacman-49a8e90bc78c17600eb4903ba00be26341df9161.tar.xz
meson: make non-symlink scripts install for real, and use a better wrapper
We now generate the scripts using their real name, install them using meson's builtin facility instead of an install_script, and generate the wrapper scripts in the root of the build directory, instead of a subdirectory. This gets us closer to resolving FS#64394. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r--Makefile.am1
-rw-r--r--build-aux/meson-install-script.sh6
-rw-r--r--meson.build16
-rw-r--r--scripts/meson.build38
4 files changed, 32 insertions, 29 deletions
diff --git a/Makefile.am b/Makefile.am
index 9216ef00..fbbc2559 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,6 @@ EXTRA_DIST = \
HACKING test/tap.sh \
meson.build meson_options.txt \
build-aux/edit-script.sh.in \
- build-aux/meson-install-script.sh \
build-aux/meson-make-symlink.sh \
build-aux/script-wrapper.sh.in
diff --git a/build-aux/meson-install-script.sh b/build-aux/meson-install-script.sh
deleted file mode 100644
index f5a42fca..00000000
--- a/build-aux/meson-install-script.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-built_script=$1
-dest_path=$2
-
-install -Dm755 "$built_script" "$DESTDIR/$dest_path"
diff --git a/meson.build b/meson.build
index 2c9185a6..572526b2 100644
--- a/meson.build
+++ b/meson.build
@@ -32,7 +32,6 @@ SED = find_program('sed')
DU = find_program('du')
LDCONFIG = get_option('ldconfig')
MESON_MAKE_SYMLINK = join_paths(meson.source_root(), 'build-aux/meson-make-symlink.sh')
-MESON_INSTALL_SCRIPT = join_paths(meson.source_root(), 'build-aux/meson-install-script.sh')
BASH = find_program('bash4', 'bash')
if BASH.found()
@@ -366,6 +365,21 @@ executable(
install : true,
)
+foreach wrapper : script_wrappers
+ cdata = configuration_data()
+ cdata.set_quoted('BASH', BASH.path())
+ cdata.set_quoted('BUILDDIR', wrapper[2])
+ cdata.set_quoted('REAL_PROGPATH', wrapper[1].full_path())
+
+ # Create a wrapper script that bootstraps the real script within the build
+ # directory. Use configure_file instead of a custom_target to ensure that
+ # permissions on the input script wrapper are preserved.
+ configure_file(
+ input : join_paths(meson.source_root(), 'build-aux', 'script-wrapper.sh.in'),
+ output : wrapper[0],
+ configuration : cdata)
+endforeach
+
configure_file(
input : 'etc/makepkg.conf.in',
output : 'makepkg.conf',
diff --git a/scripts/meson.build b/scripts/meson.build
index 696d8ddd..d2466523 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -26,42 +26,38 @@ foreach script : scripts
install_dir : get_option('bindir'))
endforeach
+script_wrappers = []
foreach script : wrapped_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(
script,
input : script,
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@', '0755'],
- output : script,
- build_by_default : true)
-
- 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())
-
- # Create a wrapper script that bootstraps the real script within the build
- # directory. Use configure_file instead of a custom_target to ensure that
- # permissions on the input script wrapper are preserved.
- configure_file(
- input : join_paths(meson.source_root(), 'build-aux', 'script-wrapper.sh.in'),
output : script_shortname,
- configuration : cdata)
+ install : true,
+ install_dir : BINDIR)
+
+ script_wrappers += [[ script_shortname, internal_script, meson.current_build_dir() ]]
- # Install the real script
- meson.add_install_script(MESON_INSTALL_SCRIPT,
- internal_script.full_path(),
- join_paths(BINDIR, script_shortname))
+ if script_shortname == 'repo-add'
+ repo_add = internal_script
+ endif
endforeach
foreach symlink : ['repo-remove', 'repo-elephant']
meson.add_install_script(MESON_MAKE_SYMLINK,
'repo-add',
join_paths(BINDIR, symlink))
+
+ internal_script = custom_target(
+ symlink,
+ build_by_default : true,
+ command : ['ln', '-sf', 'repo-add', '@OUTPUT@'],
+ depends : repo_add,
+ output : symlink)
+
+ script_wrappers += [[ symlink, internal_script, meson.current_build_dir() ]]
endforeach
subdir('libmakepkg')