protobuf.mk 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ################################################################################
  2. #
  3. # protobuf
  4. #
  5. ################################################################################
  6. # When bumping this package, make sure to also verify if the
  7. # python-protobuf package still works and to update its hash,
  8. # as they share the same version/site variables.
  9. PROTOBUF_VERSION = 21.12
  10. PROTOBUF_SOURCE = protobuf-cpp-3.$(PROTOBUF_VERSION).tar.gz
  11. PROTOBUF_SITE = https://github.com/protocolbuffers/protobuf/releases/download/v$(PROTOBUF_VERSION)
  12. PROTOBUF_LICENSE = BSD-3-Clause
  13. PROTOBUF_LICENSE_FILES = LICENSE
  14. PROTOBUF_CPE_ID_VENDOR = google
  15. # N.B. Need to use host protoc during cross compilation.
  16. PROTOBUF_DEPENDENCIES = host-protobuf
  17. PROTOBUF_CONF_OPTS = --with-protoc=$(HOST_DIR)/bin/protoc
  18. PROTOBUF_CXXFLAGS = $(TARGET_CXXFLAGS)
  19. ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
  20. PROTOBUF_CXXFLAGS += -O0
  21. endif
  22. ifeq ($(BR2_or1k),y)
  23. PROTOBUF_CXXFLAGS += -mcmodel=large
  24. endif
  25. PROTOBUF_CONF_ENV = CXXFLAGS="$(PROTOBUF_CXXFLAGS)"
  26. ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
  27. PROTOBUF_CONF_ENV += LIBS=-latomic
  28. endif
  29. PROTOBUF_INSTALL_STAGING = YES
  30. ifeq ($(BR2_PACKAGE_ZLIB),y)
  31. PROTOBUF_DEPENDENCIES += zlib
  32. endif
  33. define PROTOBUF_REMOVE_UNNECESSARY_TARGET_FILES
  34. rm -rf $(TARGET_DIR)/usr/bin/protoc
  35. rm -rf $(TARGET_DIR)/usr/lib/libprotoc.so*
  36. endef
  37. PROTOBUF_POST_INSTALL_TARGET_HOOKS += PROTOBUF_REMOVE_UNNECESSARY_TARGET_FILES
  38. $(eval $(autotools-package))
  39. $(eval $(host-autotools-package))