| 1 |
|
# Copyright 1999-2025 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
| 6 |
|
inherit toolchain-funcs
|
| 7 |
|
|
| 8 |
|
MY_TESTDATA_COMMIT="0703f1d6a21802c3ff00c2c8b31bd255b74b2aec"
|
|
6 |
inherit dot-a edo toolchain-funcs
|
| 9 |
7 |
|
|
8 |
MY_TESTDATA_COMMIT="39dde6129dfc7c65520704ad159d486396e4dbc5"
|
| 10 |
9 |
DESCRIPTION="Snowball compiler and stemming algorithms"
|
| 11 |
10 |
HOMEPAGE="https://snowballstem.org/ https://github.com/snowballstem/snowball/"
|
| 12 |
|
SRC_URI="https://github.com/snowballstem/snowball/archive/v${PV}.tar.gz -> ${P}.tar.gz
|
| 13 |
|
test? ( https://github.com/snowballstem/snowball-data/archive/${MY_TESTDATA_COMMIT}.tar.gz -> snowball-data-${MY_TESTDATA_COMMIT}.tar.gz )"
|
|
11 |
SRC_URI="
|
|
12 |
https://github.com/snowballstem/snowball/archive/v${PV}.tar.gz
|
|
13 |
-> ${P}.tar.gz
|
|
14 |
test? ( https://github.com/snowballstem/snowball-data/archive/${MY_TESTDATA_COMMIT}.tar.gz
|
|
15 |
-> snowball-data-${MY_TESTDATA_COMMIT}.tar.gz )
|
|
16 |
"
|
|
17 |
S="${WORKDIR}/snowball-${PV}"
|
| 14 |
18 |
|
| 15 |
19 |
LICENSE="BSD"
|
| 16 |
|
SLOT="0/$(ver_cut 1)"
|
| 17 |
|
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
|
|
20 |
SONAME="$(ver_cut 1-2)"
|
|
21 |
SLOT="0/${SONAME}"
|
|
22 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
| 18 |
23 |
IUSE="static-libs test"
|
| 19 |
|
|
| 20 |
|
BDEPEND="dev-lang/perl
|
| 21 |
|
test? ( virtual/libiconv )"
|
| 22 |
24 |
RESTRICT="!test? ( test )"
|
| 23 |
25 |
|
| 24 |
|
S="${WORKDIR}/snowball-${PV}"
|
|
26 |
BDEPEND="
|
|
27 |
dev-lang/perl
|
|
28 |
test? ( virtual/libiconv )
|
|
29 |
"
|
| 25 |
30 |
|
| 26 |
31 |
PATCHES=(
|
| 27 |
|
"${FILESDIR}/${P}-shared-library.patch"
|
|
32 |
# Shared-library: export only public sb_stemmer_* symbols (matching libstemmer.h)
|
|
33 |
"${FILESDIR}"/${PN}-3.1.0-public_symbols.patch
|
| 28 |
34 |
)
|
| 29 |
35 |
|
|
36 |
src_configure() {
|
|
37 |
use static-libs && lto-guarantee-fat
|
|
38 |
default
|
|
39 |
}
|
|
40 |
|
| 30 |
41 |
src_compile() {
|
|
42 |
# 947412
|
|
43 |
tc-is-cross-compiler && tc-env_build emake snowball
|
|
44 |
|
| 31 |
45 |
tc-export CC AR
|
| 32 |
|
default
|
|
46 |
emake CFLAGS="${CFLAGS} -fPIC" all
|
|
47 |
|
|
48 |
# Created shared library contains a lot of relocations, which slow down loading.
|
|
49 |
# It is known issue and probably the main reason why upstream does not support shared library yet.
|
|
50 |
# see https://github.com/snowballstem/snowball/issues/34
|
|
51 |
edo "${CC}" \
|
|
52 |
${CFLAGS} \
|
|
53 |
${LDFLAGS} \
|
|
54 |
-Wl,-version-script,libstemmer/symbol.map \
|
|
55 |
-Wl,--whole-archive \
|
|
56 |
libstemmer.a \
|
|
57 |
-Wl,--no-whole-archive \
|
|
58 |
-Wl,-soname,libstemmer.so.${SONAME} \
|
|
59 |
-shared \
|
|
60 |
-o libstemmer.so.${PV}
|
| 33 |
61 |
}
|
| 34 |
62 |
|
| 35 |
63 |
src_test() {
|
| ... | ... | |
| 44 |
72 |
doheader include/libstemmer.h
|
| 45 |
73 |
|
| 46 |
74 |
dolib.so libstemmer.so.${PV}
|
| 47 |
|
dolib.so libstemmer.so.$(ver_cut 1)
|
| 48 |
|
dolib.so libstemmer.so
|
|
75 |
dosym libstemmer.so.${PV} /usr/$(get_libdir)/libstemmer.so.${SONAME}
|
|
76 |
dosym libstemmer.so.${PV} /usr/$(get_libdir)/libstemmer.so
|
| 49 |
77 |
|
| 50 |
|
use static-libs && dolib.a libstemmer.a
|
|
78 |
if use static-libs; then
|
|
79 |
dolib.a libstemmer.a
|
|
80 |
strip-lto-bytecode
|
|
81 |
fi
|
| 51 |
82 |
}
|