diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-19 15:14:09 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-08-16 02:06:54 +0200 |
commit | 248bccd60f78e84c7c6f2c9b2c9733ba19e3fc61 (patch) | |
tree | 7e0b5b7c0b1a1179ab117a724006c255a495a6a7 /main/protobuf | |
parent | 9b268d50f7b4c460a3014eb5fd38e88635879894 (diff) | |
download | aports-248bccd60f78e84c7c6f2c9b2c9733ba19e3fc61.tar.bz2 aports-248bccd60f78e84c7c6f2c9b2c9733ba19e3fc61.tar.xz |
main/protobuf: add subpackage ruby-google-protobuf
Diffstat (limited to 'main/protobuf')
-rw-r--r-- | main/protobuf/APKBUILD | 40 | ||||
-rw-r--r-- | main/protobuf/trim-rakefile.patch | 66 |
2 files changed, 103 insertions, 3 deletions
diff --git a/main/protobuf/APKBUILD b/main/protobuf/APKBUILD index f25c03cae9..7dfff64bbd 100644 --- a/main/protobuf/APKBUILD +++ b/main/protobuf/APKBUILD @@ -1,6 +1,7 @@ # Contributor: Kiyoshi Aman <kiyoshi.aman@gmail.com> # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=protobuf +_gemname=google-protobuf pkgver=3.3.2 pkgrel=0 pkgdesc="Library for extensible, efficient structure packing" @@ -8,10 +9,11 @@ url="https://github.com/google/protobuf" arch="all" license="BSD" depends_dev="zlib-dev" -makedepends="$depends_dev autoconf automake libtool" -subpackages="$pkgname-dev $pkgname-vim::noarch" +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 " builddir="$srcdir/$pkgname-$pkgver" @@ -32,8 +34,22 @@ build() { --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 @@ -44,6 +60,23 @@ package() { 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="" @@ -54,4 +87,5 @@ vim() { } sha512sums="795b2b438e6c3628f574bdb2929b7a3771a8105af2d320ca0f9b144b93d9be4f713fb389f5a08c1c771ce93585b7aefc9b272c9cb57299d9ee6827e06e7ff557 protobuf-3.3.2.tar.gz -66b430c81f34f49a86dfca50edbb517e4ad1a5ea922625b6266410c5feacfb621fe583c2998ac8994c6de45470652d2408c6c731d9746b74891a627564ca01f0 musl-fix.patch" +66b430c81f34f49a86dfca50edbb517e4ad1a5ea922625b6266410c5feacfb621fe583c2998ac8994c6de45470652d2408c6c731d9746b74891a627564ca01f0 musl-fix.patch +e1f6483b7e8d38b07cd01883bda439b2017fa0a87626fa49628f1d2042b5097ba8a68bdf1a03cd385e3e9a7c0bd2af6fbccec25e1c061617c3cceccabd17dce4 trim-rakefile.patch" diff --git a/main/protobuf/trim-rakefile.patch b/main/protobuf/trim-rakefile.patch new file mode 100644 index 0000000000..f03bf92684 --- /dev/null +++ b/main/protobuf/trim-rakefile.patch @@ -0,0 +1,66 @@ +Remove code that we don't use to avoid installing additional dependencies. +--- a/ruby/Rakefile ++++ b/ruby/Rakefile +@@ -1,6 +1,4 @@ + require "rubygems" +-require "rubygems/package_task" +-require "rake/extensiontask" unless RUBY_PLATFORM == "java" + require "rake/testtask" + + spec = Gem::Specification.load("google-protobuf.gemspec") +@@ -39,45 +37,6 @@ + end + end + +-if RUBY_PLATFORM == "java" +- if `which mvn` == '' +- raise ArgumentError, "maven needs to be installed" +- end +- task :clean do +- system("mvn --batch-mode clean") +- end +- +- task :compile do +- system("mvn --batch-mode package") +- end +-else +- Rake::ExtensionTask.new("protobuf_c", spec) do |ext| +- ext.ext_dir = "ext/google/protobuf_c" +- ext.lib_dir = "lib/google" +- ext.cross_compile = true +- ext.cross_platform = [ +- 'x86-mingw32', 'x64-mingw32', +- 'x86_64-linux', 'x86-linux', +- 'universal-darwin' +- ] +- end +- +- task 'gem:windows' do +- require 'rake_compiler_dock' +- RakeCompilerDock.sh "bundle && IN_DOCKER=true rake cross native gem RUBY_CC_VERSION=2.4.0:2.3.0:2.2.2:2.1.5:2.0.0" +- end +- +- if RUBY_PLATFORM =~ /darwin/ +- task 'gem:native' do +- system "rake genproto" +- system "rake cross native gem RUBY_CC_VERSION=2.4.0:2.3.0:2.2.2:2.1.5:2.0.0" +- end +- else +- task 'gem:native' => [:genproto, 'gem:windows'] +- end +-end +- +- + # Proto for tests. + genproto_output << "tests/generated_code.rb" + genproto_output << "tests/test_import.rb" +@@ -93,9 +52,6 @@ + + task :clean do + sh "rm -f #{genproto_output.join(' ')}" +-end +- +-Gem::PackageTask.new(spec) do |pkg| + end + + Rake::TestTask.new(:test => :build) do |t| |