ASR_BASE

Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/package/libs/gettext-full/Makefile b/package/libs/gettext-full/Makefile
new file mode 100644
index 0000000..0a7782c
--- /dev/null
+++ b/package/libs/gettext-full/Makefile
@@ -0,0 +1,187 @@
+#
+# Copyright (C) 2006-2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=gettext-full
+PKG_VERSION:=0.22.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=gettext-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNU/gettext
+PKG_HASH:=fe10c37353213d78a5b83d48af231e005c4da84db5ce88037d88355938259640
+PKG_BUILD_DIR:=$(BUILD_DIR)/gettext-$(PKG_VERSION)
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/gettext-$(PKG_VERSION)
+
+PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
+PKG_LICENSE:=GPL-3.0-or-later
+PKG_CPE_ID:=cpe:/a:gnu:gettext
+
+PKG_INSTALL:=1
+PKG_BUILD_DEPENDS:=gettext-full/host libunistring libxml2
+PKG_BUILD_PARALLEL:=0
+
+PKG_FIXUP:=autoreconf
+
+HOST_BUILD_DEPENDS:=gperf/host libiconv-full/host libunistring/host libxml2/host
+HOST_BUILD_PARALLEL:=0
+
+PKG_SUBDIRS:= \
+	$$$$(foreach dir, \
+		intl \
+		intl-csharp \
+		intl-java \
+		its \
+		gnulib-lib \
+		gnulib-local \
+		lib \
+		$$$$(SUBDIR_libasprintf) \
+		libgettextpo \
+		libgrep \
+		libtextstyle \
+		m4 \
+		misc \
+		po \
+		projects \
+		src \
+		styles \
+		gettext-runtime \
+		gettext-tools \
+	,$$$$(wildcard $$$$(dir)) )
+
+PKG_MAKEFILES_FAKE:= \
+	gnulib-local/m4/Makefile \
+	libtextstyle/gnulib-local/Makefile \
+	libtextstyle/m4/Makefile \
+	m4/Makefile
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/host-build.mk
+
+define Package/libintl-full
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=GNU Internationalization library
+  URL:=http://www.gnu.org/software/gettext/
+  ABI_VERSION:=8
+endef
+
+export GNULIB_SRCDIR:=$(HOST_GNULIB_SRCDIR)
+
+TARGET_CFLAGS += $(FPIC)
+ifneq ($(HOST_OS),Linux)
+  TARGET_CFLAGS += -I$(STAGING_DIR_HOSTPKG)/include
+endif
+
+CONFIGURE_ARGS += \
+	--enable-shared \
+	--enable-static \
+	--disable-libasprintf \
+	--disable-rpath \
+	--enable-nls \
+	--disable-java \
+	--disable-openmp \
+	--disable-curses \
+	--with-included-gettext \
+	--without-libintl-prefix \
+	--without-libexpat-prefix \
+	--with-libunistring-prefix=$(STAGING_DIR)/usr \
+	--with-libxml2-prefix=$(STAGING_DIR) \
+	--without-emacs
+
+HOST_CONFIGURE_ARGS += \
+	--disable-shared \
+	--enable-static \
+	--disable-libasprintf \
+	--disable-rpath \
+	--disable-java \
+	--disable-openmp \
+	--without-emacs \
+	--with-libiconv-prefix=$(STAGING_DIR_HOSTPKG) \
+	--with-libunistring-prefix=$(STAGING_DIR_HOSTPKG) \
+	--with-libxml2-prefix=$(STAGING_DIR_HOSTPKG)
+
+HOST_CONFIGURE_VARS += \
+	EMACS="no" \
+
+HOST_CFLAGS += $(HOST_FPIC)
+
+define Host/Bootstrap
+	( \
+		cd $(HOST_BUILD_DIR); \
+		$(AM_TOOL_PATHS) \
+		./autogen.sh \
+	)
+endef
+
+define Host/Prepare
+	$(call Host/Prepare/Default)
+	$(if $(QUILT),,$(call Host/Bootstrap))
+endef
+
+define Host/Configure
+	$(if $(QUILT),$(call Host/Bootstrap))
+	$(call Host/Configure/Default)
+endef
+
+define Host/Compile
+	$(foreach makefile,$(PKG_MAKEFILES_FAKE),printf '%s\n%s\n' 'all:' 'install:' > $(HOST_BUILD_DIR)/$(makefile); )
+	$(call Host/Compile/Default,SUBDIRS='$(PKG_SUBDIRS)')
+endef
+
+define Build/Bootstrap
+	( \
+		cd $(PKG_BUILD_DIR); \
+		$(AM_TOOL_PATHS) \
+		./autogen.sh \
+	)
+endef
+
+define Build/Prepare
+	$(call Build/Prepare/Default)
+	$(if $(QUILT),,$(call Build/Bootstrap))
+endef
+
+define Build/Configure
+	$(if $(QUILT),$(call Build/Bootstrap))
+	$(call Build/Configure/Default)
+endef
+
+define Build/Compile
+	$(foreach makefile,$(PKG_MAKEFILES_FAKE),printf '%s\n%s\n' 'all:' 'install:' > $(PKG_BUILD_DIR)/$(makefile); )
+	$(call Build/Compile/Default,SUBDIRS='$(PKG_SUBDIRS)')
+endef
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/lib/libintl-full/include
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/libintl.h $(1)/usr/lib/libintl-full/include/
+
+	$(INSTALL_DIR) $(1)/usr/lib/libintl-full/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libintl.{a,so*} $(1)/usr/lib/libintl-full/lib/
+
+	$(INSTALL_DIR) $(1)/usr/share/aclocal
+	$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/aclocal/* $(1)/usr/share/aclocal/
+
+	$(SED) '/read dummy/d' $(STAGING_DIR_HOSTPKG)/bin/gettextize
+endef
+
+define Host/Install
+	$(call Host/Compile/Default,install SUBDIRS='$(PKG_SUBDIRS)')
+	$(LN) msgfmt $(STAGING_DIR_HOSTPKG)/bin/gmsgfmt
+endef
+
+define Build/Install
+	$(call Build/Install/Default,install SUBDIRS='$(PKG_SUBDIRS)')
+endef
+
+define Package/libintl-full/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libintl.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,libintl-full))
diff --git a/package/libs/gettext-full/patches/000-relocatable.patch b/package/libs/gettext-full/patches/000-relocatable.patch
new file mode 100644
index 0000000..a95c268
--- /dev/null
+++ b/package/libs/gettext-full/patches/000-relocatable.patch
@@ -0,0 +1,30 @@
+--- a/gettext-tools/misc/autopoint.in
++++ b/gettext-tools/misc/autopoint.in
+@@ -27,7 +27,11 @@ archive_version=@ARCHIVE_VERSION@
+ 
+ # Set variables
+ # - gettext_datadir     directory where the data files are stored.
+-prefix="@prefix@"
++if [ -n "$STAGING_DIR_HOSTPKG" ]; then
++	prefix="$STAGING_DIR_HOSTPKG"
++else
++	prefix="@prefix@"
++fi
+ datarootdir="@datarootdir@"
+ : ${gettext_datadir="@datadir@/gettext"}
+ : ${AUTOM4TE=autom4te}
+--- a/gettext-tools/misc/gettextize.in
++++ b/gettext-tools/misc/gettextize.in
+@@ -27,7 +27,11 @@ archive_version=@ARCHIVE_VERSION@
+ 
+ # Set variables
+ # - gettext_datadir     directory where the data files are stored.
+-prefix="@prefix@"
++if [ -n "$STAGING_DIR_HOSTPKG" ]; then
++	prefix="$STAGING_DIR_HOSTPKG"
++else
++	prefix="@prefix@"
++fi
+ datarootdir="@datarootdir@"
+ : ${gettext_datadir="@datadir@/gettext"}
+ : ${AUTOM4TE=autom4te}
diff --git a/package/libs/gettext-full/patches/001-autotools.patch b/package/libs/gettext-full/patches/001-autotools.patch
new file mode 100644
index 0000000..7e1f005
--- /dev/null
+++ b/package/libs/gettext-full/patches/001-autotools.patch
@@ -0,0 +1,24 @@
+--- a/gettext-runtime/man/Makefile.am
++++ b/gettext-runtime/man/Makefile.am
+@@ -176,8 +176,7 @@ textdomain.3.html: textdomain.3.in
+ bindtextdomain.3.html: bindtextdomain.3.in
+ bind_textdomain_codeset.3.html: bind_textdomain_codeset.3.in
+ 
+-install-html-local:
+-	$(MKDIR_P) $(DESTDIR)$(htmldir)
++install-html: installdirs-html
+ 	for file in $(man_HTML); do \
+ 	  if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
+ 	  $(INSTALL_DATA) $$dir/$$file $(DESTDIR)$(htmldir)/$$file; \
+--- a/gettext-tools/man/Makefile.am
++++ b/gettext-tools/man/Makefile.am
+@@ -158,8 +158,7 @@ recode-sr-latin.1.html: recode-sr-latin.
+ gettextize.1.html: gettextize.1
+ autopoint.1.html: autopoint.1
+ 
+-install-html-local:
+-	$(MKDIR_P) $(DESTDIR)$(htmldir)
++install-html: installdirs-html
+ 	for file in $(man_HTML); do \
+ 	  if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
+ 	  $(INSTALL_DATA) $$dir/$$file $(DESTDIR)$(htmldir)/$$file; \
diff --git a/package/libs/gettext-full/patches/100-libxml-no-force-included.patch b/package/libs/gettext-full/patches/100-libxml-no-force-included.patch
new file mode 100644
index 0000000..af5c0a4
--- /dev/null
+++ b/package/libs/gettext-full/patches/100-libxml-no-force-included.patch
@@ -0,0 +1,31 @@
+--- a/libtextstyle/gnulib-local/modules/libxml.diff
++++ /dev/null
+@@ -1,28 +0,0 @@
+-*** libxml.orig	2018-10-28 14:37:07.007164889 +0100
+---- libxml	2019-02-14 22:19:29.994771110 +0100
+-***************
+-*** 118,124 ****
+-  fabs
+-  
+-  configure.ac:
+-! gl_LIBXML
+-  
+-  Makefile.am:
+-  if INCLUDED_LIBXML
+---- 118,133 ----
+-  fabs
+-  
+-  configure.ac:
+-! # In libtextstyle, we don't want to use an external libxml, because its
+-! # dependencies and their dynamic relocations have an impact on the startup
+-! # time of a program that is linked with it. As you can see by using
+-! # 'readelf -r ... | wc -l' and 'readelf -d ... | grep NEEDED':
+-! # - libxml2.so has more than 3300 relocations and depends on libicuuc.
+-! #   - libicuuc.so has more than 4900 relocations and depends on libstdc++.
+-! #     - libstdc++.so has more than 4600 relocations.
+-! # These are more than 12800 relocations, to perform at program startup.
+-! # So, force the use of the included libxml part.
+-! gl_LIBXML([yes])
+-  
+-  Makefile.am:
+-  if INCLUDED_LIBXML
diff --git a/package/libs/gettext-full/patches/200-libunistring-missing-link.patch b/package/libs/gettext-full/patches/200-libunistring-missing-link.patch
new file mode 100644
index 0000000..19a1ae1
--- /dev/null
+++ b/package/libs/gettext-full/patches/200-libunistring-missing-link.patch
@@ -0,0 +1,21 @@
+--- a/autogen.sh
++++ b/autogen.sh
+@@ -81,6 +81,7 @@ if ! $skip_gnulib; then
+     getopt-gnu
+     gettext-h
+     havelib
++    libunistring-optional
+     memmove
+     noreturn
+     progname
+--- a/gettext-runtime/src/Makefile.am
++++ b/gettext-runtime/src/Makefile.am
+@@ -43,7 +43,7 @@ envsubst_SOURCES = envsubst.c
+ 
+ # Link dependencies.
+ # Need @LTLIBICONV@ because striconv.c uses iconv().
+-LDADD = ../gnulib-lib/libgrt.a @LTLIBINTL@ @LTLIBICONV@ $(WOE32_LDADD)
++LDADD = ../gnulib-lib/libgrt.a $(LTLIBUNISTRING) @LTLIBINTL@ @LTLIBICONV@ $(WOE32_LDADD)
+ 
+ # Specify installation directory, for --enable-relocatable.
+ gettext_CFLAGS = -DINSTALLDIR=\"$(bindir)\"