extra/protobuf to 27.3-2

This commit is contained in:
Kevin Mihelich 2024-08-21 00:28:14 +00:00
parent 87852c5e9d
commit 3f604255a4
3 changed files with 93 additions and 5 deletions

View file

@ -1,7 +1,7 @@
pkgbase = protobuf
pkgdesc = Protocol Buffers - Google's data interchange format
pkgver = 27.3
pkgrel = 1
pkgrel = 2
url = https://developers.google.com/protocol-buffers/
arch = x86_64
license = BSD
@ -14,14 +14,19 @@ pkgbase = protobuf
makedepends = python-installer
makedepends = python-setuptools
makedepends = python-wheel
makedepends = ruby
makedepends = ruby-rake
makedepends = ruby-rake-compiler
depends = gcc-libs
depends = glibc
depends = zlib
depends = abseil-cpp
source = https://github.com/protocolbuffers/protobuf/archive/v27.3/protobuf-27.3.tar.gz
source = https://github.com/protocolbuffers/protobuf/commit/2e62ef1e.patch
source = protobuf-25.3-ruby-disable-LTO.patch
sha512sums = a3a555f17a069dd4aa0d683d3126915077fe4211ae6532a4947fb76a9eeb1ed7d25d29ada8dc372435a08aad1aa14374d88e92ac7c195510f57609efaf9d341d
sha512sums = f42d9bd702abe2c7fc4dcb07d050376287ac60b0b7e2fde0d7a9e9df24a620866bee5fd7de2e3b216095376de47e1fe7443cca74c9a9e85c1a0bc42e8973a280
sha512sums = 1ebdea4e533ee0f71baf1b3fe2623ca723b36a08c6b97475ea5996b10aeb6873cf94d9120596ddd1216bd2f6feb991f8c33078e8104008a5078ace5be5431efd
pkgname = protobuf
provides = libprotoc.so
@ -33,3 +38,7 @@ pkgname = python-protobuf
pkgdesc = Python 3 bindings for Google Protocol Buffers
depends = protobuf=27.3
depends = python
pkgname = ruby-google-protobuf
pkgdesc = Ruby bindings for Google Protocol Buffers
depends = ruby

View file

@ -15,9 +15,9 @@
# - split off python-protobuf to its own PKGBUILD file
pkgbase='protobuf'
pkgname=('protobuf')
pkgname=('protobuf' 'ruby-google-protobuf')
pkgver=27.3
pkgrel=1
pkgrel=2
# Note: python-protobuf needs to be updated alongside this package to the same version
pkgdesc="Protocol Buffers - Google's data interchange format"
arch=('x86_64')
@ -36,18 +36,26 @@ makedepends=(
'python-installer'
'python-setuptools'
'python-wheel'
'ruby'
'ruby-rake'
'ruby-rake-compiler'
)
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)
https://github.com/protocolbuffers/protobuf/commit/2e62ef1e.patch
$pkgbase-25.3-ruby-disable-LTO.patch) # https://github.com/protocolbuffers/protobuf/issues/11935
sha512sums=('a3a555f17a069dd4aa0d683d3126915077fe4211ae6532a4947fb76a9eeb1ed7d25d29ada8dc372435a08aad1aa14374d88e92ac7c195510f57609efaf9d341d'
'f42d9bd702abe2c7fc4dcb07d050376287ac60b0b7e2fde0d7a9e9df24a620866bee5fd7de2e3b216095376de47e1fe7443cca74c9a9e85c1a0bc42e8973a280')
'f42d9bd702abe2c7fc4dcb07d050376287ac60b0b7e2fde0d7a9e9df24a620866bee5fd7de2e3b216095376de47e1fe7443cca74c9a9e85c1a0bc42e8973a280'
'1ebdea4e533ee0f71baf1b3fe2623ca723b36a08c6b97475ea5996b10aeb6873cf94d9120596ddd1216bd2f6feb991f8c33078e8104008a5078ace5be5431efd')
_gemname=google-protobuf
prepare() {
patch -d $pkgname-$pkgver -p1 < 2e62ef1e.patch # Fix cmake config compatibility mode
patch -d $pkgbase-$pkgver -p1 < $pkgbase-25.3-ruby-disable-LTO.patch
}
build() {
@ -66,6 +74,51 @@ build() {
cmake "${cmake_options[@]}"
cmake --build build --verbose
cd $pkgbase-$pkgver/ruby
local _gemdir="$(gem env gemdir)"
local _gemver=4.$pkgver
PROTOC="$srcdir"/build/protoc \
rake genproto
rake copy_third_party
gem build --verbose "${_gemname}.gemspec"
gem install \
--local \
--verbose \
--ignore-dependencies \
--no-user-install \
--install-dir "tmp_install${_gemdir}" \
--bindir "tmp_install/usr/bin" \
"${_gemname}-${_gemver}.gem"
# remove unrepreducible files
rm --force --recursive --verbose \
"tmp_install${_gemdir}/cache/" \
"tmp_install${_gemdir}/gems/${_gemname}-${_gemver}/vendor/" \
"tmp_install${_gemdir}/doc/${_gemname}-${_gemver}/ri/ext/"
find "tmp_install${_gemdir}/gems/" \
-type f \
\( \
-iname "*.o" -o \
-iname "*.c" -o \
-iname "*.so" -o \
-iname "*.time" -o \
-iname "gem.build_complete" -o \
-iname "Makefile" \
\) \
-delete
find "tmp_install${_gemdir}/extensions/" \
-type f \
\( \
-iname "mkmf.log" -o \
-iname "gem_make.out" \
\) \
-delete
}
check() {
@ -85,3 +138,15 @@ package_protobuf() {
install -vDm 644 editors/proto.vim \
-t "${pkgdir}/usr/share/vim/vimfiles/syntax"
}
package_ruby-google-protobuf() {
pkgdesc='Ruby bindings for Google Protocol Buffers'
depends=(
'ruby'
)
cp -a $pkgbase-$pkgver/ruby/tmp_install/* "$pkgdir"
install -vDm 644 $pkgbase-$pkgver/LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
install -Dm 0644 $pkgbase-$pkgver/ruby/*.md -t "$pkgdir/usr/share/doc/${pkgname}"
}

View file

@ -0,0 +1,14 @@
diff --git a/ruby/ext/google/protobuf_c/extconf.rb b/ruby/ext/google/protobuf_c/extconf.rb
index 4bb49bb..37266d7 100755
--- a/ruby/ext/google/protobuf_c/extconf.rb
+++ b/ruby/ext/google/protobuf_c/extconf.rb
@@ -14,7 +14,8 @@ end
if RUBY_PLATFORM =~ /linux/
# Instruct the linker to point memcpy calls at our __wrap_memcpy wrapper.
- $LDFLAGS += " -Wl,-wrap,memcpy"
+ $CFLAGS += " -fno-lto"
+ $LDFLAGS += " -Wl,-wrap,memcpy -fno-lto"
end
$VPATH << "$(srcdir)/third_party/utf8_range"