0002-install-don-t-use-ln-relative.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From ecf3b9baaebda1d9182c22dc504e32ed275d4abb Mon Sep 17 00:00:00 2001
  2. From: Adam Duskett <Adamduskett@outlook.com>
  3. Date: Sun, 31 Dec 2017 12:46:04 -0500
  4. Subject: [PATCH] install: don't use ln --relative
  5. Oldish enterprise-class distributions have too old versions of
  6. coreutils, with ln not supporting --relative.
  7. So we fake it.
  8. ln --relative would create minimalist relative paths, but they are not
  9. trivial to generate. Instead, we always create paths relative to the
  10. root, i.e.:
  11. ln -s --relative /usr/bin/foo /usr/sbin/foo
  12. would create: /usr/sbin/foo -> ../bin/foo
  13. while we do : /usr/sbin/foo -> ../../usr/bin/foo
  14. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  15. [aduskett@gmail.com: Added meson.build section and dirname wrapper in add-wants]
  16. Signed-off-by: Adam Duskett <Adamduskett@outlook.com>
  17. ---
  18. meson.build | 2 +-
  19. tools/meson-make-symlink.sh | 3 ++-
  20. units/meson-add-wants.sh | 5 +++--
  21. 3 files changed, 6 insertions(+), 4 deletions(-)
  22. diff --git a/meson.build b/meson.build
  23. index ddc061c..614201a 100644
  24. --- a/meson.build
  25. +++ b/meson.build
  26. @@ -531,7 +531,7 @@ foreach prog : progs
  27. endforeach
  28. if run_command('ln', '--relative', '--help').returncode() != 0
  29. - error('ln does not support --relative')
  30. + message('ln does not support --relative')
  31. endif
  32. ############################################################
  33. diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh
  34. index 47a5e70..e9002ad 100755
  35. --- a/tools/meson-make-symlink.sh
  36. +++ b/tools/meson-make-symlink.sh
  37. @@ -7,5 +7,6 @@ mkdir -vp "$(dirname "${DESTDIR:-}$2")"
  38. if [ "$(dirname $1)" = . ]; then
  39. ln -vfs -T "$1" "${DESTDIR:-}$2"
  40. else
  41. - ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
  42. + dds="$( dirname "$2" |sed -r -e 's:/+[^/]+:../:g; s:/$::' )"
  43. + ln -vfs -T "${dds}$1" "${DESTDIR:-}$2"
  44. fi
  45. diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh
  46. index dfd287e..8c08283 100755
  47. --- a/units/meson-add-wants.sh
  48. +++ b/units/meson-add-wants.sh
  49. @@ -13,7 +13,7 @@ case "$target" in
  50. ;;
  51. esac
  52. -unitpath="${DESTDIR:-}${unitdir}/${unit}"
  53. +unitpath="${unitdir}/${unit}"
  54. case "$target" in
  55. */)
  56. @@ -24,4 +24,5 @@ case "$target" in
  57. ;;
  58. esac
  59. -ln -vfs --relative "$unitpath" "$dir"
  60. +dds="$( dirname `printf "%s" "${dir#${DESTDIR:-}}" |sed -r -e 's:/+[^/]+:../:g; s:/$::'` )"
  61. +ln -vfs "$dds$unitpath" "$dir"
  62. --
  63. 2.14.3