aboutsummaryrefslogtreecommitdiffstats
path: root/main/protobuf/APKBUILD
blob: 20f2acf35f712f157c1bde635fecce8f3a60308a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Contributor: Kiyoshi Aman <kiyoshi.aman@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=protobuf
_gemname=google-protobuf
pkgver=3.5.0
pkgrel=0
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
	"
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"