diff mbox

[09/12] luaposix: New package

Message ID 1369054604-26139-9-git-send-email-shmuelzon@gmail.com
State Changes Requested
Headers show

Commit Message

Assaf Inbal May 20, 2013, 12:56 p.m. UTC
Luaposix is a Lua frontend to posix functions.

Signed-off-by: Assaf Inbal <shmuelzon@gmail.com>
---
 package/Config.in                                         |  1 +
 package/luaposix/Config.in                                | 10 ++++++++++
 .../luaposix/luaposix-remove-cross-compile-check.patch    | 13 +++++++++++++
 package/luaposix/luaposix.mk                              | 15 +++++++++++++++
 4 files changed, 39 insertions(+)
 create mode 100644 package/luaposix/Config.in
 create mode 100644 package/luaposix/luaposix-remove-cross-compile-check.patch
 create mode 100644 package/luaposix/luaposix.mk

Comments

Francois Perrad May 20, 2013, 4:09 p.m. UTC | #1
2013/5/20 Assaf Inbal <shmuelzon@gmail.com>

> Luaposix is a Lua frontend to posix functions.
>
> Signed-off-by: Assaf Inbal <shmuelzon@gmail.com>
> ---
>  package/Config.in                                         |  1 +
>  package/luaposix/Config.in                                | 10 ++++++++++
>  .../luaposix/luaposix-remove-cross-compile-check.patch    | 13
> +++++++++++++
>  package/luaposix/luaposix.mk                              | 15
> +++++++++++++++
>  4 files changed, 39 insertions(+)
>  create mode 100644 package/luaposix/Config.in
>  create mode 100644
> package/luaposix/luaposix-remove-cross-compile-check.patch
>  create mode 100644 package/luaposix/luaposix.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index 3351f21..9c615b5 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -314,6 +314,7 @@ source "package/luacrypto/Config.in"
>  source "package/luaexpat/Config.in"
>  source "package/luaexpatutils/Config.in"
>  source "package/luafilesystem/Config.in"
> +source "package/luaposix/Config.in"
>  source "package/luasocket/Config.in"
>  source "package/lua-ev/Config.in"
>  source "package/lua-msgpack-native/Config.in"
> diff --git a/package/luaposix/Config.in b/package/luaposix/Config.in
> new file mode 100644
> index 0000000..a4bad8d
> --- /dev/null
> +++ b/package/luaposix/Config.in
> @@ -0,0 +1,10 @@
> +config BR2_PACKAGE_LUAPOSIX
> +       bool "luaposix"
> +       help
> +         luaposix is a POSIX binding, including curses, for Lua 5.1 and
> 5.2;
> +         Like most libraries it simply binds to C APIs on the underlying
> +         system, so it won't work on a non-POSIX system. However, it does
> try
> +         to detect the level of POSIX conformance of the underlying
> system and
> +         bind only available APIs
> +
> +         https://github.com/rrthomas/luaposix
> diff --git a/package/luaposix/luaposix-remove-cross-compile-check.patch
> b/package/luaposix/luaposix-remove-cross-compile-check.patch
> new file mode 100644
> index 0000000..37dc2db
> --- /dev/null
> +++ b/package/luaposix/luaposix-remove-cross-compile-check.patch
> @@ -0,0 +1,13 @@
> +--- a/configure        2012-06-05 21:50:55.000000000 +0300
> ++++ b/configure        2012-07-16 14:41:15.000000000 +0300
> +@@ -14654,10 +14654,6 @@
> +   LUA_OLD_CPPFLAGS="$CPPFLAGS"
> +   CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
> +   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; }
> + else
> +   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> + /* end confdefs.h.  */
> diff --git a/package/luaposix/luaposix.mk b/package/luaposix/luaposix.mk
> new file mode 100644
> index 0000000..db55df0
> --- /dev/null
> +++ b/package/luaposix/luaposix.mk
> @@ -0,0 +1,15 @@
> +#############################################################
> +#
> +# luaposix
> +#
> +#############################################################
> +
> +LUAPOSIX_VERSION = 5.1.20
> +LUAPOSIX_SITE = https://github.com/downloads/luaposix/luaposix
> +LUAPOSIX_LICENSE = MIT
> +LUAPOSIX_LICENSE_FILES = COPYRIGHT
> +LUAPOSIX_DEPENDENCIES = lua host-lua luabitop
>

luabitop is not a built dependency.

François


> +LUAPOSIX_CONF_ENV = LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib"
> +LUAPOSIX_CONF_OPT = --libdir="/usr/lib/lua" --datarootdir="/usr/share/lua"
> +
> +$(eval $(autotools-package))
> --
> 1.8.1.2
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
Peter Korsgaard June 19, 2013, 9:34 p.m. UTC | #2
>>>>> "Assaf" == Assaf Inbal <shmuelzon@gmail.com> writes:

 Assaf> Luaposix is a Lua frontend to posix functions.
 Assaf> Signed-off-by: Assaf Inbal <shmuelzon@gmail.com>
 Assaf> ---
 Assaf>  package/Config.in                                         |  1 +
 Assaf>  package/luaposix/Config.in                                | 10 ++++++++++
 Assaf>  .../luaposix/luaposix-remove-cross-compile-check.patch    | 13 +++++++++++++
 Assaf>  package/luaposix/luaposix.mk                              | 15 +++++++++++++++
 Assaf>  4 files changed, 39 insertions(+)
 Assaf>  create mode 100644 package/luaposix/Config.in
 Assaf>  create mode 100644 package/luaposix/luaposix-remove-cross-compile-check.patch
 Assaf>  create mode 100644 package/luaposix/luaposix.mk

 Assaf> diff --git a/package/Config.in b/package/Config.in
 Assaf> index 3351f21..9c615b5 100644
 Assaf> --- a/package/Config.in
 Assaf> +++ b/package/Config.in
 Assaf> @@ -314,6 +314,7 @@ source "package/luacrypto/Config.in"
 Assaf>  source "package/luaexpat/Config.in"
 Assaf>  source "package/luaexpatutils/Config.in"
 Assaf>  source "package/luafilesystem/Config.in"
 Assaf> +source "package/luaposix/Config.in"
 Assaf>  source "package/luasocket/Config.in"
 Assaf>  source "package/lua-ev/Config.in"
 Assaf>  source "package/lua-msgpack-native/Config.in"
 Assaf> diff --git a/package/luaposix/Config.in b/package/luaposix/Config.in
 Assaf> new file mode 100644
 Assaf> index 0000000..a4bad8d
 Assaf> --- /dev/null
 Assaf> +++ b/package/luaposix/Config.in
 Assaf> @@ -0,0 +1,10 @@
 Assaf> +config BR2_PACKAGE_LUAPOSIX
 Assaf> +	bool "luaposix"
 Assaf> +	help
 Assaf> +	  luaposix is a POSIX binding, including curses, for Lua 5.1 and 5.2;
 Assaf> +	  Like most libraries it simply binds to C APIs on the underlying
 Assaf> +	  system, so it won't work on a non-POSIX system. However, it does try
 Assaf> +	  to detect the level of POSIX conformance of the underlying system and
 Assaf> +	  bind only available APIs
 Assaf> +
 Assaf> +	  https://github.com/rrthomas/luaposix
 Assaf> diff --git a/package/luaposix/luaposix-remove-cross-compile-check.patch b/package/luaposix/luaposix-remove-cross-compile-check.patch
 Assaf> new file mode 100644
 Assaf> index 0000000..37dc2db
 Assaf> --- /dev/null
 Assaf> +++ b/package/luaposix/luaposix-remove-cross-compile-check.patch
 Assaf> @@ -0,0 +1,13 @@

Description and signed-off-by missing. configure is a generated file,
you should normally fixup configure.ac and set LUAPOSIX_AUTORECONF = YES
to regenerate it instead.


 Assaf> +--- a/configure	2012-06-05 21:50:55.000000000 +0300
 Assaf> ++++ b/configure	2012-07-16 14:41:15.000000000 +0300
 Assaf> +@@ -14654,10 +14654,6 @@
 Assaf> +   LUA_OLD_CPPFLAGS="$CPPFLAGS"
 Assaf> +   CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
 Assaf> +   if test "$cross_compiling" = yes; then :
 Assaf> +-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 Assaf> +-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 Assaf> +-as_fn_error $? "cannot run test program while cross compiling
 Assaf> +-See \`config.log' for more details" "$LINENO" 5; }
 Assaf> + else
 Assaf> +   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 Assaf> + /* end confdefs.h.  */
 Assaf> diff --git a/package/luaposix/luaposix.mk b/package/luaposix/luaposix.mk
 Assaf> new file mode 100644
 Assaf> index 0000000..db55df0
 Assaf> --- /dev/null
 Assaf> +++ b/package/luaposix/luaposix.mk
 Assaf> @@ -0,0 +1,15 @@
 Assaf> +#############################################################
 Assaf> +#
 Assaf> +# luaposix
 Assaf> +#
 Assaf> +#############################################################

The ###### file headers should be 80 chars.

 Assaf> +
 Assaf> +LUAPOSIX_VERSION = 5.1.20
 Assaf> +LUAPOSIX_SITE = https://github.com/downloads/luaposix/luaposix
 Assaf> +LUAPOSIX_LICENSE = MIT
 Assaf> +LUAPOSIX_LICENSE_FILES = COPYRIGHT

I think you mean COPYING here.

 Assaf> +LUAPOSIX_DEPENDENCIES = lua host-lua luabitop


luabitop should go as François mentioned.

 Assaf> +LUAPOSIX_CONF_ENV = LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib"

Please explain why this is needed with a comment.

 Assaf> +LUAPOSIX_CONF_OPT = --libdir="/usr/lib/lua" --datarootdir="/usr/share/lua"
 Assaf> +
 Assaf> +$(eval $(autotools-package))

Care to resend with these issues fixed? Thanks.
Assaf Inbal June 20, 2013, 4:45 a.m. UTC | #3
>
> Care to resend with these issues fixed? Thanks.


See attached.
Arnout Vandecappelle June 20, 2013, 5:57 a.m. UTC | #4
On 20/06/13 06:45, Assaf Inbal wrote:
[snip]
> diff --git a/package/luaposix/luaposix-remove-lua-header-check.patch b/package/luaposix/luaposix-remove-lua-header-check.patch
> new file mode 100644
> index 0000000..7909b91
> --- /dev/null
> +++ b/package/luaposix/luaposix-remove-lua-header-check.patch
> @@ -0,0 +1,16 @@
> +Checking the Lua version inside the headers requires compiling a small
> +C program. However, autoconf will raise an error when attempting to do so
> +while cross-compiling. Hence, this specific test is removed.
> +
> +Signed-off-by: Assaf Inbal<shmuelzon@gmail.com>
> +--- a/configure.ac	2013-06-20 07:23:27.943091833 +0300
> ++++ b/configure.ac	2013-06-20 07:23:30.644441710 +0300
> +@@ -105,7 +105,7 @@
> +
> + dnl Lua 5.1 or 5.2
> + AX_PROG_LUA(501, 503)
> + AX_LUA_HEADERS
> +-AX_LUA_HEADERS_VERSION(501, 503)
> ++#AX_LUA_HEADERS_VERSION(501, 503)
> + AC_SUBST(LUA)
> + AC_SUBST(LUA_INCLUDE)
> diff --git a/package/luaposix/luaposix.mk b/package/luaposix/luaposix.mk
> new file mode 100644
> index 0000000..84570e6
> --- /dev/null
> +++ b/package/luaposix/luaposix.mk
> @@ -0,0 +1,18 @@
> +################################################################################
> +#
> +# luaposix
> +#
> +################################################################################
> +
> +LUAPOSIX_VERSION = 5.1.20
> +LUAPOSIX_SITE =https://github.com/downloads/luaposix/luaposix
> +LUAPOSIX_LICENSE = MIT
> +LUAPOSIX_LICENSE_FILES = COPYING
> +LUAPOSIX_DEPENDENCIES = lua host-lua
> +# Luaposix attempts to run Lua as a part of the configure proccess, it needs to
> +# find the location of liblua.so in order for the binary to execute

  Actually, then host-lua should be fixed to use an rpath. I'm surprised 
it doesn't, because what's the point of having host-lua when you can't 
execute it?


  Regards,
  Arnout

> +LUAPOSIX_CONF_ENV = LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib"
> +LUAPOSIX_CONF_OPT = --libdir="/usr/lib/lua" --datarootdir="/usr/share/lua"
> +LUAPOSIX_AUTORECONF = YES
> +
> +$(eval $(autotools-package))
> -- 1.7.9.5
Thomas Petazzoni June 20, 2013, 6:10 a.m. UTC | #5
Dear Assaf Inbal,

On Thu, 20 Jun 2013 07:45:26 +0300, Assaf Inbal wrote:
> >
> > Care to resend with these issues fixed? Thanks.
> 
> 
> See attached.

+# Luaposix attempts to run Lua as a part of the configure proccess, it needs to
+# find the location of liblua.so in order for the binary to execute
+LUAPOSIX_CONF_ENV = LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib"

I still don't quite understand why this is needed. All binaries built
and installed in $(HOST_DIR)/usr/bin are compiled with a RPATH of
$(HOST_DIR)/usr/lib, so normally, passing a LD_LIBRARY_PATH is not needed.

Can you check if the host lua in $(HOST_DIR)/usr/bin/ has the correct
RPATH, by doing:

readelf -d $(HOST_DIR)/usr/bin/lua | grep RPATH

Thanks!

Thomas
Assaf Inbal June 20, 2013, 7:05 a.m. UTC | #6
>
> Can you check if the host lua in $(HOST_DIR)/usr/bin/ has the correct
> RPATH, by doing:
>
> readelf -d $(HOST_DIR)/usr/bin/lua | grep RPATH
>

Hey Thomas,

I would be happy if there was a better way to handle this...

I ran the command, but got no results, RPATH doesn't exist in the Lua
binary.
See below the output (without grep):
$ readelf -d output/host/usr/bin/lua

Dynamic section at offset 0x2f14 contains 21 entries:
  Tag        Type                         Name/Value
 0x00000003 (PLTGOT)                     0x804bff4
 0x00000002 (PLTRELSZ)                   352 (bytes)
 0x00000017 (JMPREL)                     0x80488ac
 0x00000014 (PLTREL)                     REL
 0x00000011 (REL)                        0x804888c
 0x00000012 (RELSZ)                      32 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000006 (SYMTAB)                     0x80481ac
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000005 (STRTAB)                     0x804851c
 0x0000000a (STRSZ)                      658 (bytes)
 0x6ffffef5 (GNU_HASH)                   0x80487b0
 0x00000001 (NEEDED)                     Shared library: [liblua.so.5.1.5]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000c (INIT)                       0x8048a0c
 0x0000000d (FINI)                       0x804a16c
 0x6ffffff0 (VERSYM)                     0x80487ec
 0x6ffffffe (VERNEED)                    0x804885c
 0x6fffffff (VERNEEDNUM)                 1
 0x00000000 (NULL)                       0x0

Good day,
Assaf
Assaf Inbal June 20, 2013, 7:39 a.m. UTC | #7
>
> I ran the command, but got no results, RPATH doesn't exist in the Lua
> binary.
>

OK, so I've done a bit more digging and saw that buildroot adds -rpath as a
part of the HOST_LDFLAGS, but the problem was that this variable wasn't
passed to Lua's make file.
So, I'm submitting now two patches. The first is for adding these flags to
the host compilation of Lua and the second the for adding Luaposix, without
the LD_LIBRARY_PATH hack.

Thanks for pointing me in the right direction.

Good day,
Assaf
Thomas Petazzoni June 20, 2013, 7:46 a.m. UTC | #8
Dear Assaf Inbal,

On Thu, 20 Jun 2013 10:39:43 +0300, Assaf Inbal wrote:

> OK, so I've done a bit more digging and saw that buildroot adds -rpath as a
> part of the HOST_LDFLAGS, but the problem was that this variable wasn't
> passed to Lua's make file.

Ok.

> So, I'm submitting now two patches. The first is for adding these flags to
> the host compilation of Lua and the second the for adding Luaposix, without
> the LD_LIBRARY_PATH hack.

Thanks, this looks a lot better!

Best regards,

Thomas
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 3351f21..9c615b5 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -314,6 +314,7 @@  source "package/luacrypto/Config.in"
 source "package/luaexpat/Config.in"
 source "package/luaexpatutils/Config.in"
 source "package/luafilesystem/Config.in"
+source "package/luaposix/Config.in"
 source "package/luasocket/Config.in"
 source "package/lua-ev/Config.in"
 source "package/lua-msgpack-native/Config.in"
diff --git a/package/luaposix/Config.in b/package/luaposix/Config.in
new file mode 100644
index 0000000..a4bad8d
--- /dev/null
+++ b/package/luaposix/Config.in
@@ -0,0 +1,10 @@ 
+config BR2_PACKAGE_LUAPOSIX
+	bool "luaposix"
+	help
+	  luaposix is a POSIX binding, including curses, for Lua 5.1 and 5.2;
+	  Like most libraries it simply binds to C APIs on the underlying
+	  system, so it won't work on a non-POSIX system. However, it does try
+	  to detect the level of POSIX conformance of the underlying system and
+	  bind only available APIs
+
+	  https://github.com/rrthomas/luaposix
diff --git a/package/luaposix/luaposix-remove-cross-compile-check.patch b/package/luaposix/luaposix-remove-cross-compile-check.patch
new file mode 100644
index 0000000..37dc2db
--- /dev/null
+++ b/package/luaposix/luaposix-remove-cross-compile-check.patch
@@ -0,0 +1,13 @@ 
+--- a/configure	2012-06-05 21:50:55.000000000 +0300
++++ b/configure	2012-07-16 14:41:15.000000000 +0300
+@@ -14654,10 +14654,6 @@
+   LUA_OLD_CPPFLAGS="$CPPFLAGS"
+   CPPFLAGS="$CPPFLAGS $LUA_INCLUDE"
+   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; }
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
diff --git a/package/luaposix/luaposix.mk b/package/luaposix/luaposix.mk
new file mode 100644
index 0000000..db55df0
--- /dev/null
+++ b/package/luaposix/luaposix.mk
@@ -0,0 +1,15 @@ 
+#############################################################
+#
+# luaposix
+#
+#############################################################
+
+LUAPOSIX_VERSION = 5.1.20
+LUAPOSIX_SITE = https://github.com/downloads/luaposix/luaposix
+LUAPOSIX_LICENSE = MIT
+LUAPOSIX_LICENSE_FILES = COPYRIGHT
+LUAPOSIX_DEPENDENCIES = lua host-lua luabitop
+LUAPOSIX_CONF_ENV = LD_LIBRARY_PATH="$(HOST_DIR)/usr/lib"
+LUAPOSIX_CONF_OPT = --libdir="/usr/lib/lua" --datarootdir="/usr/share/lua"
+
+$(eval $(autotools-package))