vlc/867.patch

1507 lines
46 KiB
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From dc95063af0d2d54b36185ca8ef2203b364b568ef Mon Sep 17 00:00:00 2001
From: Marvin Scholz <epirat07@gmail.com>
Date: Thu, 4 Nov 2021 18:10:43 +0100
Subject: [PATCH 01/10] lua: common: do not use deprecated module function
---
share/lua/intf/cli.lua | 2 +-
share/lua/intf/http.lua | 2 +-
share/lua/modules/common.lua | 46 +++++++++++++++++++-----------------
3 files changed, 26 insertions(+), 24 deletions(-)
Index: vlc-3.0.17.4/share/lua/intf/cli.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/intf/cli.lua
+++ vlc-3.0.17.4/share/lua/intf/cli.lua
@@ -58,7 +58,9 @@ description=
* flatplaylist: 0 to disable, 1 to enable.
]============================================================================]
-require("common")
+local common = require("common")
+local host = require("host")
+
skip = common.skip
skip2 = function(foo) return skip(skip(foo)) end
setarg = common.setarg
@@ -794,7 +796,6 @@ function on_write( client )
end
--[[ Setup host ]]
-require("host")
h = host.host()
h.status_callbacks[host.status.password] = on_password
Index: vlc-3.0.17.4/share/lua/intf/http.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/intf/http.lua
+++ vlc-3.0.17.4/share/lua/intf/http.lua
@@ -30,7 +30,7 @@ Configuration options:
--]==========================================================================]
-require "common"
+local common = require "common"
vlc.msg.info("Lua HTTP interface")
Index: vlc-3.0.17.4/share/lua/modules/common.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/modules/common.lua
+++ vlc-3.0.17.4/share/lua/modules/common.lua
@@ -1,9 +1,9 @@
--[[ This code is public domain (since it really isn't very interesting) ]]--
-module("common",package.seeall)
+local common = {}
-- Iterate over a table in the keys' alphabetical order
-function pairs_sorted(t)
+function common.pairs_sorted(t)
local s = {}
for k,_ in pairs(t) do table.insert(s,k) end
table.sort(s)
@@ -12,17 +12,17 @@ function pairs_sorted(t)
end
-- Return a function such as skip(foo)(a,b,c) = foo(b,c)
-function skip(foo)
+function common.skip(foo)
return function(discard,...) return foo(...) end
end
-- Return a function such as setarg(foo,a)(b,c) = foo(a,b,c)
-function setarg(foo,a)
+function common.setarg(foo,a)
return function(...) return foo(a,...) end
end
-- Trigger a hotkey
-function hotkey(arg)
+function common.hotkey(arg)
local id = vlc.misc.action_id( arg )
if id ~= nil then
vlc.var.set( vlc.object.libvlc(), "key-action", id )
@@ -33,14 +33,14 @@ function hotkey(arg)
end
-- Take a video snapshot
-function snapshot()
+function common.snapshot()
local vout = vlc.object.vout()
if not vout then return end
vlc.var.set(vout,"video-snapshot",nil)
end
-- Naive (non recursive) table copy
-function table_copy(t)
+function common.table_copy(t)
c = {}
for i,v in pairs(t) do c[i]=v end
return c
@@ -48,7 +48,7 @@ end
-- tonumber() for decimals number, using a dot as decimal separator
-- regardless of the system locale
-function us_tonumber(str)
+function common.us_tonumber(str)
local s, i, d = string.match(str, "^([+-]?)(%d*)%.?(%d*)$")
if not s or not i or not d then
return nil
@@ -70,40 +70,40 @@ end
-- tostring() for decimals number, using a dot as decimal separator
-- regardless of the system locale
-function us_tostring(n)
+function common.us_tostring(n)
s = tostring(n):gsub(",", ".", 1)
return s
end
-- strip leading and trailing spaces
-function strip(str)
+function common.strip(str)
return string.gsub(str, "^%s*(.-)%s*$", "%1")
end
-- print a table (recursively)
-function table_print(t,prefix)
+function common.table_print(t,prefix)
local prefix = prefix or ""
if not t then
print(prefix.."/!\\ nil")
return
end
- for a,b in pairs_sorted(t) do
+ for a,b in common.pairs_sorted(t) do
print(prefix..tostring(a),b)
if type(b)==type({}) then
- table_print(b,prefix.."\t")
+ common.table_print(b,prefix.."\t")
end
end
end
-- print the list of callbacks registered in lua
-- useful for debug purposes
-function print_callbacks()
+function common.print_callbacks()
print "callbacks:"
- table_print(vlc.callbacks)
+ common.table_print(vlc.callbacks)
end
-- convert a duration (in seconds) to a string
-function durationtostring(duration)
+function common.durationtostring(duration)
return string.format("%02d:%02d:%02d",
math.floor(duration/3600),
math.floor(duration/60)%60,
@@ -113,7 +113,7 @@ end
-- realpath
-- this is for URL paths - do not use for file paths as this has
-- no support for Windows '\' directory separators
-function realpath(path)
+function common.realpath(path)
-- detect URLs to extract and process the path component
local s, p, qf = string.match(path, "^([a-zA-Z0-9+%-%.]-://[^/]-)(/[^?#]*)(.*)$")
if not s then
@@ -149,7 +149,7 @@ end
-- parse the time from a string and return the seconds
-- time format: [+ or -][<int><H or h>:][<int><M or m or '>:][<int><nothing or S or s or ">]
-function parsetime(timestring)
+function common.parsetime(timestring)
local seconds = 0
local hourspattern = "(%d+)[hH]"
local minutespattern = "(%d+)[mM']"
@@ -176,11 +176,11 @@ function parsetime(timestring)
end
-- seek
-function seek(value)
+function common.seek(value)
local input = vlc.object.input()
if input ~= nil and value ~= nil then
if string.sub(value,-1) == "%" then
- local number = us_tonumber(string.sub(value,1,-2))
+ local number = common.us_tonumber(string.sub(value,1,-2))
if number ~= nil then
local posPercent = number/100
if string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then
@@ -190,7 +190,7 @@ function seek(value)
end
end
else
- local posTime = parsetime(value)
+ local posTime = common.parsetime(value)
if string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then
vlc.var.set(input,"time",vlc.var.get(input,"time") + (posTime * 1000000))
else
@@ -200,10 +200,12 @@ function seek(value)
end
end
-function volume(value)
+function common.volume(value)
if type(value)=="string" and string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then
vlc.volume.set(vlc.volume.get()+tonumber(value))
else
vlc.volume.set(tostring(value))
end
end
+
+return common
Index: vlc-3.0.17.4/share/lua/modules/sandbox.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/modules/sandbox.lua
+++ vlc-3.0.17.4/share/lua/modules/sandbox.lua
@@ -21,7 +21,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]==========================================================================]
-module("sandbox",package.seeall)
+local sandbox = {}
-- See Programming in Lua (second edition) for sandbox examples
-- See http://lua-users.org/wiki/SandBoxes for a list of SAFE/UNSAFE variables
@@ -49,7 +49,7 @@ if _VERSION == "Lua 5.1" then
sandbox_blacklist["loadstring"] = true
end
-function readonly_table_proxy(name,src,blacklist)
+function sandbox.readonly_table_proxy(name,src,blacklist)
if type(src)=="nil" then return end
if type(src)~="table" then error("2nd argument must be a table (or nil)") end
local name = name
@@ -77,17 +77,17 @@ end
-- Of course, all of this is useless if the sandbox calling code has
-- another reference to one of these tables in his global environement.
local sandbox_proxy = {
- coroutine = readonly_table_proxy("coroutine",coroutine),
- string = readonly_table_proxy("string",string,{"dump"}),
- table = readonly_table_proxy("table",table),
- math = readonly_table_proxy("math",math),
- io = readonly_table_proxy("io",io),
- os = readonly_table_proxy("os",os,{"exit","getenv","remove",
- "rename","setlocale"}),
- sandbox = readonly_table_proxy("sandbox",sandbox),
+ coroutine = sandbox.readonly_table_proxy("coroutine",coroutine),
+ string = sandbox.readonly_table_proxy("string",string,{"dump"}),
+ table = sandbox.readonly_table_proxy("table",table),
+ math = sandbox.readonly_table_proxy("math",math),
+ io = sandbox.readonly_table_proxy("io",io),
+ os = sandbox.readonly_table_proxy("os",os,{"exit","getenv","remove",
+ "rename","setlocale"}),
+ sandbox = sandbox.readonly_table_proxy("sandbox",sandbox),
}
-function sandbox(func,override)
+function sandbox.sandbox(func,override)
local _G = getfenv(2)
local override = override or {}
local sandbox_metatable =
@@ -121,3 +121,5 @@ function sandbox(func,override)
return unpack(ret)
end
end
+
+return sandbox
Index: vlc-3.0.17.4/share/lua/modules/simplexml.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/modules/simplexml.lua
+++ vlc-3.0.17.4/share/lua/modules/simplexml.lua
@@ -21,7 +21,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]==========================================================================]
-module("simplexml",package.seeall)
+local simplexml = {}
--[[ Returns the xml tree structure
-- Each node is of one of the following types:
@@ -86,19 +86,19 @@ local function parsexml(stream, errormsg
return tree
end
-function parse_url(url)
+function simplexml.parse_url(url)
return parsexml(vlc.stream(url))
end
-function parse_stream(stream)
+function simplexml.parse_stream(stream)
return parsexml(stream)
end
-function parse_string(str)
+function simplexml.parse_string(str)
return parsexml(vlc.memory_stream(str))
end
-function add_name_maps(tree)
+function simplexml.add_name_maps(tree)
tree.children_map = {}
for _, node in pairs(tree.children) do
if type(node) == "table" then
@@ -106,8 +106,9 @@ function add_name_maps(tree)
tree.children_map[node.name] = {}
end
table.insert(tree.children_map[node.name], node)
- add_name_maps(node)
+ simplexml.add_name_maps(node)
end
end
end
+return simplexml
Index: vlc-3.0.17.4/share/lua/playlist/jamendo.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/playlist/jamendo.lua
+++ vlc-3.0.17.4/share/lua/playlist/jamendo.lua
@@ -20,7 +20,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
-require "simplexml"
+local simplexml = require "simplexml"
-- Probe function.
function probe()
Index: vlc-3.0.17.4/share/lua/sd/fmc.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/sd/fmc.lua
+++ vlc-3.0.17.4/share/lua/sd/fmc.lua
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
-require "simplexml"
+local simplexml = require "simplexml"
function descriptor()
return { title="Free Music Charts" }
Index: vlc-3.0.17.4/share/lua/sd/icecast.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/sd/icecast.lua
+++ vlc-3.0.17.4/share/lua/sd/icecast.lua
@@ -20,12 +20,13 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
-lazily_loaded = false
+local simplexml = nil
function lazy_load()
- if lazily_loaded then return nil end
- require "simplexml"
- lazily_loaded = true
+ if simplexml == nil
+ then
+ simplexml = require "simplexml"
+ end
end
function descriptor()
Index: vlc-3.0.17.4/share/lua/http/requests/browse.json
===================================================================
--- vlc-3.0.17.4.orig/share/lua/http/requests/browse.json
+++ vlc-3.0.17.4/share/lua/http/requests/browse.json
@@ -27,7 +27,7 @@ vim:syntax=lua
<?vlc
--package.loaded.httprequests = nil --uncomment to debug changes
-require "httprequests"
+local httprequests = require "httprequests"
httprequests.processcommands()
Index: vlc-3.0.17.4/share/lua/http/requests/browse.xml
===================================================================
--- vlc-3.0.17.4.orig/share/lua/http/requests/browse.xml
+++ vlc-3.0.17.4/share/lua/http/requests/browse.xml
@@ -28,7 +28,7 @@ vim:syntax=lua
<?vlc
--package.loaded.httprequests = nil --uncomment to debug changes
-require "httprequests"
+local httprequests = require "httprequests"
httprequests.processcommands()
Index: vlc-3.0.17.4/share/lua/http/requests/playlist.json
===================================================================
--- vlc-3.0.17.4.orig/share/lua/http/requests/playlist.json
+++ vlc-3.0.17.4/share/lua/http/requests/playlist.json
@@ -27,7 +27,7 @@ vim:syntax=lua
<?vlc
--package.loaded.httprequests = nil --uncomment to debug changes
-require "httprequests"
+local httprequests = require "httprequests"
httprequests.processcommands()
Index: vlc-3.0.17.4/share/lua/http/requests/playlist.xml
===================================================================
--- vlc-3.0.17.4.orig/share/lua/http/requests/playlist.xml
+++ vlc-3.0.17.4/share/lua/http/requests/playlist.xml
@@ -29,7 +29,7 @@ vim:syntax=lua
<?vlc
--package.loaded.httprequests = nil --uncomment to debug changes
-require "httprequests"
+local httprequests = require "httprequests"
local printleaf = function(item)
print ("\n<leaf")
@@ -89,4 +89,4 @@ local pt=httprequests.playlisttable()
printitem(pt)
-?>
\ No newline at end of file
+?>
Index: vlc-3.0.17.4/share/lua/http/requests/status.json
===================================================================
--- vlc-3.0.17.4.orig/share/lua/http/requests/status.json
+++ vlc-3.0.17.4/share/lua/http/requests/status.json
@@ -27,7 +27,7 @@ vim:syntax=lua
<?vlc
--package.loaded.httprequests = nil --uncomment to debug changes
-require "httprequests"
+local httprequests = require "httprequests"
httprequests.processcommands()
Index: vlc-3.0.17.4/share/lua/http/requests/status.xml
===================================================================
--- vlc-3.0.17.4.orig/share/lua/http/requests/status.xml
+++ vlc-3.0.17.4/share/lua/http/requests/status.xml
@@ -29,7 +29,7 @@ vim:syntax=lua
<?vlc
--package.loaded.httprequests = nil --uncomment to debug changes
-require "httprequests"
+local httprequests = require "httprequests"
httprequests.processcommands()
Index: vlc-3.0.17.4/share/lua/intf/modules/httprequests.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/intf/modules/httprequests.lua
+++ vlc-3.0.17.4/share/lua/intf/modules/httprequests.lua
@@ -22,7 +22,7 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]==========================================================================]
-module("httprequests",package.seeall)
+local httprequests = {}
local common = require ("common")
local dkjson = require ("dkjson")
@@ -39,6 +39,7 @@ function round(what, precision)
end
return nil
end
+httprequests.round = round
--split text where it matches the delimiter
function strsplit(text, delimiter)
@@ -64,6 +65,7 @@ function strsplit(text, delimiter)
end
return list
end
+httprequests.strsplit = strsplit
--main function to process commands sent with the request
@@ -207,6 +209,7 @@ processcommands = function ()
local val = nil
end
+httprequests.processcommands = processcommands
--utilities for formatting output
@@ -219,6 +222,7 @@ function xmlString(s)
return tostring(s)
end
end
+httprequests.xmlString = xmlString
--dkjson outputs numbered tables as arrays
--so we don't need the array indicators
@@ -238,6 +242,7 @@ function removeArrayIndicators(dict)
return newDict
end
+httprequests.removeArrayIndicators = removeArrayIndicators
printTableAsJson = function (dict)
dict=removeArrayIndicators(dict)
@@ -245,6 +250,7 @@ printTableAsJson = function (dict)
local output=dkjson.encode (dict, { indent = true })
print(output)
end
+httprequests.printTableAsJson = printTableAsJson
local printXmlKeyValue = function (k,v,indent)
print("\n")
@@ -270,12 +276,14 @@ local printXmlKeyValue = function (k,v,i
end
end
end
+httprequests.printXmlKeyValue = printXmlKeyValue
printTableAsXml = function (dict,indent)
for k,v in pairs(dict) do
printXmlKeyValue(k,v,indent)
end
end
+httprequests.printTableAsXml = printTableAsXml
--[[
function logTable(t,pre)
@@ -310,6 +318,7 @@ getplaylist = function ()
return p
end
+httprequests.getplaylist = getplaylist
parseplaylist = function (item)
if item.flags.disabled then return end
@@ -358,6 +367,7 @@ parseplaylist = function (item)
end
end
+httprequests.parseplaylist = parseplaylist
playlisttable = function ()
@@ -365,6 +375,7 @@ playlisttable = function ()
return parseplaylist(basePlaylist)
end
+httprequests.playlisttable = playlisttable
getbrowsetable = function ()
@@ -442,6 +453,7 @@ getbrowsetable = function ()
return result;
end
+httprequests.getbrowsetable = getbrowsetable
getstatus = function (includecategories)
@@ -554,4 +566,5 @@ getstatus = function (includecategories)
end
return s
end
+httprequests.getstatus = getstatus
Index: vlc-3.0.17.4/share/lua/intf/modules/host.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/intf/modules/host.lua
+++ vlc-3.0.17.4/share/lua/intf/modules/host.lua
@@ -24,7 +24,7 @@
--[==========================================================================[
Example use:
- require "host"
+ local host = require "host"
h = host.host()
-- Bypass any authentication
@@ -62,8 +62,6 @@ Example use:
For complete examples see existing VLC Lua interface modules (ie cli.lua)
--]==========================================================================]
-module("host",package.seeall)
-
status = { init = 0, read = 1, write = 2, password = 3 }
client_type = { net = 1, stdio = 2, fifo = 3, telnet = 4 }
@@ -366,3 +364,10 @@ function host()
})
return h
end
+
+return {
+ host = host,
+ status = status,
+ client_type = client_type,
+ is_flag_set = is_flag_set,
+}
Index: vlc-3.0.17.4/share/lua/http/custom.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/http/custom.lua
+++ vlc-3.0.17.4/share/lua/http/custom.lua
@@ -2,7 +2,6 @@
function gettext(text) print(vlc.gettext._(text)) end
local _G = _G
-module("custom",package.seeall)
local dialogs = setmetatable({}, {
__index = function(self, name)
Index: vlc-3.0.17.4/share/lua/intf/luac.lua
===================================================================
--- vlc-3.0.17.4.orig/share/lua/intf/luac.lua
+++ vlc-3.0.17.4/share/lua/intf/luac.lua
@@ -24,14 +24,11 @@
usage =
[[
To compile a lua script to bytecode (luac) run:
- vlc -I luaintf --lua-intf --lua-config 'luac={input="file.lua",output="file.luac"}'
+ vlc -I luaintf --lua-intf luac --lua-config 'luac={input="file.lua",output="file.luac"}'
Output will be similar to that of the luac command line tool provided with lua with the following arguments:
luac -o file.luac file.lua
]]
-require "string"
-require "io"
-
function compile()
vlc.msg.info("About to compile lua file")
vlc.msg.info(" Input is '"..tostring(config.input).."'")
Index: vlc-3.0.17.4/contrib/src/lua/Add-EXE_EXT-to-allow-specifying-binary-extension.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Add-EXE_EXT-to-allow-specifying-binary-extension.patch
@@ -0,0 +1,36 @@
+From 08522a57a2330ce840a812d75d6ef4adb94f0f4b Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Thu, 4 Nov 2021 16:15:53 +0100
+Subject: [PATCH] Add EXE_EXT to allow specifying binary extension
+
+This is needed to make the install step aware that the lua/luac
+binaries have a .exe suffix for Windows.
+---
+ Makefile | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index cae9b35..7913cd2 100644
+--- a/Makefile
++++ b/Makefile
+@@ -34,13 +34,16 @@ INSTALL_DATA= $(INSTALL) -m 0644
+ MKDIR= mkdir -p
+ RM= rm -f
+
++# File extension used for executables
++EXE_EXT=
++
+ # == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE =======
+
+ # Convenience platforms targets.
+ PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
+
+ # What to install.
+-TO_BIN= lua luac
++TO_BIN= lua$(EXE_EXT) luac$(EXE_EXT)
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+ TO_LIB= liblua5.4.a
+ TO_MAN= lua.1 luac.1
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Add-a-Makefile-variable-to-override-the-strip-tool.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Add-a-Makefile-variable-to-override-the-strip-tool.patch
@@ -0,0 +1,33 @@
+From bedf474c5b2f1c46188ff7774ad3b97c4c028108 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Wed, 10 Nov 2021 12:44:52 +0100
+Subject: [PATCH] Add a Makefile variable to override the strip tool
+
+---
+ src/Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index af57fe2..db0a3e2 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -15,6 +15,7 @@ AR= ar rcu
+ RANLIB= ranlib
+ RM= rm -f
+ UNAME= uname
++STRIP= strip
+
+ SYSCFLAGS=
+ SYSLDFLAGS=
+@@ -131,7 +132,7 @@ Darwin macos macosx:
+
+ mingw:
+ $(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" "LUA_A_LINK=lua54.lib" \
+- "AR=$(CC) -shared -Wl,--out-implib,lua54.lib $(LDFLAGS) -o" "RANLIB=strip --strip-unneeded" \
++ "AR=$(CC) -shared -Wl,--out-implib,lua54.lib $(LDFLAGS) -o" "RANLIB=$(STRIP) --strip-unneeded" \
+ "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
+ $(MAKE) "LUAC_T=luac.exe" luac.exe
+
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Add-version-to-library-name.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Add-version-to-library-name.patch
@@ -0,0 +1,39 @@
+From 55bc6b11605b7e35323daf28587990d4d57b5e59 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Thu, 4 Nov 2021 13:47:03 +0100
+Subject: [PATCH] Add version to library name
+
+---
+ Makefile | 2 +-
+ src/Makefile | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index fed75b3..29c50a3 100644
+--- a/Makefile
++++ b/Makefile
+@@ -41,7 +41,7 @@ PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix
+ # What to install.
+ TO_BIN= lua luac
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+-TO_LIB= liblua.a
++TO_LIB= liblua5.4.a
+ TO_MAN= lua.1 luac.1
+
+ # Lua version and release.
+diff --git a/src/Makefile b/src/Makefile
+index 91f2315..af57fe2 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -32,7 +32,7 @@ CMCFLAGS=
+
+ PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
+
+-LUA_A= liblua.a
++LUA_A= liblua5.4.a
+ LUA_A_LINK= $(LUA_A)
+ CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
+ LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Always-use-the-luac-32-bit-format.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Always-use-the-luac-32-bit-format.patch
@@ -0,0 +1,161 @@
+From ba66def0fbcbb4635e62f820ed588bd429b81dc9 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Thu, 4 Nov 2021 03:21:58 +0100
+Subject: [PATCH] Always use the luac 32-bit format
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Based on the previous patch by Rémi Denis-Courmont
+
+This forces lua and luac to use 32-bit integers even if it would
+usually use 64-bit ones, this makes it easier to cross-compile,
+as the build machine might be 64bit while the host is 32bit.
+---
+ src/ldump.c | 4 +--
+ src/luaconf.h | 68 ++++++++-------------------------------------------
+ src/lundump.c | 4 +--
+ 3 files changed, 14 insertions(+), 62 deletions(-)
+
+diff --git a/src/ldump.c b/src/ldump.c
+index f848b66..c66afe5 100644
+--- a/src/ldump.c
++++ b/src/ldump.c
+@@ -56,9 +56,9 @@ static void dumpByte (DumpState *D, int y) {
+
+
+ /* dumpInt Buff Size */
+-#define DIBS ((sizeof(size_t) * 8 / 7) + 1)
++#define DIBS ((sizeof(uint32_t) * 8 / 7) + 1)
+
+-static void dumpSize (DumpState *D, size_t x) {
++static void dumpSize (DumpState *D, uint32_t x) {
+ lu_byte buff[DIBS];
+ int n = 0;
+ do {
+diff --git a/src/luaconf.h b/src/luaconf.h
+index e64d2ee..0d04694 100644
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -10,6 +10,8 @@
+
+ #include <limits.h>
+ #include <stddef.h>
++#include <stdint.h>
++#include <sys/types.h>
+
+
+ /*
+@@ -116,7 +118,7 @@
+ /*
+ @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats.
+ */
+-#define LUA_32BITS 0
++#define LUA_32BITS 1
+
+
+ /*
+@@ -503,7 +505,7 @@
+ ** use LUAI_UACINT here to avoid problems with promotions (which
+ ** can turn a comparison between unsigneds into a signed comparison)
+ */
+-#define LUA_UNSIGNED unsigned LUAI_UACINT
++#define LUA_UNSIGNED uint32_t
+
+
+ #define LUA_UNSIGNEDBITS (sizeof(LUA_UNSIGNED) * CHAR_BIT)
+@@ -511,66 +513,16 @@
+
+ /* now the variable definitions */
+
+-#if LUA_INT_TYPE == LUA_INT_INT /* { int */
+-
+-#define LUA_INTEGER int
++#define LUA_INTEGER int32_t
+ #define LUA_INTEGER_FRMLEN ""
+
+-#define LUA_MAXINTEGER INT_MAX
+-#define LUA_MININTEGER INT_MIN
+-
+-#define LUA_MAXUNSIGNED UINT_MAX
+-
+-#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */
+-
+-#define LUA_INTEGER long
+-#define LUA_INTEGER_FRMLEN "l"
+-
+-#define LUA_MAXINTEGER LONG_MAX
+-#define LUA_MININTEGER LONG_MIN
+-
+-#define LUA_MAXUNSIGNED ULONG_MAX
+-
+-#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */
+-
+-/* use presence of macro LLONG_MAX as proxy for C99 compliance */
+-#if defined(LLONG_MAX) /* { */
+-/* use ISO C99 stuff */
+-
+-#define LUA_INTEGER long long
+-#define LUA_INTEGER_FRMLEN "ll"
+-
+-#define LUA_MAXINTEGER LLONG_MAX
+-#define LUA_MININTEGER LLONG_MIN
+-
+-#define LUA_MAXUNSIGNED ULLONG_MAX
+-
+-#elif defined(LUA_USE_WINDOWS) /* }{ */
+-/* in Windows, can use specific Windows types */
+-
+-#define LUA_INTEGER __int64
+-#define LUA_INTEGER_FRMLEN "I64"
++#define LUA_MAXINTEGER INT32_MAX
++#define LUA_MININTEGER INT32_MIN
+
+-#define LUA_MAXINTEGER _I64_MAX
+-#define LUA_MININTEGER _I64_MIN
+-
+-#define LUA_MAXUNSIGNED _UI64_MAX
+-
+-#else /* }{ */
+-
+-#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
+- or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
+-
+-#endif /* } */
+-
+-#else /* }{ */
+-
+-#error "numeric integer type not defined"
+-
+-#endif /* } */
+-
+-/* }================================================================== */
++#define LUA_MAXUNSIGNED UINT32_MAX
+
++#define LUAI_UMEM size_t
++#define LUAI_MEM ssize_t
+
+ /*
+ ** {==================================================================
+diff --git a/src/lundump.c b/src/lundump.c
+index 5aa55c4..54840ee 100644
+--- a/src/lundump.c
++++ b/src/lundump.c
+@@ -81,12 +81,12 @@ static size_t loadUnsigned (LoadState *S, size_t limit) {
+
+
+ static size_t loadSize (LoadState *S) {
+- return loadUnsigned(S, ~(size_t)0);
++ return loadUnsigned(S, ~(uint32_t)0);
+ }
+
+
+ static int loadInt (LoadState *S) {
+- return cast_int(loadUnsigned(S, INT_MAX));
++ return cast_int(loadUnsigned(S, INT32_MAX));
+ }
+
+
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Avoid-usage-of-localeconv.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Avoid-usage-of-localeconv.patch
@@ -0,0 +1,239 @@
+From 1eb23c5258753ad13b1103909d3637a950cc7d3d Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Thu, 4 Nov 2021 04:41:06 +0100
+Subject: [PATCH] Avoid usage of localeconv
+
+In order to properly do this, we need to implement a locale-independent
+version of strtof and snprintf, else lua will be unable to properly
+parse floating point numbers on systems that do not use a locale where
+the dot is the decimal point.
+---
+ src/Makefile | 2 +-
+ src/clocwrappers.c | 159 +++++++++++++++++++++++++++++++++++++++++++++
+ src/luaconf.h | 9 ++-
+ 3 files changed, 166 insertions(+), 4 deletions(-)
+ create mode 100644 src/clocwrappers.c
+
+diff --git a/src/Makefile b/src/Makefile
+index f78c0b8..2f18923 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -23,7 +23,7 @@ SYSLIBS=
+ MYCFLAGS=
+ MYLDFLAGS=
+ MYLIBS=
+-MYOBJS=
++MYOBJS= clocwrappers.o
+
+ # Special flags for compiler modules; -Os reduces code size.
+ CMCFLAGS=
+diff --git a/src/clocwrappers.c b/src/clocwrappers.c
+new file mode 100644
+index 0000000..5a9b4cc
+--- /dev/null
++++ b/src/clocwrappers.c
+@@ -0,0 +1,159 @@
++#include <stdlib.h>
++#include <stdio.h>
++#include <stdarg.h>
++
++#if defined(__APPLE__)
++# include <xlocale.h>
++#elif defined(_WIN32)
++# include <windows.h>
++# include <locale.h>
++#else
++# define _GNU_SOURCE
++# include <locale.h>
++#endif
++
++/* A strtof replacement that always uses the C locale to ensure
++ * it always accepts '.' as decimal point.
++ */
++
++#if defined(__APPLE__)
++
++float strtof_c_locale(const char *nptr, char **endptr)
++{
++ return strtof_l(nptr, endptr, LC_C_LOCALE);
++}
++
++int snprintf_c_locale(char * restrict str, size_t size, const char * restrict format, ...)
++{
++ int res;
++ va_list args;
++
++ va_start(args, format);
++ res = vsnprintf_l(str, size, LC_C_LOCALE, format, args);
++ va_end(args);
++
++ return res;
++}
++
++#elif defined(_WIN32)
++
++float strtof_c_locale(const char *nptr, char **endptr)
++{
++ float res;
++
++ // Store old threadlocale state
++ int cfgtlocale_old = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
++ char *orig_locale = NULL;
++ if (cfgtlocale_old != -1) {
++ // Store current locale
++ orig_locale = setlocale(LC_NUMERIC, NULL);
++ setlocale(LC_NUMERIC, "C");
++ }
++ res = strtof(nptr, endptr);
++ if (orig_locale != NULL) {
++ // Restore the old locale
++ setlocale(LC_NUMERIC, orig_locale);
++ }
++ if (cfgtlocale_old != _ENABLE_PER_THREAD_LOCALE && cfgtlocale_old != -1) {
++ // Restore the old threadlocale state
++ _configthreadlocale(cfgtlocale_old);
++ }
++
++ return res;
++}
++
++int snprintf_c_locale(char * restrict str, size_t size, const char * restrict format, ...)
++{
++ int res;
++
++ // Store old threadlocale state
++ int cfgtlocale_old = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
++ char *orig_locale = NULL;
++ if (cfgtlocale_old != -1) {
++ // Store current locale
++ orig_locale = setlocale(LC_NUMERIC, NULL);
++ setlocale(LC_NUMERIC, "C");
++ }
++
++ va_list args;
++ va_start(args, format);
++ res = vsnprintf(str, size, format, args);
++ va_end(args);
++
++ if (orig_locale != NULL) {
++ // Restore the old locale
++ setlocale(LC_NUMERIC, orig_locale);
++ }
++ if (cfgtlocale_old != _ENABLE_PER_THREAD_LOCALE && cfgtlocale_old != -1) {
++ // Restore the old threadlocale state
++ _configthreadlocale(cfgtlocale_old);
++ }
++
++ return res;
++}
++
++#elif defined(__ANDROID__) && (__ANDROID_API__ < 21)
++
++float strtof_c_locale(const char *nptr, char **endptr)
++{
++ // Android API level < 21 has no locales support
++ return strtof(nptr, endptr);
++}
++
++int snprintf_c_locale(char * restrict str, size_t size, const char * restrict format, ...)
++{
++ // Android API level < 21 has no locales support
++ va_list args;
++ va_start(args, format);
++ return vsnprintf(str, size, format, args);
++ va_end(args);
++}
++
++#else // Version for all other OSes
++
++float strtof_c_locale(const char *nptr, char **endptr)
++{
++ float res;
++
++ locale_t orig_locale = (locale_t)0;
++ locale_t locale = newlocale(LC_NUMERIC_MASK, "C", (locale_t)0);
++ if (locale != (locale_t)0) {
++ // Store current locale
++ orig_locale = uselocale(locale);
++ }
++ res = strtof(nptr, endptr);
++ if (locale != (locale_t)0) {
++ // Restore old locale
++ uselocale(orig_locale);
++ freelocale(locale);
++ }
++
++ return res;
++}
++
++int snprintf_c_locale(char * restrict str, size_t size, const char * restrict format, ...)
++{
++ int res;
++
++ locale_t orig_locale = (locale_t)0;
++ locale_t locale = newlocale(LC_NUMERIC_MASK, "C", (locale_t)0);
++ if (locale != (locale_t)0) {
++ // Store current locale
++ orig_locale = uselocale(locale);
++ }
++
++ va_list args;
++ va_start(args, format);
++ res = vsnprintf(str, size, format, args);
++ va_end(args);
++
++ if (locale != (locale_t)0) {
++ // Restore old locale
++ uselocale(orig_locale);
++ freelocale(locale);
++ }
++
++ return res;
++}
++
++#endif
+diff --git a/src/luaconf.h b/src/luaconf.h
+index 38be08d..4b632ee 100644
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -12,7 +12,10 @@
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <sys/types.h>
++#include <locale.h>
+
++float strtof_c_locale(const char *nptr, char **endptr);
++int snprintf_c_locale(char * restrict str, size_t size, const char * restrict format, ...);
+
+ /*
+ ** ===================================================================
+@@ -437,7 +440,7 @@
+
+ #define l_mathop(op) op##f
+
+-#define lua_str2number(s,p) strtof((s), (p))
++#define lua_str2number(s,p) strtof_c_locale((s), (p))
+
+
+ #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */
+@@ -535,7 +538,7 @@
+ ** (All uses in Lua have only one format item.)
+ */
+ #if !defined(LUA_USE_C89)
+-#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i)
++#define l_sprintf(s,sz,f,i) snprintf_c_locale(s,sz,f,i)
+ #else
+ #define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i))
+ #endif
+@@ -609,7 +612,7 @@
+ ** macro must include the header 'locale.h'.)
+ */
+ #if !defined(lua_getlocaledecpoint)
+-#define lua_getlocaledecpoint() (localeconv()->decimal_point[0])
++#define lua_getlocaledecpoint() '.'
+ #endif
+
+
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Create-an-import-library-needed-for-lld.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Create-an-import-library-needed-for-lld.patch
@@ -0,0 +1,48 @@
+From 536cf8d2acceb47bc5ef823d5553603eaa7fa8b1 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Thu, 4 Nov 2021 05:40:43 +0100
+Subject: [PATCH] Create an import library needed for lld
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Based on the previous patch by Martin Storsjö
+---
+ src/Makefile | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index 2f18923..91f2315 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -33,6 +33,7 @@ CMCFLAGS=
+ PLATS= guess aix bsd c89 freebsd generic linux linux-readline macosx mingw posix solaris
+
+ LUA_A= liblua.a
++LUA_A_LINK= $(LUA_A)
+ CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o
+ LIB_O= lauxlib.o lbaselib.o lcorolib.o ldblib.o liolib.o lmathlib.o loadlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o linit.o
+ BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
+@@ -61,7 +62,7 @@ $(LUA_A): $(BASE_O)
+ $(RANLIB) $@
+
+ $(LUA_T): $(LUA_O) $(LUA_A)
+- $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
++ $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A_LINK) $(LIBS)
+
+ $(LUAC_T): $(LUAC_O) $(LUA_A)
+ $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+@@ -129,8 +130,8 @@ Darwin macos macosx:
+ $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX -DLUA_USE_READLINE" SYSLIBS="-lreadline"
+
+ mingw:
+- $(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" \
+- "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \
++ $(MAKE) "LUA_A=lua54.dll" "LUA_T=lua.exe" "LUA_A_LINK=lua54.lib" \
++ "AR=$(CC) -shared -Wl,--out-implib,lua54.lib $(LDFLAGS) -o" "RANLIB=strip --strip-unneeded" \
+ "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe
+ $(MAKE) "LUAC_T=luac.exe" luac.exe
+
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Create-and-install-a-.pc-file.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Create-and-install-a-.pc-file.patch
@@ -0,0 +1,87 @@
+From 5b1f5e5d94dc380cded9ecf4fa49a2e19daccf0b Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Thu, 4 Nov 2021 15:33:41 +0100
+Subject: [PATCH] Create and install a .pc file
+
+---
+ Makefile | 27 ++++++++++++++++++++++-----
+ 1 file changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 29c50a3..cae9b35 100644
+--- a/Makefile
++++ b/Makefile
+@@ -14,6 +14,7 @@ INSTALL_TOP= /usr/local
+ INSTALL_BIN= $(INSTALL_TOP)/bin
+ INSTALL_INC= $(INSTALL_TOP)/include
+ INSTALL_LIB= $(INSTALL_TOP)/lib
++INSTALL_LIB_PKGCONFIG= $(INSTALL_LIB)/pkgconfig
+ INSTALL_MAN= $(INSTALL_TOP)/man/man1
+ INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
+ INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V
+@@ -43,6 +44,7 @@ TO_BIN= lua luac
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+ TO_LIB= liblua5.4.a
+ TO_MAN= lua.1 luac.1
++TO_PKGCONFIG= lua.pc
+
+ # Lua version and release.
+ V= 5.4
+@@ -54,12 +56,17 @@ all: $(PLAT)
+ $(PLATS) help test clean:
+ @cd src && $(MAKE) $@
+
+-install: dummy
++lua.pc:
++ $(MAKE) pc > lua.pc
++
++
++install: dummy $(TO_PKGCONFIG)
+ cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+ cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
+ cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+ cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+ cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
++ $(INSTALL_DATA) $(TO_PKGCONFIG) $(INSTALL_LIB_PKGCONFIG)
+
+ uninstall:
+ cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
+@@ -83,10 +90,12 @@ echo:
+ @echo "TO_INC= $(TO_INC)"
+ @echo "TO_LIB= $(TO_LIB)"
+ @echo "TO_MAN= $(TO_MAN)"
++ @echo "TO_PKGCONFIG= $(TO_PKGCONFIG)"
+ @echo "INSTALL_TOP= $(INSTALL_TOP)"
+ @echo "INSTALL_BIN= $(INSTALL_BIN)"
+ @echo "INSTALL_INC= $(INSTALL_INC)"
+ @echo "INSTALL_LIB= $(INSTALL_LIB)"
++ @echo "INSTALL_LIB_PKGCONFIG= $(INSTALL_LIB_PKGCONFIG)"
+ @echo "INSTALL_MAN= $(INSTALL_MAN)"
+ @echo "INSTALL_LMOD= $(INSTALL_LMOD)"
+ @echo "INSTALL_CMOD= $(INSTALL_CMOD)"
+@@ -95,10 +104,18 @@ echo:
+
+ # Echo pkg-config data.
+ pc:
+- @echo "version=$R"
+- @echo "prefix=$(INSTALL_TOP)"
+- @echo "libdir=$(INSTALL_LIB)"
+- @echo "includedir=$(INSTALL_INC)"
++ @echo 'version=$R'
++ @echo 'prefix=$(INSTALL_TOP)'
++ @echo 'libdir=$(INSTALL_LIB)'
++ @echo 'includedir=$(INSTALL_INC)'
++ @echo ''
++ @echo 'Name: lua'
++ @echo 'Description: the lua programming language'
++ @echo 'Version: $R'
++ @echo 'URL: https://www.lua.org'
++ @echo 'Cflags: -I$${includedir}'
++ @echo 'Libs: -L$${libdir} -llua5.4'
++ @echo 'Requires:'
+
+ # Targets that do not create files (not all makes understand .PHONY).
+ .PHONY: all $(PLATS) help test clean install uninstall local dummy echo pc
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Disable-dynamic-library-loading-support.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Disable-dynamic-library-loading-support.patch
@@ -0,0 +1,44 @@
+From b299adde28756deebeb9e51b137aeaf6c332e5f1 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Thu, 4 Nov 2021 03:30:05 +0100
+Subject: [PATCH] Disable dynamic library loading support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Based on the previous patch by Rafaël Carré
+---
+ src/luaconf.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/luaconf.h b/src/luaconf.h
+index 0d04694..38be08d 100644
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -55,20 +55,20 @@
+
+
+ #if defined(LUA_USE_WINDOWS)
+-#define LUA_DL_DLL /* enable support for DLL */
++//#define LUA_DL_DLL /* enable support for DLL */
+ #define LUA_USE_C89 /* broadly, Windows is C89 */
+ #endif
+
+
+ #if defined(LUA_USE_LINUX)
+ #define LUA_USE_POSIX
+-#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
++//#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
+ #endif
+
+
+ #if defined(LUA_USE_MACOSX)
+ #define LUA_USE_POSIX
+-#define LUA_USE_DLOPEN /* MacOS does not need -ldl */
++//#define LUA_USE_DLOPEN /* MacOS does not need -ldl */
+ #endif
+
+
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Disable-system-and-popen-for-windows-store-builds.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Disable-system-and-popen-for-windows-store-builds.patch
@@ -0,0 +1,67 @@
+From 105c0c6fcaa2e3498b52cb1a6e3328a670b64dc6 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Thu, 4 Nov 2021 06:42:04 +0100
+Subject: [PATCH] Disable system and popen for windows store builds
+
+---
+ src/loslib.c | 4 ++++
+ src/luaconf.h | 13 +++++++++++++
+ 2 files changed, 17 insertions(+)
+
+diff --git a/src/loslib.c b/src/loslib.c
+index 3e20d62..d7fdb40 100644
+--- a/src/loslib.c
++++ b/src/loslib.c
+@@ -139,6 +139,7 @@
+
+
+
++#if !defined(LUA_USE_WINSTORE)
+ static int os_execute (lua_State *L) {
+ const char *cmd = luaL_optstring(L, 1, NULL);
+ int stat;
+@@ -151,6 +152,7 @@ static int os_execute (lua_State *L) {
+ return 1;
+ }
+ }
++#endif
+
+
+ static int os_remove (lua_State *L) {
+@@ -408,7 +410,9 @@ static const luaL_Reg syslib[] = {
+ {"clock", os_clock},
+ {"date", os_date},
+ {"difftime", os_difftime},
++#if !defined(LUA_USE_WINSTORE)
+ {"execute", os_execute},
++#endif
+ {"exit", os_exit},
+ {"getenv", os_getenv},
+ {"remove", os_remove},
+diff --git a/src/luaconf.h b/src/luaconf.h
+index 4b632ee..382e70b 100644
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -54,6 +54,19 @@ int snprintf_c_locale(char * restrict str, size_t size, const char * restrict fo
+ */
+ #if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE)
+ #define LUA_USE_WINDOWS /* enable goodies for regular Windows */
++
++#include <winapifamily.h>
++#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
++#define LUA_USE_WINSTORE
++#endif
++#endif
++
++#if defined(LUA_USE_WINSTORE)
++#define l_popen(L,c,m) \
++ ((void)c, (void)m, \
++ luaL_error(L, "'popen' not supported"), \
++ (FILE*)0)
++#define l_pclose(L,file) ((void)L, (void)file, -1)
+ #endif
+
+
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Do-not-use-large-file-offsets-with-too-old-Android-A.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Do-not-use-large-file-offsets-with-too-old-Android-A.patch
@@ -0,0 +1,30 @@
+From 02f5f23eb8efac1c1cbca8cffb9f136391639f51 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Fri, 5 Nov 2021 13:50:40 +0100
+Subject: [PATCH] Do not use large file offsets with too old Android API level
+
+---
+ src/lprefix.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/lprefix.h b/src/lprefix.h
+index 484f2ad..11b2889 100644
+--- a/src/lprefix.h
++++ b/src/lprefix.h
+@@ -8,6 +8,13 @@
+ #define lprefix_h
+
+
++#if defined(__ANDROID__) && (__ANDROID_API__ < 24)
++// Android API level < 24 does not support large file
++// offsets, so define this here to prevent it being
++// defined to 64 below.
++#define _FILE_OFFSET_BITS 32
++#endif
++
+ /*
+ ** Allows POSIX/XSI stuff
+ */
+--
+2.33.0
+
Index: vlc-3.0.17.4/contrib/src/lua/Do-not-use-log2f-with-too-old-Android-API-level.patch
===================================================================
--- /dev/null
+++ vlc-3.0.17.4/contrib/src/lua/Do-not-use-log2f-with-too-old-Android-API-level.patch
@@ -0,0 +1,25 @@
+From d8cf6736921895a1f11ef69531e189261f944d53 Mon Sep 17 00:00:00 2001
+From: Marvin Scholz <epirat07@gmail.com>
+Date: Fri, 5 Nov 2021 12:09:08 +0100
+Subject: [PATCH] Do not use log2f with too old Android API level
+
+---
+ src/lmathlib.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lmathlib.c b/src/lmathlib.c
+index 5f5983a..7c37c88 100644
+--- a/src/lmathlib.c
++++ b/src/lmathlib.c
+@@ -173,7 +173,7 @@ static int math_log (lua_State *L) {
+ res = l_mathop(log)(x);
+ else {
+ lua_Number base = luaL_checknumber(L, 2);
+-#if !defined(LUA_USE_C89)
++#if !defined(LUA_USE_C89) && !(defined(__ANDROID__) && (__ANDROID_API__ < 18))
+ if (base == l_mathop(2.0))
+ res = l_mathop(log2)(x);
+ else
+--
+2.33.0
+
Index: vlc-3.0.17.4/configure.ac
===================================================================
--- vlc-3.0.17.4.orig/configure.ac
+++ vlc-3.0.17.4/configure.ac
@@ -1717,7 +1717,7 @@ then
AS_IF([test "${LUAC}" = "false"], [
AC_MSG_ERROR([Could not find the LUA byte compiler.])
])
- AS_IF([test -d "${CONTRIB_DIR}" -a -f "${CONTRIB_DIR}/lib/liblua.a" -a `echo|${LUAC} -o - -|od -j 8 -N 2 -t x2|head -n 1|tr -s ' '|cut -d' ' -f2` != 0404], [
+ AS_IF([test -d "${CONTRIB_DIR}" -a -f "${CONTRIB_DIR}/lib/liblua5.4.a" -a `echo|${LUAC} -o - -|od -j 12 -N 2 -t x2|head -n 1|tr -s ' '|cut -d' ' -f2` != 0404], [
AC_MSG_ERROR([You need 32-bits luac when using lua from contrib.])
])
fi