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 Dec 27, 2024
1 parent 1a082c7 commit 58710d5
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 236 deletions.
22 changes: 16 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ if get_option('enable_update_checker')
deps += [libcurl_dep]
endif

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'])
if luajit.found() and luajit.type_name() != 'internal'
luajit_test = cc.run('''#include <lauxlib.h>
int main(void)
Expand All @@ -332,18 +334,26 @@ 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', version: '>=2.0.0',
default_options: ['amalgam=true', 'luajit=false', 'lua52compat=true'])
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
25 changes: 19 additions & 6 deletions subprojects/luabins/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ luabins_src = files(

deps = []

luajit = dependency('luajit', version: '>=2.0.0')
luajit = dependency('luajit', version: '>=2.0.0', required: get_option('system_luajit'),
allow_fallback: false,
default_options: ['amalgam=true', 'luajit=false', 'lua52compat=true'])
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 +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')
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', version: '>=2.0.0',
default_options: ['amalgam=true', 'luajit=false', 'lua52compat=true'])
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 58710d5

Please sign in to comment.