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 authored and arch1t3cht committed Jan 6, 2025
1 parent 7e9422f commit da7d1da
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 240 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,13 @@ jobs:
run: |
set -e
# Work around https://github.com/mesonbuild/meson/issues/14005
rm -rf subprojects/luajit/.git
meson dist --include-subprojects -C build
# Make sure the subprojects we need are included
mkdir distcheck
tar -xJf build/meson-dist/*.tar.xz -C distcheck/
test -e distcheck/*/subprojects/luabins/meson.build
test -e distcheck/*/subprojects/luajit/meson.build
test -e distcheck/*/subprojects/LuaJIT*/meson.build
- name: Upload artifacts - tarball
uses: actions/upload-artifact@v4
Expand Down
30 changes: 23 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
project('Aegisub', ['c', 'cpp'],
license: 'BSD-3-Clause',
meson_version: '>=0.57.0',
default_options: ['cpp_std=c++20', 'buildtype=debugoptimized', 'harfbuzz:icu=disabled', 'ffmpeg:libdav1d=enabled'],
default_options: [
'cpp_std=c++20',
'buildtype=debugoptimized',
'harfbuzz:icu=disabled',
'ffmpeg:libdav1d=enabled',
'luajit:amalgam=true',
'luajit:lua52compat=true',
'luajit:luajit=false',
],
version: '3.4.1')

cmake = import('cmake')
Expand Down Expand Up @@ -318,7 +326,8 @@ 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, method: 'pkg-config')
if luajit.found() and luajit.type_name() != 'internal'
luajit_test = cc.run('''#include <lauxlib.h>
int main(void)
Expand All @@ -334,18 +343,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')
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
19 changes: 14 additions & 5 deletions subprojects/luabins/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ luabins_src = files(

deps = []

luajit = dependency('luajit', version: '>=2.0.0')
luajit = dependency('luajit', version: '>=2.0.0', required: false,
allow_fallback: false, method: 'pkg-config')
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 +25,24 @@ 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')
message('System luajit found but not compiled in 5.2 mode')
luajit = dependency('', required: false)
else
deps += luajit
endif
else
message('System luajit not found; using built-in luajit')
message('System luajit not found')
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')
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-2_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/luajit_2.1.1720049189-2/get_patch
patch_hash = e54b4ff6dc1f8cb2d43a2a64b56822e644aa03edf4a0ef472678f3046e272655
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/luajit_2.1.1720049189-2/luajit-2.1.1720049189.tar.gz
wrapdb_version = 2.1.1720049189-2

[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 da7d1da

Please sign in to comment.