From f13cb02bd6df1eccc7271706c84d43ef0cefdaf9 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sat, 2 Feb 2019 17:37:08 +0000
Subject: libstemmer: initial inclusion. dep of appstream-glib

---
 abs/extra/libstemmer/PKGBUILD         | 55 +++++++++++++++++++++++++++++++++++
 abs/extra/libstemmer/dynamiclib.patch | 39 +++++++++++++++++++++++++
 2 files changed, 94 insertions(+)
 create mode 100644 abs/extra/libstemmer/PKGBUILD
 create mode 100644 abs/extra/libstemmer/dynamiclib.patch

diff --git a/abs/extra/libstemmer/PKGBUILD b/abs/extra/libstemmer/PKGBUILD
new file mode 100644
index 0000000..ccee9fd
--- /dev/null
+++ b/abs/extra/libstemmer/PKGBUILD
@@ -0,0 +1,55 @@
+# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
+
+pkgbase=snowball
+pkgname=(snowball libstemmer)
+pkgver=0+337
+pkgrel=3
+pkgdesc="String processing language for creating stemming algorithms"
+arch=(x86_64)
+url="http://snowballstem.org/"
+license=(BSD)
+depends=(glibc)
+makedepends=(git)
+_commit=fc2adaa96b0561506e6c1a80d73de7f4e0fa9663
+source=("git+https://github.com/snowballstem/snowball#commit=$_commit"
+        dynamiclib.patch)
+sha256sums=('SKIP'
+            '99511a11cdeeb1ef1eaa9d7b777f6934693d4696ba9523de40b886f7d898058e')
+
+prepare() {
+  cd $pkgbase
+  patch -Np1 -i ../dynamiclib.patch
+}
+
+pkgver() {
+  cd $pkgbase
+  echo "0+$(git rev-list --count HEAD)"
+}
+
+build() {
+  cd $pkgbase
+  make
+}
+
+check() {
+  cd $pkgbase
+  # Disabled - needs external test data
+  #make check
+}
+
+package_snowball() {
+  cd $pkgbase
+  install -d "$pkgdir/usr/bin"
+  install -t "$pkgdir/usr/bin" snowball stemwords
+  install -Dm644 COPYING "$pkgdir/usr/share/licenses/snowball/LICENSE"
+}
+
+package_libstemmer() {
+  pkgdesc="Stemming library supporting several languages"
+  cd $pkgbase
+  install -Dm644 {.,"$pkgdir"/usr}/include/libstemmer.h
+  install -D {.,"$pkgdir"/usr/lib}/libstemmer.so.0.0.0
+  ln -s libstemmer.so.0.0.0 "$pkgdir/usr/lib/libstemmer.so.0"
+  ln -s libstemmer.so.0 "$pkgdir/usr/lib/libstemmer.so"
+  install -Dm644 COPYING "$pkgdir/usr/share/licenses/libstemmer/LICENSE"
+}
diff --git a/abs/extra/libstemmer/dynamiclib.patch b/abs/extra/libstemmer/dynamiclib.patch
new file mode 100644
index 0000000..7d86cde
--- /dev/null
+++ b/abs/extra/libstemmer/dynamiclib.patch
@@ -0,0 +1,39 @@
+diff --git c/GNUmakefile i/GNUmakefile
+index 1693f5a..b33a42e 100644
+--- c/GNUmakefile
++++ i/GNUmakefile
+@@ -112,10 +112,10 @@ C_OTHER_OBJECTS = $(C_OTHER_SOURCES:.c=.o)
+ JAVA_CLASSES = $(JAVA_SOURCES:.java=.class)
+ JAVA_RUNTIME_CLASSES=$(JAVARUNTIME_SOURCES:.java=.class)
+ 
+-CFLAGS=-O2 -W -Wall -Wmissing-prototypes -Wmissing-declarations
++CFLAGS=-O2 -fPIC -W -Wall -Wmissing-prototypes -Wmissing-declarations
+ CPPFLAGS=-Iinclude
+ 
+-all: snowball libstemmer.o stemwords $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS)
++all: snowball libstemmer.o libstemmer.so stemwords $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS)
+ 
+ clean:
+ 	rm -f $(COMPILER_OBJECTS) $(RUNTIME_OBJECTS) \
+@@ -158,6 +158,9 @@ libstemmer/libstemmer.o: libstemmer/modules.h $(C_LIB_HEADERS)
+ libstemmer.o: libstemmer/libstemmer.o $(RUNTIME_OBJECTS) $(C_LIB_OBJECTS)
+ 	$(AR) -cru $@ $^
+ 
++libstemmer.so: libstemmer/libstemmer.o $(RUNTIME_OBJECTS) $(C_LIB_OBJECTS)
++	$(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname,libstemmer.so.0,-version-script,libstemmer/symbol.map -o $@.0.0.0 $^
++
+ stemwords: $(STEMWORDS_OBJECTS) libstemmer.o
+ 	$(CC) -o $@ $^
+ 
+diff --git c/libstemmer/symbol.map i/libstemmer/symbol.map
+new file mode 100644
+index 0000000..7a3d423
+--- /dev/null
++++ i/libstemmer/symbol.map
+@@ -0,0 +1,6 @@
++SB_STEMMER_0 {
++    global:
++        sb_stemmer_*;
++    local:
++        *;
++};
-- 
cgit v0.12

