diff mbox series

[v2] package/cups-filters: fix build without NLS

Message ID 20190919034717.18806-1-unixmania@gmail.com
State Accepted
Headers show
Series [v2] package/cups-filters: fix build without NLS | expand

Commit Message

Carlos Santos Sept. 19, 2019, 3:47 a.m. UTC
From: Carlos Santos <unixmania@gmail.com>

texttotext must be linked to libiconv if !BR2_ENABLE_LOCALE so pull a
patch applied upstream that adds libiconv discovery via autoconf.

With this change, autoreconf requires the config.rpath and ABOUT-NLS
files which are not in v1.25.4. Add a pre-configure hook to fake them.

Fixes: https://bugs.busybox.net/show_bug.cgi?id=12031

Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
 ...otext.c-link-with-libiconv-if-needed.patch | 122 ++++++++++++++++++
 package/cups-filters/cups-filters.mk          |   8 ++
 2 files changed, 130 insertions(+)
 create mode 100644 package/cups-filters/0002-filter-texttotext.c-link-with-libiconv-if-needed.patch

Comments

Arnout Vandecappelle Sept. 21, 2019, 1:39 p.m. UTC | #1
On 19/09/2019 05:47, unixmania@gmail.com wrote:
> From: Carlos Santos <unixmania@gmail.com>
> 
> texttotext must be linked to libiconv if !BR2_ENABLE_LOCALE so pull a
> patch applied upstream that adds libiconv discovery via autoconf.
> 
> With this change, autoreconf requires the config.rpath and ABOUT-NLS
> files which are not in v1.25.4. Add a pre-configure hook to fake them.
> 
> Fixes: https://bugs.busybox.net/show_bug.cgi?id=12031
> 
> Signed-off-by: Carlos Santos <unixmania@gmail.com>

 Applied to master, thanks.

 Regards,
 Arnout
Peter Korsgaard Sept. 30, 2019, 1:30 p.m. UTC | #2
>>>>> "unixmania" == unixmania  <unixmania@gmail.com> writes:

 > From: Carlos Santos <unixmania@gmail.com>
 > texttotext must be linked to libiconv if !BR2_ENABLE_LOCALE so pull a
 > patch applied upstream that adds libiconv discovery via autoconf.

 > With this change, autoreconf requires the config.rpath and ABOUT-NLS
 > files which are not in v1.25.4. Add a pre-configure hook to fake them.

 > Fixes: https://bugs.busybox.net/show_bug.cgi?id=12031

 > Signed-off-by: Carlos Santos <unixmania@gmail.com>

Committed to 2019.02.x, 2019.05.x and 2019.08.x, thanks.
Carlos Santos Sept. 30, 2019, 2:01 p.m. UTC | #3
On Mon, Sep 30, 2019 at 10:30 AM Peter Korsgaard <peter@korsgaard.com> wrote:
>
> >>>>> "unixmania" == unixmania  <unixmania@gmail.com> writes:
>
>  > From: Carlos Santos <unixmania@gmail.com>
>  > texttotext must be linked to libiconv if !BR2_ENABLE_LOCALE so pull a
>  > patch applied upstream that adds libiconv discovery via autoconf.
>
>  > With this change, autoreconf requires the config.rpath and ABOUT-NLS
>  > files which are not in v1.25.4. Add a pre-configure hook to fake them.
>
>  > Fixes: https://bugs.busybox.net/show_bug.cgi?id=12031
>
>  > Signed-off-by: Carlos Santos <unixmania@gmail.com>
>
> Committed to 2019.02.x, 2019.05.x and 2019.08.x, thanks.
>
> --
> Bye, Peter Korsgaard

I suggest you to pull commits 811f504ecd07df35ebf95c7b228ccc6461f7e736
and 3da92264c6dd693022d06fd2500878f7f5d492c2 too.
Peter Korsgaard Sept. 30, 2019, 3:41 p.m. UTC | #4
>>>>> "Carlos" == Carlos Santos <unixmania@gmail.com> writes:

 > On Mon, Sep 30, 2019 at 10:30 AM Peter Korsgaard <peter@korsgaard.com> wrote:
 >> 
 >> >>>>> "unixmania" == unixmania  <unixmania@gmail.com> writes:
 >> 
 >> > From: Carlos Santos <unixmania@gmail.com>
 >> > texttotext must be linked to libiconv if !BR2_ENABLE_LOCALE so pull a
 >> > patch applied upstream that adds libiconv discovery via autoconf.
 >> 
 >> > With this change, autoreconf requires the config.rpath and ABOUT-NLS
 >> > files which are not in v1.25.4. Add a pre-configure hook to fake them.
 >> 
 >> > Fixes: https://bugs.busybox.net/show_bug.cgi?id=12031
 >> 
 >> > Signed-off-by: Carlos Santos <unixmania@gmail.com>
 >> 
 >> Committed to 2019.02.x, 2019.05.x and 2019.08.x, thanks.
 >> 
 >> --
 >> Bye, Peter Korsgaard

 > I suggest you to pull commits 811f504ecd07df35ebf95c7b228ccc6461f7e736
 > and 3da92264c6dd693022d06fd2500878f7f5d492c2 too.

Yes, I will get to them (handling the backports in chronological
order). Is there any specific reason to include the version bump? Is
there a changelog/release notes available?
Carlos Santos Sept. 30, 2019, 4:12 p.m. UTC | #5
On Mon, Sep 30, 2019 at 12:41 PM Peter Korsgaard <peter@korsgaard.com> wrote:
>
> >>>>> "Carlos" == Carlos Santos <unixmania@gmail.com> writes:
>
>  > On Mon, Sep 30, 2019 at 10:30 AM Peter Korsgaard <peter@korsgaard.com> wrote:
>  >>
>  >> >>>>> "unixmania" == unixmania  <unixmania@gmail.com> writes:
>  >>
>  >> > From: Carlos Santos <unixmania@gmail.com>
>  >> > texttotext must be linked to libiconv if !BR2_ENABLE_LOCALE so pull a
>  >> > patch applied upstream that adds libiconv discovery via autoconf.
>  >>
>  >> > With this change, autoreconf requires the config.rpath and ABOUT-NLS
>  >> > files which are not in v1.25.4. Add a pre-configure hook to fake them.
>  >>
>  >> > Fixes: https://bugs.busybox.net/show_bug.cgi?id=12031
>  >>
>  >> > Signed-off-by: Carlos Santos <unixmania@gmail.com>
>  >>
>  >> Committed to 2019.02.x, 2019.05.x and 2019.08.x, thanks.
>  >>
>  >> --
>  >> Bye, Peter Korsgaard
>
>  > I suggest you to pull commits 811f504ecd07df35ebf95c7b228ccc6461f7e736
>  > and 3da92264c6dd693022d06fd2500878f7f5d492c2 too.
>
> Yes, I will get to them (handling the backports in chronological
> order). Is there any specific reason to include the version bump? Is
> there a changelog/release notes available?
>
> --
> Bye, Peter Korsgaard

It includes the fixes contained in the previous two patches and make
autoreconf unnecessary, which speeds-up the build a little bit.
Peter Korsgaard Oct. 1, 2019, 6:32 a.m. UTC | #6
>>>>> "Carlos" == Carlos Santos <unixmania@gmail.com> writes:

Hi,

 > On Mon, Sep 30, 2019 at 12:41 PM Peter Korsgaard <peter@korsgaard.com> wrote:
 >> 
 >> > I suggest you to pull commits 811f504ecd07df35ebf95c7b228ccc6461f7e736
 >> > and 3da92264c6dd693022d06fd2500878f7f5d492c2 too.
 >> 
 >> Yes, I will get to them (handling the backports in chronological
 >> order). Is there any specific reason to include the version bump? Is
 >> there a changelog/release notes available?

 > It includes the fixes contained in the previous two patches and make
 > autoreconf unnecessary, which speeds-up the build a little bit.

True, but it would also require bumping the version from the 1.21 series
(2019.02.x, 2019.05.x) and 1.23 series (2019.08.x).

But I will take the braille patch (if these older versions have that
configure option).
diff mbox series

Patch

diff --git a/package/cups-filters/0002-filter-texttotext.c-link-with-libiconv-if-needed.patch b/package/cups-filters/0002-filter-texttotext.c-link-with-libiconv-if-needed.patch
new file mode 100644
index 0000000000..cace0773ae
--- /dev/null
+++ b/package/cups-filters/0002-filter-texttotext.c-link-with-libiconv-if-needed.patch
@@ -0,0 +1,122 @@ 
+From 734ef160b428c545d8c6ae16c4bfe3c036173aa4 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <unixmania@gmail.com>
+Date: Sun, 21 Jul 2019 23:54:29 -0300
+Subject: [PATCH] filter/texttotext.c: link with libiconv if needed
+
+texttotext.c uses iconv so it should link with libiconv on platforms
+where it is a separate library (e.g. uClibc-ng without built-in NLS)
+otherwise texttotext fails to link:
+
+  CCLD     texttotext
+[...]/ld: texttotext-texttotext.o: in function `main':
+texttotext.c:(.text.startup+0xde0): undefined reference to `libiconv_open'
+[...]/ld: texttotext.c:(.text.startup+0xf9d): undefined reference to `libiconv'
+[...]/ld: texttotext.c:(.text.startup+0xfd6): undefined reference to `libiconv'
+[...]/ld: texttotext.c:(.text.startup+0x16c3): undefined reference to `libiconv_close'
+
+Modify autogen.sh to call autopoint, which adds the libiconv discovery.
+It also creates a "po" skeleton but we can discard it, since it is not
+really necessary.
+
+Fixes: https://bugs.busybox.net/show_bug.cgi?id=12031
+
+Signed-off-by: Carlos Santos <unixmania@gmail.com>
+---
+ Makefile.am  |  4 +++-
+ autogen.sh   | 17 +++++++++++++++++
+ configure.ac |  6 +++++-
+ 3 files changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 72e023ed..76b81de5 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -778,7 +778,7 @@ texttotext_SOURCES = \
+ 	filter/texttotext.c
+ EXTRA_texttotext_SOURCES = filter/strcasestr.c
+ texttotext_CFLAGS = $(CUPS_CFLAGS)
+-texttotext_LDADD = $(STRCASESTR) $(CUPS_LIBS)
++texttotext_LDADD = $(STRCASESTR) $(CUPS_LIBS) $(LIBICONV)
+ texttotext_DEPENDENCIES = $(STRCASESTR)
+ 
+ pdftops_SOURCES = \
+@@ -1049,3 +1049,5 @@ if ENABLE_BRAILLE
+ 	$(RM) $(DESTDIR)$(pkgfilterdir)/vectortoubrl
+ 	$(RM) $(DESTDIR)$(pkgfilterdir)/textbrftoindexv4
+ endif
++
++SUBDIRS =
+diff --git a/autogen.sh b/autogen.sh
+index 5462a323..cd7397a9 100755
+--- a/autogen.sh
++++ b/autogen.sh
+@@ -13,11 +13,22 @@ aclocal --version > /dev/null 2> /dev/null || {
+     echo "error: aclocal not found"
+     exit 1
+ }
++
+ automake --version > /dev/null 2> /dev/null || {
+     echo "error: automake not found"
+     exit 1
+ }
+ 
++autopoint --version > /dev/null 2> /dev/null || {
++    echo "error: autopoint not found"
++    exit 1
++}
++
++gettext --version > /dev/null 2> /dev/null || {
++    echo "error: gettext not found"
++    exit 1
++}
++
+ for i in $TESTLIBTOOLIZE; do
+ 	if which $i > /dev/null 2>&1; then
+ 		LIBTOOLIZE=$i
+@@ -39,6 +50,12 @@ fi
+ 
+ rm -rf autom4te*.cache
+ 
++autopoint --force || {
++    echo "error: autopoint failed"
++    exit 1
++}
++# autopoint is for libiconv discovery; we don't want the po directory
++rm -rf po
+ $LIBTOOLIZE --force --copy || {
+     echo "error: libtoolize failed"
+     exit 1
+diff --git a/configure.ac b/configure.ac
+index 607dc17a..d5a539b6 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4])
+ m4_include([m4/ac_define_dir.m4])
+ m4_include([m4/ax_compare_version.m4])
+ m4_include([m4/basic-directories.m4])
+-AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2])
++AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2 subdir-objects])
+ AM_SILENT_RULES([yes])
+ AC_LANG([C++])
+ AC_CONFIG_HEADERS([config.h])
+@@ -54,6 +54,7 @@ AC_PROG_CC
+ AC_PROG_CXX
+ AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory])
+ AM_PROG_CC_C_O
++AM_ICONV
+ AC_PROG_CPP
+ AC_PROG_INSTALL
+ AC_PROG_LN_S
+@@ -61,6 +62,9 @@ AC_PROG_MAKE_SET
+ AC_PROG_LIBTOOL
+ PKG_PROG_PKG_CONFIG([0.20])
+ 
++AM_GNU_GETTEXT_VERSION([0.18.3])
++AM_GNU_GETTEXT([external])
++
+ # ========================================
+ # Specify the fontdir patch if not default
+ # ========================================
+-- 
+2.18.1
+
diff --git a/package/cups-filters/cups-filters.mk b/package/cups-filters/cups-filters.mk
index 5355fc019e..7f8defb2cb 100644
--- a/package/cups-filters/cups-filters.mk
+++ b/package/cups-filters/cups-filters.mk
@@ -21,6 +21,14 @@  CUPS_FILTERS_CONF_OPTS = --disable-imagefilters \
 	--with-pdftops=pdftops \
 	--with-jpeg
 
+# After 0002-filter-texttotext.c-link-with-libiconv-if-needed.patch autoreconf
+# needs config.rpath and ABOUT-NLS, which are not in v1.25.4 yet. Fake them.
+define CUPS_FILTERS_ADD_MISSING_FILE
+	touch $(@D)/config.rpath $(@D)/ABOUT-NLS
+endef
+
+CUPS_FILTERS_PRE_CONFIGURE_HOOKS = CUPS_FILTERS_ADD_MISSING_FILE
+
 ifeq ($(BR2_PACKAGE_LIBPNG),y)
 CUPS_FILTERS_CONF_OPTS += --with-png
 CUPS_FILTERS_DEPENDENCIES += libpng