Skip to contentSkip to conversation

luajit: point /usr/bin/lua to luajit if lua not selected

PATCH Superseded Danomi Manchego 2 participants 3 messages Nov 9, 2014 – Nov 18, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 luajit: point /usr/bin/lua to luajit if lua not selected

The luajit package is a provider of a lua interpreter, but does not install a lua executable, as it can live side by side with lua. This is fine for scripts that explicitly invoke luajit, but not so good for scripts that just need a lua interpreter and call lua. This mod creates a lua symlink so that the non-jit-specific scripts will still work.

---
 package/luajit/luajit.mk |    7 +++++++
 1 file changed, 7 insertions(+)
package/luajit/luajit.mk +7 -0
index 2c1f8f4..f38088c 100644
@@ -64,6 +64,13 @@ define LUAJIT_INSTALL_TARGET_CMDS
 	$(MAKE) PREFIX="/usr" DESTDIR="$(TARGET_DIR)" LDCONFIG=true -C $(@D) install
 endef
 
+ifneq ($(BR2_PACKAGE_LUA),y)
+define LUAJIT_INSTALL_SYMLINK
+	ln -fs luajit $(TARGET_DIR)/usr/bin/lua
+endef
+LUAJIT_POST_INSTALL_TARGET_HOOKS += LUAJIT_INSTALL_SYMLINK
+endif
+
 define HOST_LUAJIT_BUILD_CMDS
 	$(MAKE) PREFIX="/usr" BUILDMODE=static -C $(@D) amalg
 endef
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 luajit: point /usr/bin/lua to luajit if lua not selected

Danomi, All,

On 2014-11-08 22:22 -0500, Danomi Manchego spake thusly:

Quoted 2 lines

The luajit package is a provider of a lua interpreter, but does not install a lua executable, as it can live side by side with lua.

That is not the case in Buildroot: since they are both providers for the luainterpreter virtual package, only one of them may be enabled at a time in Buildroot.

(Well, it's possible to enable both in the menuconfig, but then it will fail early at build time.)

Quoted 15 lines

This is fine for scripts that explicitly invoke luajit, but not so good for scripts that just need a lua interpreter and call lua. This mod creates a lua symlink so that the non-jit-specific scripts will still work.

---
 package/luajit/luajit.mk |    7 +++++++
 1 file changed, 7 insertions(+)
package/luajit/luajit.mk +0 -0
index 2c1f8f4..f38088c 100644

package/luajit/luajit.mk define LUAJIT_INSTALL_TARGET_CMDS · line 72

Quoted 9 lines
package/luajit/luajit.mk +6 -0
@@ -64,6 +64,13 @@ define LUAJIT_INSTALL_TARGET_CMDS
 	$(MAKE) PREFIX="/usr" DESTDIR="$(TARGET_DIR)" LDCONFIG=true -C $(@D) install
 endef
 
+ifneq ($(BR2_PACKAGE_LUA),y)
+define LUAJIT_INSTALL_SYMLINK
+	ln -fs luajit $(TARGET_DIR)/usr/bin/lua
+endef
+LUAJIT_POST_INSTALL_TARGET_HOOKS += LUAJIT_INSTALL_SYMLINK
+endif

Well, since only one of lua or luajit can be enabled at a time, there is not reason for that conditional block.

Otherwise, OK for creating the symlink.

Note: I seem to recall you (or someone else?) already asked to be able to be able to select both lua and luajit at the same time.

This is unfortunately not possible, given how we hanfdle virtual
packages: only one provider may be active at a time.

However, I think there might be a solution for that, but it is not really clean. For example, we could do (code stripped down for readability):

config BR2_PACKAGE_LUAJIT
bool "luajit"
select BR2_PACKAGE_HAS_LUAINTERPRETER if !BR2_PACKAGE_LUA

if BR2_PACKAGE_LUAJIT

config BR2_PACKAGE_PROVIDES_LUAINTERPRETER
default "luajit" if !BR2_PACKAGE_LUA

endif

But I doubt we want to go down that route in Buildroot... Thomas, Peter?

Regards,
Yann E. MORIN.

Quoted 10 lines
package/luajit/luajit.mk +0 -0
 define HOST_LUAJIT_BUILD_CMDS
 	$(MAKE) PREFIX="/usr" BUILDMODE=static -C $(@D) amalg
 endef
Signature · 6 lines
1.7.9.5

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 luajit: point /usr/bin/lua to luajit if lua not selected

Yann,

Quoted 6 lines · Yann E. MORIN

Danomi, All,

On 2014-11-08 22:22 -0500, Danomi Manchego spake thusly:

Quoted 2 lines

The luajit package is a provider of a lua interpreter, but does not install a lua executable, as it can live side by side with lua.

Quoted 6 lines

That is not the case in Buildroot: since they are both providers for the luainterpreter virtual package, only one of them may be enabled at a time in Buildroot.

(Well, it's possible to enable both in the menuconfig, but then it will fail early at build time.)

Understood. I was simply explaining why luajit doesn't install a "lua", and probably never will - because there's no reason outside of buildroot to think that luajit and lua are mutually exclusive.

Quoted 28 lines
Quoted 15 lines

This is fine for scripts that explicitly invoke luajit, but not so good for scripts that just need a lua interpreter and call lua. This mod creates a lua symlink so that the non-jit-specific scripts will still work.

---
 package/luajit/luajit.mk |    7 +++++++
 1 file changed, 7 insertions(+)
package/luajit/luajit.mk +0 -0
index 2c1f8f4..f38088c 100644

package/luajit/luajit.mk define LUAJIT_INSTALL_TARGET_CMDS · line 72

Quoted 9 lines
package/luajit/luajit.mk +6 -0
@@ -64,6 +64,13 @@ define LUAJIT_INSTALL_TARGET_CMDS
      $(MAKE) PREFIX="/usr" DESTDIR="$(TARGET_DIR)" LDCONFIG=true -C $(@D) install
 endef
 
+ifneq ($(BR2_PACKAGE_LUA),y)
+define LUAJIT_INSTALL_SYMLINK
+     ln -fs luajit $(TARGET_DIR)/usr/bin/lua
+endef
+LUAJIT_POST_INSTALL_TARGET_HOOKS += LUAJIT_INSTALL_SYMLINK
+endif

Well, since only one of lua or luajit can be enabled at a time, there is not reason for that conditional block.

Quoted 1 line

Otherwise, OK for creating the symlink.

I'm fine with taking the conditional out. I was simply emulating a similar setup in python3.mk:

  define PYTHON3_INSTALL_SYMLINK
  ln -fs python3 $(TARGET_DIR)/usr/bin/python
  endef

  ifneq ($(BR2_PACKAGE_PYTHON),y)
  PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
  endif

Anyway, I'll wait to see if there is more feedback before generating a v2.

Thanks,
Danomi -

Quoted 45 lines

Note: I seem to recall you (or someone else?) already asked to be able to be able to select both lua and luajit at the same time.

This is unfortunately not possible, given how we hanfdle virtual
packages: only one provider may be active at a time.

However, I think there might be a solution for that, but it is not really clean. For example, we could do (code stripped down for readability):

config BR2_PACKAGE_LUAJIT
bool "luajit"
select BR2_PACKAGE_HAS_LUAINTERPRETER if !BR2_PACKAGE_LUA

if BR2_PACKAGE_LUAJIT

config BR2_PACKAGE_PROVIDES_LUAINTERPRETER
default "luajit" if !BR2_PACKAGE_LUA

endif

But I doubt we want to go down that route in Buildroot... Thomas, Peter?

Regards,
Yann E. MORIN.

Quoted 10 lines
package/luajit/luajit.mk +0 -1
 define HOST_LUAJIT_BUILD_CMDS
      $(MAKE) PREFIX="/usr" BUILDMODE=static -C $(@D) amalg
 endef
--

1.7.9.5

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'