aboutsummaryrefslogtreecommitdiffstats
path: root/main/protobuf/APKBUILD
blob: 58b8225997c5b608d52f60235d76d2e94991c389 (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
92
93
# Contributor: Kiyoshi Aman <kiyoshi.aman@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=protobuf
_gemname=google-protobuf
pkgver=3.5.2
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
	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 -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="09d10cf0c07a0ba249428bbf20f5dbed840965fa06b3c09682f286a4dee9d84bb96f3b5b50e993d48ef1f20440531255ce7d0e60a648bf3fe536a5f2b0b74181  protobuf-3.5.2.tar.gz
b321cf82a959263d3173cc1c5cce4c77d4720f5dd824f20c98abb94f11eccf2907afce8b8a86340b4fc1bd1c7d5df1afca4672c17a97feb089521e167b20c70f  musl-fix.patch
e09f83b6cd1c4d046390704333f72825166b841474f37ac5181ae7a67c9acc6fe6098660064890517c41380544e4cac7cb73acc2815b7a2decd16ea8fd3fb92b  trim-rakefile.patch
269184e48fc0b645134a08a0e1e2709970109f283a75cef5e8de9b8b61344d6ca9dea2e7ff15aee26dd8049c5b424fd94262729e7fcc1e688a1d7fc486d9d2e4  adding_release_compareandswap_64-bit_variant.patch"