0009-build-Fix-DESTDIR-handling.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. From d4ec369c6457cca55db5297701ddd5d9d3ff5ae0 Mon Sep 17 00:00:00 2001
  2. From: Guillem Jover <guillem@hadrons.org>
  3. Date: Sun, 12 Apr 2020 03:58:12 +0200
  4. Subject: [PATCH libaio 09/11] build: Fix DESTDIR handling
  5. The convention for DESTDIR is that it is only prefixed during the
  6. install target. In this case we postpone that to the inner Makefile
  7. so that it can be invoked directly while preserving the expected
  8. semantics.
  9. Signed-off-by: Guillem Jover <guillem@hadrons.org>
  10. ---
  11. Makefile | 8 +++++++-
  12. src/Makefile | 11 ++++++-----
  13. 2 files changed, 13 insertions(+), 6 deletions(-)
  14. diff --git a/Makefile b/Makefile
  15. index c1fb831..e48b520 100644
  16. --- a/Makefile
  17. +++ b/Makefile
  18. @@ -4,6 +4,7 @@ VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE))
  19. TAG = $(NAME)-$(VERSION)
  20. RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm")
  21. +DESTDIR=
  22. prefix=/usr
  23. includedir=$(prefix)/include
  24. libdir=$(prefix)/lib
  25. @@ -14,7 +15,12 @@ all:
  26. @$(MAKE) -C src
  27. install:
  28. - @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
  29. + @$(MAKE) -C src install \
  30. + DESTDIR=$(DESTDIR) \
  31. + prefix=$(prefix) \
  32. + includedir=$(includedir) \
  33. + libdir=$(libdir) \
  34. + $(nil)
  35. check:
  36. @$(MAKE) -C harness check
  37. diff --git a/src/Makefile b/src/Makefile
  38. index 37ae219..a53c43c 100644
  39. --- a/src/Makefile
  40. +++ b/src/Makefile
  41. @@ -1,3 +1,4 @@
  42. +DESTDIR=
  43. prefix=/usr
  44. includedir=$(prefix)/include
  45. libdir=$(prefix)/lib
  46. @@ -58,12 +59,12 @@ $(libname): $(libaio_sobjs) libaio.map
  47. $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
  48. install: $(all_targets)
  49. - install -D -m 644 libaio.h $(includedir)/libaio.h
  50. - install -D -m 644 libaio.a $(libdir)/libaio.a
  51. + install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h
  52. + install -D -m 644 libaio.a $(DESTDIR)$(libdir)/libaio.a
  53. ifeq ($(ENABLE_SHARED),1)
  54. - install -D -m 755 $(libname) $(libdir)/$(libname)
  55. - ln -sf $(libname) $(libdir)/$(soname)
  56. - ln -sf $(libname) $(libdir)/libaio.so
  57. + install -D -m 755 $(libname) $(DESTDIR)$(libdir)/$(libname)
  58. + ln -sf $(libname) $(DESTDIR)$(libdir)/$(soname)
  59. + ln -sf $(libname) $(DESTDIR)$(libdir)/libaio.so
  60. endif
  61. $(libaio_objs): libaio.h
  62. --
  63. 2.26.0.292.g33ef6b2f38