Skip to contentSkip to conversation

lzlib: add LuaJIT support

PATCH New Wojciech Nizinski 2 participants 4 messages Feb 22, 2017 – Mar 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lzlib: add LuaJIT support

Previous change forces lua package to be built, even if LuaJIT is selected as only one lua interpreter.
Problem is located in lzlib build system: cmake scripts cannot find luajit.
This patch restores previous depends on BR2_PACKAGE_HAS_LUAINTERPRETER and adds build dependency to luajit or lua.

---
 .../0001-FindLua.cmake-support-for-LuaJIT.patch    | 67 ++++++++++++++++++++++
 package/lzlib/Config.in                            |  2 +-
 package/lzlib/lzlib.mk                             |  9 ++-
 3 files changed, 76 insertions(+), 2 deletions(-)
 create mode 100644 package/lzlib/0001-FindLua.cmake-support-for-LuaJIT.patch
package/lzlib/0001-FindLua.cmake-support-for-LuaJIT.patch new file +67 -0
new file mode 100644
index 000000000..30e29aae8
@@ -0,0 +1,67 @@
+From 4cedebed4746f1bcc3dc1a3e0c0bc7251153aeca Mon Sep 17 00:00:00 2001
+From: Wojciech Nizinski <[email protected]>
+Date: Tue, 21 Feb 2017 12:51:31 +0100
+Subject: [PATCH] FindLua.cmake: support for LuaJIT
+
+---
+ cmake/FindLua.cmake | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake
+index 7fb7ca3..0fdf235 100644
+--- a/cmake/FindLua.cmake
++++ b/cmake/FindLua.cmake
+@@ -34,7 +34,7 @@
+ # Always search for non-versioned lua first (recommended)
+ SET(_POSSIBLE_LUA_INCLUDE include include/lua)
+ SET(_POSSIBLE_LUA_EXECUTABLE lua)
+-SET(_POSSIBLE_LUA_LIBRARY lua)
++SET(_POSSIBLE_LUA_LIBRARY lua luajit)
+ 
+ # Determine possible naming suffixes (there is no standard for this)
+ IF(Lua_FIND_VERSION_MAJOR AND Lua_FIND_VERSION_MINOR)
+@@ -43,17 +43,25 @@ ELSE(Lua_FIND_VERSION_MAJOR AND Lua_FIND_VERSION_MINOR)
+   SET(_POSSIBLE_SUFFIXES "52" "5.2" "-5.2" "51" "5.1" "-5.1")
+ ENDIF(Lua_FIND_VERSION_MAJOR AND Lua_FIND_VERSION_MINOR)
+ 
++MESSAGE(STATUS "Possible suffixes: ${_POSSIBLE_SUFFIXES}")
++
+ # Set up possible search names and locations
+ FOREACH(_SUFFIX ${_POSSIBLE_SUFFIXES})
+   LIST(APPEND _POSSIBLE_LUA_INCLUDE "include/lua${_SUFFIX}")
+   LIST(APPEND _POSSIBLE_LUA_EXECUTABLE "lua${_SUFFIX}")
+   LIST(APPEND _POSSIBLE_LUA_LIBRARY "lua${_SUFFIX}")
++  LIST(APPEND _POSSIBLE_LUA_LIBRARY "luajit${_SUFFIX}")
+ ENDFOREACH(_SUFFIX)
+ 
++MESSAGE (STATUS "Possible LUA library names: ${_POSSIBLE_LUA_LIBRARY}")
++MESSAGE (STATUS "Possible LUA include dirs:  ${_POSSIBLE_LUA_INCLUDE}")
++MESSAGE (STATUS "Possible LUA executable:    ${_POSSIBLE_LUA_EXECUTABLE}")
++
+ # Find the lua executable
+ FIND_PROGRAM(LUA_EXECUTABLE
+   NAMES ${_POSSIBLE_LUA_EXECUTABLE}
+ )
++MESSAGE (STATUS "Found LUA executable: ${LUA_EXECUTABLE}")
+ 
+ # Find the lua header
+ FIND_PATH(LUA_INCLUDE_DIR lua.h
+@@ -70,6 +78,7 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h
+   /opt/csw # Blastwave
+   /opt
+ )
++MESSAGE (STATUS "Found LUA header: ${LUA_INCLUDE_DIR}")
+ 
+ # Find the lua library
+ FIND_LIBRARY(LUA_LIBRARY 
+@@ -87,6 +96,7 @@ FIND_LIBRARY(LUA_LIBRARY
+   /opt/csw
+   /opt
+ )
++MESSAGE (STATUS "Found LUA lib: ${LUA_LIBRARY}")
+ 
+ IF(LUA_LIBRARY)
+   # include the math library for Unix
+-- 
+2.11.0
+
package/lzlib/Config.in +1 -1
index 32328c5ec..f7fae1579 100644
@@ -1,7 +1,7 @@
 config BR2_PACKAGE_LZLIB
 	bool "lzlib"
 	select BR2_PACKAGE_ZLIB
-	depends on BR2_PACKAGE_LUA
+	depends on BR2_PACKAGE_HAS_LUAINTERPRETER
 	help
 	  This package provides a library to access zlib library
 	  functions and also to read/write gzip files using an
package/lzlib/lzlib.mk +8 -1
index f468a1c83..c3de5ccd7 100644
@@ -6,7 +6,14 @@
 
 LZLIB_VERSION = 0.4.3
 LZLIB_SITE = $(call github,LuaDist,lzlib,$(LZLIB_VERSION))
-LZLIB_DEPENDENCIES = lua zlib
+LZLIB_DEPENDENCIES = zlib
+
+ifeq ($(BR2_PACKAGE_LUAJIT),y)
+LZLIB_DEPENDENCIES += luajit
+else
+LZLIB_DEPENDENCIES += lua
+endif
+
 LZLIB_LICENSE = MIT
 LZLIB_CONF_OPTS = -DINSTALL_CMOD="/usr/lib/lua/$(LUAINTERPRETER_ABIVER)" \
 	-DINSTALL_LMOD="/usr/share/lua/$(LUAINTERPRETER_ABIVER)"
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 lzlib: add LuaJIT support

Hello,

Quoted 8 lines · Wojciech Nizinski

Previous change forces lua package to be built, even if LuaJIT is selected as only one lua interpreter.
Problem is located in lzlib build system: cmake scripts cannot find luajit.
This patch restores previous depends on BR2_PACKAGE_HAS_LUAINTERPRETER and adds build dependency to luajit or lua.

Thanks for your contribution. See some comments below.

package/lzlib/0001-FindLua.cmake-support-for-LuaJIT.patch line 5

Quoted 11 lines
package/lzlib/0001-FindLua.cmake-support-for-LuaJIT.patch new file +5 -0
new file mode 100644
index 000000000..30e29aae8
@@ -0,0 +1,67 @@
+From 4cedebed4746f1bcc3dc1a3e0c0bc7251153aeca Mon Sep 17 00:00:00 2001
+From: Wojciech Nizinski <[email protected]>
+Date: Tue, 21 Feb 2017 12:51:31 +0100
+Subject: [PATCH] FindLua.cmake: support for LuaJIT
+

This patch needs your SoB line.

Also, since this is kind of a feature patch, we will most likely not accept it in Buildroot unless it is accepted upstream. Have you submitted this patch to the upstream lzlib project?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 lzlib: add LuaJIT support

Quoted 15 lines · Thomas Petazzoni

Thanks for your contribution. See some comments below.

package/lzlib/0001-FindLua.cmake-support-for-LuaJIT.patch line 5

Quoted 11 lines
package/lzlib/0001-FindLua.cmake-support-for-LuaJIT.patch new file +5 -0
new file mode 100644
index 000000000..30e29aae8
@@ -0,0 +1,67 @@
+From 4cedebed4746f1bcc3dc1a3e0c0bc7251153aeca Mon Sep 17 00:00:00 2001
+From: Wojciech Nizinski <[email protected]>
+Date: Tue, 21 Feb 2017 12:51:31 +0100
+Subject: [PATCH] FindLua.cmake: support for LuaJIT
+

This patch needs your SoB line.

Quoted 3 lines

Also, since this is kind of a feature patch, we will most likely not accept it in Buildroot unless it is accepted upstream. Have you submitted this patch to the upstream lzlib project?

I've created pull request on GitHub project on the same day.
https://github.com/LuaDist/lzlib/pull/7)

Here is patch with SoB line:

---
  .../0001-FindLua.cmake-support-for-LuaJIT.patch    | 68 
++++++++++++++++++++++
  package/lzlib/Config.in                            |  2 +-
  package/lzlib/lzlib.mk                             |  9 ++-
  3 files changed, 77 insertions(+), 2 deletions(-)

create mode 100644
package/lzlib/0001-FindLua.cmake-support-for-LuaJIT.patch

(quoted diff) +0 -0

b/package/lzlib/0001-FindLua.cmake-support-for-LuaJIT.patch new file mode 100644
index 000000000..883c0f81f

package/lzlib/0001-FindLua.cmake-support-for-LuaJIT.patch new file +24 -0
@@ -0,0 +1,68 @@
+From 4cedebed4746f1bcc3dc1a3e0c0bc7251153aeca Mon Sep 17 00:00:00 2001
+From: Wojciech Nizinski <[email protected]>
+Date: Tue, 21 Feb 2017 12:51:31 +0100
+Subject: [PATCH 1/1] FindLua.cmake: support for LuaJIT
+
+Signed-off-by: Wojciech Nizinski <[email protected]>
+---
+ cmake/FindLua.cmake | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake
+index 7fb7ca3..0fdf235 100644
+--- a/cmake/FindLua.cmake
++++ b/cmake/FindLua.cmake
+@@ -34,7 +34,7 @@
+ # Always search for non-versioned lua first (recommended)
+ SET(_POSSIBLE_LUA_INCLUDE include include/lua)
+ SET(_POSSIBLE_LUA_EXECUTABLE lua)
+-SET(_POSSIBLE_LUA_LIBRARY lua)
++SET(_POSSIBLE_LUA_LIBRARY lua luajit)
+
+ # Determine possible naming suffixes (there is no standard for this)
+ IF(Lua_FIND_VERSION_MAJOR AND Lua_FIND_VERSION_MINOR)
+@@ -43,17 +43,25 @@ ELSE(Lua_FIND_VERSION_MAJOR AND 

Lua_FIND_VERSION_MINOR)
+ SET(_POSSIBLE_SUFFIXES "52" "5.2" "-5.2" "51" "5.1" "-5.1")
+ ENDIF(Lua_FIND_VERSION_MAJOR AND Lua_FIND_VERSION_MINOR) +
++MESSAGE(STATUS "Possible suffixes: ${_POSSIBLE_SUFFIXES}") ++
+ # Set up possible search names and locations
+ FOREACH(_SUFFIX ${_POSSIBLE_SUFFIXES})

+   LIST(APPEND _POSSIBLE_LUA_INCLUDE "include/lua${_SUFFIX}")
+   LIST(APPEND _POSSIBLE_LUA_EXECUTABLE "lua${_SUFFIX}")
+   LIST(APPEND _POSSIBLE_LUA_LIBRARY "lua${_SUFFIX}")
++  LIST(APPEND _POSSIBLE_LUA_LIBRARY "luajit${_SUFFIX}")

+ ENDFOREACH(_SUFFIX)
+
++MESSAGE (STATUS "Possible LUA library names: ${_POSSIBLE_LUA_LIBRARY}") ++MESSAGE (STATUS "Possible LUA include dirs: ${_POSSIBLE_LUA_INCLUDE}") ++MESSAGE (STATUS "Possible LUA executable: ${_POSSIBLE_LUA_EXECUTABLE}") ++
+ # Find the lua executable
+ FIND_PROGRAM(LUA_EXECUTABLE
+ NAMES ${_POSSIBLE_LUA_EXECUTABLE}
+ )
++MESSAGE (STATUS "Found LUA executable: ${LUA_EXECUTABLE}") +
+ # Find the lua header
+ FIND_PATH(LUA_INCLUDE_DIR lua.h
+@@ -70,6 +78,7 @@ FIND_PATH(LUA_INCLUDE_DIR lua.h
+ /opt/csw # Blastwave
+ /opt
+ )
++MESSAGE (STATUS "Found LUA header: ${LUA_INCLUDE_DIR}")
+
+ # Find the lua library
+ FIND_LIBRARY(LUA_LIBRARY
+@@ -87,6 +96,7 @@ FIND_LIBRARY(LUA_LIBRARY
+ /opt/csw
+ /opt
+ )
++MESSAGE (STATUS "Found LUA lib: ${LUA_LIBRARY}")
+
+ IF(LUA_LIBRARY)
+ # include the math library for Unix
+--
+2.11.0
+

package/lzlib/Config.in +1 -1
index 32328c5ec..f7fae1579 100644
@@ -1,7 +1,7 @@
  config BR2_PACKAGE_LZLIB
      bool "lzlib"
      select BR2_PACKAGE_ZLIB
-    depends on BR2_PACKAGE_LUA
+    depends on BR2_PACKAGE_HAS_LUAINTERPRETER
      help
        This package provides a library to access zlib library
        functions and also to read/write gzip files using an
package/lzlib/lzlib.mk +8 -2
index f468a1c83..c3de5ccd7 100644
@@ -6,7 +6,14 @@
 
  LZLIB_VERSION = 0.4.3
  LZLIB_SITE = $(call github,LuaDist,lzlib,$(LZLIB_VERSION))
-LZLIB_DEPENDENCIES = lua zlib
+LZLIB_DEPENDENCIES = zlib
+
+ifeq ($(BR2_PACKAGE_LUAJIT),y)
+LZLIB_DEPENDENCIES += luajit
+else
+LZLIB_DEPENDENCIES += lua
+endif
+
  LZLIB_LICENSE = MIT
  LZLIB_CONF_OPTS = 
-DINSTALL_CMOD="/usr/lib/lua/$(LUAINTERPRETER_ABIVER)" \
      -DINSTALL_LMOD="/usr/share/lua/$(LUAINTERPRETER_ABIVER)"
Signature · 1 line
2.11.0
#3 lore raw

PATCH 1/1 lzlib: add LuaJIT support

Hello,

Quoted 2 lines · Wojciech Nizinski

I've created pull request on GitHub project on the same day.
https://github.com/LuaDist/lzlib/pull/7)

Thanks for doing this! Can you wait until upstream gives some feedback and merges the patch, and then submit it again to Buildroot?

Quoted 1 line

Here is patch with SoB line:

This patch cannot be applied, it's completely line wrapped. Please always send your patches with "git send-email".

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com