124 lines
3.2 KiB
Bash
124 lines
3.2 KiB
Bash
# This is an example PKGBUILD file. Use this as a start to creating your own,
|
|
# and remove these comments. For more information, see 'man PKGBUILD'.
|
|
# NOTE: Please fill out the license field for your package! If it is unknown,
|
|
# then please put 'unknown'.
|
|
|
|
# Maintainer: Future Linux Team <future_linux@163.com>
|
|
pkgname=(marisa perl-marisa python-marisa ruby-marisa)
|
|
pkgbase=marisa
|
|
pkgver=0.2.6
|
|
pkgrel=1
|
|
pkgdesc=""
|
|
arch=('x86_64')
|
|
url="https://github.com/s-yata/marisa-trie"
|
|
license=('BSD' 'LGPL')
|
|
makedepends=('python' 'ruby' 'perl' 'swig' 'python-setuptools')
|
|
source=(https://github.com/s-yata/marisa-trie/archive/v${pkgver}/${pkgbase}-trie-${pkgver}.tar.gz
|
|
fix-format-security.patch)
|
|
sha256sums=(1063a27c789e75afa2ee6f1716cc6a5486631dcfcb7f4d56d6485d2462e566de
|
|
b673e36e6206f47e5353b363f7e73916d9aa0b662c54a0ecb4ac461896d13147)
|
|
|
|
prepare() {
|
|
cd ${pkgbase}-trie-${pkgver}
|
|
|
|
autoreconf -i
|
|
|
|
# https://github.com/s-yata/marisa-trie/pull/45
|
|
patch -Np1 -i ${srcdir}/fix-format-security.patch
|
|
|
|
}
|
|
|
|
build() {
|
|
cd ${pkgbase}-trie-${pkgver}
|
|
|
|
# sse2 is part of amd64
|
|
${CONFIGURE} --disable-static --enable-sse2
|
|
|
|
make
|
|
|
|
# Regenerate swig bindings
|
|
# remove ruby because it's broken for now
|
|
make -C bindings -j1 swig-perl swig-python
|
|
|
|
# Perl bindings
|
|
cd ${srcdir}/${pkgbase}-trie-${pkgver}/bindings/perl
|
|
|
|
perl Makefile.PL \
|
|
INC=-I${srcdir}/${pkgbase}-trie-${pkgver}/include \
|
|
LIBS=-L${srcdir}/${pkgbase}-trie-${pkgver}/lib/marisa/.libs \
|
|
INSTALLDIRS=vendor
|
|
|
|
make
|
|
|
|
# Python bindings
|
|
cd ${srcdir}/${pkgbase}-trie-${pkgver}/bindings/python
|
|
|
|
python3 setup.py build_ext \
|
|
--include-dirs=${srcdir}/${pkgbase}-trie-${pkgver}/include \
|
|
--library-dirs=${srcdir}/${pkgbase}-trie-${pkgver}/lib/marisa/.libs
|
|
|
|
python3 setup.py build
|
|
|
|
# Ruby bindings
|
|
cd ${srcdir}/${pkgbase}-trie-${pkgver}/bindings/ruby
|
|
|
|
ruby extconf.rb \
|
|
--with-opt-include=${srcdir}/${pkgbase}-trie-${pkgver}/include \
|
|
--with-opt-lib=${srcdir}/${pkgbase}-trie-${pkgver}/lib/marisa/.libs \
|
|
--vendor
|
|
|
|
make
|
|
|
|
}
|
|
|
|
package_marisa() {
|
|
pkgdesc="Static and space-efficient trie data structure library"
|
|
depends=('gcc-libs')
|
|
|
|
cd ${pkgbase}-trie-${pkgver}
|
|
make DESTDIR=${pkgdir} install
|
|
|
|
install -d ${pkgdir}/usr/share/doc/${pkgbase}-${pkgver}
|
|
install -m 644 docs/* ${pkgdir}/usr/share/doc/${pkgbase}-${pkgver}/
|
|
|
|
}
|
|
|
|
package_perl-marisa() {
|
|
pkgdesc="Perl language binding for marisa"
|
|
depends=('perl' 'marisa')
|
|
|
|
cd ${pkgbase}-trie-${pkgver}/bindings/perl
|
|
|
|
make DESTDIR=${pkgdir} install
|
|
|
|
}
|
|
|
|
package_python-marisa() {
|
|
pkgdesc="Python language binding for marisa"
|
|
depends=('python' 'marisa')
|
|
|
|
cd ${pkgbase}-trie-${pkgver}/bindings/python
|
|
|
|
python3 setup.py install -O1 --root=${pkgdir}
|
|
|
|
}
|
|
|
|
package_ruby-marisa() {
|
|
pkgdesc="Ruby language binding for marisa"
|
|
depends=('ruby' 'marisa')
|
|
|
|
# ruby version without the patch number, e.g. 2.4
|
|
local _rubyver=$(ruby -e"puts Gem.ruby_version.to_s.split('.')[0..1].join('.')")
|
|
|
|
cd ${pkgbase}-trie-${pkgver}/bindings/ruby
|
|
|
|
_hdrdir=$(pkg-config --variable=rubyhdrdir ruby-${_rubyver})
|
|
_arch=$(pkg-config --variable=arch ruby-${_rubyver})
|
|
|
|
make DESTDIR=${pkgdir} install \
|
|
hdrdir=${_hdrdir} \
|
|
arch_hdrdir=${_hdrdir}/${_arch} \
|
|
rubyhdrdir=${_hdrdir}
|
|
|
|
}
|