snowball_stemmer, add version 3.0.1 (#12535)

This commit is contained in:
Schrijvers Luc
2025-06-30 10:25:34 +02:00
committed by GitHub
parent 17e8b407fa
commit bb7399f9ca
2 changed files with 160 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
From 758d068a06d66ac88967ef76944becb8e4c12a77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sun, 21 Nov 2021 04:01:06 +0100
Subject: applying patch snowball-stemmer-3.0.1-shared-library.patch [1]
[1] Gentoo: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-libs/snowball-stemmer/files/snowball-stemmer-3.0.1-shared-library.patch
This is based on a patch taken from alpinelinux, however, duplicated
libstemmer.o and stemwords targets were removed and the patch was
rebased on top of v3.0.1 tag.
Created shared library contains a lot of relocations, which slow down loading.
It is known issue and probably the main reason why upstream does not support
shared library yet [2].
[2] https://github.com/snowballstem/snowball/issues/34#issuecomment-203200078
Alpinelinux-patch: https://git.alpinelinux.org/aports/tree/community/snowball/libstemmer-library.patch?id=28f9d9e192876c43fd96bc5856cd9d8a50dd49c0
Upstream-issue: https://github.com/snowballstem/snowball/issues/34
diff --git a/GNUmakefile b/GNUmakefile
index e1403be..f66dc0f 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -4,6 +4,8 @@
# which hard-code it.
SNOWBALL_VERSION = 3.0.1
+MAJOR_VERSION := $(shell echo $(SNOWBALL_VERSION) | cut -d. -f1)
+
ifeq ($(OS),Windows_NT)
EXEEXT = .exe
endif
@@ -190,12 +192,17 @@ C_OTHER_OBJECTS = $(C_OTHER_SOURCES:.c=.o)
JAVA_CLASSES = $(JAVA_SOURCES:.java=.class)
JAVA_RUNTIME_CLASSES=$(JAVARUNTIME_SOURCES:.java=.class)
-CFLAGS=-g -O2 -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wshadow $(WERROR)
-CPPFLAGS=
+CFLAGS+=-fPIC -W -Wall -Wmissing-prototypes -Wmissing-declarations -Wshadow
+CPPFLAGS+=
INCLUDES=-Iinclude
-all: snowball$(EXEEXT) libstemmer.a stemwords$(EXEEXT) $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS)
+all: snowball$(EXEEXT) libstemmer.a libstemmer.so stemwords$(EXEEXT) $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS)
+
+libstemmer.so: libstemmer/libstemmer.o $(RUNTIME_OBJECTS) $(C_LIB_OBJECTS)
+ $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname,$@.$(MAJOR_VERSION),-version-script,libstemmer/symbol.map -o $@.$(SNOWBALL_VERSION) $^
+ ln -s $@.$(SNOWBALL_VERSION) $@.$(MAJOR_VERSION)
+ ln -s $@.$(SNOWBALL_VERSION) $@
algorithms.mk: libstemmer/mkalgorithms.pl libstemmer/modules.txt
libstemmer/mkalgorithms.pl algorithms.mk libstemmer/modules.txt
diff --git a/libstemmer/symbol.map b/libstemmer/symbol.map
new file mode 100644
index 0000000..7a3d423
--- /dev/null
+++ b/libstemmer/symbol.map
@@ -0,0 +1,6 @@
+SB_STEMMER_0 {
+ global:
+ sb_stemmer_*;
+ local:
+ *;
+};
--
2.48.1

View File

@@ -0,0 +1,91 @@
SUMMARY="Snowball compiler and stemming algorithms"
DESCRIPTION="Snowball is a small string processing language for creating \
stemming algorithms for use in Information Retrieval, plus a collection of \
stemming algorithms implemented using it."
HOMEPAGE="https://github.com/snowballstem/snowball"
COPYRIGHT="2001 Dr Martin Porter
2004,2005 Richard Boulton
2013 Yoshiki Shibukawa
2006,2007,2009,2010,2011,2014-2019 Olly Betts"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/snowballstem/snowball/archive/refs/tags/v${portVersion}.tar.gz"
CHECKSUM_SHA256="80ac10ce40dc4fcfbfed8d085c457b5613da0e86a73611a3d5527d044a142d60"
SOURCE_DIR="snowball-$portVersion"
srcGitRev_2="c87231db9e26e7fbc524b7000d720fc882a5dc80"
SOURCE_URI_2="https://github.com/snowballstem/snowball-data/archive/$srcGitRev_2.tar.gz"
CHECKSUM_SHA256_2="56fb9157ba03d2a600b81af33632acde6bd75986fad1da6b4ea3fad7256b3faa"
PATCHES="snowball_stemmer3-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
snowball_stemmer3$secondaryArchSuffix = $portVersion
cmd:snowball$secondaryArchSuffix = portVersion compat >= 3
cmd:stemwords$secondaryArchSuffix = portVersion compat >= 3
lib:libstemmer$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
snowball_stemmer3${secondaryArchSuffix}_devel = portVersion
devel:libstemmer$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
snowball_stemmer3$secondaryArchSuffix == $portVersion base
"
CONFLICTS_devel="
snowball_stemmer${secondaryArchSuffix}_devel
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:perl
"
defineDebugInfoPackage snowball_stemmer3$secondaryArchSuffix \
$libDir/libstemmer.so.$libVersion
TEST_REQUIRES="
cmd:diff
"
BUILD()
{
make $jobArgs
}
INSTALL()
{
install -d $binDir $libDir $includeDir
install snowball stemwords $binDir
install include/libstemmer.h $includeDir
install libstemmer.so.$libVersion $libDir
ln -srf $libDir/libstemmer.so.$libVersion $libDir/libstemmer.so.3
ln -srf $libDir/libstemmer.so.$libVersion $libDir/libstemmer.so
# prepare develop/lib
prepareInstalledDevelLib libstemmer
fixPkgconfig
# devel package
packageEntries devel \
$developDir
}
TEST()
{
# check_utf8 and check_iso_8859_1 fails with error
make -j1 STEMMING_DATA="$sourceDir2/snowball-data-$srcGitRev_2" check
}