archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / marisa / trunk / PKGBUILD
blobd869905b1724ccfbe54810cf64b877ba0452258c
1 # Maintainer: Felix Yan <felixonmars@archlinux.org>
2 # Contributor: ponsfoot <cabezon dot hashimoto at gmail dot com>
4 pkgbase=marisa
5 pkgname=('marisa' 'perl-marisa' 'python-marisa' 'ruby-marisa')
6 pkgver=0.2.6
7 pkgrel=10
8 arch=('x86_64')
9 url="https://github.com/s-yata/marisa-trie"
10 license=('BSD' 'LGPL')
11 makedepends=('python' 'ruby' 'perl' 'swig')
12 source=("marisa-trie-$pkgver.tar.gz::https://github.com/s-yata/marisa-trie/archive/v$pkgver.tar.gz"
13         fix-format-security.patch)
14 sha512sums=('c094e4b22e1457efdd20f2b978ee421b53e36ed94e4fdbd8944136c0ba23da4f6ba9fe3a2c64729c1426aee4dbe8098bfa5eebb943ae7fdaa4eec760485c564d'
15             '3583f23c55ccd46cefbd757ef3f82dc7a90f14c64ecf69a99ab3467ca1e6aeddf9822be4c4dffcdbb8841d79fe116cfb8eff0e9b44abaadbcbf8d50a10ab1ec9')
17 prepare() {
18   cd marisa-trie-$pkgver
19   autoreconf -i
21   # https://github.com/s-yata/marisa-trie/pull/45
22   patch -Np1 -i ../fix-format-security.patch
25 build() {
26   cd marisa-trie-$pkgver
27   # sse2 is part of amd64
28   ./configure --prefix=/usr --disable-static --enable-sse2
29     # --enable-popcnt
30     # --enable-sse3
31     # --enable-ssse3
32     # --enable-sse4.1
33     # --enable-sse4.2
34     # --enable-sse4
35     # --enable-sse4a
37   make
39   # Regenerate swig bindings
40   # remove ruby because it's broken for now
41   make -C bindings -j1 swig-perl swig-python
43   # Perl bindings
44   cd "$srcdir"/marisa-trie-$pkgver/bindings/perl
45   perl Makefile.PL \
46     INC=-I"$srcdir"/marisa-trie-$pkgver/include \
47     LIBS=-L"$srcdir"/marisa-trie-$pkgver/lib/marisa/.libs \
48     INSTALLDIRS=vendor
49   make
51   # Python bindings
52   cd "$srcdir"/marisa-trie-$pkgver/bindings/python
53   python setup.py build_ext \
54     --include-dirs="$srcdir"/marisa-trie-$pkgver/include \
55     --library-dirs="$srcdir"/marisa-trie-$pkgver/lib/marisa/.libs
56   python setup.py build
58   # Ruby bindings
59   cd "$srcdir"/marisa-trie-$pkgver/bindings/ruby
60   ruby extconf.rb \
61     --with-opt-include="$srcdir"/marisa-trie-$pkgver/include \
62     --with-opt-lib="$srcdir"/marisa-trie-$pkgver/lib/marisa/.libs \
63     --vendor
64   make
67 package_marisa() {
68   pkgdesc="Static and space-efficient trie data structure library"
69   depends=('gcc-libs')
71   cd marisa-trie-$pkgver
72   make DESTDIR="$pkgdir" install
74   install -d "$pkgdir"/usr/share/doc/$pkgbase-$pkgver
75   install -m 644 docs/* "$pkgdir"/usr/share/doc/$pkgbase-$pkgver/
77   install -d "$pkgdir"/usr/share/licenses/$pkgname
78   install -m 644 AUTHORS COPYING.md "$pkgdir"/usr/share/licenses/$pkgname/
81 package_perl-marisa() {
82   pkgdesc="Perl language binding for marisa"
83   depends=('perl' 'marisa')
85   cd marisa-trie-$pkgver/bindings/perl
86   make DESTDIR="$pkgdir" install
88   cd ../..
89   install -d "$pkgdir"/usr/share/licenses/$pkgname
90   install -m 644 AUTHORS COPYING.md "$pkgdir"/usr/share/licenses/$pkgname/
93 package_python-marisa() {
94   pkgdesc="Python language binding for marisa"
95   depends=('python' 'marisa')
97   cd marisa-trie-$pkgver/bindings/python
98   python setup.py install -O1 --root="$pkgdir"
100   cd ../..
101   install -d "$pkgdir"/usr/share/licenses/$pkgname
102   install -m 644 AUTHORS COPYING.md "$pkgdir"/usr/share/licenses/$pkgname/
105 package_ruby-marisa() {
106   pkgdesc="Ruby language binding for marisa"
107   depends=('ruby' 'marisa')
109   # ruby version without the patch number, e.g. 2.4
110   local _rubyver=$(ruby -e"puts Gem.ruby_version.to_s.split('.')[0..1].join('.')")
112   cd marisa-trie-$pkgver/bindings/ruby
113     _hdrdir=$(pkg-config --variable=rubyhdrdir ruby-$_rubyver)
114     _arch=$(pkg-config --variable=arch ruby-$_rubyver)
115   make DESTDIR="$pkgdir" install \
116     hdrdir="$_hdrdir" \
117     arch_hdrdir="${_hdrdir}/${_arch}" \
118     rubyhdrdir="$_hdrdir"
120   cd ../..
121   install -d "$pkgdir"/usr/share/licenses/$pkgname
122   install -m 644 AUTHORS COPYING.md "$pkgdir"/usr/share/licenses/$pkgname/