File flite-1.4-sharedlibs.patch of Package flite

Index: config/common_make_rules
===================================================================
--- config/common_make_rules.orig
+++ config/common_make_rules
@@ -59,16 +59,21 @@ BUILDDIR=$(TOP)/build/$(TARGET_PLATFORM)
 endif
 OBJDIR=$(BUILDDIR)/obj/$(DIRNAME)
 BINDIR=$(BUILDDIR)/bin
+LIBDIR=$(BUILDDIR)/lib
 ifeq ($(HOST_PLATFORM),$(TARGET_PLATFORM))
 BINDIR=$(TOP)/bin
+LIBDIR=$(TOP)/lib
 endif
 
-LIBDIR=$(BUILDDIR)/lib
 BUILDDIRS=$(OBJDIR) $(BINDIR) $(LIBDIR)
 
-FLITELIBS = $(BUILDDIR)/lib/libflite.a
-FLITELIBFLAGS = -L$(BUILDDIR)/lib -lflite 
-LDFLAGS += -lm $(AUDIOLIBS) $(OTHERLIBS)
+ifdef SHFLAGS
+FLITELIBS = $(LIBDIR)/libflite.so
+LDFLAGS += -L$(LIBDIR) -lflite -lm $(OTHERLIBS)
+else
+FLITELIBS = $(BUILDDIR)/libflite.a
+LDFLAGS += -L$(LIBDIR) -lflite -lm $(AUDIOLIBS) $(OTHERLIBS)
+endif
 
 FULLOBJS = $(OBJS:%=$(OBJDIR)/%)
 ifdef SHFLAGS
@@ -77,10 +82,12 @@ FULLSHOBJS = $(SOOBJS:%=$(OBJDIR)/%)
 ifdef LIBNAME
 ALL += $(OBJDIR)/.build_so
 endif
-endif
+else
 ifdef LIBNAME
 ALL += $(OBJDIR)/.build_lib
 endif
+endif
+
 # Only do some directories when you are not cross compiling
 ifeq ($(HOST_PLATFORM),$(TARGET_PLATFORM))
 OTHER_BUILD_DIRS = $(HOST_ONLY_DIRS)
@@ -118,14 +125,14 @@ $(OBJDIR)/.build_so: $(FULLSHOBJS)
 	@ touch $(OBJDIR)/.build_so
 
 # Used in the lib/ directory and in building new voices
-$(LIBDIR)/%.so: $(LIBDIR)/%.shared.a
+%.so: %.shared.a
 	@ echo making $@
 	@ rm -rf shared_os && mkdir shared_os
 	@ rm -f $@ $@.${PROJECT_VERSION} $@.${PROJECT_SHLIB_VERSION} 
 	@ (cd shared_os && ar x ../$<)
-	@ (cd shared_os && $(CC) -shared -Wl,-soname,`basename $@`.${PROJECT_SHLIB_VERSION} -o ../$@.${PROJECT_VERSION} *.os)
-	@ (cd $(LIBDIR) && ln -s `basename $@.${PROJECT_VERSION}` `basename $@.${PROJECT_SHLIB_VERSION}` )
-	@ (cd $(LIBDIR) && ln -s `basename $@.${PROJECT_SHLIB_VERSION}` `basename $@` )
+	@ (cd shared_os && $(CC) -shared -Wl,-soname,$@.${PROJECT_SHLIB_VERSION} -o ../$@.${PROJECT_VERSION} *.os -L../ $($(@:%.so=%_LDLIBS)))
+	@ ln -s $@.${PROJECT_VERSION} $@.${PROJECT_SHLIB_VERSION}
+	@ ln -s $@.${PROJECT_SHLIB_VERSION} $@
 	@ rm -rf shared_os
 
 $(OBJDIR)/.make_build_dirs:
Index: lib/Makefile
===================================================================
--- /dev/null
+++ lib/Makefile
@@ -0,0 +1,78 @@
+###########################################################################
+##                                                                       ##
+##                  Language Technologies Institute                      ##
+##                     Carnegie Mellon University                        ##
+##                        Copyright (c) 1999                             ##
+##                        All Rights Reserved.                           ##
+##                                                                       ##
+##  Permission is hereby granted, free of charge, to use and distribute  ##
+##  this software and its documentation without restriction, including   ##
+##  without limitation the rights to use, copy, modify, merge, publish,  ##
+##  distribute, sublicense, and/or sell copies of this work, and to      ##
+##  permit persons to whom this work is furnished to do so, subject to   ##
+##  the following conditions:                                            ##
+##   1. The code must retain the above copyright notice, this list of    ##
+##      conditions and the following disclaimer.                         ##
+##   2. Any modifications must be clearly marked as such.                ##
+##   3. Original authors' names are not deleted.                         ##
+##   4. The authors' names are not used to endorse or promote products   ##
+##      derived from this software without specific prior written        ##
+##      permission.                                                      ##
+##                                                                       ##
+##  CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK         ##
+##  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ##
+##  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ##
+##  SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE      ##
+##  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ##
+##  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ##
+##  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ##
+##  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ##
+##  THIS SOFTWARE.                                                       ##
+##                                                                       ##
+###########################################################################
+##                                                                       ##
+##    FLITE libraries                                                    ##
+##                                                                       ##
+###########################################################################
+TOP=..
+DIRNAME=lib
+BUILD_DIRS =
+ALL_DIRS=
+FILES = Makefile
+LIBNAMES = flite flite_cmulex flite_usenglish \
+           flite_cmu_time_awb flite_cmu_us_awb \
+           flite_cmu_us_kal16 flite_cmu_us_kal \
+           flite_cmu_us_rms flite_cmu_us_slt
+
+STATICLIBS= $(LIBNAMES:%=lib%.a)
+SHAREDARLIBS= $(LIBNAMES:%=lib%.shared.a)
+#SHAREDLIBS = $(LIBNAMES:%=lib%.so)
+SHAREDLIBS = $(SHAREDARLIBS:%.shared.a=%.so)
+VERSIONSHAREDLIBS = $(SHAREDLIBS:%=%.${PROJECT_VERSION}) \
+                    $(SHAREDLIBS:%=%.${PROJECT_SHLIB_VERSION})
+ALL_LIBS = $(SHAREDLIBS) $(VERSIONSHAREDLIBS)
+
+ALL = shared_libs
+
+LOCAL_CLEAN=*.a *.so *.so.${PROJECT_VERSION} *.so.${PROJECT_SHLIB_VERSION}
+
+include $(TOP)/config/common_make_rules
+
+ifdef SHFLAGS
+shared_libs: $(SHAREDLIBS)
+libflite_LDLIBS = -lm $(AUDIOLIBS)
+libflite_cmulex_LDLIBS = -lflite
+libflite_usenglish_LDLIBS = -lflite
+libflite_cmu_time_awb_LDLIBS = -lflite -lflite_cmulex -lflite_usenglish
+libflite_cmu_us_awb_LDLIBS = -lflite_cmulex -lflite_usenglish
+libflite_cmu_us_kal_LDLIBS = -lflite_cmulex -lflite_usenglish
+libflite_cmu_us_kal16_LDLIBS = -lflite_cmulex -lflite_usenglish
+libflite_cmu_us_rms_LDLIBS = -lflite_cmulex -lflite_usenglish
+libflite_cmu_us_slt_LDLIBS = -lflite_cmulex -lflite_usenglish
+else
+shared_libs: nothing
+endif
+
+install:
+	@ tar cvf - $(ALL_LIBS) | ( cd $(INSTALLLIBDIR) && tar xf -)
+
Index: main/Makefile
===================================================================
--- main/Makefile.orig
+++ main/Makefile
@@ -52,9 +52,8 @@ VOICES=$(VOXES)
 VOICELIBS=$(VOICES:%=flite_%)
 
 flite_LIBS = $(VOICELIBS) $(LANGS:%=flite_%) $(LEXES:%=flite_%) flite
-
 flite_LIBS_flags = -L$(LIBDIR) $(flite_LIBS:%=-l%)
-flite_LIBS_deps = $(flite_LIBS:%=$(LIBDIR)/lib%.a)
+flite_LIBS_deps = $(flite_LIBS:%=$(LIBDIR)/lib%.so)
 
 include $(TOP)/config/common_make_rules
 
@@ -67,7 +66,7 @@ VERSIONSHAREDLIBS = $(SHAREDLIBS:%=%.${P
 
 flite_time_LIBS = flite_cmu_time_awb flite_usenglish flite_cmulex
 flite_time_LIBS_flags = -L$(LIBDIR) $(flite_time_LIBS:%=-l%)
-flite_time_LIBS_deps = $(flite_time_LIBS:%=$(LIBDIR)/lib%.a)
+flite_time_LIBS_deps = $(flite_time_LIBS:%=$(LIBDIR)/lib%.so)
 
 LOCAL_CLEAN = $(BINDIR)/flite$(EXEEXT) $(BINDIR)/flite_time$(EXEEXT) \
               $(BINDIR)/t2p$(EXEEXT) \
@@ -75,27 +74,27 @@ LOCAL_CLEAN = $(BINDIR)/flite$(EXEEXT) $
               $(flite_LIBS_deps) $(VOICES:%=$(BINDIR)/flite_%)
 
 ifdef SHFLAGS
-flite_LIBS_flags += -Wl,-rpath $(LIBDIR) 
+#flite_LIBS_flags += -Wl,-rpath $(LIBDIR)
 shared_libs: $(SHAREDLIBS)
 else
 shared_libs: nothing
 endif
 
-$(BINDIR)/flite$(EXEEXT): flite_main.o $(flite_LIBS_deps)
+$(BINDIR)/flite$(EXEEXT): flite_main.o $(FLITELIBS) $(flite_LIBS_deps)
 	$(TOP)/tools/make_voice_list $(VOICES)
 	rm -f flite_voice_list.o
 	$(MAKE) flite_voice_list.o
 	$(CC) $(CFLAGS) -o $@ flite_main.o flite_voice_list.o $(flite_LIBS_flags) $(LDFLAGS)
 
-$(BINDIR)/flite_time$(EXEEXT): flite_time_main.o $(flite_time_LIBS_deps)
-	$(CC) $(CFLAGS) -o $@ flite_time_main.o $(flite_time_LIBS_flags) $(FLITELIBFLAGS) $(LDFLAGS) 
+$(BINDIR)/flite_time$(EXEEXT): flite_time_main.o $(FLITELIBS) $(flite_time_LIBS_deps)
+	$(CC) $(CFLAGS) -o $@ flite_time_main.o $(flite_time_LIBS_flags) $(LDFLAGS)
 
-$(BINDIR)/t2p$(EXEEXT): t2p_main.o $(flite_LIBS_deps)
+$(BINDIR)/t2p$(EXEEXT): t2p_main.o $(FLITELIBS) $(flite_LIBS_deps)
 	$(CC) $(CFLAGS) -o $@ t2p_main.o $(flite_LIBS_flags) $(LDFLAGS)
 
 
-$(BINDIR)/compile_regexes$(EXEEXT): compile_regexes.o $(FLITELIBS)
-	$(CC) $(CFLAGS) -o $@ compile_regexes.o $(FLITELIBFLAGS) $(LDFLAGS)
+$(BINDIR)/compile_regexes$(EXEEXT): compile_regexes.o $(FLITELIBS) $(flite_LIBS_deps)
+	$(CC) $(CFLAGS) -o $@ compile_regexes.o $(flite_LIBS_flags) $(LDFLAGS)
 
 each:
 	@ for i in $(VOICES) ; \
Index: Makefile
===================================================================
--- Makefile.orig
+++ Makefile
@@ -42,7 +42,7 @@
 ###########################################################################
 TOP=.
 DIRNAME=
-BUILD_DIRS = include src lang doc
+BUILD_DIRS = include src lang lib doc
 ALL_DIRS=config $(BUILD_DIRS) testsuite sapi palm wince windows tools main
 CONFIG=configure configure.in config.sub config.guess \
        missing install-sh mkinstalldirs
Index: tools/Makefile
===================================================================
--- tools/Makefile.orig
+++ tools/Makefile
@@ -61,10 +61,10 @@ include $(TOP)/config/common_make_rules
 
 LOCAL_CLEAN = $(BINDIR)/find_sts $(BINDIR)/flite_sort
 
-$(BINDIR)/find_sts: find_sts_main.o $(FLITELIBS) 
-	$(CC) $(CFLAGS) -o $@ find_sts_main.o $(FLITELIBFLAGS) $(LDFLAGS)
-$(BINDIR)/flite_sort: flite_sort_main.o $(FLITELIBS)
-	$(CC) $(CFLAGS) -o $@ flite_sort_main.o $(FLITELIBFLAGS) $(LDFLAGS)
+$(BINDIR)/find_sts: find_sts_main.o $(FLITELIBS) $(flite_LIBS_deps)
+	$(CC) $(CFLAGS) -o $@ find_sts_main.o $(flite_LIBS_flags) $(LDFLAGS)
+$(BINDIR)/flite_sort: flite_sort_main.o $(FLITELIBS) $(flite_LIBS_deps)
+	$(CC) $(CFLAGS) -o $@ flite_sort_main.o $(flite_LIBS_flags) $(LDFLAGS)
 makescripts:
 	@ cp -p $(SCRIPTS) $(TOP)/bin
 
openSUSE Build Service is sponsored by