meson: Respect MESON_INSTALL_QUIET

MESON_INSTALL_QUIET is set when --quiet is passed to meson install.
Make sure we check the variable in our custom install scripts and
don't output anything if it is set.
This commit is contained in:
Daan De Meyer 2020-12-06 18:16:59 +00:00
parent 5e577e1737
commit 09422f9a28
2 changed files with 18 additions and 6 deletions

View File

@ -1,12 +1,18 @@
#!/bin/sh #!/bin/sh
set -eu set -eu
if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then
VERBOSE=""
else
VERBOSE="v"
fi
# this is needed mostly because $DESTDIR is provided as a variable, # this is needed mostly because $DESTDIR is provided as a variable,
# and we need to create the target directory... # and we need to create the target directory...
mkdir -vp "$(dirname "${DESTDIR:-}$2")" mkdir -${VERBOSE}p "$(dirname "${DESTDIR:-}$2")"
if [ "$(dirname $1)" = . -o "$(dirname $1)" = .. ]; then if [ "$(dirname $1)" = . -o "$(dirname $1)" = .. ]; then
ln -vfs -T -- "$1" "${DESTDIR:-}$2" ln -${VERBOSE}fs -T -- "$1" "${DESTDIR:-}$2"
else else
ln -vfs -T --relative -- "${DESTDIR:-}$1" "${DESTDIR:-}$2" ln -${VERBOSE}fs -T --relative -- "${DESTDIR:-}$1" "${DESTDIR:-}$2"
fi fi

View File

@ -5,6 +5,12 @@ unitdir="$1"
target="$2" target="$2"
unit="$3" unit="$3"
if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then
VERBOSE=""
else
VERBOSE="v"
fi
case "$target" in case "$target" in
*/?*) # a path, but not just a slash at the end */?*) # a path, but not just a slash at the end
dir="${DESTDIR:-}${target}" dir="${DESTDIR:-}${target}"
@ -18,11 +24,11 @@ unitpath="${DESTDIR:-}${unitdir}/${unit}"
case "$target" in case "$target" in
*/) */)
mkdir -vp -m 0755 "$dir" mkdir -${VERBOSE}p -m 0755 "$dir"
;; ;;
*) *)
mkdir -vp -m 0755 "$(dirname "$dir")" mkdir -${VERBOSE}p -m 0755 "$(dirname "$dir")"
;; ;;
esac esac
ln -vfs --relative "$unitpath" "$dir" ln -${VERBOSE}fs --relative "$unitpath" "$dir"