Bug 238079

Summary: editors/neovim: use Lua instead of LuaJIT on various architectures (aarch64, powerpc64 etc)
Product: Ports & Packages Reporter: Greg V <greg>
Component: Individual Port(s)Assignee: Adam Weinberger <adamw>
Status: Closed FIXED    
Severity: Affects Only Me CC: greg
Priority: --- Flags: bugzilla: maintainer-feedback? (adamw)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 201763    
Attachments:
Description Flags
neovim-lua.patch none

Description Greg V 2019-05-23 17:43:26 UTC
Created attachment 204572 [details]
neovim-lua.patch

So, Neovim defaults to LuaJIT, but FreeBSD Ports currently only has LuaJIT 2.0.5, while support for aarch64 and mips64 was only added in 2.1.0-beta, and powerpc64 support only exists in an unofficial fork https://github.com/PPC64/LuaJIT

I posted a luajit 2.1.0-beta3 update as bug 225342, but its dependencies bug 226537 and bug 226541 are still unresolved.

And recently I've discovered an extra problem: LuaJIT was still calling setrlimit for some reason related to FreeBSD <10 not supporting MAP32 or something, which was imposing a data size limit on any process you'd run under neovim :D https://github.com/siddhesh/LuaJIT/pull/1 — I've sent the fix to one of the maintained forks, I should also post it to ports but I haven't checked if it applies to 2.0.5.

Aaaaanyway, since the 2.1.0-beta3 update is not merged yet, let's just unbreak neovim already by using regular Lua on non-x86 platforms instead. Turns out Neovim does support lua 5.2+ https://github.com/neovim/neovim/pull/9280/files and other distributions are using this for architectures like aarch64: https://github.com/NixOS/nixpkgs/pull/61588

Honestly I'd be okay with always using regular Lua on any platform, but that's not my call to make.
Comment 1 Adam Weinberger freebsd_committer 2019-05-27 20:55:56 UTC
Hi Greg, sorry for the delayed response, I was on vacation. I like the idea but I'm not liking LUAJIT just being a default--people on x86 should always have it enabled. I think OPTIONS_SLAVE_amd64/i386 might work better than just OPTIONS_DEFAULT. I haven't tested that out though.
Comment 2 Greg V 2019-05-27 23:17:01 UTC
(In reply to Adam Weinberger from comment #1)
> people on x86 should always have it enabled

Why? It's a valid option.

I'm currently using a build with lua 5.2 on amd64 and not planning on going back to luajit. I'd like to get rid of luajit on my system completely.
Comment 3 Adam Weinberger freebsd_committer 2019-05-28 13:39:06 UTC
Interesting. I hadn't considered x86 nvim without luajit before, though I see now that you mentioned it in your original PR message too.
Comment 4 commit-hook freebsd_committer 2019-05-28 14:04:47 UTC
A commit references this bug:

Author: adamw
Date: Tue May 28 14:04:35 UTC 2019
New revision: 502895
URL: https://svnweb.freebsd.org/changeset/ports/502895

Log:
  Disable LuaJIT on non-x86 architectures

  The version of LuaJIT in port doesn't work well (or at all) for neovim
  on non-x86 architectures. Plus, some users (at least the submitter, who
  made a good argument for it) may not want LuaJIT at all.

  So, make LuaJIT an OPTION. Enable it by default, and exclude it from
  all the archs that LuaJIT+neovim doesn't work on. Fall back instead on
  normal Lua.

  PR:		238079
  Submitted by:	Greg V
  MFH:		2019Q2

Changes:
  head/editors/neovim/Makefile
Comment 5 commit-hook freebsd_committer 2019-05-28 14:08:53 UTC
A commit references this bug:

Author: adamw
Date: Tue May 28 14:08:12 UTC 2019
New revision: 502897
URL: https://svnweb.freebsd.org/changeset/ports/502897

Log:
  MFH: r500370 r502895
  Approved by:	portmgr (with hat)

  Update neovim to 0.3.5

  Maintenance release to fix issues found in v0.3.4.

    options: properly reset directories on 'autochdir'
    Remove MSVC optimization workaround for SHM_ALL
    Make SHM_ALL to a variable instead of a compound literal #define
    doc: mention "pynvim" module rename
    screen: don't crash when drawing popupmenu with 'rightleft' option
    look-behind match may use the wrong line number
    :terminal : set topline based on window height
    :recover : Fix crash on non-existent *.swp

  Disable LuaJIT on non-x86 architectures

  The version of LuaJIT in port doesn't work well (or at all) for neovim
  on non-x86 architectures. Plus, some users (at least the submitter, who
  made a good argument for it) may not want LuaJIT at all.

  So, make LuaJIT an OPTION. Enable it by default, and exclude it from
  all the archs that LuaJIT+neovim doesn't work on. Fall back instead on
  normal Lua.

  PR:		238079
  Submitted by:	Greg V

Changes:
_U  branches/2019Q2/
  branches/2019Q2/editors/neovim/Makefile
  branches/2019Q2/editors/neovim/distinfo
Comment 6 Adam Weinberger freebsd_committer 2019-05-28 14:10:27 UTC
Committed with slight modifications (spacing, changed a few words in the _DESC, and used OPTIONS_DEFAULT instead of per-arch _DEFAULT). Threw in a PORTREVISION bump for good measure, and merged it to quarterly.

Thanks for this, Greg!