From fa75cecf701de0d42eecba9dfb292fe94ea479f5 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Fri, 28 Jun 2024 22:42:53 +0000 Subject: [PATCH] added extra/protobuf --- extra/protobuf/.SRCINFO | 37 +++++++++ extra/protobuf/PKGBUILD | 87 ++++++++++++++++++++++ extra/protobuf/protobuf-21.12-pep517.patch | 16 ++++ extra/protobuf/soversion.patch | 36 +++++++++ 4 files changed, 176 insertions(+) create mode 100644 extra/protobuf/.SRCINFO create mode 100644 extra/protobuf/PKGBUILD create mode 100644 extra/protobuf/protobuf-21.12-pep517.patch create mode 100644 extra/protobuf/soversion.patch diff --git a/extra/protobuf/.SRCINFO b/extra/protobuf/.SRCINFO new file mode 100644 index 000000000..9924491be --- /dev/null +++ b/extra/protobuf/.SRCINFO @@ -0,0 +1,37 @@ +pkgbase = protobuf + pkgdesc = Protocol Buffers - Google's data interchange format + pkgver = 27.2 + pkgrel = 1 + url = https://developers.google.com/protocol-buffers/ + arch = x86_64 + license = BSD + checkdepends = python-pytest + checkdepends = python-numpy + makedepends = bazel + makedepends = cmake + makedepends = gtest + makedepends = python-build + makedepends = python-installer + makedepends = python-setuptools + makedepends = python-wheel + depends = gcc-libs + depends = glibc + depends = zlib + depends = abseil-cpp + source = https://github.com/protocolbuffers/protobuf/archive/v27.2/protobuf-27.2.tar.gz + source = https://github.com/protocolbuffers/protobuf/commit/2e62ef1e.patch + source = soversion.patch + sha512sums = 664c66b62cf1ed0c65d9b910d8e67d4d5d471113697f1b8edf1573cd5c0fc8e850ac53ce984e48e6c6b9cbbefa12f8530058384e7388e65a59c1e46d03772397 + sha512sums = 18bc71031bbcbc3810a9985fa670465040f06a6c104ab8079b56bdfc499bb6cec40805a0cefd455031142490a576dc60aa8000523877ac0353b93558e9beabbd + sha512sums = f0813a415cff5639e4709400f15b0c5565294e7907ae164e620b76258734c643115d8e5170bf0e4aee264c347fb7e01ac4be60d19be2a91c0ce9c561dad8c8e9 + +pkgname = protobuf + provides = libprotoc.so + provides = libprotobuf.so + provides = libprotobuf-lite.so + replaces = protobuf-cpp + +pkgname = python-protobuf + pkgdesc = Python 3 bindings for Google Protocol Buffers + depends = protobuf=27.2 + depends = python diff --git a/extra/protobuf/PKGBUILD b/extra/protobuf/PKGBUILD new file mode 100644 index 000000000..f964b960d --- /dev/null +++ b/extra/protobuf/PKGBUILD @@ -0,0 +1,87 @@ +# Maintainer: Lukas Fleischer +# Contributor: David Runge +# Contributor: Aleksey Filippov +# Contributor: Bartłomiej Piotrowski +# Contributor: Sven-Hendrik Haase +# Contributor: Thomas S Hatch +# Contributor: Geoffroy Carrier +# Contributor: Daniel J Griffiths + +# ALARM: Kevin Mihelich +# - remove makedpends on bazel +# - remove python package + +pkgbase='protobuf' +pkgname=('protobuf') +pkgver=27.2 +pkgrel=1 +# Note: libphonenumber needs a rebuild for every version bump +pkgdesc="Protocol Buffers - Google's data interchange format" +arch=('x86_64') +url='https://developers.google.com/protocol-buffers/' +license=('BSD') +depends=( + 'gcc-libs' + 'glibc' + 'zlib' + 'abseil-cpp' +) +makedepends=( + 'cmake' + 'gtest' + 'python-build' + 'python-installer' + 'python-setuptools' + 'python-wheel' +) +checkdepends=( + python-pytest + python-numpy +) +source=(https://github.com/protocolbuffers/protobuf/archive/v$pkgver/$pkgname-$pkgver.tar.gz + https://github.com/protocolbuffers/protobuf/commit/2e62ef1e.patch + soversion.patch) +sha512sums=('664c66b62cf1ed0c65d9b910d8e67d4d5d471113697f1b8edf1573cd5c0fc8e850ac53ce984e48e6c6b9cbbefa12f8530058384e7388e65a59c1e46d03772397' + '18bc71031bbcbc3810a9985fa670465040f06a6c104ab8079b56bdfc499bb6cec40805a0cefd455031142490a576dc60aa8000523877ac0353b93558e9beabbd' + 'f0813a415cff5639e4709400f15b0c5565294e7907ae164e620b76258734c643115d8e5170bf0e4aee264c347fb7e01ac4be60d19be2a91c0ce9c561dad8c8e9') + +prepare() { + patch -d $pkgname-$pkgver -p1 < 2e62ef1e.patch # Fix cmake config compatibility mode + patch -d $pkgbase-$pkgver -p1 < soversion.patch # Restore soversion +} + +build() { + local cmake_options=( + -B build + -D CMAKE_BUILD_TYPE=None + -D CMAKE_INSTALL_PREFIX=/usr + -D CMAKE_C_FLAGS="$CFLAGS -ffat-lto-objects" + -D CMAKE_CXX_FLAGS="$CXXFLAGS -ffat-lto-objects" + -D protobuf_BUILD_SHARED_LIBS=ON + -D protobuf_USE_EXTERNAL_GTEST=ON + -D protobuf_ABSL_PROVIDER=package + -S "$pkgbase-$pkgver" + -W no-dev + ) + + cmake "${cmake_options[@]}" + cmake --build build --verbose +} + +check() { + ctest --test-dir build +} + +package_protobuf() { + replaces=('protobuf-cpp') + provides=('libprotoc.so' 'libprotobuf.so' 'libprotobuf-lite.so') + + DESTDIR="$pkgdir" cmake --install build + + cd $pkgbase-$pkgver + install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname" + install -vDm 644 editors/protobuf-mode.el \ + -t "$pkgdir/usr/share/emacs/site-lisp/" + install -vDm 644 editors/proto.vim \ + -t "${pkgdir}/usr/share/vim/vimfiles/syntax" +} diff --git a/extra/protobuf/protobuf-21.12-pep517.patch b/extra/protobuf/protobuf-21.12-pep517.patch new file mode 100644 index 000000000..51f3f6700 --- /dev/null +++ b/extra/protobuf/protobuf-21.12-pep517.patch @@ -0,0 +1,16 @@ +diff -ruN a/python/setup.py b/python/setup.py +--- a/python/setup.py 2022-12-13 01:03:12.000000000 +0100 ++++ b/python/setup.py 2023-04-06 22:12:36.199029178 +0200 +@@ -220,10 +220,10 @@ + return False + + +-if __name__ == '__main__': ++if True: + ext_module_list = [] + warnings_as_errors = '--warnings_as_errors' +- if GetOptionFromArgv('--cpp_implementation'): ++ if True: + # Link libprotobuf.a and libprotobuf-lite.a statically with the + # extension. Note that those libraries have to be compiled with + # -fPIC for this to work. diff --git a/extra/protobuf/soversion.patch b/extra/protobuf/soversion.patch new file mode 100644 index 000000000..7e1b42de1 --- /dev/null +++ b/extra/protobuf/soversion.patch @@ -0,0 +1,36 @@ +diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake +index 9b1de677b4f..276c99c489e 100644 +--- a/cmake/libprotobuf-lite.cmake ++++ b/cmake/libprotobuf-lite.cmake +@@ -30,6 +30,7 @@ if(protobuf_BUILD_SHARED_LIBS) + endif() + set_target_properties(libprotobuf-lite PROPERTIES + VERSION ${protobuf_VERSION} ++ SOVERSION ${protobuf_VERSION_MINOR} + OUTPUT_NAME ${LIB_PREFIX}protobuf-lite + DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") + add_library(protobuf::libprotobuf-lite ALIAS libprotobuf-lite) +diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake +index aa3efc9a68a..0f34d20b97d 100644 +--- a/cmake/libprotobuf.cmake ++++ b/cmake/libprotobuf.cmake +@@ -33,6 +33,7 @@ if(protobuf_BUILD_SHARED_LIBS) + endif() + set_target_properties(libprotobuf PROPERTIES + VERSION ${protobuf_VERSION} ++ SOVERSION ${protobuf_VERSION_MINOR} + OUTPUT_NAME ${LIB_PREFIX}protobuf + DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") + add_library(protobuf::libprotobuf ALIAS libprotobuf) +diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake +index 72b4a1abb92..91e8bbeb04e 100644 +--- a/cmake/libprotoc.cmake ++++ b/cmake/libprotoc.cmake +@@ -24,6 +24,7 @@ endif() + set_target_properties(libprotoc PROPERTIES + COMPILE_DEFINITIONS LIBPROTOC_EXPORTS + VERSION ${protobuf_VERSION} ++ SOVERSION ${protobuf_VERSION_MINOR} + OUTPUT_NAME ${LIB_PREFIX}protoc + DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}") + add_library(protobuf::libprotoc ALIAS libprotoc)