Protobuf-c: Add modified protobuf-c

master
Mike Kershaw / Dragorn 2022-03-14 11:50:22 -04:00
parent c5441e58f8
commit fe4e1a808c
2 changed files with 108 additions and 0 deletions

68
libs/protobuf-c/Makefile Normal file
View File

@ -0,0 +1,68 @@
#
# Copyright (C) 2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
# Fix building on mips
PKG_USE_MIPS16:=0
PKG_NAME:=libprotobuf-c
PKG_VERSION:=1.3.3
PKG_RELEASE:=2HAK5
PKG_SOURCE:=protobuf-c-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/protobuf-c/protobuf-c/releases/download/v$(PKG_VERSION)
PKG_HASH:=22956606ef50c60de1fabc13a78fbc50830a0447d780467d3c519f84ad527e78
PKG_BUILD_DIR:=$(BUILD_DIR)/protobuf-c-$(PKG_VERSION)
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/protobuf-c-$(PKG_VERSION)
PKG_MAINTAINER:=
PKG_LICENSE:=BSD-2-Clause
PKG_LICENSE_FILES:=LICENSE
HOST_BUILD_DEPENDS:=protobuf/host
PKG_BUILD_DEPENDS:=protobuf
CMAKE_INSTALL:=1
PKG_BUILD_PARALLEL:=1
CMAKE_SOURCE_SUBDIR:=build-cmake
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libprotobuf-c
TITLE:=Protocol Buffers library
SECTION:=libs
CATEGORY:=Libraries
URL:=https://github.com/protobuf-c/protobuf-c
endef
define Package/libprotobuf-c/description
Runtime library to use Google Protocol Buffers from C applications.
Protocol Buffers are a way of encoding structured data in an efficient yet
extensible format. Google uses Protocol Buffers for almost all of its
internal RPC protocols and file formats.
endef
CMAKE_HOST_OPTIONS += \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_CXX_STANDARD=11 \
-DCMAKE_SKIP_RPATH=OFF \
-DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOSTPKG}/lib"
CMAKE_OPTIONS += \
-DBUILD_SHARED_LIBS=ON
define Package/libprotobuf-c/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libprotobuf-c.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libprotobuf-c))
$(eval $(call HostBuild))

View File

@ -0,0 +1,40 @@
--- a/build-cmake/CMakeLists.txt
+++ b/build-cmake/CMakeLists.txt
@@ -1,7 +1,10 @@
SET(PACKAGE protobuf-c)
SET(PACKAGE_NAME protobuf-c)
SET(PACKAGE_VERSION 1.3.3)
+set(PACKAGE_URL https://github.com/protobuf-c/protobuf-c)
+set(PACKAGE_DESCRIPTION "Protocol Buffers implementation in C")
+include(GNUInstallDirs)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
@@ -141,6 +144,9 @@ IF(CMAKE_HOST_UNIX)
INSTALL(CODE "EXECUTE_PROCESS (COMMAND ln -sf protoc-gen-c protoc-c WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)")
ENDIF()
+CONFIGURE_FILE ("libprotobuf-c.pc.in" "libprotobuf-c.pc" @ONLY)
+INSTALL (FILES "../libprotobuf-c.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+
INCLUDE(Dart)
SET(DART_TESTING_TIMEOUT 5)
--- /dev/null
+++ b/build-cmake/libprotobuf-c.pc.in
@@ -0,0 +1,14 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+bindir=${exec_prefix}/@CMAKE_INSTALL_BINDIR@
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: @PACKAGE_NAME@
+Version: @PACKAGE_VERSION@
+Description: @PACKAGE_DESCRIPTION@
+URL: @PACKAGE_URL@
+Requires:
+Libs: -L${libdir} -lprotobuf-c
+Libs.private:
+Cflags: -I${includedir}