0001-Allow-building-shared-or-static-library-only.patch 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. From 93005632eca13d8eda409f6e9496fd5dd69e75b0 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Fri, 4 May 2018 18:38:31 +0200
  4. Subject: [PATCH] Allow building shared or static library only
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Patchs retrieved from:
  9. - https://git.buildroot.net/buildroot/tree/package/zmqpp/0001-Allow-building-shared-or-static-library-only.patch
  10. - https://git.buildroot.net/buildroot/tree/package/zmqpp/0002-Install-static-library-for-static-builds.patch
  11. Both patches have been merged in a single one and slightly updated to
  12. keep default behavior of building and installing static library
  13. (BUILD_STATIC is set to yes by default)
  14. [Upstream status: merged (https://github.com/zeromq/zmqpp/pull/218)]
  15. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
  16. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  17. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  18. ---
  19. Makefile | 24 ++++++++++++++++++++----
  20. 1 file changed, 20 insertions(+), 4 deletions(-)
  21. diff --git a/Makefile b/Makefile
  22. index 689acaa..e43054c 100644
  23. --- a/Makefile
  24. +++ b/Makefile
  25. @@ -81,6 +81,9 @@ ifeq ($(UNAME_S),Darwin)
  26. endif
  27. +BUILD_SHARED ?= yes
  28. +BUILD_STATIC ?= yes
  29. +
  30. CONFIG_FLAGS =
  31. ifeq ($(CONFIG),debug)
  32. CONFIG_FLAGS = -g -fno-inline -ftemplate-depth-1000
  33. @@ -95,13 +98,22 @@ ifneq (,$(findstring $(CONFIG),release loadtest))
  34. CONFIG_FLAGS = -O3 -funroll-loops -ffast-math -finline-functions -fomit-frame-pointer -DNO_DEBUG_LOG -DNO_TRACE_LOG -DNDEBUG
  35. endif
  36. -COMMON_FLAGS = -MMD -std=c++11 -pipe -Wall -fPIC \
  37. +COMMON_FLAGS = -MMD -std=c++11 -pipe -Wall \
  38. -DBUILD_ENV=$(CONFIG) \
  39. -DBUILD_DATESTAMP='$(APP_DATESTAMP)' \
  40. -DBUILD_LIBRARY_NAME='"$(LIBRARY_NAME)"' \
  41. -DBUILD_CLIENT_NAME='"$(CLIENT_TARGET)"' \
  42. -I$(SRC_PATH) $(CUSTOM_INCLUDE_PATH)
  43. +ifeq ($(BUILD_SHARED),yes)
  44. +COMMON_FLAGS += -fPIC
  45. +LIBRARY_TARGETS += $(LIBRARY_SHARED)
  46. +endif
  47. +
  48. +ifeq ($(BUILD_STATIC),yes)
  49. +LIBRARY_TARGETS += $(LIBRARY_ARCHIVE)
  50. +endif
  51. +
  52. COMMON_LIBS = -lzmq
  53. LIBRARY_LIBS =
  54. @@ -150,11 +162,15 @@ install:
  55. mkdir -p $(LIBDIR)
  56. mkdir -p $(PKGCONFIGDIR)
  57. install -m 644 $(ALL_LIBRARY_INCLUDES) $(INCLUDEDIR)/$(LIBRARY_DIR)
  58. - install -m 755 $(BUILD_PATH)/$(LIBRARY_VERSION_SHARED) $(LIBDIR)/$(LIBRARY_FULL_VERSION_SHARED)
  59. - install -m 755 $(BUILD_PATH)/$(LIBRARY_ARCHIVE) $(LIBDIR)/$(LIBRARY_ARCHIVE)
  60. install -m 755 $(BUILD_PATH)/$(PKGCONFIG_FILE) $(PKGCONFIGDIR)/$(PKGCONFIG_FILE)
  61. +ifeq ($(BUILD_SHARED),yes)
  62. + install -m 755 $(BUILD_PATH)/$(LIBRARY_VERSION_SHARED) $(LIBDIR)/$(LIBRARY_FULL_VERSION_SHARED)
  63. ln -sf $(LIBRARY_FULL_VERSION_SHARED) $(LIBDIR)/$(LIBRARY_VERSION_SHARED)
  64. ln -sf $(LIBRARY_FULL_VERSION_SHARED) $(LIBDIR)/$(LIBRARY_SHARED)
  65. +endif
  66. +ifeq ($(BUILD_STATIC),yes)
  67. + install -m 755 $(BUILD_PATH)/$(LIBRARY_ARCHIVE) $(LIBDIR)/$(LIBRARY_ARCHIVE)
  68. +endif
  69. if [ -f $(BUILD_PATH)/$(CLIENT_TARGET) ]; then install -m 755 $(BUILD_PATH)/$(CLIENT_TARGET) $(BINDIR); fi
  70. $(LDCONFIG)
  71. @echo "use make installcheck to test the install"
  72. @@ -176,7 +192,7 @@ clean:
  73. client: $(CLIENT_TARGET)
  74. -library: $(LIBRARY_SHARED) $(LIBRARY_ARCHIVE)
  75. +library: $(LIBRARY_TARGETS)
  76. #
  77. # BUILD Targets
  78. --
  79. 2.14.1