Description: Build libstemmer as a shared library. Author: Stefano Rivera Forwarded: http://news.gmane.org/find-root.php?message_id=%3c20110821220427.GC1738%40bach.rivera.co.za%3e Last-Update: 2019-10-17 Index: snowball-2.2.0/GNUmakefile =================================================================== --- snowball-2.2.0.orig/GNUmakefile +++ snowball-2.2.0/GNUmakefile @@ -175,7 +175,7 @@ ovveride_CPPFLAGS += INCLUDES=-Iinclude -all: snowball$(EXEEXT) libstemmer.a stemwords$(EXEEXT) $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS) +all: snowball$(EXEEXT) libstemmer.so stemwords$(EXEEXT) $(C_OTHER_SOURCES) $(C_OTHER_HEADERS) $(C_OTHER_OBJECTS) algorithms.mk: libstemmer/mkalgorithms.pl libstemmer/modules.txt libstemmer/mkalgorithms.pl algorithms.mk libstemmer/modules.txt @@ -183,7 +183,7 @@ algorithms.mk: libstemmer/mkalgorithms.p clean: rm -f $(COMPILER_OBJECTS) $(RUNTIME_OBJECTS) \ $(LIBSTEMMER_OBJECTS) $(LIBSTEMMER_UTF8_OBJECTS) $(STEMWORDS_OBJECTS) snowball$(EXEEXT) \ - libstemmer.a stemwords$(EXEEXT) \ + $(wildcard libstemmer.so*) libstemmer.a stemwords$(EXEEXT) \ libstemmer/modules.h \ libstemmer/modules_utf8.h \ $(C_LIB_SOURCES) $(C_LIB_HEADERS) $(C_LIB_OBJECTS) \ @@ -198,7 +198,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) @@ -222,14 +222,19 @@ libstemmer/modules_utf8.h libstemmer/mki libstemmer/libstemmer.o: libstemmer/modules.h $(C_LIB_HEADERS) -libstemmer.a: libstemmer/libstemmer.o $(RUNTIME_OBJECTS) $(C_LIB_OBJECTS) - $(AR) -cru $@ $^ +libstemmer.so: libstemmer/libstemmer.o $(RUNTIME_OBJECTS) $(C_LIB_OBJECTS) + $(CC) -shared $(LDFLAGS) \ + -Wl,--version-script=${RPM_SOURCE_DIR}/libstemmer.ver,-soname,libstemmer.so.1d \ + -o $@.1d.0.0 ${^:%=.shared/%} + ln -s $@.1d.0.0 $@.1d + ln -s $@.1d.0.0 $@ + $(AR) -crs ${@:.so=.a} $^ examples/%.o: examples/%.c $(CC) $(CFLAGS) $(INCLUDES) $(CPPFLAGS) -c -o $@ $< -stemwords$(EXEEXT): $(STEMWORDS_OBJECTS) libstemmer.a - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ +stemwords$(EXEEXT): $(STEMWORDS_OBJECTS) libstemmer.so + $(CC) $(CFLAGS) $(LDFLAGS) -g -o $@ $(STEMWORDS_OBJECTS) -L. -lstemmer tests/%.o: tests/%.c $(CC) $(CFLAGS) $(INCLUDES) $(CPPFLAGS) -c -o $@ $< @@ -275,7 +280,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) $(INCLUDES) $(CPPFLAGS) -c -o $@ $< $(java_src_dir)/%Stemmer.java: algorithms/%.sbl snowball$(EXEEXT) @mkdir -p $(java_src_dir) @@ -520,13 +524,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$(EXEEXT) check_utf8_%: $(STEMMING_DATA)/% stemwords$(EXEEXT) @echo "Checking output of `echo $<|sed 's!.*/!!'` stemmer with UTF-8" @if test -f '$