[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libedit: Fix build system to use system instead of embeded functions



Package: libedit
Version: 3.1-20130712-1~exp1
Severity: normal
Tags: patch

On Fri, 2013-08-02 at 22:32:13 +0200, Guillem Jover wrote:
> On Fri, 2013-08-02 at 19:34:01 +0200, Sylvestre Ledru wrote:
> > I just uploaded in experimental a new upstream version of libedit
> > published here:
> > http://www.thrysoee.dk/editline/
> > 
> > It would be nice if you could test if your packages still behave the
> > same. I am not really worried but since it is an important package, I
> > would like confirmations.
> 
> I had just noticed that the version in experimental dropped the libbsd
> usage and started using its embedded function copies, with the
> consequence of exporting them as part of the shared library.
> 
> I'll try to send a patch, in case this does not get fixed in
> the meantime. Most probably adding to LDFLAGS the output of
> «pkg-config --libs libbsd-overlay» and to CFLAGS the output of
> «pkg-config --clags libbsd-overlay», and passing these to ./configure
> might be enough. The fix_gcc_warnings.diff patch should probably be
> dropped then too. Plus updating the symbols file.

Here's a patch that switches libedit back to use libbsd instead of
using the embedded code copies, it also fixes the build system to not
embed fgetln() and wcsdup() even if they are found on the system,
stops embedding wcsdup() when widechar support is not enabled, and to
not check for functions twice. Fixes the pkg-config file, to not make
users unnecessarily link against tinfo. Removes the obsolete patches
related to libbsd. And adds a missing symbol to the symbols file.

I could split the patch in logical pieces if you want, I just wanted
to get this out of the way for now, in case someone else was
considering taking a look.

Thanks,
Guillem
diff --git a/debian/control b/debian/control
index aed6030..d1431c5 100644
--- a/debian/control
+++ b/debian/control
@@ -4,6 +4,7 @@ Priority: standard
 Maintainer: LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>
 Uploaders: Anibal Monsalve Salazar <anibal@debian.org>, Sylvestre Ledru <sylvestre@debian.org>
 Build-Depends: dpkg-dev (>= 1.16.1~), debhelper (>= 9), dh-autoreconf,
+ pkg-config,
  groff-base, libbsd-dev (>= 0.1.3), libncurses5-dev (>= 5.9-2), bsdmainutils
 Standards-Version: 3.9.4
 Vcs-Git: git://git.debian.org/collab-maint/libedit.git
diff --git a/debian/libedit2.symbols b/debian/libedit2.symbols
index b0fc185..fc04775 100644
--- a/debian/libedit2.symbols
+++ b/debian/libedit2.symbols
@@ -77,6 +77,7 @@ libedit.so.2 libedit2 #MINVER#
  ed_tty_stop_output@Base 3.1-20130611
  ed_unassigned@Base 3.1-20130611
  el_beep@Base 2.11-20080614
+ el_cursor@Base 3.1-20130712
  el_deletestr@Base 2.11-20080614
  el_editmode@Base 3.1-20130611
  el_end@Base 2.11-20080614
@@ -166,9 +167,6 @@ libedit.so.2 libedit2 #MINVER#
  keymacro_map_str@Base 3.1-20130611
  keymacro_print@Base 3.1-20130611
  keymacro_reset@Base 3.1-20130611
- libedit_fgetln@Base 3.1-20130611
- libedit_strlcat@Base 3.1-20130611
- libedit_strlcpy@Base 3.1-20130611
  map_addfunc@Base 3.1-20130611
  map_bind@Base 3.1-20130611
  map_end@Base 3.1-20130611
@@ -179,7 +177,6 @@ libedit.so.2 libedit2 #MINVER#
  map_set_editor@Base 3.1-20130611
  max_input_history@Base 2.11-20080614
  next_history@Base 2.11-20080614
- nvis@Base 3.1-20130611
  parse__escape@Base 3.1-20130611
  parse__string@Base 3.1-20130611
  parse_cmd@Base 3.1-20130611
@@ -285,23 +282,7 @@ libedit.so.2 libedit2 #MINVER#
  sig_end@Base 3.1-20130611
  sig_init@Base 3.1-20130611
  sig_set@Base 3.1-20130611
- snvis@Base 3.1-20130611
  stifle_history@Base 2.11-20080614
- strenvisx@Base 3.1-20130611
- strnunvis@Base 3.1-20130611
- strnunvisx@Base 3.1-20130611
- strnvis@Base 3.1-20130611
- strnvisx@Base 3.1-20130611
- strsenvisx@Base 3.1-20130611
- strsnvis@Base 3.1-20130611
- strsnvisx@Base 3.1-20130611
- strsvis@Base 3.1-20130611
- strsvisx@Base 3.1-20130611
- strunvis@Base 3.1-20130611
- strunvisx@Base 3.1-20130611
- strvis@Base 3.1-20130611
- strvisx@Base 3.1-20130611
- svis@Base 3.1-20130611
  terminal__flush@Base 3.1-20130611
  terminal__putc@Base 3.1-20130611
  terminal_beep@Base 3.1-20130611
@@ -342,7 +323,6 @@ libedit.so.2 libedit2 #MINVER#
  tty_rawmode@Base 3.1-20130611
  tty_stty@Base 3.1-20130611
  unstifle_history@Base 2.11-20080614
- unvis@Base 3.1-20130611
  username_completion_function@Base 2.11-20080614
  using_history@Base 2.11-20080614
  vi_add@Base 3.1-20130611
@@ -392,7 +372,5 @@ libedit.so.2 libedit2 #MINVER#
  vi_yank@Base 3.1-20130611
  vi_yank_end@Base 3.1-20130611
  vi_zero@Base 3.1-20130611
- vis@Base 3.1-20130611
- wcsdup@Base 3.1-20130611
  where_history@Base 2.11-20080614
  write_history@Base 2.11-20080614
diff --git a/debian/patches/01-Makefile.diff b/debian/patches/01-Makefile.diff
deleted file mode 100644
index c254f86..0000000
--- a/debian/patches/01-Makefile.diff
+++ /dev/null
@@ -1,23 +0,0 @@
- 01-Makefile.diff by Neal H Walfield <neal@cs.uml.edu> and
- Gergely Nagy <algernon@debian.org>
-
- Add the necessary includes and other things to the libedit
- Makefile, so it will compile on GNU systems, with our supplied
- glue code
-
---- a/libedit/Makefile
-+++ b/libedit/Makefile
-@@ -1,6 +1,13 @@
- #	$NetBSD: Makefile,v 1.36 2007/05/28 12:06:18 tls Exp $
- #	@(#)Makefile	8.1 (Berkeley) 6/4/93
- 
-+OS!=	sh -c "case `uname -s` in GNU|GNU/*) echo GNU ;; *) uname -s ;; esac"
-+
-+.if ${OS} == GNU || ${OS} == Linux
-+CFLAGS += -include bsd/bsd.h
-+MKLINT=no
-+.endif
-+
- USE_SHLIBDIR=	yes
- 
- WARNS=	3
diff --git a/debian/patches/fix_gcc_warnings.diff b/debian/patches/fix_gcc_warnings.diff
deleted file mode 100644
index 9d4bdda..0000000
--- a/debian/patches/fix_gcc_warnings.diff
+++ /dev/null
@@ -1,43 +0,0 @@
-Description: fix warnings about deprecated headers
-Author: Steve Langasek <steve.langasek@canonical.com>
-Bug-Debian: http://bugs.debian.org/634324
-
-Index: libedit.git/src/readline.c
-===================================================================
---- libedit.git.orig/src/readline.c	2013-07-07 12:52:19.000000000 +0200
-+++ libedit.git/src/readline.c	2013-07-07 12:58:16.501284020 +0200
-@@ -47,7 +47,7 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <setjmp.h>
--#include <vis.h>
-+#include <bsd/vis.h>
- 
- #include "editline/readline.h"
- #include "el.h"
-Index: libedit.git/src/filecomplete.c
-===================================================================
---- libedit.git.orig/src/filecomplete.c	2013-07-07 12:52:19.000000000 +0200
-+++ libedit.git/src/filecomplete.c	2013-07-07 12:58:34.625283913 +0200
-@@ -47,7 +47,7 @@
- #include <limits.h>
- #include <errno.h>
- #include <fcntl.h>
--#include <vis.h>
-+#include <bsd/vis.h>
- 
- #include "el.h"
- #include "fcns.h"		/* for EL_NUM_FCNS */
-Index: libedit.git/src/history.c
-===================================================================
---- libedit.git.orig/src/history.c	2013-07-07 12:52:19.000000000 +0200
-+++ libedit.git/src/history.c	2013-07-07 12:58:31.485283932 +0200
-@@ -50,7 +50,7 @@
- #include <string.h>
- #include <stdlib.h>
- #include <stdarg.h>
--#include <vis.h>
-+#include <bsd/vis.h>
- #include <sys/stat.h>
- 
- static const char hist_cookie[] = "_HiStOrY_V2_\n";
diff --git a/debian/patches/libbsd.patch b/debian/patches/libbsd.patch
new file mode 100644
index 0000000..e41ef0e
--- /dev/null
+++ b/debian/patches/libbsd.patch
@@ -0,0 +1,101 @@
+diff --git a/configure.ac b/configure.ac
+index 5e33526..45f4358 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -61,6 +61,12 @@ AC_CHECK_LIB(tinfo, tgetent,,
+   )]
+ )
+ 
++PKG_CHECK_MODULES(LIBBSD, [libbsd-overlay],
++  [CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
++   LDFLAGS="$LDFLAGS $LIBBSD_LIBS"
++   MODULES="$MODULES libbsd"
++   AC_SUBST([MODULES])]
++)
+ 
+ ### use option --enable-widec to turn on use of wide-character support
+ EL_ENABLE_WIDEC
+@@ -108,24 +114,32 @@ AC_PROG_GCC_TRADITIONAL
+ #AC_FUNC_REALLOC
+ AC_TYPE_SIGNAL
+ AC_FUNC_STAT
+-AC_CHECK_FUNCS([endpwent isascii memchr memset re_comp regcomp strcasecmp strchr strcspn strdup strerror strrchr strstr strtol issetugid wcsdup strlcpy strlcat fgetln vis strvis strunvis __secure_getenv secure_getenv])
++AC_CHECK_FUNCS([endpwent isascii memchr memset re_comp regcomp strcasecmp strchr strcspn strdup strerror strrchr strstr strtol issetugid __secure_getenv secure_getenv])
++
++# fgetln
++AC_CHECK_FUNCS(fgetln, found_fgetln=yes, found_fgetln=no)
++AM_CONDITIONAL(HAVE_FGETLN, [test "x$found_fgetln" = xyes])
+ 
+ # strlcpy
+-AC_CHECK_FUNC(strlcpy, found_strlcpy=yes, found_strlcpy=no)
++AC_CHECK_FUNCS(strlcpy, found_strlcpy=yes, found_strlcpy=no)
+ AM_CONDITIONAL(HAVE_STRLCPY, [test "x$found_strlcpy" = xyes])
+ 
+ # strlcat
+-AC_CHECK_FUNC(strlcat, found_strlcat=yes, found_strlcat=no)
++AC_CHECK_FUNCS(strlcat, found_strlcat=yes, found_strlcat=no)
+ AM_CONDITIONAL(HAVE_STRLCAT, [test "x$found_strlcat" = xyes])
+ 
+ # vis
+-AC_CHECK_FUNC(vis, found_vis=yes, found_vis=no)
++AC_CHECK_FUNCS(vis, found_vis=yes, found_vis=no)
+ AM_CONDITIONAL(HAVE_VIS, [test "x$found_vis" = xyes])
+ 
+ # unvis
+-AC_CHECK_FUNC(unvis, found_unvis=yes, found_unvis=no)
++AC_CHECK_FUNCS(unvis, found_unvis=yes, found_unvis=no)
+ AM_CONDITIONAL(HAVE_UNVIS, [test "x$found_unvis" = xyes])
+ 
++# wcsdup
++AC_CHECK_FUNCS(wcsdup, found_wcsdup=yes, found_wcsdup=no)
++AM_CONDITIONAL(HAVE_WCSDUP, [test "x$found_wcsdup" = xyes])
++
+ 
+ EL_GETPW_R_POSIX
+ EL_GETPW_R_DRAFT
+diff --git a/libedit.pc.in b/libedit.pc.in
+index deaaa39..1fe9cb9 100644
+--- a/libedit.pc.in
++++ b/libedit.pc.in
+@@ -6,7 +6,8 @@ includedir=@includedir@
+ Name: libedit
+ Description: command line editor library provides generic line editing, history, and tokenization functions.
+ Version: @VERSION@
+-Requires:
+-Libs: -L${libdir} -ledit @LIBS@
++Requires.private: @MODULES@
++Libs: -L${libdir} -ledit
++Libs.private: @LIBS@
+ Cflags: -I${includedir} -I${includedir}/editline
+ 
+diff --git a/src/Makefile.am b/src/Makefile.am
+index da68023..402ba74 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -39,12 +39,15 @@ CLEANFILES = $(BUILT_SOURCES)
+ lib_LTLIBRARIES    = libedit.la
+ libedit_la_SOURCES = chared.c common.c el.c emacs.c hist.c keymacro.c map.c chartype.c parse.c \
+ 							prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c \
+-							fgetln.c wcsdup.c tokenizer.c \
++							tokenizer.c \
+ 							history.c filecomplete.c readline.c chared.h el.h hist.h \
+ 							histedit.h keymacro.h map.h chartype.h parse.h prompt.h read.h refresh.h \
+ 							search.h sig.h sys.h terminal.h tty.h vis.h filecomplete.h \
+ 							editline/readline.h
+ 
++if !HAVE_FGETLN
++libedit_la_SOURCES += fgetln.c
++endif
+ if !HAVE_STRLCPY
+ libedit_la_SOURCES += strlcpy.c
+ endif
+@@ -59,6 +62,9 @@ libedit_la_SOURCES += unvis.c
+ endif
+ if WIDECHAR
+ libedit_la_SOURCES += eln.c
++if !HAVE_WCSDUP
++libedit_la_SOURCES += wcsdup.c
++endif
+ endif
+ 
+ EXTRA_DIST = makelist shlib_version
diff --git a/debian/patches/series b/debian/patches/series
index d9089ca..8c8fe39 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,5 +1,5 @@
 
 # check 20-fortify.patch
-fix_gcc_warnings.diff
 #30-change-tty-handling.patch
 update-soname.diff
+libbsd.patch

Reply to: