-
Notifications
You must be signed in to change notification settings - Fork 517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use upstream luajit meson wrap #242
Conversation
I don't know if this is needed/wanted. But I think upstream wrap by benoit-pierre is pretty ok. Of course current Aegisub is good too, but this PR transfers maintenance cost of the luajit wrap elsewhere. |
I... sent a pull request to your pull request because using github reviews to suggest changes didn't work so well. kasper93#1 I simplified the code a little, some conditionals weren't needed and I put the arguments to I tested the path with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! In principle this is definitely wanted, the less we have to vendor and wrap ourselves the better.
However, this doesn't actually work for me as it is (on Arch Linux, using meson 1.6.1, with non-5.2 system luajit installed). The subproject is executed, but the dependency()
call afterwards still returns the pkg-config
dependency. I believe that's why the original code used a manual get_variable
solution. (In fact, I am slightly confused as to why the meson.override_dependency
call works at all here. When I tried making our luajit wrap override the dependency, I got an error because the dependency had already been resolved. Maybe this depends on the meson version, I'd have to look into this further.)
However, the upstream luajit wrap doesn't actually write the result of declare_dependency
into a variable, so it'd have to be updated or patched (with a diff) locally. When patching it this way, however (and passing -Ddefault_library=static
when configuring Aegisub), things compile.
Finally, 5.2 compat doesn't actually seem to work with this wrap. The flag -DLUAJIT_ENABLE_LUA52COMPAT
flag is only set for the target, but it also needs to be set for the native objects for buildvm (and this suggests that maybe it should be carefully checked if any other flags are missing for native objects).
In summary, while switching to an upstream wrap would be nice, it does seem to need a bit of extra work, at least some of which needs to happen on the wrap itself. (I don't expect you to do that work, I'm just writing out everything I know here. I might do it myself eventually.)
The two review comments are from before I wrote all of the above so they're not really pressing, but I'll leave them in so I don't forget.
meson.build
Outdated
luajit = dependency('luajit', version: '>=2.0.0', required: get_option('system_luajit')) | ||
luajit = dependency('luajit', version: '>=2.0.0', required: get_option('system_luajit'), | ||
allow_fallback: false, | ||
default_options: ['amalgam=true', 'luajit=false', 'lua52compat=true']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you have default_options
together with allow_fallback: false
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case meson.override_dependency
were called before the initial lookup it would always use subproject. This can happen if Aegisub itself is used as subproject. Unlikely as it may be, it can happen that those default_options
would be used.
subprojects/luabins/meson.build
Outdated
@@ -24,16 +26,27 @@ int main(void) | |||
}''', dependencies: luajit) | |||
|
|||
if luajit_test.returncode() == 1 | |||
message('System luajit found but not compiled in 5.2 mode; using built-in luajit') | |||
if get_option('system_luajit') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to check this option in the subproject, which won't necessarily match the value of system_luajit
for the parent project? Or is this just to match the parent meson.build's logic one-to-one? (If so, could you maybe add a comment above this section saying something like Duplicate luajit detection logic from main meson.build
?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is this just to match the parent meson.build's logic one-to-one?
Correct. In fact if we agree that luabins is only used as a subproject of main meson.build we can remove this duplicated logic completely.
I was kinda expecting that. It probably uses the cached dependency lookup. I was hoping that all args to dependency() are used for the cache, but apparently not. Either way, I will fix that when I get a sec. Likely using different required version would invalidate the cache.
Yeah, I was expecting override_dependecy actually did the job of overriding it.
Exactly, that's why I did all the changes here to adopt it. |
Should be fixed now. |
Thanks for looking into this! With meson 1.5 this now works for me on Linux (with system luajit installed) and on Windows (with no luajit installed, barring problems in the wrap). With meson 1.0 (which we'd like to support since that is what Debian stable currently ships), I get an error about Apart from that, all the Aegisub-side build logic seems to work now. The remaining problems are ones in the upstream luajit wrap itself (apart from broken 5.2 compat I also now saw that it doesn't (always) work on Windows since it calls a shell script), which I'll look into myself at some point. Once that's figured out, we can merge this PR. Finally: Do you know if this behavior of the caching in |
Yes, it is better to check it again in luabins, if anything to be safe we don't mix different luajit variants.
This was my idea, but apparently I copied it by accident in the end. Fixed now. As for
What do you mean exactly? Does it not compile with 5.2 compat? Looking at the code everything should be fine, but I didn't test the actual build. The define is there tho.
I think it calls
This is iffy. Currently I actually do I didn't expect initially all this changes to be required. I was hoping for drop-in replacement, but as we can see some shenanigans are needed. At least there is an assert there, so it if fails for whatever reason it will be immediately visible and not silently using wrong version. |
The define is there for the luajit library, but not for buildvm, which also needs it. |
Definitely a bug to report to the Meson wrap then. |
I've pushed small test to catch invalid luajit early. Either if it slips through our meson checks or subproject is built incorrectly. EDIT: and mesonbuild/wrapdb#1848 |
Thanks! This now looks good to me pending mesonbuild/wrapdb#1853 . |
Oh, I didn't see your edit. I'll update the PR to mention the issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Force pushed to update the wrap. Thanks again!
No description provided.