1#!/bin/sh
2# SPDX-License-Identifier: LGPL-2.1-or-later
3set -eu
4
5SOURCE="${1:?}"
6TARGET="${2:?}"
7
8if [ "${MESON_INSTALL_QUIET:-0}" = 1 ] ; then
9    VERBOSE=""
10else
11    VERBOSE="v"
12fi
13
14# this is needed mostly because $DESTDIR is provided as a variable,
15# and we need to create the target directory...
16
17mkdir -${VERBOSE}p "$(dirname "${DESTDIR:-}$TARGET")"
18if [ "$(dirname "$SOURCE")" = . ] || [ "$(dirname "$SOURCE")" = .. ]; then
19    ln -${VERBOSE}fs -T -- "$SOURCE" "${DESTDIR:-}$TARGET"
20else
21    ln -${VERBOSE}fs -T --relative -- "${DESTDIR:-}$SOURCE" "${DESTDIR:-}$TARGET"
22fi
23