Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] lftp: new package.
  2013-11-21 15:16 [Buildroot] LFTP: a sophisticated ftp/sftp/http/fish client with few dependencies Arnaud Rébillout
@ 2013-11-21 15:16 ` Arnaud Rébillout
  2013-11-21 15:42   ` Thomas Petazzoni
  0 siblings, 1 reply; 18+ messages in thread
From: Arnaud Rébillout @ 2013-11-21 15:16 UTC (permalink / raw)
  To: buildroot

LFTP is a sophisticated ftp/http client, and a file transfer program
supporting a number of network protocols. Like BASH, it has job
control and uses the readline library for input. It has bookmarks,
a built-in mirror command, and can transfer several files in parallel.
It was designed with reliability in mind.

Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
---
 package/Config.in                               |  1 +
 package/lftp/Config.in                          | 65 ++++++++++++++++++
 package/lftp/lftp-disable-posix_fallocate.patch | 21 ++++++
 package/lftp/lftp.mk                            | 87 +++++++++++++++++++++++++
 4 files changed, 174 insertions(+)
 create mode 100644 package/lftp/Config.in
 create mode 100644 package/lftp/lftp-disable-posix_fallocate.patch
 create mode 100644 package/lftp/lftp.mk

diff --git a/package/Config.in b/package/Config.in
index 311cc6c..bcaa8f3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -814,6 +814,7 @@ source "package/iputils/Config.in"
 source "package/iw/Config.in"
 source "package/kismet/Config.in"
 source "package/knock/Config.in"
+source "package/lftp/Config.in"
 source "package/lighttpd/Config.in"
 source "package/linknx/Config.in"
 source "package/links/Config.in"
diff --git a/package/lftp/Config.in b/package/lftp/Config.in
new file mode 100644
index 0000000..93de861
--- /dev/null
+++ b/package/lftp/Config.in
@@ -0,0 +1,65 @@
+config BR2_PACKAGE_LFTP
+	bool "lftp"
+	depends on BR2_USE_WCHAR
+	depends on BR2_INSTALL_LIBSTDCPP
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_ZLIB
+	select BR2_PACKAGE_GNUTLS if !BR2_PACKAGE_OPENSSL
+	help
+	  LFTP is a sophisticated ftp/http client, and a file transfer program
+	  supporting a number of network protocols. Like BASH, it has job
+	  control and uses the readline library for input. It has bookmarks,
+	  a built-in mirror command, and can transfer several files in parallel.
+	  It was designed with reliability in mind.
+
+	  http://lftp.yar.ru/
+
+if BR2_PACKAGE_LFTP
+
+comment "Commands"
+
+config BR2_PACKAGE_LFTP_CMD_MIRROR
+	bool "Mirror command"
+	help
+	  Enable mirror command
+
+config BR2_PACKAGE_LFTP_CMD_SLEEP
+	bool "Sleep command"
+	help
+	  Enable sleep command
+
+config BR2_PACKAGE_LFTP_CMD_TORRENT
+	bool "Torrent command"
+	help
+	  Enable torren command
+
+comment "Protocols"
+
+config BR2_PACKAGE_LFTP_PROTO_FISH
+	bool "FISH protocol"
+	default y
+	help
+	  Enable FILE protocol
+
+config BR2_PACKAGE_LFTP_PROTO_FTP
+	bool "FTP protocol"
+	default y
+	help
+	  Enable FTP protocol
+
+config BR2_PACKAGE_LFTP_PROTO_HTTP
+	bool "HTTP protocol"
+	default y
+	help
+	  Enable HTTP protocol
+
+config BR2_PACKAGE_LFTP_PROTO_SFTP
+	bool "SFTP protocol"
+	default y
+	help
+	  Enable SFTP protocol
+
+endif  # BR2_PACKAGE_LFTP
+
+comment "lftp requires a toolchain w/ C++, wchar"
+	depends on !(BR2_USE_WCHAR && BR2_INSTALL_LIBSTDCPP)
diff --git a/package/lftp/lftp-disable-posix_fallocate.patch b/package/lftp/lftp-disable-posix_fallocate.patch
new file mode 100644
index 0000000..29bb780
--- /dev/null
+++ b/package/lftp/lftp-disable-posix_fallocate.patch
@@ -0,0 +1,21 @@
+diff -pruN lftp-4.4.10.orig/configure lftp-4.4.10/configure
+--- lftp-4.4.10.orig/configure	2013-10-31 15:40:04.716111900 +0100
++++ lftp-4.4.10/configure	2013-10-31 15:41:37.431445424 +0100
+@@ -48870,10 +48870,13 @@ if ${i_cv_posix_fallocate_works+:} false
+ else
+ 
+      if test "$cross_compiling" = yes; then :
+-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+-as_fn_error $? "cannot run test program while cross compiling
+-See \`config.log' for more details" "$LINENO" 5; }
++#  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++#$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++#as_fn_error $? "cannot run test program while cross compiling
++#See \`config.log' for more details" "$LINENO" 5; }
++
++# Can't test, assume it doesn't work
++i_cv_posix_fallocate_works=no
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/package/lftp/lftp.mk b/package/lftp/lftp.mk
new file mode 100644
index 0000000..1ee8e89
--- /dev/null
+++ b/package/lftp/lftp.mk
@@ -0,0 +1,87 @@
+################################################################################
+#
+# lftp
+#
+################################################################################
+
+LFTP_VERSION = 4.4.10
+LFTP_SOURCE  = lftp-$(LFTP_VERSION).tar.gz
+LFTP_SITE    = http://lftp.yar.ru/ftp
+LFTP_LICENSE = GPLv3+
+LFTP_LICENSE_FILES = COPYING
+LFTP_DEPENDENCIES  = readline zlib
+
+LFTP_CONF_OPT += --with-modules
+
+ifeq ($(BR2_PACKAGE_GNUTLS),y)
+LFTP_DEPENDENCIES += gnutls
+LFTP_CONF_OPT += --with-gnutls
+else
+LFTP_CONF_OPT += --without-gnutls
+endif
+
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+LFTP_DEPENDENCIES += openssl
+LFTP_CONF_OPT += --with-openssl
+else
+LFTP_CONF_OPT += --without-openssl
+endif
+
+# Remove /usr/share/lftp
+define LFTP_REMOVE_DATA
+        $(RM) -fr $(TARGET_DIR)/usr/share/lftp
+endef
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_DATA
+
+# Optional commands
+ifneq ($(BR2_PACKAGE_LFTP_CMD_MIRROR),y)
+define LFTP_REMOVE_CMD_MIRROR
+	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/cmd-mirror.so
+endef
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_CMD_MIRROR
+endif
+
+ifneq ($(BR2_PACKAGE_LFTP_CMD_SLEEP),y)
+define LFTP_REMOVE_CMD_SLEEP
+	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/cmd-sleep.so
+endef
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_CMD_SLEEP
+endif
+
+ifneq ($(BR2_PACKAGE_LFTP_CMD_TORRENT),y)
+define LFTP_REMOVE_CMD_TORRENT
+	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/cmd-torrent.so
+endef
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_CMD_TORRENT
+endif
+
+# Optional protocols
+ifneq ($(BR2_PACKAGE_LFTP_PROTO_FISH),y)
+define LFTP_REMOVE_PROTO_FISH
+	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/proto-fish.so
+endef
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_PROTO_FISH
+endif
+
+ifneq ($(BR2_PACKAGE_LFTP_PROTO_FTP),y)
+define LFTP_REMOVE_PROTO_FTP
+	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/proto-ftp.so
+endef
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_PROTO_FTP
+endif
+
+ifneq ($(BR2_PACKAGE_LFTP_PROTO_HTTP),y)
+define LFTP_REMOVE_PROTO_HTTP
+	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/proto-http.so
+endef
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_PROTO_HTTP
+endif
+
+ifneq ($(BR2_PACKAGE_LFTP_PROTO_SFTP),y)
+define LFTP_REMOVE_PROTO_SFTP
+	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/proto-sftp.so
+endef
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_PROTO_SFTP
+endif
+
+$(eval $(autotools-package))
-- 
1.8.4.3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-21 15:16 ` [Buildroot] [PATCH] lftp: new package Arnaud Rébillout
@ 2013-11-21 15:42   ` Thomas Petazzoni
  2013-11-21 16:17     ` Arnaud Rébillout
  2013-11-25 13:19     ` Arnaud Rébillout
  0 siblings, 2 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2013-11-21 15:42 UTC (permalink / raw)
  To: buildroot

Dear Arnaud R?billout,

On Thu, 21 Nov 2013 16:16:11 +0100, Arnaud R?billout wrote:
> LFTP is a sophisticated ftp/http client, and a file transfer program
> supporting a number of network protocols. Like BASH, it has job
> control and uses the readline library for input. It has bookmarks,
> a built-in mirror command, and can transfer several files in parallel.
> It was designed with reliability in mind.
> 
> Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>

Thanks, looks pretty good! A few comments below.


> +config BR2_PACKAGE_LFTP_CMD_TORRENT
> +	bool "Torrent command"
> +	help
> +	  Enable torren command

Typo.

> +
> +comment "Protocols"
> +
> +config BR2_PACKAGE_LFTP_PROTO_FISH
> +	bool "FISH protocol"
> +	default y
> +	help
> +	  Enable FILE protocol

FILE ? or FISH ?

> +
> +config BR2_PACKAGE_LFTP_PROTO_FTP
> +	bool "FTP protocol"
> +	default y
> +	help
> +	  Enable FTP protocol
> +
> +config BR2_PACKAGE_LFTP_PROTO_HTTP
> +	bool "HTTP protocol"
> +	default y
> +	help
> +	  Enable HTTP protocol
> +
> +config BR2_PACKAGE_LFTP_PROTO_SFTP
> +	bool "SFTP protocol"
> +	default y
> +	help
> +	  Enable SFTP protocol

Is the dependency on OpenSSL or GnuTLS always needed? Or is it only
needed if you enable SFTP or some specific protocol?

> diff --git a/package/lftp/lftp-disable-posix_fallocate.patch b/package/lftp/lftp-disable-posix_fallocate.patch
> new file mode 100644
> index 0000000..29bb780
> --- /dev/null
> +++ b/package/lftp/lftp-disable-posix_fallocate.patch
> @@ -0,0 +1,21 @@
> +diff -pruN lftp-4.4.10.orig/configure lftp-4.4.10/configure
> +--- lftp-4.4.10.orig/configure	2013-10-31 15:40:04.716111900 +0100
> ++++ lftp-4.4.10/configure	2013-10-31 15:41:37.431445424 +0100

All patches need a description + Signed-off-by.

Moreover, we typically don't patch the configure script, but the source
of it, i.e configure.in or configure.ac, and we mark the package as
<pkg>_AUTORECONF = YES.

> +@@ -48870,10 +48870,13 @@ if ${i_cv_posix_fallocate_works+:} false
> + else
> + 
> +      if test "$cross_compiling" = yes; then :
> +-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
> +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
> +-as_fn_error $? "cannot run test program while cross compiling
> +-See \`config.log' for more details" "$LINENO" 5; }
> ++#  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
> ++#$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
> ++#as_fn_error $? "cannot run test program while cross compiling
> ++#See \`config.log' for more details" "$LINENO" 5; }
> ++
> ++# Can't test, assume it doesn't work
> ++i_cv_posix_fallocate_works=no
> + else
> +   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> + /* end confdefs.h.  */

Can you detail the posix_fallocate() problem you've seen? Maybe we can
solve it in a different/nicer way.

> diff --git a/package/lftp/lftp.mk b/package/lftp/lftp.mk
> new file mode 100644
> index 0000000..1ee8e89
> --- /dev/null
> +++ b/package/lftp/lftp.mk
> @@ -0,0 +1,87 @@
> +################################################################################
> +#
> +# lftp
> +#
> +################################################################################
> +
> +LFTP_VERSION = 4.4.10
> +LFTP_SOURCE  = lftp-$(LFTP_VERSION).tar.gz

This last line is not needed, as it is the default.

> +LFTP_SITE    = http://lftp.yar.ru/ftp
> +LFTP_LICENSE = GPLv3+
> +LFTP_LICENSE_FILES = COPYING
> +LFTP_DEPENDENCIES  = readline zlib
> +
> +LFTP_CONF_OPT += --with-modules
> +
> +ifeq ($(BR2_PACKAGE_GNUTLS),y)
> +LFTP_DEPENDENCIES += gnutls
> +LFTP_CONF_OPT += --with-gnutls
> +else
> +LFTP_CONF_OPT += --without-gnutls
> +endif
> +
> +ifeq ($(BR2_PACKAGE_OPENSSL),y)
> +LFTP_DEPENDENCIES += openssl
> +LFTP_CONF_OPT += --with-openssl
> +else
> +LFTP_CONF_OPT += --without-openssl
> +endif
> +
> +# Remove /usr/share/lftp
> +define LFTP_REMOVE_DATA
> +        $(RM) -fr $(TARGET_DIR)/usr/share/lftp
> +endef
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_DATA
> +
> +# Optional commands
> +ifneq ($(BR2_PACKAGE_LFTP_CMD_MIRROR),y)
> +define LFTP_REMOVE_CMD_MIRROR
> +	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/cmd-mirror.so
> +endef
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_CMD_MIRROR
> +endif
> +
> +ifneq ($(BR2_PACKAGE_LFTP_CMD_SLEEP),y)
> +define LFTP_REMOVE_CMD_SLEEP
> +	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/cmd-sleep.so
> +endef
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_CMD_SLEEP
> +endif
> +
> +ifneq ($(BR2_PACKAGE_LFTP_CMD_TORRENT),y)
> +define LFTP_REMOVE_CMD_TORRENT
> +	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/cmd-torrent.so
> +endef
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_CMD_TORRENT
> +endif
> +
> +# Optional protocols
> +ifneq ($(BR2_PACKAGE_LFTP_PROTO_FISH),y)
> +define LFTP_REMOVE_PROTO_FISH
> +	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/proto-fish.so
> +endef
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_PROTO_FISH
> +endif
> +
> +ifneq ($(BR2_PACKAGE_LFTP_PROTO_FTP),y)
> +define LFTP_REMOVE_PROTO_FTP
> +	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/proto-ftp.so
> +endef
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_PROTO_FTP
> +endif
> +
> +ifneq ($(BR2_PACKAGE_LFTP_PROTO_HTTP),y)
> +define LFTP_REMOVE_PROTO_HTTP
> +	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/proto-http.so
> +endef
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_PROTO_HTTP
> +endif
> +
> +ifneq ($(BR2_PACKAGE_LFTP_PROTO_SFTP),y)
> +define LFTP_REMOVE_PROTO_SFTP
> +	$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/proto-sftp.so
> +endef
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_PROTO_SFTP
> +endif

I think this can be factorized in a nicer way:

LFTP_FILES_TO_REMOVE-$(BR2_PACKAGE_LFTP_CMD_MIRROR) += cmd-mirror
LFTP_FILES_TO_REMOVE-$(BR2_PACKAGE_LFTP_CMD_SLEEP) += cmd-sleep
LFTP_FILES_TO_REMOVE-$(BR2_PACKAGE_LFTP_CMD_TORRENT) += cmd-torrent
LFTP_FILES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_FISH) += proto-fish
LFTP_FILES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_FTP) += proto-ftp
LFTP_FILES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_HTTP) += proto-http
LFTP_FILES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_SFTP) += proto-sftp

define LFTP_REMOVE_FILES
	for f in $(LFTP_FILES_TO_REMOVE-y) ; do \
		$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/$$f ; \
	done
endef

LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_FILES

or in a slightly more make-style way (but maybe not so readable) :

define LFTP_REMOVE_FILES
	$(if $(LFTP_FILES_TO_REMOVE-y), \
		$(RM) -f $(addprefix $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/,$(LFTP_FILES_TO_REMOVE-y)))
endef

LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_FILES

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-21 15:42   ` Thomas Petazzoni
@ 2013-11-21 16:17     ` Arnaud Rébillout
  2013-11-21 17:12       ` Thomas Petazzoni
  2013-11-25 13:19     ` Arnaud Rébillout
  1 sibling, 1 reply; 18+ messages in thread
From: Arnaud Rébillout @ 2013-11-21 16:17 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

thanks for your comments, I'll send a second revision with everything fixed.

> Can you detail the posix_fallocate() problem you've seen? Maybe we can
> solve it in a different/nicer way.

Here is a piece of the m4 file which describes the macro 
(lftp-4.4.10/m4/lftp.m4, line 246):

> AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [Define if you have a working 
> posix_fallocate()])
> AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
>    dnl * Old glibcs have broken posix_fallocate(). Make sure not to 
> use it.
>    dnl * It may also be broken in AIX.

In order to test that, the configure script compiles and runs a piece of 
C code.

There's two problems with that.

First, the code won't compile because uClibc doesn't define 
posix_fallocate. To solve that, we can fix the m4 macro with a #define.
It's quite easy, though I don't know exactly how to do it properly.

But after that comes the second problem: the test is supposed to run 
this piece of code. How are we supposed to run cross-compiled code on 
the host ?
I can imagine it's a typical problem, but I don't know how it's supposed 
to be handled.


Regards,
Arnaud.


-- 
Arnaud R?billout
/D?veloppeur software/

SYSCOM Instruments SA,
Rue de l?Industrie 21,
1450 Ste-Croix, SUISSE
Tel : +41 (0) 24 455 44 11
Fax : +41 (0) 24 454 45 60
Visit us at www.syscom.ch <http://www.syscom.ch>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20131121/e39d8e1f/attachment.html>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-21 16:17     ` Arnaud Rébillout
@ 2013-11-21 17:12       ` Thomas Petazzoni
  2013-11-21 21:54         ` Arnout Vandecappelle
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Petazzoni @ 2013-11-21 17:12 UTC (permalink / raw)
  To: buildroot

Dear Arnaud R?billout,

On Thu, 21 Nov 2013 17:17:39 +0100, Arnaud R?billout wrote:

> thanks for your comments, I'll send a second revision with everything fixed.

Thanks!

> > Can you detail the posix_fallocate() problem you've seen? Maybe we can
> > solve it in a different/nicer way.
> 
> Here is a piece of the m4 file which describes the macro 
> (lftp-4.4.10/m4/lftp.m4, line 246):
> 
> > AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [Define if you have a working 
> > posix_fallocate()])
> > AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
> >    dnl * Old glibcs have broken posix_fallocate(). Make sure not to 
> > use it.
> >    dnl * It may also be broken in AIX.
> 
> In order to test that, the configure script compiles and runs a piece of 
> C code.
> 
> There's two problems with that.
> 
> First, the code won't compile because uClibc doesn't define 
> posix_fallocate. To solve that, we can fix the m4 macro with a #define.
> It's quite easy, though I don't know exactly how to do it properly.

Depends on the uClibc version. The official 0.9.33.2 version indeed
does not have posix_fallocate(), but we have a patch in Buildroot that
adds it. However, it is not available for uClibc-based external
toolchains, so we can't just assume posix_fallocate() is always here.

> But after that comes the second problem: the test is supposed to run 
> this piece of code. How are we supposed to run cross-compiled code on 
> the host ?
> I can imagine it's a typical problem, but I don't know how it's supposed 
> to be handled.

Yes, that's a typical problem, and of course, we cannot use configure
scripts that try to run programs compiled for the target on the build
machine.

I believe we have two solutions here:

 (1) Find the configure variable that can be passed in the configure
     environment to tell configure that posix_fallocate() is not
     available. Set it to "available" when a glibc/eglibc toolchain is
     used and "not available" when an uClibc toolchain is used.

 (2) Or, better, improve the configure test to be able to only do the
     compile test and not the execution test, and assume that if a
     posix_fallocate() program builds, then it means that it works. We
     don't use those old glibcs or AIX that have broken
     posix_fallocate().

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-21 17:12       ` Thomas Petazzoni
@ 2013-11-21 21:54         ` Arnout Vandecappelle
  2013-11-21 22:00           ` Thomas Petazzoni
  0 siblings, 1 reply; 18+ messages in thread
From: Arnout Vandecappelle @ 2013-11-21 21:54 UTC (permalink / raw)
  To: buildroot

On 21/11/13 18:12, Thomas Petazzoni wrote:
> Dear Arnaud R?billout,
>
> On Thu, 21 Nov 2013 17:17:39 +0100, Arnaud R?billout wrote:
>
[snip]
>> But after that comes the second problem: the test is supposed to run
>> this piece of code. How are we supposed to run cross-compiled code on
>> the host ?
>> I can imagine it's a typical problem, but I don't know how it's supposed
>> to be handled.
>
> Yes, that's a typical problem, and of course, we cannot use configure
> scripts that try to run programs compiled for the target on the build
> machine.
>
> I believe we have two solutions here:
>
>   (1) Find the configure variable that can be passed in the configure
>       environment to tell configure that posix_fallocate() is not
>       available. Set it to "available" when a glibc/eglibc toolchain is
>       used and "not available" when an uClibc toolchain is used.
>
>   (2) Or, better, improve the configure test to be able to only do the
>       compile test and not the execution test, and assume that if a
>       posix_fallocate() program builds, then it means that it works. We
>       don't use those old glibcs or AIX that have broken
>       posix_fallocate().

  You can give AC_TRY_RUN a fourth argument with actions to take when 
cross-compiling. These actions are taken when compilation was successful. 
Basically, the following patch should work:

----------------------------------
Fix support for cross-compilation.

The check for posix_fallocate doesn't handle the cross-compilation case. 
Assume that it works, because cross-compilation for AIX or old glibc is 
unlikely.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
diff -Nrup lftp-4.4.10.orig/m4/lftp.m4 lftp-4.4.10/m4/lftp.m4
--- lftp-4.4.10.orig/m4/lftp.m4 2013-03-19 13:25:50.000000000 +0100
+++ lftp-4.4.10/m4/lftp.m4      2013-11-21 22:46:27.776820935 +0100
@@ -271,6 +271,8 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
         i_cv_posix_fallocate_works=yes
       ], [
         i_cv_posix_fallocate_works=no
+     ], [
+       i_cv_posix_fallocate_works=yes
       ])
     ])
     if test x$i_cv_posix_fallocate_works = xyes; then
----------------------------------


  But of course I haven't tested it :-)

  If this patch is OK, can you also upstream it?

  Don't forget to add your own SOB BTW.

  Regards,
  Arnout




-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-21 21:54         ` Arnout Vandecappelle
@ 2013-11-21 22:00           ` Thomas Petazzoni
  2013-11-21 22:19             ` Arnout Vandecappelle
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Petazzoni @ 2013-11-21 22:00 UTC (permalink / raw)
  To: buildroot

Dear Arnout Vandecappelle,

On Thu, 21 Nov 2013 22:54:24 +0100, Arnout Vandecappelle wrote:

>   You can give AC_TRY_RUN a fourth argument with actions to take when 
> cross-compiling. These actions are taken when compilation was successful. 
> Basically, the following patch should work:
> 
> ----------------------------------
> Fix support for cross-compilation.
> 
> The check for posix_fallocate doesn't handle the cross-compilation case. 
> Assume that it works, because cross-compilation for AIX or old glibc is 
> unlikely.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
> diff -Nrup lftp-4.4.10.orig/m4/lftp.m4 lftp-4.4.10/m4/lftp.m4
> --- lftp-4.4.10.orig/m4/lftp.m4 2013-03-19 13:25:50.000000000 +0100
> +++ lftp-4.4.10/m4/lftp.m4      2013-11-21 22:46:27.776820935 +0100
> @@ -271,6 +271,8 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
>          i_cv_posix_fallocate_works=yes
>        ], [
>          i_cv_posix_fallocate_works=no
> +     ], [
> +       i_cv_posix_fallocate_works=yes
>        ])
>      ])
>      if test x$i_cv_posix_fallocate_works = xyes; then
> ----------------------------------

Seeing this, I believe that passing i_cv_posix_fallocate_works=yes in
the ./configure environment is a better solution.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-21 22:00           ` Thomas Petazzoni
@ 2013-11-21 22:19             ` Arnout Vandecappelle
  2013-11-22  8:15               ` Thomas Petazzoni
  0 siblings, 1 reply; 18+ messages in thread
From: Arnout Vandecappelle @ 2013-11-21 22:19 UTC (permalink / raw)
  To: buildroot

On 21/11/13 23:00, Thomas Petazzoni wrote:
> Dear Arnout Vandecappelle,
>
> On Thu, 21 Nov 2013 22:54:24 +0100, Arnout Vandecappelle wrote:
>
>>    You can give AC_TRY_RUN a fourth argument with actions to take when
>> cross-compiling. These actions are taken when compilation was successful.
>> Basically, the following patch should work:
>>
>> ----------------------------------
>> Fix support for cross-compilation.
>>
>> The check for posix_fallocate doesn't handle the cross-compilation case.
>> Assume that it works, because cross-compilation for AIX or old glibc is
>> unlikely.
>>
>> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
>> ---
>> diff -Nrup lftp-4.4.10.orig/m4/lftp.m4 lftp-4.4.10/m4/lftp.m4
>> --- lftp-4.4.10.orig/m4/lftp.m4 2013-03-19 13:25:50.000000000 +0100
>> +++ lftp-4.4.10/m4/lftp.m4      2013-11-21 22:46:27.776820935 +0100
>> @@ -271,6 +271,8 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
>>           i_cv_posix_fallocate_works=yes
>>         ], [
>>           i_cv_posix_fallocate_works=no
>> +     ], [
>> +       i_cv_posix_fallocate_works=yes
>>         ])
>>       ])
>>       if test x$i_cv_posix_fallocate_works = xyes; then
>> ----------------------------------
>
> Seeing this, I believe that passing i_cv_posix_fallocate_works=yes in
> the ./configure environment is a better solution.

  But that wouldn't detect the uClibc case when posix_fallocate isn't 
available...

  Regards,
  Arnout


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-21 22:19             ` Arnout Vandecappelle
@ 2013-11-22  8:15               ` Thomas Petazzoni
  2013-11-22  9:20                 ` Arnout Vandecappelle
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Petazzoni @ 2013-11-22  8:15 UTC (permalink / raw)
  To: buildroot

Dear Arnout Vandecappelle,

On Thu, 21 Nov 2013 23:19:10 +0100, Arnout Vandecappelle wrote:

> > Seeing this, I believe that passing i_cv_posix_fallocate_works=yes in
> > the ./configure environment is a better solution.
> 
>   But that wouldn't detect the uClibc case when posix_fallocate isn't 
> available...

I thought there were two tests, with two different variables:

 * One testing if a program with posix_fallocate() can be *compiled*.
   This test we need to let it as it is.
 
 * One testing if a program with posix_fallocate() can *run*. This test
   we need to tell the configure script to just assume that
   posix_fallocate() works (but of course, making the assumption that
   a failure on the previous test will make the configure conclude that
   posix_fallocate is not available).

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-22  8:15               ` Thomas Petazzoni
@ 2013-11-22  9:20                 ` Arnout Vandecappelle
  2013-11-25 13:06                   ` Arnaud Rébillout
  0 siblings, 1 reply; 18+ messages in thread
From: Arnout Vandecappelle @ 2013-11-22  9:20 UTC (permalink / raw)
  To: buildroot

On 22/11/13 09:15, Thomas Petazzoni wrote:
> Dear Arnout Vandecappelle,
>
> On Thu, 21 Nov 2013 23:19:10 +0100, Arnout Vandecappelle wrote:
>
>>> Seeing this, I believe that passing i_cv_posix_fallocate_works=yes in
>>> the ./configure environment is a better solution.
>>
>>    But that wouldn't detect the uClibc case when posix_fallocate isn't
>> available...
>
> I thought there were two tests, with two different variables:
>
>   * One testing if a program with posix_fallocate() can be *compiled*.
>     This test we need to let it as it is.
>
>   * One testing if a program with posix_fallocate() can *run*. This test
>     we need to tell the configure script to just assume that
>     posix_fallocate() works (but of course, making the assumption that
>     a failure on the previous test will make the configure conclude that
>     posix_fallocate is not available).

  Well, yes, there are two tests in configure, but only a single macro in 
lftp.m4. AC_TRY_RUN compiles the first argument and then tries to run it 
(if not cross-compiling). The second argument is executed if the run 
succeeds, the third argument if the compilation or the run fails, the 
fourth argument if compilation succeeds but it cannot be ran because 
you're cross-compiling.

  There are a number of other instances of AC_TRY_RUN in the lftp 
configure scripts, but the others all have the fourth argument.

  Regards,
  Arnout


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH v2] lftp: new package.
@ 2013-11-25 12:55 Arnaud Rébillout
  2013-11-25 12:55 ` [Buildroot] [PATCH] " Arnaud Rébillout
  2013-11-25 17:54 ` [Buildroot] [PATCH v2] " Arnout Vandecappelle
  0 siblings, 2 replies; 18+ messages in thread
From: Arnaud Rébillout @ 2013-11-25 12:55 UTC (permalink / raw)
  To: buildroot

Here comes a second version of the patch to include lftp in buildroot.

Improvements from v1:
 * Config.in
   * Typo corrected
 * lftp.mk
   * LFTP_SOURCE removed
   * LFTP_AUTORECONF set to YES
   * POST_INSTALL_TARGET factorized a lot
 * patches:
   * Signed-off
   * Patch the m4 file instead of the configure script

Best regards,
Arnaud.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-25 12:55 [Buildroot] [PATCH v2] lftp: new package Arnaud Rébillout
@ 2013-11-25 12:55 ` Arnaud Rébillout
  2013-11-25 17:59   ` Arnout Vandecappelle
  2013-11-25 17:54 ` [Buildroot] [PATCH v2] " Arnout Vandecappelle
  1 sibling, 1 reply; 18+ messages in thread
From: Arnaud Rébillout @ 2013-11-25 12:55 UTC (permalink / raw)
  To: buildroot

LFTP is a sophisticated ftp/http client, and a file transfer program
supporting a number of network protocols. Like BASH, it has job
control and uses the readline library for input. It has bookmarks,
a built-in mirror command, and can transfer several files in parallel.
It was designed with reliability in mind.

Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
---
 package/Config.in                                  |  1 +
 ...osix_fallocate-m4-check-for-cross-compile.patch | 32 +++++++++++
 ...02-Check-whether-posix_fallocate-compiles.patch | 55 ++++++++++++++++++
 package/lftp/Config.in                             | 65 ++++++++++++++++++++++
 package/lftp/lftp.mk                               | 54 ++++++++++++++++++
 5 files changed, 207 insertions(+)
 create mode 100644 package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch
 create mode 100644 package/lftp/0002-Check-whether-posix_fallocate-compiles.patch
 create mode 100644 package/lftp/Config.in
 create mode 100644 package/lftp/lftp.mk

diff --git a/package/Config.in b/package/Config.in
index 311cc6c..bcaa8f3 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -814,6 +814,7 @@ source "package/iputils/Config.in"
 source "package/iw/Config.in"
 source "package/kismet/Config.in"
 source "package/knock/Config.in"
+source "package/lftp/Config.in"
 source "package/lighttpd/Config.in"
 source "package/linknx/Config.in"
 source "package/links/Config.in"
diff --git a/package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch b/package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch
new file mode 100644
index 0000000..3c7209f
--- /dev/null
+++ b/package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch
@@ -0,0 +1,32 @@
+From 8a49b00a4f746f0bdc1b2490a260f98e872d0e9c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Arnaud=20R=C3=A9billout?= <rebillout@syscom.ch>
+Date: Mon, 25 Nov 2013 11:03:59 +0100
+Subject: [PATCH 1/2] Fix posix_fallocate m4 check for cross-compile.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If we're cross-compiling, it's very unlikely that we use old glibc or
+AIX. So we assume that posix_fallocate works.
+
+Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
+---
+ m4/lftp.m4 | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/m4/lftp.m4 b/m4/lftp.m4
+index 6d7ad9c..c8efb28 100644
+--- a/m4/lftp.m4
++++ b/m4/lftp.m4
+@@ -271,6 +271,8 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
+        i_cv_posix_fallocate_works=yes
+      ], [
+        i_cv_posix_fallocate_works=no
++     ], [
++       i_cv_posix_fallocate_works=yes
+      ])
+    ])
+    if test x$i_cv_posix_fallocate_works = xyes; then
+-- 
+1.8.4.4
+
diff --git a/package/lftp/0002-Check-whether-posix_fallocate-compiles.patch b/package/lftp/0002-Check-whether-posix_fallocate-compiles.patch
new file mode 100644
index 0000000..b137a52
--- /dev/null
+++ b/package/lftp/0002-Check-whether-posix_fallocate-compiles.patch
@@ -0,0 +1,55 @@
+From 99674dbf332427b6e2778643af026133cc2edac6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Arnaud=20R=C3=A9billout?= <rebillout@syscom.ch>
+Date: Mon, 25 Nov 2013 13:22:24 +0100
+Subject: [PATCH 2/2] Check whether posix_fallocate compiles.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+uClibc doesn't provide posix_fallocate as of 0.9.33.2, but some patches
+exist to add this function.
+
+Therefore, the only way to know if posix_fallocate is present is to do a
+compile test.
+
+Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
+---
+ m4/lftp.m4 | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/m4/lftp.m4 b/m4/lftp.m4
+index c8efb28..d489bec 100644
+--- a/m4/lftp.m4
++++ b/m4/lftp.m4
+@@ -244,6 +244,20 @@ AC_DEFUN([LFTP_ENVIRON_CHECK],[
+ 
+ dnl Taken from dovecot
+ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
++   dnl * Ensure posix_fallocate is provided by the C library.
++   AC_CACHE_CHECK([whether posix_fallocate() compiles],[i_cv_posix_fallocate_compiles],[
++     AC_LINK_IFELSE([
++       #include <fcntl.h>
++       int main() {
++         posix_fallocate(0, 0, 0);
++       }
++     ], [
++       i_cv_posix_fallocate_compiles=yes
++     ], [
++       i_cv_posix_fallocate_compiles=no
++     ])
++   ])
++   if test x$i_cv_posix_fallocate_compiles = xyes; then
+    dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it.
+    dnl * It may also be broken in AIX.
+    AC_CACHE_CHECK([whether posix_fallocate() works],[i_cv_posix_fallocate_works],[
+@@ -278,6 +292,7 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
+    if test x$i_cv_posix_fallocate_works = xyes; then
+      AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [Define if you have a working posix_fallocate()])
+    fi
++   fi
+ ])
+ 
+ AC_DEFUN([LFTP_POSIX_FADVISE_CHECK],[
+-- 
+1.8.4.4
+
diff --git a/package/lftp/Config.in b/package/lftp/Config.in
new file mode 100644
index 0000000..df4062a
--- /dev/null
+++ b/package/lftp/Config.in
@@ -0,0 +1,65 @@
+config BR2_PACKAGE_LFTP
+	bool "lftp"
+	depends on BR2_USE_WCHAR
+	depends on BR2_INSTALL_LIBSTDCPP
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_ZLIB
+	select BR2_PACKAGE_GNUTLS if !BR2_PACKAGE_OPENSSL
+	help
+	  LFTP is a sophisticated ftp/http client, and a file transfer program
+	  supporting a number of network protocols. Like BASH, it has job
+	  control and uses the readline library for input. It has bookmarks,
+	  a built-in mirror command, and can transfer several files in parallel.
+	  It was designed with reliability in mind.
+
+	  http://lftp.yar.ru/
+
+if BR2_PACKAGE_LFTP
+
+comment "Commands"
+
+config BR2_PACKAGE_LFTP_CMD_MIRROR
+	bool "Mirror command"
+	help
+	  Enable mirror command
+
+config BR2_PACKAGE_LFTP_CMD_SLEEP
+	bool "Sleep command"
+	help
+	  Enable sleep command
+
+config BR2_PACKAGE_LFTP_CMD_TORRENT
+	bool "Torrent command"
+	help
+	  Enable torrent command
+
+comment "Protocols"
+
+config BR2_PACKAGE_LFTP_PROTO_FISH
+	bool "FISH protocol"
+	default y
+	help
+	  Enable FISH protocol
+
+config BR2_PACKAGE_LFTP_PROTO_FTP
+	bool "FTP protocol"
+	default y
+	help
+	  Enable FTP protocol
+
+config BR2_PACKAGE_LFTP_PROTO_HTTP
+	bool "HTTP protocol"
+	default y
+	help
+	  Enable HTTP protocol
+
+config BR2_PACKAGE_LFTP_PROTO_SFTP
+	bool "SFTP protocol"
+	default y
+	help
+	  Enable SFTP protocol
+
+endif  # BR2_PACKAGE_LFTP
+
+comment "lftp requires a toolchain w/ C++, wchar"
+	depends on !(BR2_USE_WCHAR && BR2_INSTALL_LIBSTDCPP)
diff --git a/package/lftp/lftp.mk b/package/lftp/lftp.mk
new file mode 100644
index 0000000..faf9f37
--- /dev/null
+++ b/package/lftp/lftp.mk
@@ -0,0 +1,54 @@
+################################################################################
+#
+# lftp
+#
+################################################################################
+
+LFTP_VERSION = 4.4.10
+LFTP_SITE    = http://lftp.yar.ru/ftp
+LFTP_LICENSE = GPLv3+
+LFTP_LICENSE_FILES = COPYING
+LFTP_AUTORECONF = YES
+LFTP_DEPENDENCIES  = readline zlib
+
+LFTP_CONF_OPT += --with-modules
+
+ifeq ($(BR2_PACKAGE_GNUTLS),y)
+LFTP_DEPENDENCIES += gnutls
+LFTP_CONF_OPT += --with-gnutls
+else
+LFTP_CONF_OPT += --without-gnutls
+endif
+
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+LFTP_DEPENDENCIES += openssl
+LFTP_CONF_OPT += --with-openssl
+else
+LFTP_CONF_OPT += --without-openssl
+endif
+
+# Remove /usr/share/lftp
+define LFTP_REMOVE_DATA
+        $(RM) -fr $(TARGET_DIR)/usr/share/lftp
+endef
+
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_DATA
+
+# Optional commands and protocols
+LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_CMD_MIRROR) += cmd-mirror.so
+LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_CMD_SLEEP) += cmd-sleep.so
+LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_CMD_TORRENT) += cmd-torrent.so
+LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_FISH) += proto-fish.so
+LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_FTP) += proto-ftp.so
+LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_HTTP) += proto-http.so
+LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_SFTP) += proto-sftp.so
+
+define LFTP_REMOVE_MODULES
+	for f in $(LFTP_MODULES_TO_REMOVE-) ; do \
+		$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/$$f ; \
+	done
+endef
+
+LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_MODULES
+
+$(eval $(autotools-package))
-- 
1.8.4.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-22  9:20                 ` Arnout Vandecappelle
@ 2013-11-25 13:06                   ` Arnaud Rébillout
  0 siblings, 0 replies; 18+ messages in thread
From: Arnaud Rébillout @ 2013-11-25 13:06 UTC (permalink / raw)
  To: buildroot

On 11/22/2013 10:20 AM, Arnout Vandecappelle wrote:
>
>  Well, yes, there are two tests in configure, but only a single macro 
> in lftp.m4. AC_TRY_RUN compiles the first argument and then tries to 
> run it (if not cross-compiling). The second argument is executed if 
> the run succeeds, the third argument if the compilation or the run 
> fails, the fourth argument if compilation succeeds but it cannot be 
> ran because you're cross-compiling.
>
>  There are a number of other instances of AC_TRY_RUN in the lftp 
> configure scripts, but the others all have the fourth argument.

I tried to add a 4th argument to the AC_TRY_RUN as you suggested in a 
previous mail:

> +     ], [
> +       i_cv_posix_fallocate_works=yes 

But in case of cross-compiation, it always returns yes, even if 
posix_fallocate is not defined by the libc: autotools don't even try to 
compile in case of cross-compile.
So it looks like a compile tested is needed in addition to the run test.


I just sent a second revision of the patch with the compile test added. 
I tried it on two different buildroot repo, one with posix_fallocate, 
and the other without posix_fallocate. It's working good.


Best regards,
Arnaud

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-21 15:42   ` Thomas Petazzoni
  2013-11-21 16:17     ` Arnaud Rébillout
@ 2013-11-25 13:19     ` Arnaud Rébillout
  1 sibling, 0 replies; 18+ messages in thread
From: Arnaud Rébillout @ 2013-11-25 13:19 UTC (permalink / raw)
  To: buildroot

Dear Thomas,

On 11/21/2013 04:42 PM, Thomas Petazzoni wrote:
> Is the dependency on OpenSSL or GnuTLS always needed? Or is it only
> needed if you enable SFTP or some specific protocol?

It's a compile-time dependency, since lftp doesn't permit to select what 
component should be built.

About the run-time, I'm not sure, but I checked a little bit the lftp 
modules.
There are two libraries, liblftp-network.so and liblftp-pty.so, that are 
needed for lftp. Both these libraries seems to need a crypto library.

readelf -d liblftp-network.so | grep Shared
  0x00000001 (NEEDED)                     Shared library: [libssl.so.1.0.0]
  0x00000001 (NEEDED)                     Shared library: 
[libcrypto.so.1.0.0]
  0x00000001 (NEEDED)                     Shared library: [libutil.so.0]
  0x00000001 (NEEDED)                     Shared library: [libncurses.so.5]
  0x00000001 (NEEDED)                     Shared library: [libdl.so.0]
  0x00000001 (NEEDED)                     Shared library: [libstdc++.so.6]
  0x00000001 (NEEDED)                     Shared library: [libm.so.0]
  0x00000001 (NEEDED)                     Shared library: [libc.so.0]
  0x00000001 (NEEDED)                     Shared library: [libgcc_s.so.1]
/
/From my point of view, it means that we can't get rid of OpenSSL or GnuTLS.


Best regards,
Arnaud

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20131125/e9b7e2eb/attachment.html>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH v2] lftp: new package.
  2013-11-25 12:55 [Buildroot] [PATCH v2] lftp: new package Arnaud Rébillout
  2013-11-25 12:55 ` [Buildroot] [PATCH] " Arnaud Rébillout
@ 2013-11-25 17:54 ` Arnout Vandecappelle
  1 sibling, 0 replies; 18+ messages in thread
From: Arnout Vandecappelle @ 2013-11-25 17:54 UTC (permalink / raw)
  To: buildroot

  Hi Arnaud,

On 25/11/13 13:55, Arnaud R?billout wrote:
> Here comes a second version of the patch to include lftp in buildroot.
>
> Improvements from v1:
>   * Config.in
>     * Typo corrected
>   * lftp.mk
>     * LFTP_SOURCE removed
>     * LFTP_AUTORECONF set to YES
>     * POST_INSTALL_TARGET factorized a lot
>   * patches:
>     * Signed-off
>     * Patch the m4 file instead of the configure script

  Such a changelog is normally included in the patch commit message 
itself, like so:

lftp: new package

LFTP is a sophisticated ftp/http client, and a file transfer program
...

Signed-off-by: ...
---
v2:
  * Config.in: typo corrected
  * ...


  The part below --- is not included in the git history when Peter 
commits it.


  The advantage of this approach is that you can keep the history around 
when you send v3 etc. of the patch. You update the patch using 'git 
commit --amend' or 'git rebase -i', and in the commit message you add the 
history below the --- line. On your side, the part below --- *will* be 
kept in the git history, so the next time you use git send-email, 
everything will be there.


  Regards,
  Arnout


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-25 12:55 ` [Buildroot] [PATCH] " Arnaud Rébillout
@ 2013-11-25 17:59   ` Arnout Vandecappelle
  2013-12-02  9:36     ` Arnaud Rébillout
  0 siblings, 1 reply; 18+ messages in thread
From: Arnout Vandecappelle @ 2013-11-25 17:59 UTC (permalink / raw)
  To: buildroot

On 25/11/13 13:55, Arnaud R?billout wrote:
> LFTP is a sophisticated ftp/http client, and a file transfer program
> supporting a number of network protocols. Like BASH, it has job
> control and uses the readline library for input. It has bookmarks,
> a built-in mirror command, and can transfer several files in parallel.
> It was designed with reliability in mind.
>
> Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
> ---
>   package/Config.in                                  |  1 +
>   ...osix_fallocate-m4-check-for-cross-compile.patch | 32 +++++++++++
>   ...02-Check-whether-posix_fallocate-compiles.patch | 55 ++++++++++++++++++
>   package/lftp/Config.in                             | 65 ++++++++++++++++++++++
>   package/lftp/lftp.mk                               | 54 ++++++++++++++++++
>   5 files changed, 207 insertions(+)
>   create mode 100644 package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch
>   create mode 100644 package/lftp/0002-Check-whether-posix_fallocate-compiles.patch

  Since these two patches actually fix the same problem, it's better to 
squash them into a single patch.

>   create mode 100644 package/lftp/Config.in
>   create mode 100644 package/lftp/lftp.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index 311cc6c..bcaa8f3 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -814,6 +814,7 @@ source "package/iputils/Config.in"
>   source "package/iw/Config.in"
>   source "package/kismet/Config.in"
>   source "package/knock/Config.in"
> +source "package/lftp/Config.in"
>   source "package/lighttpd/Config.in"
>   source "package/linknx/Config.in"
>   source "package/links/Config.in"
> diff --git a/package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch b/package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch
> new file mode 100644
> index 0000000..3c7209f
> --- /dev/null
> +++ b/package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch
> @@ -0,0 +1,32 @@
> +From 8a49b00a4f746f0bdc1b2490a260f98e872d0e9c Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Arnaud=20R=C3=A9billout?= <rebillout@syscom.ch>
> +Date: Mon, 25 Nov 2013 11:03:59 +0100
> +Subject: [PATCH 1/2] Fix posix_fallocate m4 check for cross-compile.
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +If we're cross-compiling, it's very unlikely that we use old glibc or
> +AIX. So we assume that posix_fallocate works.
> +
> +Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
> +---
> + m4/lftp.m4 | 2 ++
> + 1 file changed, 2 insertions(+)
> +
> +diff --git a/m4/lftp.m4 b/m4/lftp.m4
> +index 6d7ad9c..c8efb28 100644
> +--- a/m4/lftp.m4
> ++++ b/m4/lftp.m4
> +@@ -271,6 +271,8 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
> +        i_cv_posix_fallocate_works=yes
> +      ], [
> +        i_cv_posix_fallocate_works=no
> ++     ], [
> ++       i_cv_posix_fallocate_works=yes
> +      ])
> +    ])
> +    if test x$i_cv_posix_fallocate_works = xyes; then
> +--
> +1.8.4.4
> +
> diff --git a/package/lftp/0002-Check-whether-posix_fallocate-compiles.patch b/package/lftp/0002-Check-whether-posix_fallocate-compiles.patch
> new file mode 100644
> index 0000000..b137a52
> --- /dev/null
> +++ b/package/lftp/0002-Check-whether-posix_fallocate-compiles.patch
> @@ -0,0 +1,55 @@
> +From 99674dbf332427b6e2778643af026133cc2edac6 Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Arnaud=20R=C3=A9billout?= <rebillout@syscom.ch>
> +Date: Mon, 25 Nov 2013 13:22:24 +0100
> +Subject: [PATCH 2/2] Check whether posix_fallocate compiles.
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +uClibc doesn't provide posix_fallocate as of 0.9.33.2, but some patches
> +exist to add this function.
> +
> +Therefore, the only way to know if posix_fallocate is present is to do a
> +compile test.
> +
> +Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
> +---
> + m4/lftp.m4 | 15 +++++++++++++++
> + 1 file changed, 15 insertions(+)
> +
> +diff --git a/m4/lftp.m4 b/m4/lftp.m4
> +index c8efb28..d489bec 100644
> +--- a/m4/lftp.m4
> ++++ b/m4/lftp.m4
> +@@ -244,6 +244,20 @@ AC_DEFUN([LFTP_ENVIRON_CHECK],[
> +
> + dnl Taken from dovecot
> + AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
> ++   dnl * Ensure posix_fallocate is provided by the C library.
> ++   AC_CACHE_CHECK([whether posix_fallocate() compiles],[i_cv_posix_fallocate_compiles],[
> ++     AC_LINK_IFELSE([
> ++       #include <fcntl.h>
> ++       int main() {
> ++         posix_fallocate(0, 0, 0);
> ++       }
> ++     ], [
> ++       i_cv_posix_fallocate_compiles=yes
> ++     ], [
> ++       i_cv_posix_fallocate_compiles=no
> ++     ])
> ++   ])

  I think it would be simpler to work the other way round: to the 
AC_LINK_IFELSE in the cross-compiling branch of AC_TRY_RUN. Then you 
don't need the additional variable, you can just write to 
posix_fallocate_works.

  Can you also send the patch upstream so they can comment on it?

> ++   if test x$i_cv_posix_fallocate_compiles = xyes; then
> +    dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it.
> +    dnl * It may also be broken in AIX.
> +    AC_CACHE_CHECK([whether posix_fallocate() works],[i_cv_posix_fallocate_works],[
> +@@ -278,6 +292,7 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
> +    if test x$i_cv_posix_fallocate_works = xyes; then
> +      AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [Define if you have a working posix_fallocate()])
> +    fi
> ++   fi
> + ])
> +
> + AC_DEFUN([LFTP_POSIX_FADVISE_CHECK],[
> +--
> +1.8.4.4
> +
> diff --git a/package/lftp/Config.in b/package/lftp/Config.in
> new file mode 100644
> index 0000000..df4062a
> --- /dev/null
> +++ b/package/lftp/Config.in
> @@ -0,0 +1,65 @@
> +config BR2_PACKAGE_LFTP
> +	bool "lftp"
> +	depends on BR2_USE_WCHAR
> +	depends on BR2_INSTALL_LIBSTDCPP
> +	select BR2_PACKAGE_READLINE
> +	select BR2_PACKAGE_ZLIB
> +	select BR2_PACKAGE_GNUTLS if !BR2_PACKAGE_OPENSSL
> +	help
> +	  LFTP is a sophisticated ftp/http client, and a file transfer program
> +	  supporting a number of network protocols. Like BASH, it has job
> +	  control and uses the readline library for input. It has bookmarks,
> +	  a built-in mirror command, and can transfer several files in parallel.
> +	  It was designed with reliability in mind.
> +
> +	  http://lftp.yar.ru/
> +
> +if BR2_PACKAGE_LFTP
> +
> +comment "Commands"
> +
> +config BR2_PACKAGE_LFTP_CMD_MIRROR
> +	bool "Mirror command"
> +	help
> +	  Enable mirror command
> +
> +config BR2_PACKAGE_LFTP_CMD_SLEEP
> +	bool "Sleep command"
> +	help
> +	  Enable sleep command
> +
> +config BR2_PACKAGE_LFTP_CMD_TORRENT
> +	bool "Torrent command"
> +	help
> +	  Enable torrent command

  Is it needed/useful to have all these options? Do they have a big 
impact on size?

> +
> +comment "Protocols"
> +
> +config BR2_PACKAGE_LFTP_PROTO_FISH
> +	bool "FISH protocol"
> +	default y
> +	help
> +	  Enable FISH protocol
> +
> +config BR2_PACKAGE_LFTP_PROTO_FTP
> +	bool "FTP protocol"
> +	default y
> +	help
> +	  Enable FTP protocol
> +
> +config BR2_PACKAGE_LFTP_PROTO_HTTP
> +	bool "HTTP protocol"
> +	default y
> +	help
> +	  Enable HTTP protocol
> +
> +config BR2_PACKAGE_LFTP_PROTO_SFTP
> +	bool "SFTP protocol"
> +	default y
> +	help
> +	  Enable SFTP protocol
> +
> +endif  # BR2_PACKAGE_LFTP
> +
> +comment "lftp requires a toolchain w/ C++, wchar"
> +	depends on !(BR2_USE_WCHAR && BR2_INSTALL_LIBSTDCPP)
> diff --git a/package/lftp/lftp.mk b/package/lftp/lftp.mk
> new file mode 100644
> index 0000000..faf9f37
> --- /dev/null
> +++ b/package/lftp/lftp.mk
> @@ -0,0 +1,54 @@
> +################################################################################
> +#
> +# lftp
> +#
> +################################################################################
> +
> +LFTP_VERSION = 4.4.10
> +LFTP_SITE    = http://lftp.yar.ru/ftp
> +LFTP_LICENSE = GPLv3+
> +LFTP_LICENSE_FILES = COPYING
> +LFTP_AUTORECONF = YES
> +LFTP_DEPENDENCIES  = readline zlib

  Is the readline dependency required?

> +
> +LFTP_CONF_OPT += --with-modules
> +
> +ifeq ($(BR2_PACKAGE_GNUTLS),y)
> +LFTP_DEPENDENCIES += gnutls
> +LFTP_CONF_OPT += --with-gnutls
> +else
> +LFTP_CONF_OPT += --without-gnutls
> +endif
> +
> +ifeq ($(BR2_PACKAGE_OPENSSL),y)
> +LFTP_DEPENDENCIES += openssl
> +LFTP_CONF_OPT += --with-openssl
> +else
> +LFTP_CONF_OPT += --without-openssl
> +endif
> +
> +# Remove /usr/share/lftp
> +define LFTP_REMOVE_DATA
> +        $(RM) -fr $(TARGET_DIR)/usr/share/lftp

  What kind of data is stored there?  If it's help text, the user may 
want it.


  Regards,
  Arnout

> +endef
> +
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_DATA
> +
> +# Optional commands and protocols
> +LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_CMD_MIRROR) += cmd-mirror.so
> +LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_CMD_SLEEP) += cmd-sleep.so
> +LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_CMD_TORRENT) += cmd-torrent.so
> +LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_FISH) += proto-fish.so
> +LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_FTP) += proto-ftp.so
> +LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_HTTP) += proto-http.so
> +LFTP_MODULES_TO_REMOVE-$(BR2_PACKAGE_LFTP_PROTO_SFTP) += proto-sftp.so
> +
> +define LFTP_REMOVE_MODULES
> +	for f in $(LFTP_MODULES_TO_REMOVE-) ; do \
> +		$(RM) -f $(TARGET_DIR)/usr/lib/lftp/$(LFTP_VERSION)/$$f ; \
> +	done
> +endef
> +
> +LFTP_POST_INSTALL_TARGET_HOOKS += LFTP_REMOVE_MODULES
> +
> +$(eval $(autotools-package))
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-11-25 17:59   ` Arnout Vandecappelle
@ 2013-12-02  9:36     ` Arnaud Rébillout
  2013-12-02 22:04       ` Arnout Vandecappelle
  0 siblings, 1 reply; 18+ messages in thread
From: Arnaud Rébillout @ 2013-12-02  9:36 UTC (permalink / raw)
  To: buildroot

Hello Arnout,

On 11/25/2013 06:59 PM, Arnout Vandecappelle wrote:
> On 25/11/13 13:55, Arnaud R?billout wrote:
>> LFTP is a sophisticated ftp/http client, and a file transfer program
>> supporting a number of network protocols. Like BASH, it has job
>> control and uses the readline library for input. It has bookmarks,
>> a built-in mirror command, and can transfer several files in parallel.
>> It was designed with reliability in mind.
>>
>> Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
>> ---
>>   package/Config.in                                  |  1 +
>>   ...osix_fallocate-m4-check-for-cross-compile.patch | 32 +++++++++++
>>   ...02-Check-whether-posix_fallocate-compiles.patch | 55 
>> ++++++++++++++++++
>>   package/lftp/Config.in                             | 65 
>> ++++++++++++++++++++++
>>   package/lftp/lftp.mk                               | 54 
>> ++++++++++++++++++
>>   5 files changed, 207 insertions(+)
>>   create mode 100644 
>> package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch
>>   create mode 100644 
>> package/lftp/0002-Check-whether-posix_fallocate-compiles.patch
>
>  Since these two patches actually fix the same problem, it's better to 
> squash them into a single patch.
OK.

>>   create mode 100644 package/lftp/Config.in
>>   create mode 100644 package/lftp/lftp.mk
>>
>> diff --git a/package/Config.in b/package/Config.in
>> index 311cc6c..bcaa8f3 100644
>> --- a/package/Config.in
>> +++ b/package/Config.in
>> @@ -814,6 +814,7 @@ source "package/iputils/Config.in"
>>   source "package/iw/Config.in"
>>   source "package/kismet/Config.in"
>>   source "package/knock/Config.in"
>> +source "package/lftp/Config.in"
>>   source "package/lighttpd/Config.in"
>>   source "package/linknx/Config.in"
>>   source "package/links/Config.in"
>> diff --git 
>> a/package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch 
>> b/package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch
>> new file mode 100644
>> index 0000000..3c7209f
>> --- /dev/null
>> +++ 
>> b/package/lftp/0001-Fix-posix_fallocate-m4-check-for-cross-compile.patch
>> @@ -0,0 +1,32 @@
>> +From 8a49b00a4f746f0bdc1b2490a260f98e872d0e9c Mon Sep 17 00:00:00 2001
>> +From: =?UTF-8?q?Arnaud=20R=C3=A9billout?= <rebillout@syscom.ch>
>> +Date: Mon, 25 Nov 2013 11:03:59 +0100
>> +Subject: [PATCH 1/2] Fix posix_fallocate m4 check for cross-compile.
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +If we're cross-compiling, it's very unlikely that we use old glibc or
>> +AIX. So we assume that posix_fallocate works.
>> +
>> +Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
>> +---
>> + m4/lftp.m4 | 2 ++
>> + 1 file changed, 2 insertions(+)
>> +
>> +diff --git a/m4/lftp.m4 b/m4/lftp.m4
>> +index 6d7ad9c..c8efb28 100644
>> +--- a/m4/lftp.m4
>> ++++ b/m4/lftp.m4
>> +@@ -271,6 +271,8 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
>> +        i_cv_posix_fallocate_works=yes
>> +      ], [
>> +        i_cv_posix_fallocate_works=no
>> ++     ], [
>> ++       i_cv_posix_fallocate_works=yes
>> +      ])
>> +    ])
>> +    if test x$i_cv_posix_fallocate_works = xyes; then
>> +--
>> +1.8.4.4
>> +
>> diff --git 
>> a/package/lftp/0002-Check-whether-posix_fallocate-compiles.patch 
>> b/package/lftp/0002-Check-whether-posix_fallocate-compiles.patch
>> new file mode 100644
>> index 0000000..b137a52
>> --- /dev/null
>> +++ b/package/lftp/0002-Check-whether-posix_fallocate-compiles.patch
>> @@ -0,0 +1,55 @@
>> +From 99674dbf332427b6e2778643af026133cc2edac6 Mon Sep 17 00:00:00 2001
>> +From: =?UTF-8?q?Arnaud=20R=C3=A9billout?= <rebillout@syscom.ch>
>> +Date: Mon, 25 Nov 2013 13:22:24 +0100
>> +Subject: [PATCH 2/2] Check whether posix_fallocate compiles.
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +uClibc doesn't provide posix_fallocate as of 0.9.33.2, but some patches
>> +exist to add this function.
>> +
>> +Therefore, the only way to know if posix_fallocate is present is to 
>> do a
>> +compile test.
>> +
>> +Signed-off-by: Arnaud R?billout <rebillout@syscom.ch>
>> +---
>> + m4/lftp.m4 | 15 +++++++++++++++
>> + 1 file changed, 15 insertions(+)
>> +
>> +diff --git a/m4/lftp.m4 b/m4/lftp.m4
>> +index c8efb28..d489bec 100644
>> +--- a/m4/lftp.m4
>> ++++ b/m4/lftp.m4
>> +@@ -244,6 +244,20 @@ AC_DEFUN([LFTP_ENVIRON_CHECK],[
>> +
>> + dnl Taken from dovecot
>> + AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
>> ++   dnl * Ensure posix_fallocate is provided by the C library.
>> ++   AC_CACHE_CHECK([whether posix_fallocate() 
>> compiles],[i_cv_posix_fallocate_compiles],[
>> ++     AC_LINK_IFELSE([
>> ++       #include <fcntl.h>
>> ++       int main() {
>> ++         posix_fallocate(0, 0, 0);
>> ++       }
>> ++     ], [
>> ++       i_cv_posix_fallocate_compiles=yes
>> ++     ], [
>> ++       i_cv_posix_fallocate_compiles=no
>> ++     ])
>> ++   ])
>
>  I think it would be simpler to work the other way round: to the 
> AC_LINK_IFELSE in the cross-compiling branch of AC_TRY_RUN. Then you 
> don't need the additional variable, you can just write to 
> posix_fallocate_works.
>
>  Can you also send the patch upstream so they can comment on it?
OK, I've done that but I didn't receive a reply yet.


>
>> ++   if test x$i_cv_posix_fallocate_compiles = xyes; then
>> +    dnl * Old glibcs have broken posix_fallocate(). Make sure not to 
>> use it.
>> +    dnl * It may also be broken in AIX.
>> +    AC_CACHE_CHECK([whether posix_fallocate() 
>> works],[i_cv_posix_fallocate_works],[
>> +@@ -278,6 +292,7 @@ AC_DEFUN([LFTP_POSIX_FALLOCATE_CHECK],[
>> +    if test x$i_cv_posix_fallocate_works = xyes; then
>> +      AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [Define if you have a 
>> working posix_fallocate()])
>> +    fi
>> ++   fi
>> + ])
>> +
>> + AC_DEFUN([LFTP_POSIX_FADVISE_CHECK],[
>> +--
>> +1.8.4.4
>> +
>> diff --git a/package/lftp/Config.in b/package/lftp/Config.in
>> new file mode 100644
>> index 0000000..df4062a
>> --- /dev/null
>> +++ b/package/lftp/Config.in
>> @@ -0,0 +1,65 @@
>> +config BR2_PACKAGE_LFTP
>> +    bool "lftp"
>> +    depends on BR2_USE_WCHAR
>> +    depends on BR2_INSTALL_LIBSTDCPP
>> +    select BR2_PACKAGE_READLINE
>> +    select BR2_PACKAGE_ZLIB
>> +    select BR2_PACKAGE_GNUTLS if !BR2_PACKAGE_OPENSSL
>> +    help
>> +      LFTP is a sophisticated ftp/http client, and a file transfer 
>> program
>> +      supporting a number of network protocols. Like BASH, it has job
>> +      control and uses the readline library for input. It has 
>> bookmarks,
>> +      a built-in mirror command, and can transfer several files in 
>> parallel.
>> +      It was designed with reliability in mind.
>> +
>> +      http://lftp.yar.ru/
>> +
>> +if BR2_PACKAGE_LFTP
>> +
>> +comment "Commands"
>> +
>> +config BR2_PACKAGE_LFTP_CMD_MIRROR
>> +    bool "Mirror command"
>> +    help
>> +      Enable mirror command
>> +
>> +config BR2_PACKAGE_LFTP_CMD_SLEEP
>> +    bool "Sleep command"
>> +    help
>> +      Enable sleep command
>> +
>> +config BR2_PACKAGE_LFTP_CMD_TORRENT
>> +    bool "Torrent command"
>> +    help
>> +      Enable torrent command
>
>  Is it needed/useful to have all these options? Do they have a big 
> impact on size?

Yep, they save a significant amount of space.

Here are the mandatory things for lftp. Alltogether, it's 1080 Kb.
$ du -h output/target/usr/bin/lftp*
44K    output/target/usr/bin/lftp
4.0K    output/target/usr/bin/lftpget
$ du -h output/target/usr/lib/liblftp-* | grep -v -e '^0' -e 'la$'
276K    output/target/usr/lib/liblftp-jobs.so.0.0.0
512K    output/target/usr/lib/liblftp-tasks.so.0.0.0
$ du -h output/target/usr/lib/lftp/4.4.10/liblftp*
232K    output/target/usr/lib/lftp/4.4.10/liblftp-network.so
12K    output/target/usr/lib/lftp/4.4.10/liblftp-pty.so

Now come the things that can be disabled:
$ du -h output/target/usr/lib/lftp/4.4.10/* | grep -v liblftp
44K    output/target/usr/lib/lftp/4.4.10/cmd-mirror.so
16K    output/target/usr/lib/lftp/4.4.10/cmd-sleep.so
164K    output/target/usr/lib/lftp/4.4.10/cmd-torrent.so
24K    output/target/usr/lib/lftp/4.4.10/proto-file.so
32K    output/target/usr/lib/lftp/4.4.10/proto-fish.so
128K    output/target/usr/lib/lftp/4.4.10/proto-ftp.so
84K    output/target/usr/lib/lftp/4.4.10/proto-http.so
76K    output/target/usr/lib/lftp/4.4.10/proto-sftp.so

For my use case, I disable cmd-torrent, and all the proto except ftp 
(and proto-file, which can't be disabled).
It saves 356Kb. To me it's not a bad score.

In the Config file I offer the choice to disable/enable everything just 
for the sake of offering every option possible, but I agree that some 
options may be useless.
For example, cmd-sleep doesn't save much space, compared to the total 
size of lftp.

Tell me what you prefer about that. Also, if you prefer to present the 
options in a sub-menu instead of the main menu, or if you think a 
default setting should be set (like enabling ftp by defaut, because the 
name lftp suggests that it deals with ftp...).

>> +
>> +comment "Protocols"
>> +
>> +config BR2_PACKAGE_LFTP_PROTO_FISH
>> +    bool "FISH protocol"
>> +    default y
>> +    help
>> +      Enable FISH protocol
>> +
>> +config BR2_PACKAGE_LFTP_PROTO_FTP
>> +    bool "FTP protocol"
>> +    default y
>> +    help
>> +      Enable FTP protocol
>> +
>> +config BR2_PACKAGE_LFTP_PROTO_HTTP
>> +    bool "HTTP protocol"
>> +    default y
>> +    help
>> +      Enable HTTP protocol
>> +
>> +config BR2_PACKAGE_LFTP_PROTO_SFTP
>> +    bool "SFTP protocol"
>> +    default y
>> +    help
>> +      Enable SFTP protocol
>> +
>> +endif  # BR2_PACKAGE_LFTP
>> +
>> +comment "lftp requires a toolchain w/ C++, wchar"
>> +    depends on !(BR2_USE_WCHAR && BR2_INSTALL_LIBSTDCPP)
>> diff --git a/package/lftp/lftp.mk b/package/lftp/lftp.mk
>> new file mode 100644
>> index 0000000..faf9f37
>> --- /dev/null
>> +++ b/package/lftp/lftp.mk
>> @@ -0,0 +1,54 @@
>> +################################################################################ 
>>
>> +#
>> +# lftp
>> +#
>> +################################################################################ 
>>
>> +
>> +LFTP_VERSION = 4.4.10
>> +LFTP_SITE    = http://lftp.yar.ru/ftp
>> +LFTP_LICENSE = GPLv3+
>> +LFTP_LICENSE_FILES = COPYING
>> +LFTP_AUTORECONF = YES
>> +LFTP_DEPENDENCIES  = readline zlib
>
>  Is the readline dependency required?
Yes it is, lftp is an interactive client. It won't compile without.

>
>> +
>> +LFTP_CONF_OPT += --with-modules
>> +
>> +ifeq ($(BR2_PACKAGE_GNUTLS),y)
>> +LFTP_DEPENDENCIES += gnutls
>> +LFTP_CONF_OPT += --with-gnutls
>> +else
>> +LFTP_CONF_OPT += --without-gnutls
>> +endif
>> +
>> +ifeq ($(BR2_PACKAGE_OPENSSL),y)
>> +LFTP_DEPENDENCIES += openssl
>> +LFTP_CONF_OPT += --with-openssl
>> +else
>> +LFTP_CONF_OPT += --without-openssl
>> +endif
>> +
>> +# Remove /usr/share/lftp
>> +define LFTP_REMOVE_DATA
>> +        $(RM) -fr $(TARGET_DIR)/usr/share/lftp
>
>  What kind of data is stored there?  If it's help text, the user may 
> want it.

Here it is:

$ du -h output/target/usr/share/lftp/*
4.0K    output/target/usr/share/lftp/convert-mozilla-cookies
4.0K    output/target/usr/share/lftp/import-ncftp
4.0K    output/target/usr/share/lftp/import-netscape
4.0K    output/target/usr/share/lftp/verify-file
4.0K    output/target/usr/share/lftp/xdg-move

Some bash and per scripts, that seem to be dedicated to specific needs. 
I don't think it's useful for anyone using buildroot.

Best regards,
Arnaud

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-12-02  9:36     ` Arnaud Rébillout
@ 2013-12-02 22:04       ` Arnout Vandecappelle
  2013-12-03  7:59         ` Arnaud Rébillout
  0 siblings, 1 reply; 18+ messages in thread
From: Arnout Vandecappelle @ 2013-12-02 22:04 UTC (permalink / raw)
  To: buildroot

On 02/12/13 10:36, Arnaud R?billout wrote:
> Hello Arnout,
>
> On 11/25/2013 06:59 PM, Arnout Vandecappelle wrote:
>> On 25/11/13 13:55, Arnaud R?billout wrote:
[snip]
>>> +if BR2_PACKAGE_LFTP
>>> +
>>> +comment "Commands"
>>> +
>>> +config BR2_PACKAGE_LFTP_CMD_MIRROR
>>> +    bool "Mirror command"
>>> +    help
>>> +      Enable mirror command
>>> +
>>> +config BR2_PACKAGE_LFTP_CMD_SLEEP
>>> +    bool "Sleep command"
>>> +    help
>>> +      Enable sleep command
>>> +
>>> +config BR2_PACKAGE_LFTP_CMD_TORRENT
>>> +    bool "Torrent command"
>>> +    help
>>> +      Enable torrent command
>>
>>  Is it needed/useful to have all these options? Do they have a big
>> impact on size?
>
> Yep, they save a significant amount of space.
>
> Here are the mandatory things for lftp. Alltogether, it's 1080 Kb.
> $ du -h output/target/usr/bin/lftp*
> 44K    output/target/usr/bin/lftp
> 4.0K    output/target/usr/bin/lftpget
> $ du -h output/target/usr/lib/liblftp-* | grep -v -e '^0' -e 'la$'
> 276K    output/target/usr/lib/liblftp-jobs.so.0.0.0
> 512K    output/target/usr/lib/liblftp-tasks.so.0.0.0
> $ du -h output/target/usr/lib/lftp/4.4.10/liblftp*
> 232K    output/target/usr/lib/lftp/4.4.10/liblftp-network.so
> 12K    output/target/usr/lib/lftp/4.4.10/liblftp-pty.so
>
> Now come the things that can be disabled:
> $ du -h output/target/usr/lib/lftp/4.4.10/* | grep -v liblftp
> 44K    output/target/usr/lib/lftp/4.4.10/cmd-mirror.so
> 16K    output/target/usr/lib/lftp/4.4.10/cmd-sleep.so
> 164K    output/target/usr/lib/lftp/4.4.10/cmd-torrent.so
> 24K    output/target/usr/lib/lftp/4.4.10/proto-file.so
> 32K    output/target/usr/lib/lftp/4.4.10/proto-fish.so
> 128K    output/target/usr/lib/lftp/4.4.10/proto-ftp.so
> 84K    output/target/usr/lib/lftp/4.4.10/proto-http.so
> 76K    output/target/usr/lib/lftp/4.4.10/proto-sftp.so
>
> For my use case, I disable cmd-torrent, and all the proto except ftp (and
> proto-file, which can't be disabled).
> It saves 356Kb. To me it's not a bad score.

  Agreed.

>
> In the Config file I offer the choice to disable/enable everything just
> for the sake of offering every option possible, but I agree that some
> options may be useless.
> For example, cmd-sleep doesn't save much space, compared to the total
> size of lftp.

  If you feel like removing the options that don't make much of a 
difference, please do. But otherwise, you can just leave things as is.

>
> Tell me what you prefer about that. Also, if you prefer to present the
> options in a sub-menu instead of the main menu, or if you think a default
> setting should be set (like enabling ftp by defaut, because the name lftp
> suggests that it deals with ftp...).

  Personally I don't like submenus, but we do have them for some 
packages. So: choose whatever you prefer.

  Enabling ftp by default makes sense but again is not strictly necessary.

[snip]

  Your other replies were satisfactory, so after squashing the two 
patches you'll probably get my Acked-by.

  Regards,
  Arnout


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH] lftp: new package.
  2013-12-02 22:04       ` Arnout Vandecappelle
@ 2013-12-03  7:59         ` Arnaud Rébillout
  0 siblings, 0 replies; 18+ messages in thread
From: Arnaud Rébillout @ 2013-12-03  7:59 UTC (permalink / raw)
  To: buildroot

On 12/02/2013 11:04 PM, Arnout Vandecappelle wrote:
> On 02/12/13 10:36, Arnaud R?billout wrote:
>> Hello Arnout,
>>
>> On 11/25/2013 06:59 PM, Arnout Vandecappelle wrote:
>>> On 25/11/13 13:55, Arnaud R?billout wrote:
> [snip]
>>
>> In the Config file I offer the choice to disable/enable everything just
>> for the sake of offering every option possible, but I agree that some
>> options may be useless.
>> For example, cmd-sleep doesn't save much space, compared to the total
>> size of lftp.
>
>  If you feel like removing the options that don't make much of a 
> difference, please do. But otherwise, you can just leave things as is.
OK, personnally I prefer to let every option visible, so that people may 
decide by themselves whether it's useful.

>
>>
>> Tell me what you prefer about that. Also, if you prefer to present the
>> options in a sub-menu instead of the main menu, or if you think a 
>> default
>> setting should be set (like enabling ftp by defaut, because the name 
>> lftp
>> suggests that it deals with ftp...).
>
>  Personally I don't like submenus, but we do have them for some 
> packages. So: choose whatever you prefer.
>
>  Enabling ftp by default makes sense but again is not strictly necessary.
Ok, I'll keep the same presentation.

>
>  Your other replies were satisfactory, so after squashing the two 
> patches you'll probably get my Acked-by.
>
Great ! Thanks a lot for taking time to review !


Best regards,
Arnaud


-- 
Arnaud R?billout
/D?veloppeur software/

SYSCOM Instruments SA,
Rue de l?Industrie 21,
1450 Ste-Croix, SUISSE
Tel : +41 (0) 24 455 44 11
Fax : +41 (0) 24 454 45 60
Visit us at www.syscom.ch <http://www.syscom.ch>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20131203/1f41fc47/attachment.html>

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-12-03  7:59 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-25 12:55 [Buildroot] [PATCH v2] lftp: new package Arnaud Rébillout
2013-11-25 12:55 ` [Buildroot] [PATCH] " Arnaud Rébillout
2013-11-25 17:59   ` Arnout Vandecappelle
2013-12-02  9:36     ` Arnaud Rébillout
2013-12-02 22:04       ` Arnout Vandecappelle
2013-12-03  7:59         ` Arnaud Rébillout
2013-11-25 17:54 ` [Buildroot] [PATCH v2] " Arnout Vandecappelle
  -- strict thread matches above, loose matches on Subject: below --
2013-11-21 15:16 [Buildroot] LFTP: a sophisticated ftp/sftp/http/fish client with few dependencies Arnaud Rébillout
2013-11-21 15:16 ` [Buildroot] [PATCH] lftp: new package Arnaud Rébillout
2013-11-21 15:42   ` Thomas Petazzoni
2013-11-21 16:17     ` Arnaud Rébillout
2013-11-21 17:12       ` Thomas Petazzoni
2013-11-21 21:54         ` Arnout Vandecappelle
2013-11-21 22:00           ` Thomas Petazzoni
2013-11-21 22:19             ` Arnout Vandecappelle
2013-11-22  8:15               ` Thomas Petazzoni
2013-11-22  9:20                 ` Arnout Vandecappelle
2013-11-25 13:06                   ` Arnaud Rébillout
2013-11-25 13:19     ` Arnaud Rébillout

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox