aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormi <mi@FreeBSD.org>2014-12-02 15:01:40 +0800
committermi <mi@FreeBSD.org>2014-12-02 15:01:40 +0800
commit6485991e610169303aca8e3b8091c2a0ddc2e20f (patch)
treecb1c77ce424a23ce66af033ed848939d97e8ed92
parent1fa2b587049d16850c8563301908da6064060e38 (diff)
downloadfreebsd-ports-gnome-6485991e610169303aca8e3b8091c2a0ddc2e20f.tar.gz
freebsd-ports-gnome-6485991e610169303aca8e3b8091c2a0ddc2e20f.tar.zst
freebsd-ports-gnome-6485991e610169303aca8e3b8091c2a0ddc2e20f.zip
Fix the ancient problem, where we replaced Linux' "cp -pd" with
simple "cp -p". This caused symbolic links (like libFOO.so -> libFOO.so.X.Y) to be dereferenced installing three copies of each library instead of one. Strip the executables and the shared libraries after staging. Fix the authors' makefiles to allow parallel building. Add a patch which allows us to replace the multitude of flite_VOICE-executables (one for each voice) with sym-links to the single flite itself. The size of the package shrunk from 100Mb to 50Mb here (amd64) as the result of the above measures. Bump PORTREVISION. Note: the new patches are deliberately organized by feature rather than by the patched files -- to make it easier to refer the upstream maintainers to them.
-rw-r--r--audio/flite/Makefile6
-rw-r--r--audio/flite/files/patch-parallel-build155
-rw-r--r--audio/flite/files/patch-single-exe66
3 files changed, 224 insertions, 3 deletions
diff --git a/audio/flite/Makefile b/audio/flite/Makefile
index 60f3d1ee584c..d032caf9395d 100644
--- a/audio/flite/Makefile
+++ b/audio/flite/Makefile
@@ -3,6 +3,7 @@
PORTNAME= flite
PORTVERSION= 1.4
+PORTREVISION= 1
CATEGORIES= audio
MASTER_SITES= http://www.speech.cs.cmu.edu/flite/packed/${PORTNAME}-${PORTVERSION}/
DISTNAME= ${PORTNAME}-${PORTVERSION}-release
@@ -17,13 +18,12 @@ GNU_CONFIGURE= yes
CONFIGURE_ARGS= --enable-shared=yes
USE_LDCONFIG= yes
-MAKE_JOBS_UNSAFE= yes
-
post-patch:
- @${REINPLACE_CMD} -e 's|-pd|-p|g' ${WRKSRC}/main/Makefile
+ @${REINPLACE_CMD} -e 's|-pd|-pR|g' ${WRKSRC}/main/Makefile
post-install:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/README ${STAGEDIR}${DOCSDIR}
+ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/* ${STAGEDIR}${PREFIX}/lib/*.so
.include <bsd.port.mk>
diff --git a/audio/flite/files/patch-parallel-build b/audio/flite/files/patch-parallel-build
new file mode 100644
index 000000000000..76af9b66651e
--- /dev/null
+++ b/audio/flite/files/patch-parallel-build
@@ -0,0 +1,155 @@
+Allow parallel builds:
+
+ 1. First, modify make_voice_list script to accept the
+ output file (defaulting to flite_voice_list.c as before).
+ 2. Use a per-library subdirectory to build shared objecs from
+ the .shared.a-counterparts -- using the same shared_os/
+ was causing conflicts, when multiple such libraries were
+ built in parallel.
+ 3. Use the new feature of make_voice_list (see 1.) to build
+ separate voice-list files for each voice, thus avoiding
+ the last sort of conflicts.
+
+This also removes linking unnecessary libraries into flite_VOICE
+executables -- only the library providing the particular voice is used
+now.
+
+ -mi
+
+--- tools/make_voice_list 2009-04-08 09:18:42.000000000 -0400
++++ tools/make_voice_list 2014-12-01 19:39:40.000000000 -0500
+@@ -36,26 +36,38 @@
+ ###########################################################################
+
+-rm -f flite_voice_list.c
++case "$1" in
++-o)
++ output=$2
++ shift 2
++ ;;
++*)
++ output=flite_voice_list.c
++ ;;
++esac
++
++rm -f $output
++exec > $output
++
++cat << EOT
++/* Generated automatically from make_voice_list */
++
++#include "flite.h"
++
++EOT
+
+-echo "/* Generated automatically from make_voice_list */" >flite_voice_list.c
+-echo >>flite_voice_list.c
+-echo '#include "flite.h"' >>flite_voice_list.c
+-echo >>flite_voice_list.c
+ for i in $*
+ do
+- echo "cst_voice *register_"$i"(const char *voxdir);">>flite_voice_list.c
++ echo "cst_voice *register_"$i"(const char *voxdir);"
+ done
+
+-echo >>flite_voice_list.c
+-echo "cst_val *flite_set_voice_list(void)" >>flite_voice_list.c
+-echo "{" >>flite_voice_list.c
++echo
++echo "cst_val *flite_set_voice_list(void)"
++echo "{"
+ for i in $*
+ do
+- echo " flite_voice_list = cons_val(voice_val(register_"$i"(NULL)),flite_voice_list);" >>flite_voice_list.c
++ echo " flite_voice_list = cons_val(voice_val(register_"$i"(NULL)),flite_voice_list);"
+ done
+- echo " flite_voice_list = val_reverse(flite_voice_list);" >>flite_voice_list.c
+- echo " return flite_voice_list;" >>flite_voice_list.c
+-
+-echo "}" >>flite_voice_list.c
+-echo >>flite_voice_list.c
++ echo " flite_voice_list = val_reverse(flite_voice_list);"
++ echo " return flite_voice_list;"
+
++echo "}"
+--- config/common_make_rules 2009-07-30 10:52:56.000000000 -0400
++++ config/common_make_rules 2014-12-01 19:43:50.000000000 -0500
+@@ -121,11 +121,11 @@
+ $(LIBDIR)/%.so: $(LIBDIR)/%.shared.a
+ @ echo making $@
+- @ rm -rf shared_os && mkdir shared_os
++ @ 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 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 $@` )
+- @ rm -rf shared_os
++ @ rm -rf shared_os.$*
+
+ $(OBJDIR)/.make_build_dirs:
+--- main/Makefile 2009-08-14 17:11:07.000000000 -0400
++++ main/Makefile 2014-12-01 21:07:35.000000000 -0500
+@@ -40,5 +40,5 @@
+ ALL_DIRS=
+ SRCS = flite_main.c flite_time_main.c t2p_main.c compile_regexes.c
+-OBJS = $(SRCS:.c=.o) flite_voice_list.o
++OBJS = $(SRCS:.c=.o)
+ FILES = Makefile $(SRCS)
+ LOCAL_INCLUDES =
+@@ -47,8 +47,9 @@
+ $(BINDIR)/flite$(EXEEXT) \
+ $(BINDIR)/t2p$(EXEEXT) $(BINDIR)/compile_regexes$(EXEEXT) \
+- flite_voice_list.c each $(EXTRABINS)
++ $(EXTRABINS)
+
+ VOICES=$(VOXES)
+ VOICELIBS=$(VOICES:%=flite_%)
++VOICEEXES=$(VOICES:%=${BINDIR}/flite_%)
+
+ flite_LIBS = $(VOICELIBS) $(LANGS:%=flite_%) $(LEXES:%=flite_%) flite
+@@ -76,5 +77,4 @@
+
+ ifdef SHFLAGS
+-flite_LIBS_flags += -Wl,-rpath $(LIBDIR)
+ shared_libs: $(SHAREDLIBS)
+ else
+@@ -82,9 +82,9 @@
+ endif
+
+-$(BINDIR)/flite$(EXEEXT): flite_main.o $(flite_LIBS_deps)
++flite_voice_list.c:
+ $(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$(EXEEXT): flite_main.o flite_voice_list.c $(flite_LIBS_deps)
++ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ flite_main.o flite_voice_list.c $(flite_LIBS_flags) $(LDFLAGS)
+
+ $(BINDIR)/flite_time$(EXEEXT): flite_time_main.o $(flite_time_LIBS_deps)
+@@ -98,15 +98,12 @@
+ $(CC) $(CFLAGS) -o $@ compile_regexes.o $(FLITELIBFLAGS) $(LDFLAGS)
+
+-each:
+- @ for i in $(VOICES) ; \
+- do \
+- $(MAKE) VOICE=$$i $(BINDIR)/flite_$$i ; \
+- done
++each: ${VOICEEXES}
++
++voice_list_%.c: $(TOP)/tools/make_voice_list
++ $(TOP)/tools/make_voice_list -o $@
+
+-$(BINDIR)/flite_${VOICE}: flite_main.o $(flite_LIBS_deps)
+- $(TOP)/tools/make_voice_list $(VOICE)
+- 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_%: voice_list_%.c flite_main.o $(flite_LIBS_deps)
++ $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ flite_main.o voice_list_$*.c \
++ $(filter-out -lflite_cmu_%,${flite_LIBS_flags}) -lflite_$* $(LDFLAGS)
+
+ install:
diff --git a/audio/flite/files/patch-single-exe b/audio/flite/files/patch-single-exe
new file mode 100644
index 000000000000..e7acd1cb695f
--- /dev/null
+++ b/audio/flite/files/patch-single-exe
@@ -0,0 +1,66 @@
+This patch completely dispenses with building flite_VOICE executables
+for each voice, replacing them all with symlinks to flite itself.
+
+The flite itself will now determine the desired voice -- if not
+explicitly given on command-line -- based on the name of the invoked
+program (argv[0]).
+
+ -mi
+
+--- main/Makefile 2009-08-14 17:11:07.000000000 -0400
++++ main/Makefile 2014-12-02 01:11:35.000000000 -0500
+@@ -116,3 +113,3 @@
+ do \
+- $(INSTALL) $(BINDIR)/flite_$$i $(INSTALLBINDIR); \
++ ln -s flite $(INSTALLBINDIR)/flite_$$i; \
+ done
++++ main/flite_main.c 2014-12-02 01:05:49.000000000 -0500
+@@ -51,4 +51,18 @@
+ void cst_alloc_debug_summary();
+
++/* Return 1 if the big string ends with the small one, 0 otherwise */
++static int
++endsWith(const char *big, const char *small)
++{
++ size_t biglen, smallen;
++
++ biglen = strlen(big);
++ smallen = strlen(small);
++
++ if (smallen > biglen)
++ return 0;
++ return strcmp(big + (biglen - smallen), small) == 0;
++}
++
+ static void flite_version()
+ {
+@@ -299,6 +313,27 @@
+
+ if (filename == NULL) filename = "-"; /* stdin */
+- if (desired_voice == 0)
+- desired_voice = flite_voice_select(NULL);
++ if (desired_voice == NULL) {
++ cst_voice *voice;
++ const cst_val *val;
++ const cst_lexicon *lex;
++
++ /* Try to find the voice based on the executable filename */
++ for (val = flite_voice_list; val; val = val_cdr(val)) {
++ voice = val_voice(val_car(val));
++ /* First check the name of the voice itself: */
++ if (endsWith(argv[0], voice->name)) {
++ desired_voice = voice;
++ break;
++ }
++ /* Ok, check the name of the voice's lexicon: */
++ lex = val_lexicon(feat_val(voice->features, "lexicon"));
++ if (endsWith(argv[0], lex->name)) {
++ desired_voice = voice;
++ break;
++ }
++ }
++ if (desired_voice == NULL)
++ desired_voice = flite_voice_select(NULL);
++ }
+
+ v = desired_voice;