# Contributor: Kiyoshi Aman # Maintainer: Natanael Copa pkgname=protobuf _gemname=google-protobuf pkgver=3.5.0 pkgrel=1 pkgdesc="Library for extensible, efficient structure packing" url="https://github.com/google/protobuf" arch="all" license="BSD" depends_dev="zlib-dev" makedepends="$depends_dev autoconf automake libtool ruby ruby-dev ruby-rake" subpackages="ruby-$_gemname:_ruby $pkgname-dev $pkgname-vim::noarch" source="$pkgname-$pkgver.tar.gz::https://github.com/google/$pkgname/archive/v$pkgver.tar.gz musl-fix.patch trim-rakefile.patch adding_release_compareandswap_64-bit_variant.patch " builddir="$srcdir/$pkgname-$pkgver" prepare() { default_prepare cd "$builddir" ./autogen.sh } build() { cd "$builddir" CXXFLAGS="$CXXFLAGS -fno-delete-null-pointer-checks" \ ./configure --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --localstatedir=/var make cd "$builddir"/ruby # Generate proto files for built-in protocols. rake genproto gem build $_gemname.gemspec gem install --local \ --install-dir dist \ --ignore-dependencies \ --no-document \ --verbose \ $_gemname } # TODO: Run tests for ruby gem. check() { cd "$builddir" make check } package() { cd "$builddir" make DESTDIR="$pkgdir" install } _ruby() { pkgdesc="Ruby bindings to Google's data interchange format" local gemdir="$subpkgdir/$(ruby -rubygems -e 'puts Gem.default_dir')" cd "$builddir"/ruby/dist mkdir -p "$gemdir" cp -r extensions gems specifications "$gemdir"/ # Remove duplicated .so libs (should be only in extensions directory). find "$gemdir"/gems/ -name "*.so" -delete # Remove unnecessary files. cd "$gemdir"/gems/$_gemname-$pkgver rm -r ext/ tests/ } vim() { pkgdesc="Vim syntax for $pkgname" depends="" install_if="$pkgname=$pkgver-r$pkgrel vim" install -Dm644 "$builddir"/editors/proto.vim \ "$subpkgdir"/usr/share/vim/vimfiles/syntax/proto.vim } sha512sums="7b9477d298f604067b9ebab72a99adae8a31249b3ea3fd0e70fd4ac77180bec83131193b2642a624fbb7cc5eae9f1b369bffec9297b49b04207ae50a4071aaa4 protobuf-3.5.0.tar.gz b321cf82a959263d3173cc1c5cce4c77d4720f5dd824f20c98abb94f11eccf2907afce8b8a86340b4fc1bd1c7d5df1afca4672c17a97feb089521e167b20c70f musl-fix.patch e1f6483b7e8d38b07cd01883bda439b2017fa0a87626fa49628f1d2042b5097ba8a68bdf1a03cd385e3e9a7c0bd2af6fbccec25e1c061617c3cceccabd17dce4 trim-rakefile.patch 269184e48fc0b645134a08a0e1e2709970109f283a75cef5e8de9b8b61344d6ca9dea2e7ff15aee26dd8049c5b424fd94262729e7fcc1e688a1d7fc486d9d2e4 adding_release_compareandswap_64-bit_variant.patch"