espeak: Compile with uClibc++
authorRosen Penev <redacted>
Sun, 13 Oct 2019 04:11:56 +0000 (21:11 -0700)
committerRosen Penev <redacted>
Mon, 14 Oct 2019 18:53:12 +0000 (11:53 -0700)
Several Makefile cleanups.

Added PKG_BUILD_PARALLEL for faster compilation.

Several size optimizations applied.

Signed-off-by: Rosen Penev <redacted>
sound/espeak/Makefile
sound/espeak/patches/.101-Fix_GCC_narrowing_conversion_errors.patch.swp [new file with mode: 0644]
sound/espeak/patches/010-uclibcxx.patch [new file with mode: 0644]

index ee4aa66627e9ce2efd5f9ec21071e3bd6a9c6628..a5c2fc6215576b3eab1cfb2010c8c146d889eb21 100644 (file)
@@ -12,20 +12,22 @@ PKG_RELEASE:=2
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-source.zip
 PKG_SOURCE_URL:=@SF/espeak
 PKG_HASH:=bf9a17673adffcc28ff7ea18764f06136547e97bbd9edf2ec612f09b207f0659
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-source
 
-PKG_LICENSE:=GPL-3.0
+PKG_MAINTAINER:=
+PKG_LICENSE:=GPL-3.0-or-later
 PKG_LICENSE_FILES:=License.txt
-PKG_MAINTAINER:=Nicolas Thill <nico@openwrt.org>
 
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-source
 PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
 
+include $(INCLUDE_DIR)/uclibc++.mk
 include $(INCLUDE_DIR)/package.mk
 
 define Package/espeak
   SECTION:=sound
   CATEGORY:=Sound
-  DEPENDS:=+libpthread +libstdcpp +portaudio
+  DEPENDS:=$(CXX_DEPENDS) +portaudio
   TITLE:=Speech synthesizer
   URL:=http://espeak.sourceforge.net/
 endef
@@ -35,23 +37,26 @@ define Package/espeak/description
  other languages.
 endef
 
+# Use system header for portaudio
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       rm $(PKG_BUILD_DIR)/src/portaudio.h
+endef
+
 MAKE_FLAGS+= \
        AUDIO="portaudio" \
        DATADIR="/usr/share/espeak" \
-       CXXFLAGS="$(TARGET_CFLAGS)" \
+       CXXFLAGS="$(TARGET_CXXFLAGS)" \
        LDFLAGS="$(TARGET_LDFLAGS)" \
 
 MAKE_PATH:=./src
 
-# Use system header for portaudio
-define Build/Prepare
-       $(call Build/Prepare/Default)
-       rm $(PKG_BUILD_DIR)/src/portaudio.h
-endef
+TARGET_CXXFLAGS += -std=c++14 -ffunction-sections -fdata-sections -flto
+TARGET_LDFLAGS += $(FPIC) $(if $(CONFIG_USE_GLIBC),-lm) -Wl,--gc-sections,--as-needed
 
 define Package/espeak/install
        $(INSTALL_DIR) $(1)/usr/bin
-       $(CP) $(PKG_INSTALL_DIR)/usr/bin/espeak $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/espeak $(1)/usr/bin/
        $(INSTALL_DIR) $(1)/usr/lib
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/libespeak.so.* $(1)/usr/lib/
        $(INSTALL_DIR) $(1)/usr/share
diff --git a/sound/espeak/patches/.101-Fix_GCC_narrowing_conversion_errors.patch.swp b/sound/espeak/patches/.101-Fix_GCC_narrowing_conversion_errors.patch.swp
new file mode 100644 (file)
index 0000000..0f1c9a1
Binary files /dev/null and b/sound/espeak/patches/.101-Fix_GCC_narrowing_conversion_errors.patch.swp differ
diff --git a/sound/espeak/patches/010-uclibcxx.patch b/sound/espeak/patches/010-uclibcxx.patch
new file mode 100644 (file)
index 0000000..f4d2f9a
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -83,15 +83,15 @@ libespeak_SOURCES = speak_lib.cpp compiledict.cpp dictionary.cpp intonation.cpp
+ SRCS1=$(speak_SOURCES)
+ OBJS1=$(patsubst %.cpp,%.o,$(SRCS1))
+-LIBS1=-lstdc++ $(LIB_AUDIO) -lpthread $(EXTRA_LIBS)
++LIBS1=$(LIB_AUDIO) -lpthread $(EXTRA_LIBS)
+ SRCS2=$(libespeak_SOURCES)
+ OBJS2=$(patsubst %.cpp,x_%.o,$(SRCS2))
+-LIBS2=-lstdc++ $(LIB_AUDIO) -lpthread
++LIBS2=$(LIB_AUDIO) -lpthread
+ SRCS3 = espeak.cpp
+ OBJS3=$(patsubst %.cpp,%.o,$(SRCS3))
+-LIBS3=-lstdc++ -L . -lespeak
++LIBS3=-L . -lespeak
+ CXXFLAGS=-O2
git clone https://git.99rst.org/PROJECT