dev-libs/libpeas: bump to 1.26.0
[gentoo.git] / dev-libs / libpeas / files / 1.26.0-lua.patch
1 From b693feda0148eb421e1f59d468caceb6f3183a82 Mon Sep 17 00:00:00 2001
2 From: Mart Raudsepp <mart@leio.tech>
3 Date: Mon, 16 Mar 2020 23:43:12 +0200
4 Subject: [PATCH] build: Handle lua as needed by Gentoo
5
6 Gentoo currently uses unversioned lua:0 - lua.pc instad of lua5.1.pc,
7 /usr/bin/lua instead of /usr/bin/lua5.1
8 Additionally lua and luajit can be installed in parallel, but only one
9 should be chosen - so add explicit meson options to choose between them.
10 This is currently in a hacky un-upstreamable way: working correctly only
11 if both options are disabled, or only one is enabled and the other
12 disabled, but having logic issues if any is "auto" or both enabled; this
13 is because feature option is mainly used to handle explicit choice
14 between them more easily in a Gentoo-specific patch without having to
15 add various conditional branches thanks to the feature being disabled
16 acting as a full disabler, so the other option is automatically not
17 checked.
18 ---
19  meson.build       | 22 +++++++---------------
20  meson_options.txt |  5 ++++-
21  2 files changed, 11 insertions(+), 16 deletions(-)
22
23 diff --git a/meson.build b/meson.build
24 index 8322fea..49e5011 100644
25 --- a/meson.build
26 +++ b/meson.build
27 @@ -117,18 +117,12 @@ endif
28  
29  python2_dep = dependency('python2', version: python2_req, required: false)
30  pygobject_dep = dependency('pygobject-3.0', version: pygobject_req, required: false)
31 -lua51_dep = dependency('lua51', version: lua_req, required: false)
32 -if not lua51_dep.found()
33 -  lua51_dep = dependency('lua-5.1', version: lua_req, required: false)
34 -endif
35 -luajit_dep = dependency('luajit', version: luajit_req, required: false)
36 +lua51_dep = dependency('lua', version: lua_req, required: get_option('lua51'))
37 +luajit_dep = dependency('luajit', version: luajit_req, required: get_option('luajit'))
38  lua_lgi_found = false
39  lua_lgi_ver = 'not found'
40 -lua51_prg = find_program('lua5.1', required: false)
41 -if not lua51_prg.found()
42 -  lua51_prg = find_program('lua51', required: false)
43 -endif
44 -luajit_prg = find_program('luajit', required: false)
45 +lua51_prg = find_program('lua', required: get_option('lua51'))
46 +luajit_prg = find_program('luajit', required: get_option('luajit'))
47  xmllint_prg = find_program('xmllint', required: false)
48  
49  if (luajit_dep.found() and luajit_prg.found()) or (lua51_dep.found() and lua51_prg.found())
50 @@ -144,6 +138,8 @@ if (luajit_dep.found() and luajit_prg.found()) or (lua51_dep.found() and lua51_p
51              lua51_lgi_dep = declare_dependency(version: lua_lgi_ver)
52              lua_lgi_found = true
53          endif
54 +    else
55 +        error('lua support requested but lua-lgi not found')
56      endif
57      message('lua-lgi version: ' + lua_lgi_ver)
58  endif
59 @@ -222,11 +218,7 @@ if generate_gir and not introspection_dep.found()
60    generate_gir = false
61  endif
62  
63 -build_lua51_loader = get_option('lua51')
64 -lua51_found = (luajit_dep.found() or lua51_dep.found()) and lua_lgi_found
65 -if build_lua51_loader and not lua51_found
66 -  build_lua51_loader = false
67 -endif
68 +build_lua51_loader = (luajit_dep.found() or lua51_dep.found()) and lua_lgi_found
69  
70  build_python2_loader = get_option('python2')
71  python2_found = python2_dep.found() and pygobject_dep.found()
72 diff --git a/meson_options.txt b/meson_options.txt
73 index 18e1779..dc3e776 100644
74 --- a/meson_options.txt
75 +++ b/meson_options.txt
76 @@ -1,6 +1,9 @@
77  option('lua51',
78 -       type: 'boolean', value: true,
79 +       type: 'feature', value: 'enabled',
80         description: 'Enable Lua 5.1 support (requires lua-lgi)')
81 +option('luajit',
82 +       type: 'feature', value: 'disabled',
83 +       description: 'Use LuaJIT for Lua 5.1 support (requires lua-lgi)')
84  
85  option('python2',
86         type: 'boolean', value: false,
87 -- 
88 2.20.1
89