Skip to content

Commit

Permalink
Use upstream luajit meson wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Jan 3, 2025
1 parent 235a1d3 commit 87f1750
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 236 deletions.
26 changes: 20 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,14 @@ if get_option('enable_update_checker')
deps += [libcurl_dep]
endif

luajit = dependency('luajit', version: '>=2.0.0', required: get_option('system_luajit'))
luajit_kwargs = {
'version': '>= 2.0.0',
'default_options': ['amalgam=true', 'luajit=false', 'lua52compat=true']
}

luajit = dependency('luajit', required: get_option('system_luajit'),
allow_fallback: false, method: 'pkg-config',
kwargs: luajit_kwargs)
if luajit.found() and luajit.type_name() != 'internal'
luajit_test = cc.run('''#include <lauxlib.h>
int main(void)
Expand All @@ -334,18 +341,25 @@ int main(void)
if get_option('system_luajit')
error('System luajit found but not compiled in 5.2 mode')
else
message('System luajit found but not compiled in 5.2 mode; using built-in luajit')
message('System luajit found but not compiled in 5.2 mode')
luajit = dependency('', required: false)
endif
else
deps += luajit
endif
else
message('System luajit not found; using built-in luajit')
endif

if not deps.contains(luajit)
deps += subproject('luajit').get_variable('luajit_dep')
if not luajit.found()
message('Using built-in luajit')
subproject('luajit') # Initialize subproject to ignore system luajit
luajit = dependency('luajit', kwargs: luajit_kwargs)
assert(luajit.type_name() == 'internal', 'System luajit used instead of built-in luajit')
endif

if luajit.type_name() == 'internal'
deps += luajit
endif

deps += subproject('luabins').get_variable('luabins_dep')

dep_gl = dependency('gl', required: false)
Expand Down
29 changes: 23 additions & 6 deletions subprojects/luabins/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ luabins_src = files(

deps = []

luajit = dependency('luajit', version: '>=2.0.0')
luajit_kwargs = {
'version': '>= 2.0.0',
'default_options': ['amalgam=true', 'luajit=false', 'lua52compat=true']
}

luajit = dependency('luajit', required: get_option('system_luajit'),
allow_fallback: false, method: 'pkg-config',
kwargs: luajit_kwargs)
if luajit.found() and luajit.type_name() != 'internal'
luajit_test = meson.get_compiler('c').run('''#include <lauxlib.h>
int main(void)
Expand All @@ -24,16 +31,26 @@ 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')
error('System luajit found but not compiled in 5.2 mode')
else
message('System luajit found but not compiled in 5.2 mode')
luajit = dependency('', required: false)
endif
else
deps += luajit
endif
else
message('System luajit not found; using built-in luajit')
endif

if not deps.contains(luajit)
deps += subproject('luajit').get_variable('luajit_dep')
if not luajit.found()
message('Using built-in luajit')
subproject('luajit') # Initialize subproject to ignore system luajit
luajit = dependency('luajit', kwargs: luajit_kwargs)
assert(luajit.type_name() == 'internal', 'System luajit used instead of built-in luajit')
endif

if luajit.type_name() == 'internal'
deps += luajit
endif

luabins = static_library('luabins', luabins_src, dependencies: deps)
Expand Down
18 changes: 12 additions & 6 deletions subprojects/luajit.wrap
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
[wrap-git]
directory = luajit
url = https://github.com/LuaJIT/LuaJIT.git
revision = v2.1
patch_directory = luajit
[wrap-file]
directory = LuaJIT-04dca7911ea255f37be799c18d74c305b921c1a6
source_url = https://github.com/LuaJIT/LuaJIT/archive/04dca7911ea255f37be799c18d74c305b921c1a6.tar.gz
source_filename = luajit-2.1.1720049189.tar.gz
source_hash = 346b028d9ba85e04b7e23a43cc51ec076574d2efc0d271d4355141b0145cd6e0
patch_filename = luajit_2.1.1720049189-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/luajit_2.1.1720049189-1/get_patch
patch_hash = 3d62fd49cc65bc89c187bf94f633d9d48056f6034541c372e5180fc7bd64d7ae
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/luajit_2.1.1720049189-1/luajit-2.1.1720049189.tar.gz
wrapdb_version = 2.1.1720049189-1

[provide]
luajit = luajit_dep
dependency_names = luajit
program_names = luajit
40 changes: 0 additions & 40 deletions subprojects/packagefiles/luajit/meson.build

This file was deleted.

56 changes: 0 additions & 56 deletions subprojects/packagefiles/luajit/src/host/meson.build

This file was deleted.

1 change: 0 additions & 1 deletion subprojects/packagefiles/luajit/src/luajit_relver.txt.in

This file was deleted.

121 changes: 0 additions & 121 deletions subprojects/packagefiles/luajit/src/meson.build

This file was deleted.

0 comments on commit 87f1750

Please sign in to comment.