[geary/mjog/334-libstemmer: 3/3] build: Fix flatpak CI failing
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/334-libstemmer: 3/3] build: Fix flatpak CI failing
- Date: Tue, 15 Sep 2020 12:32:12 +0000 (UTC)
commit bc8fab036db28cf8d158ff781e44ac0498237921
Author: Michael Gratton <mike vee net>
Date: Mon Sep 14 22:43:41 2020 +1000
build: Fix flatpak CI failing
Build libstemmer as a shared library. Use current mainline since that
at least supports build system args.
Shared lib patch courtesy of Stefano Rivera <stefanor debian org>,
updated to current head.
build-aux/patches/shared-library.diff | 115 ++++++++++++++++++++++++++++++++++
org.gnome.Geary.json | 24 +++++++
org.gnome.Geary.yaml | 17 +++++
3 files changed, 156 insertions(+)
---
diff --git a/build-aux/patches/shared-library.diff b/build-aux/patches/shared-library.diff
new file mode 100644
index 000000000..9fd094e7b
--- /dev/null
+++ b/build-aux/patches/shared-library.diff
@@ -0,0 +1,115 @@
+Description: Build libstemmer as a shared library.
+Author: Stefano Rivera <stefanor debian org>
+Forwarded: http://news.gmane.org/find-root.php?message_id=%3c20110821220427.GC1738%40bach.rivera.co.za%3e
+Last-Update: 2019-10-17
+
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -154,12 +154,13 @@ JAVA_RUNTIME_CLASSES=$(JAVARUNTIME_SOURC
+ override CFLAGS += -W -Wall -Wmissing-prototypes -Wmissing-declarations
+ override CPPFLAGS += -Iinclude
+
+-all: snowball libstemmer.o stemwords $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS)
++all: snowball libstemmer.so stemwords $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS)
+
+ clean:
+ rm -f $(COMPILER_OBJECTS) $(RUNTIME_OBJECTS) \
+ $(LIBSTEMMER_OBJECTS) $(LIBSTEMMER_UTF8_OBJECTS) $(STEMWORDS_OBJECTS) snowball \
+- libstemmer.o stemwords \
++ $(wildcard libstemmer.so*) libstemmer.a \
++ stemwords \
+ libstemmer/modules.h \
+ libstemmer/modules_utf8.h \
+ $(C_LIB_SOURCES) $(C_LIB_HEADERS) $(C_LIB_OBJECTS) \
+@@ -173,7 +174,7 @@ clean:
+ libstemmer/mkinc.mak libstemmer/mkinc_utf8.mak \
+ libstemmer/libstemmer.c libstemmer/libstemmer_utf8.c \
+ algorithms.mk
+- rm -rf dist
++ rm -rf dist .shared
+ -rmdir $(c_src_dir)
+ -rmdir $(python_output_dir)
+ -rmdir $(js_output_dir)
+@@ -197,11 +198,17 @@ libstemmer/modules_utf8.h libstemmer/mki
+
+ 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 \
++ -o $@.0.0.0 ${^:%=.shared/%}
++ ln -s $@.0.0.0 $@.0
++ ln -s $@.0.0.0 $@
++ $(AR) -crs ${@:.so=.a} $^
+
+-stemwords: $(STEMWORDS_OBJECTS) libstemmer.o
++stemwords: $(STEMWORDS_OBJECTS) libstemmer.so
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
++ $(CC) $(CFLAGS) $(LDFLAGS) -g -o $@ $(STEMWORDS_OBJECTS) -L. -lstemmer
+
+ csharp_stemwords: $(CSHARP_STEMWORDS_SOURCES) $(CSHARP_RUNTIME_SOURCES) $(CSHARP_SOURCES)
+ $(MCS) -unsafe -target:exe -out:$@ $(CSHARP_STEMWORDS_SOURCES) $(CSHARP_RUNTIME_SOURCES)
$(CSHARP_SOURCES)
+@@ -241,7 +248,6 @@ $(c_src_dir)/stem_ISO_8859_2_%.c $(c_src
+ ./snowball charsets/ISO-8859-2.sbl $< -o $${o} -eprefix $${l}_ISO_8859_2_ -r ../runtime
+
+ $(c_src_dir)/stem_%.o: $(c_src_dir)/stem_%.c $(c_src_dir)/stem_%.h
+- $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+ $(java_src_dir)/%Stemmer.java: algorithms/%.sbl snowball
+ @mkdir -p $(java_src_dir)
+@@ -473,13 +479,14 @@ check_koi8r: $(KOI8_R_algorithms:%=check
+ # a sibling to this one.
+ STEMMING_DATA ?= ../snowball-data
+ STEMMING_DATA_ABS := $(abspath $(STEMMING_DATA))
++STEMWORDS=LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ./stemwords
+
+ check_utf8_%: $(STEMMING_DATA)/% stemwords
+ @echo "Checking output of `echo $<|sed 's!.*/!!'` stemmer with UTF-8"
+ @if test -f '$</voc.txt.gz' ; then \
+- gzip -dc '$</voc.txt.gz'|./stemwords -c UTF_8 -l `echo $<|sed 's!.*/!!'` -o tmp.txt; \
++ gzip -dc '$</voc.txt.gz'|$(STEMWORDS) -c UTF_8 -l `echo $<|sed 's!.*/!!'` -o tmp.txt; \
+ else \
+- ./stemwords -c UTF_8 -l `echo $<|sed 's!.*/!!'` -i $</voc.txt -o tmp.txt; \
++ $(STEMWORDS) -c UTF_8 -l `echo $<|sed 's!.*/!!'` -i $</voc.txt -o tmp.txt; \
+ fi
+ @if test -f '$</output.txt.gz' ; then \
+ gzip -dc '$</output.txt.gz'|diff -u - tmp.txt; \
+@@ -491,7 +498,7 @@ check_utf8_%: $(STEMMING_DATA)/% stemwor
+ check_iso_8859_1_%: $(STEMMING_DATA)/% stemwords
+ @echo "Checking output of `echo $<|sed 's!.*/!!'` stemmer with ISO_8859_1"
+ @$(ICONV) -fUTF8 -tISO8859-1 '$</voc.txt' |\
+- ./stemwords -c ISO_8859_1 -l `echo $<|sed 's!.*/!!'` -o tmp.txt
++ $(STEMWORDS) -c ISO_8859_1 -l `echo $<|sed 's!.*/!!'` -o tmp.txt
+ @$(ICONV) -fUTF8 -tISO8859-1 '$</output.txt' |\
+ diff -u - tmp.txt
+ @rm tmp.txt
+@@ -499,7 +506,7 @@ check_iso_8859_1_%: $(STEMMING_DATA)/% s
+ check_iso_8859_2_%: $(STEMMING_DATA)/% stemwords
+ @echo "Checking output of `echo $<|sed 's!.*/!!'` stemmer with ISO_8859_2"
+ @$(ICONV) -fUTF8 -tISO8859-2 '$</voc.txt' |\
+- ./stemwords -c ISO_8859_2 -l `echo $<|sed 's!.*/!!'` -o tmp.txt
++ $(STEMWORDS) -c ISO_8859_2 -l `echo $<|sed 's!.*/!!'` -o tmp.txt
+ @$(ICONV) -fUTF8 -tISO8859-2 '$</output.txt' |\
+ diff -u - tmp.txt
+ @rm tmp.txt
+@@ -507,7 +514,7 @@ check_iso_8859_2_%: $(STEMMING_DATA)/% s
+ check_koi8r_%: $(STEMMING_DATA)/% stemwords
+ @echo "Checking output of `echo $<|sed 's!.*/!!'` stemmer with KOI8R"
+ @$(ICONV) -fUTF8 -tKOI8-R '$</voc.txt' |\
+- ./stemwords -c KOI8_R -l `echo $<|sed 's!.*/!!'` -o tmp.txt
++ $(STEMWORDS) -c KOI8_R -l `echo $<|sed 's!.*/!!'` -o tmp.txt
+ @$(ICONV) -fUTF8 -tKOI8-R '$</output.txt' |\
+ diff -u - tmp.txt
+ @rm tmp.txt
+@@ -663,4 +670,9 @@ update_version:
+ csharp/Snowball/AssemblyInfo.cs \
+ python/setup.py
+
++%.o: %.c
++ @mkdir -p $(shell dirname ${@:%=.shared/%})
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c -fPIC -o ${@:%=.shared/%} $<
++ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
++
+ .SUFFIXES: .class .java
diff --git a/org.gnome.Geary.json b/org.gnome.Geary.json
index 99e416122..deb31456f 100644
--- a/org.gnome.Geary.json
+++ b/org.gnome.Geary.json
@@ -236,6 +236,30 @@
}
]
},
+ {
+ "name": "snowball",
+ "buildsystem": "simple",
+ "sources": [
+ {
+ "type": "git",
+ "url": "https://github.com/snowballstem/snowball.git",
+ "branch": "master"
+ },
+ {
+ "type": "patch",
+ "paths": [
+ "build-aux/patches/shared-library.diff"
+ ]
+ }
+ ],
+ "build-commands": [
+ "make libstemmer.so -j$FLATPAK_BUILDER_N_JOBS",
+ "install -Dm644 include/libstemmer.h /app/include/libstemmer.h",
+ "install -Dm644 libstemmer.so.0.0.0 /app/lib/libstemmer.so.0.0.0",
+ "ln -s libstemmer.so.0.0.0 /app/lib/libstemmer.so.0",
+ "ln -s libstemmer.so.0 /app/lib/libstemmer.so"
+ ]
+ },
{
"name": "sound-theme-freedesktop",
"sources": [
diff --git a/org.gnome.Geary.yaml b/org.gnome.Geary.yaml
index 0dd89a18d..bcdfa9029 100644
--- a/org.gnome.Geary.yaml
+++ b/org.gnome.Geary.yaml
@@ -228,6 +228,23 @@ modules:
# https://github.com/Yeraze/ytnef/issues/81 remains an issue
branch: v1.9.3
+ # Geary dependency
+ - name: snowball
+ buildsystem: simple
+ sources:
+ - type: git
+ url: https://github.com/snowballstem/snowball.git
+ branch: master
+ - type: patch
+ paths:
+ - build-aux/patches/shared-library.diff
+ build-commands:
+ - "make libstemmer.so -j$FLATPAK_BUILDER_N_JOBS"
+ - "install -Dm644 include/libstemmer.h /app/include/libstemmer.h"
+ - "install -Dm644 libstemmer.so.0.0.0 /app/lib/libstemmer.so.0.0.0"
+ - "ln -s libstemmer.so.0.0.0 /app/lib/libstemmer.so.0"
+ - "ln -s libstemmer.so.0 /app/lib/libstemmer.so"
+
# Geary dependency
- name: sound-theme-freedesktop
sources:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]