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