util-linux-004-support-static-lib-build.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. Only move shared libraries to /lib if they exists
  2. In several Makemodule.am, there is a install-exec-hook-<library>
  3. target whose role is to move the shared library from /usr/lib to /lib,
  4. while keeping a symbolic link /usr/lib/libuuid.so ->
  5. ../../lib/<library>.so.<version>.
  6. However, when util-linux is built with --enable-static
  7. --disable-shared (as is needed on noMMU platforms that don't support
  8. shared libraries), no <library>.so is built, but the
  9. install-exec-hook-libuuid creates an invalid /usr/lib/<library>.so
  10. symbolic link, pointing to ../../lib (yes, the directory). This causes
  11. troubles later one when other libraries/programs are compiled with
  12. -l<library>, as gcc thinks a shared library is available because
  13. there's a file named /usr/lib/<library>.so.
  14. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  15. Index: b/libuuid/src/Makemodule.am
  16. ===================================================================
  17. --- a/libuuid/src/Makemodule.am
  18. +++ b/libuuid/src/Makemodule.am
  19. @@ -44,7 +44,7 @@
  20. # move lib from $(usrlib_execdir) to $(libdir) if needed
  21. install-exec-hook-libuuid:
  22. - if test "$(usrlib_execdir)" != "$(libdir)"; then \
  23. + if test "$(usrlib_execdir)" != "$(libdir)" -a -f "$(DESTDIR)$(usrlib_execdir)/libuuid.so"; then \
  24. mkdir -p $(DESTDIR)$(libdir); \
  25. mv $(DESTDIR)$(usrlib_execdir)/libuuid.so.* $(DESTDIR)$(libdir); \
  26. so_img_name=$$(readlink $(DESTDIR)$(usrlib_execdir)/libuuid.so); \
  27. Index: b/libmount/src/Makemodule.am
  28. ===================================================================
  29. --- a/libmount/src/Makemodule.am
  30. +++ b/libmount/src/Makemodule.am
  31. @@ -123,7 +123,7 @@
  32. # move lib from $(usrlib_execdir) to $(libdir) if needed
  33. install-exec-hook-libmount:
  34. - if test "$(usrlib_execdir)" != "$(libdir)"; then \
  35. + if test "$(usrlib_execdir)" != "$(libdir)" -a -f "$(DESTDIR)$(usrlib_execdir)/libmount.so"; then \
  36. mkdir -p $(DESTDIR)$(libdir); \
  37. mv $(DESTDIR)$(usrlib_execdir)/libmount.so.* $(DESTDIR)$(libdir); \
  38. so_img_name=$$(readlink $(DESTDIR)$(usrlib_execdir)/libmount.so); \
  39. Index: b/libblkid/src/Makemodule.am
  40. ===================================================================
  41. --- a/libblkid/src/Makemodule.am
  42. +++ b/libblkid/src/Makemodule.am
  43. @@ -220,7 +220,7 @@
  44. # move lib from $(usrlib_execdir) to $(libdir) if needed
  45. install-exec-hook-libblkid:
  46. - if test "$(usrlib_execdir)" != "$(libdir)"; then \
  47. + if test "$(usrlib_execdir)" != "$(libdir)" -a -f "$(DESTDIR)$(usrlib_execdir)/libblkid.so"; then \
  48. mkdir -p $(DESTDIR)$(libdir); \
  49. mv $(DESTDIR)$(usrlib_execdir)/libblkid.so.* $(DESTDIR)$(libdir); \
  50. so_img_name=$$(readlink $(DESTDIR)$(usrlib_execdir)/libblkid.so); \