summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ba66bad1d996fd96b393f3820d0bda786cc85f89 (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
# Maintainer: Hideaki Takahashi (mymelo+aur@gmail.com)
# Maintainer: taotieren <admin@taotieren.com>
# based on PKGBUILD for MeCab https://aur.archlinux.org/packages/mecab/

pkgname=mecab-git
pkgrel=1
pkgver=r157.61b90ba
pkgdesc="Yet another part-of-speech and morphological analyzer."
arch=($CARCH)
url="https://taku910.github.io/mecab"
depends=(
	gcc-libs
	glibc
	sh
)
makedepends=(
	'git'
	'wget'
)
conflicts=('mecab')
provides=('mecab')
license=('BSD-3-Clause AND GPL-2.0-or-later AND LGPL-2.1-or-later')
source=("${pkgname}::git+https://github.com/taku910/mecab.git")
sha512sums=('SKIP')

pkgver() {
	cd "${srcdir}/${pkgname}"
	(
		set -o pipefail
		git describe --long --tag --abbrev=7 2>/dev/null | sed 's/^v//g;s/\([^-]*-g\)/r\1/;s/-/./g' ||
			printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
	)
}

prepare() {
	git -C "${srcdir}/${pkgname}" clean -dfx
}
build() {
	cd "${pkgname}/mecab"
	if [ "$CARCH" == "aarch64" ]; then
		echo "Detected aarch64 architecture. Updating config.guess and config.sub..."

		rm -f config.guess
		wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O config.guess
		if [ $? -ne 0 ]; then
			echo "Failed to download config.guess" >&2
			exit 1
		fi

		rm -f config.sub
		wget 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O config.sub
		if [ $? -ne 0 ]; then
			echo "Failed to download config.sub" >&2
			exit 1
		fi

		echo "Updated config.guess and config.sub successfully."
	else
		echo "Not aarch64 architecture. Skipping update of config.guess and config.sub."
	fi
	./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --with-charset=utf-8
	make
}

check() {
	cd "${pkgname}/mecab"
	make -k check
}

package() {
	cd "${pkgname}/mecab"
	make DESTDIR="$pkgdir/" install
}