MSYS2: Add Lua 5.1 support and fix test suite failures

This commit is contained in:
João Valverde 2023-01-15 19:52:21 +00:00
parent 1e1e733d8c
commit 7e6266d33d
9 changed files with 37 additions and 15 deletions

View File

@ -30,9 +30,12 @@ How to build the Wireshark MSYS2 package:
The application must be run from the MINGW64 shell.
Currently the Wireshark MinGW-w64 build has the following limitations:
Currently the MinGW-w64 build has the following limitations compared to
the MSVC build:
* The ETW extcap (etwdump) is not supported.
* The Event Tracing for Windows (ETW) extcap is not supported.
* Lua version is 5.1 (MSVC uses Lua 5.2) and does not have UTF-8 patches[1].
* Some optional dependencies are not available in the official MSYS2
repositories. These are:
@ -40,11 +43,12 @@ Currently the Wireshark MinGW-w64 build has the following limitations:
- AirPcap
- libsmi
- Kerberos
- Lua-unicode (Lua 5.1 is available and can be used instead)
- SBC codec
- BCG729 codec
* There is currently no way to build a stand-alone distributable binary
package, similar to the Wireshark NSIS installer built using Visual Studio.
* Many compiler warnings to be fixed.
References:
[1]https://github.com/Lekensteyn/lua-unicode

View File

@ -100,6 +100,15 @@ IF(LUA_FOUND)
)
mark_as_advanced( LUA_DLL_DIR LUA_DLL )
endif()
if(LUA_DLL_DIR MATCHES ".*/lua-.*-unicode-.*")
# Do we have Lua with Unicode for Windows patches?
# https://github.com/Lekensteyn/lua-unicode
# XXX Would be better if it was possible to
# detect a Lua-unicode build from C and Lua code
# but upstream rejected patches for that so we do
# it here.
set(HAVE_LUA_UNICODE True)
endif()
ELSE(LUA_FOUND)
SET( LUA_LIBRARIES )
SET( LUA_INCLUDE_DIRS )

View File

@ -163,6 +163,9 @@
/* Define to use Lua */
#cmakedefine HAVE_LUA 1
/* Define to 1 if we have Lua with Unicode for Windows patches. */
#cmakedefine HAVE_LUA_UNICODE 1
/* Define to use MIT kerberos */
#cmakedefine HAVE_MIT_KERBEROS 1

View File

@ -779,8 +779,12 @@ epan_gather_compile_info(feature_list l)
{
/* Lua */
#ifdef HAVE_LUA
#ifdef HAVE_LUA_UNICODE
with_feature(l, "%s", LUA_RELEASE" (with UfW patches)");
#else /* HAVE_LUA_UNICODE */
with_feature(l, "%s", LUA_RELEASE);
#else
#endif /* HAVE_LUA_UNICODE */
#else /* HAVE_LUA */
without_feature(l, "Lua");
#endif /* HAVE_LUA */

View File

@ -20,6 +20,7 @@ depends=("${MINGW_PACKAGE_PREFIX}-brotli"
"${MINGW_PACKAGE_PREFIX}-libpcap"
"${MINGW_PACKAGE_PREFIX}-libssh"
"${MINGW_PACKAGE_PREFIX}-libxml2"
"${MINGW_PACKAGE_PREFIX}-lua51"
"${MINGW_PACKAGE_PREFIX}-lz4"
"${MINGW_PACKAGE_PREFIX}-minizip"
"${MINGW_PACKAGE_PREFIX}-nghttp2"

View File

@ -177,6 +177,7 @@ def features(cmd_tshark, make_env):
return types.SimpleNamespace(
have_x64='Compiled (64-bit)' in tshark_v,
have_lua='with Lua' in tshark_v,
have_lua_unicode='(with UfW patches)' in tshark_v,
have_nghttp2='with nghttp2' in tshark_v,
have_kerberos='with Kerberos' in tshark_v,
have_gnutls='with GnuTLS' in tshark_v,

View File

@ -209,6 +209,8 @@ class case_tshark_dump_glossaries(subprocesstest.SubprocessTestCase):
'''Folders output with unicode'''
if not features.have_lua:
self.skipTest('Test requires Lua scripting support.')
if sys.platform == 'win32' and not features.have_lua_unicode:
self.skipTest('Test requires a patched Lua build with UTF-8 support.')
proc = self.assertRun((cmd_tshark, '-G', 'folders'), env=unicode_env.env)
out = proc.stdout_str
pluginsdir = [x.split('\t', 1)[1] for x in out.splitlines() if x.startswith('Personal Lua Plugins:')]

View File

@ -8,6 +8,7 @@
#
'''Wireshark Lua scripting tests'''
import sys
import filecmp
import os.path
import shutil
@ -284,6 +285,8 @@ class case_wslua_unicode(subprocesstest.SubprocessTestCase):
'''Check handling of unicode paths.'''
if not features.have_lua:
self.skipTest('Test requires Lua scripting support.')
if sys.platform == 'win32' and not features.have_lua_unicode:
self.skipTest('Test requires a patched Lua build with UTF-8 support.')
# Prepare test environment, put files in the right places.
uni_script = os.path.join(unicode_env.pluginsdir, 'script-Ф-€-中.lua')

View File

@ -24,7 +24,6 @@ function print_usage() {
ADDITIONAL=0
TESTDEPS=0
LUA=0
OPTIONS=
for arg; do
case $arg in
@ -41,7 +40,6 @@ for arg; do
--install-all)
ADDITIONAL=1
TESTDEPS=1
LUA=1
;;
*)
OPTIONS="$OPTIONS $arg"
@ -52,9 +50,10 @@ done
PACKAGE_PREFIX="${MINGW_PACKAGE_PREFIX:-mingw-w64-x86_64}"
#
# Lua is kind of a mess. Lua 5.2 is not available. Some packages depend
# on LuaJIT and it conflicts with Lua 5.1. This will probably have to
# be fixed by the MSYS2 maintainers. Take a hands off approach for now.
# Lua packaging is kind of a mess. Lua 5.2 is not available. Some packages have
# a hard dependy on LuaJIT and it conflicts with Lua 5.1 and vice-versa.
# This will probably have to be fixed by the MSYS2 maintainers.
# XXX Is this still true?
#
BASIC_LIST="base-devel \
git \
@ -70,6 +69,7 @@ BASIC_LIST="base-devel \
${PACKAGE_PREFIX}-libpcap \
${PACKAGE_PREFIX}-libssh \
${PACKAGE_PREFIX}-libxml2 \
${PACKAGE_PREFIX}-lua51 \
${PACKAGE_PREFIX}-lz4 \
${PACKAGE_PREFIX}-minizip \
${PACKAGE_PREFIX}-ninja \
@ -121,8 +121,3 @@ if [ $TESTDEPS -eq 0 ]
then
printf "\n*** Test deps not installed. Rerun with --install-test-deps to have them.\n"
fi
if [ $LUA -ne 0 ]
then
printf "\n*** Lua 5.1 can be installed with: pacman -S ${PACKAGE_PREFIX}-lua51\n"
fi