Add sound support to flite (#1573)
authorFlorian Fainelli <florian@openwrt.org>
Tue, 10 Apr 2007 10:31:36 +0000 (10:31 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Tue, 10 Apr 2007 10:31:36 +0000 (10:31 +0000)
SVN-Revision: 6918

sound/flite/Makefile
sound/flite/patches/100-shared_libs [new file with mode: 0644]

index cdbfe96b89a9b0610c5f3f6ab92b59a44299dcbe..481fadd0c2ffa200119d947885e2c057bc02b3a8 100644 (file)
@@ -14,7 +14,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.speech.cs.cmu.edu/flite/packed/flite-1.3/
 PKG_MD5SUM:=ae0aca1cb7b4801f4372f3a75a9e52b5
 PKG_CAT:=zcat
-
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 
 include $(INCLUDE_DIR)/package.mk
@@ -31,17 +31,40 @@ endef
 
 define Build/Configure
        $(call Build/Configure/Default, \
+               --enable-shared \
                --with-audio="oss" \
+               --with-vox="cmu_us_kal16" \
+               --prefix="$(PKG_INSTALL_DIR)/usr" \
+               --exec-prefix="$(PKG_INSTALL_DIR)/usr" \
+               --bindir="$(PKG_INSTALL_DIR)/usr/bin" \
        )
 endef
 
 define Build/Compile
-    $(MAKE) -C $(PKG_BUILD_DIR)
+       rm -rf $(PKG_INSTALL_DIR)
+       mkdir -p $(PKG_INSTALL_DIR)
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Build/InstallDev
+       mkdir -p $(STAGING_DIR)/usr/include/flite
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/flite/{cst,flite}*.h $(STAGING_DIR)/usr/include/flite/
+       mkdir -p $(STAGING_DIR)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libflite*.so.* $(STAGING_DIR)/usr/lib/
+endef
+       
+define Build/UninstallDev
+       rm -rf  $(STAGING_DIR)/usr/include/flite/{cst,flite}*.h \
+               $(STAGING_DIR)/usr/lib/libflite*.so.*
 endef
 
 define Package/flite/install
-       $(INSTALL_DIR) $(1)/usr/bin/
-       $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/flite $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/flite $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libflite*.so.* $(1)/usr/lib/
 endef
 
 $(eval $(call BuildPackage,flite))
diff --git a/sound/flite/patches/100-shared_libs b/sound/flite/patches/100-shared_libs
new file mode 100644 (file)
index 0000000..2137b40
--- /dev/null
@@ -0,0 +1,170 @@
+diff -uNr flite-1.3-release/config/common_make_rules flite-1.3-release-mod/config/common_make_rules
+--- flite-1.3-release/config/common_make_rules 2004-12-20 00:20:43.000000000 +0200
++++ flite-1.3-release-mod/config/common_make_rules     2006-11-12 12:17:25.000000000 +0200
+@@ -59,27 +59,35 @@
+ 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
+-LDFLAGS += -L$(BUILDDIR)/lib -lflite -lm $(AUDIOLIBS) $(OTHERLIBS)
++ifdef SHFLAGS
++FLITELIBS = $(LIBDIR)/libflite.so
++LDFLAGS += -L$(LIBDIR) -lflite $(OTHERLIBS)
++else
++FLITELIBS = $(LIBDIR)/libflite.a
++LDFLAGS += -L$(LIBDIR) -lflite -lm $(AUDIOLIBS) $(OTHERLIBS)
++endif
+ FULLOBJS = $(OBJS:%=$(OBJDIR)/%)
+ ifdef SHFLAGS
+ SOOBJS = $(OBJS:.o=.os)
+-FULLSHOBJS = $(SOOBJS:%=$(OBJDIR)/%)
++FULLSOOBJS = $(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)
+@@ -117,14 +125,14 @@
+       @ touch $(OBJDIR)/.build_so
+ # Used in the lib/ directory and in building new voices
+-$(OBJDIR)/%.so: %.shared.a
++%.so: %.shared.a
+       @ echo making $@
+       @ rm -rf shared_os && mkdir shared_os
+-      @ rm -f $@ $(LIBDIR)/$@.${PROJECT_VERSION} $(LIBDIR)/$@.${PROJECT_SHLIB_VERSION} 
++      @ rm -f $@ $@.${PROJECT_VERSION} $@.${PROJECT_SHLIB_VERSION} 
+       @ (cd shared_os && ar x ../$<)
+-      @ (cd shared_os && $(CC) -shared -Wl,-soname,$@.${PROJECT_SHLIB_VERSION} -o ../$@.${PROJECT_VERSION} *.os)
+-      @ ln -s $(LIBDIR)/$@.${PROJECT_VERSION} $(LIBDIR)/$@.${PROJECT_SHLIB_VERSION}
+-      @ ln -s $(LIBDIR)/$@.${PROJECT_SHLIB_VERSION} $(LIBDIR)/$@
++      @ (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:
+diff -uNr flite-1.3-release/lib/Makefile flite-1.3-release-mod/lib/Makefile
+--- flite-1.3-release/lib/Makefile     1970-01-01 02:00:00.000000000 +0200
++++ flite-1.3-release-mod/lib/Makefile 2006-11-12 12:17:40.000000000 +0200
+@@ -0,0 +1,73 @@
++###########################################################################
++##                                                                       ##
++##                  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_us_kal flite_cmu_us_kal16 flite_cmu_time_awb
++
++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_us_kal_LDLIBS = -lflite_cmulex -lflite_usenglish
++libflite_cmu_us_kal16_LDLIBS = -lflite_cmulex -lflite_usenglish
++libflite_cmu_time_awb_LDLIBS = -lflite -lflite_cmulex -lflite_usenglish
++else
++shared_libs: nothing
++endif
++
++install:
++      @ tar cvf - $(ALL_LIBS) | ( cd $(INSTALLLIBDIR) && tar xf -)
++
+diff -uNr flite-1.3-release/main/Makefile flite-1.3-release-mod/main/Makefile
+--- flite-1.3-release/main/Makefile    2005-08-08 00:38:42.000000000 +0200
++++ flite-1.3-release-mod/main/Makefile        2006-11-12 11:44:46.000000000 +0200
+@@ -50,11 +50,11 @@
+ flite_LIBS = flite_$(FL_VOX) flite_$(FL_LANG) flite_$(FL_LEX) 
+ flite_LIBS_flags = -L$(LIBDIR) $(flite_LIBS:%=-l%)
+-flite_LIBS_deps = $(flite_LIBS:%=$(LIBDIR)/lib%.a)
++flite_LIBS_deps = $(flite_LIBS:%=$(LIBDIR)/lib%.so)
+ flite_time_LIBS = flite_cmu_time_awb flite_$(FL_LANG) flite_$(FL_LEX)
+ 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)
+ include $(TOP)/config/common_make_rules
+diff -uNr flite-1.3-release/Makefile flite-1.3-release-mod/Makefile
+--- flite-1.3-release/Makefile 2005-11-01 15:40:45.000000000 +0200
++++ flite-1.3-release-mod/Makefile     2006-11-12 11:44:46.000000000 +0200
+@@ -41,7 +41,7 @@
+ ###########################################################################
+ TOP=.
+ DIRNAME=
+-BUILD_DIRS = include src lang doc
++BUILD_DIRS = include src lang lib
+ ALL_DIRS=config $(BUILD_DIRS) testsuite sapi palm tools main
+ CONFIG=configure configure.in config.sub config.guess \
+        missing install-sh mkinstalldirs