restructure #3

Merged
wyj merged 82 commits from dev into main 2026-01-18 20:12:27 -05:00
3 changed files with 142 additions and 0 deletions
Showing only changes of commit dc2bf570b4 - Show all commits

View File

@@ -0,0 +1,58 @@
pkgname=protobuf
pkgver=31.1
pkgdesc="Google's Protocol Buffers - Extensible mechanism for serializing structured data"
homepage="https://protobuf.dev/"
license=("BSD")
depends=(abseil-cpp zlib)
_patches=("${pkgname}-30.0-findJsonCpp.patch")
_patch_sums=("e3212111ada7f0a9dba717c70a9257b366a9cb6dfecfbcb67cf76645dcecf653cfb23b99ac394be16fa9c3baa8439be59ef5fa64631f31263da6c82c875665a5")
sources=("${pkgname}-${pkgver}.tar.gz"
"FindJsonCpp.cmake"
"${_patches[@]}"
)
urls=("https://github.com/protocolbuffers/protobuf/releases/download/v${pkgver}/${sources[0]}"
"FindJsonCpp.cmake"
"${_patches[@]}"
)
sha512sums=("5bf730e37183defcb29cf4831128f536ad8bcdce2b2b46b297d95f3de4a037b9ff3b6c57df66a039256dcefd828ba9d43c32b01a7a82aa5c881a9ae12cadb643"
"4a824ac0a73eebf622f999c4a78add515fea92eb44e6a1bc754343567e747f5258ca0d1c600644c67691583779a9cad814a6daf983e666c389fcaa90a2ec0aa6"
"${_patch_sums[@]}"
)
src_prepare() {
tar -xf ${distdir}/${sources[0]} --strip-components=1
for _patch in ${_patches[@]}; do
patch -p1 -i ${filedir}/${_patch}
done
cp "${filedir}/FindJsonCpp.cmake" cmake
}
src_build() {
local cmake_args=(
-D CMAKE_BUILD_TYPE=release
-D CMAKE_INSTALL_PREFIX=/usr
-D protobuf_BUILD_CONFORMANCE=no
-D protobuf_BUILD_LIBPROTOC=yes
-D protobuf_BUILD_LIBUPB=yes
-D protobuf_BUILD_PROTOBUF_BINARIES=yes
-D protobuf_BUILD_PROTOC_BINARIES=yes
-D protobuf_BUILD_SHARED_LIBS="yes"
-D protobuf_BUILD_TESTS=no
-D protobuf_DISABLE_RTTI="no"
-D protobuf_INSTALL="yes"
-D protobuf_TEST_XML_OUTDIR=no
-D protobuf_WITH_ZLIB=yes
-D protobuf_VERBOSE=no
-D CMAKE_MODULE_PATH="cmake"
-D protobuf_LOCAL_DEPENDENCIES_ONLY="yes"
)
cmake -B build "${cmake_args[@]}"
cmake --build build
}
src_install() {
DESTDIR="$pkgdir" cmake --install build
install -vDm644 editors/proto.vim -t "${pkgdir}"/usr/share/vim/vimfiles/syntax
}
# vim:ft=sh syn=sh et sw=2:

View File

@@ -0,0 +1,40 @@
find_path(JsonCpp_INCLUDE_DIR "json/json.h"
PATH_SUFFIXES "jsoncpp"
DOC "jsoncpp include directory")
mark_as_advanced(JsonCpp_INCLUDE_DIR)
find_library(JsonCpp_LIBRARY
NAMES jsoncpp
DOC "jsoncpp library")
mark_as_advanced(JsonCpp_LIBRARY)
if (JsonCpp_INCLUDE_DIR AND EXISTS "${JsonCpp_INCLUDE_DIR}/json/version.h")
file(STRINGS "${JsonCpp_INCLUDE_DIR}/json/version.h" _JsonCpp_version_lines
REGEX "JSONCPP_VERSION_[A-Z]+")
string(REGEX REPLACE ".*# *define +JSONCPP_VERSION_MAJOR +([0-9]+).*" "\\1" _JsonCpp_version_major "${_JsonCpp_version_lines}")
string(REGEX REPLACE ".*# *define +JSONCPP_VERSION_MINOR +([0-9]+).*" "\\1" _JsonCpp_version_minor "${_JsonCpp_version_lines}")
string(REGEX REPLACE ".*# *define +JSONCPP_VERSION_PATCH +([0-9]+).*" "\\1" _JsonCpp_version_patch "${_JsonCpp_version_lines}")
set(JsonCpp_VERSION "${_JsonCpp_version_major}.${_JsonCpp_version_minor}.${_JsonCpp_version_patch}")
unset(_JsonCpp_version_major)
unset(_JsonCpp_version_minor)
unset(_JsonCpp_version_patch)
unset(_JsonCpp_version_lines)
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JsonCpp
REQUIRED_VARS JsonCpp_LIBRARY JsonCpp_INCLUDE_DIR
VERSION_VAR JsonCpp_VERSION)
if (JsonCpp_FOUND)
set(JsonCpp_INCLUDE_DIRS "${JsonCpp_INCLUDE_DIR}")
set(JsonCpp_LIBRARIES "${JsonCpp_LIBRARY}")
if (NOT TARGET JsonCpp::JsonCpp)
add_library(JsonCpp::JsonCpp SHARED IMPORTED)
set_target_properties(JsonCpp::JsonCpp PROPERTIES
IMPORTED_LOCATION "${JsonCpp_LIBRARY}"
IMPORTED_IMPLIB "${JsonCpp_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${JsonCpp_INCLUDE_DIR}")
endif ()
endif ()

View File

@@ -0,0 +1,44 @@
From 2fe6cac5797bead74c473c795fdc5f9d50703894 Mon Sep 17 00:00:00 2001
From: Paul Zander <negril.nx+gentoo@gmail.com>
Date: Thu, 6 Mar 2025 13:19:01 +0100
Subject: [PATCH] fix JsonCPP name
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
diff --git a/cmake/conformance.cmake b/cmake/conformance.cmake
index 7377841..dba05aa 100644
--- a/cmake/conformance.cmake
+++ b/cmake/conformance.cmake
@@ -1,9 +1,9 @@
# Don't run jsoncpp tests.
set(JSONCPP_WITH_TESTS OFF)
-if (NOT TARGET jsoncpp_lib)
+if (NOT TARGET JsonCpp::JsonCpp)
if (NOT protobuf_FORCE_FETCH_DEPENDENCIES)
- find_package(jsoncpp)
+ find_package(JsonCpp)
endif()
# Fallback to fetching Googletest from github if it's not found locally.
@@ -21,7 +21,7 @@ if (NOT TARGET jsoncpp_lib)
endif()
endif()
-if (NOT TARGET jsoncpp_lib)
+if (NOT TARGET JsonCpp::JsonCpp)
message(FATAL_ERROR
"Cannot find jsoncpp dependency that's needed to build conformance tests.\n"
"If instead you want to skip these tests, run cmake with:\n"
@@ -151,7 +151,7 @@ add_test(NAME conformance_cpp_test
set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Disable tests")
if(BUILD_SHARED_LIBS)
- target_link_libraries(conformance_test_runner jsoncpp_lib)
+ target_link_libraries(conformance_test_runner JsonCpp::JsonCpp)
else()
target_link_libraries(conformance_test_runner jsoncpp_static)
endif()
--
2.48.1