wsl-as-helper: look for perl modules in the perl that's actually used

i.e. strawberry-perl-portable for the installsets and openssl

The only module that needs to be installed (and only when building
installation sets) is Font::TTF::Font - but only on the windows side,
not in the wsl-container.

in the wsl-as-helper case there are three different versions of perl
involved:

  * one inside wsl, since autogen.sh is a perl script
  * one provided by git-bash - used for the majority of the build
    whenever a recipe uses perl
  * and strawberry-perl-portable for building openssl (since that is
    picky and needs one that handles the windows-paths a certain way)
    and for building the installation sets (because of similar
    assumptions in path mangling)

Change-Id: I8374749f21c7862f2e9e77d760077e836a6e9166
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177560
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
This commit is contained in:
Christian Lohmaier 2024-11-29 18:53:20 +01:00
parent 15f4b64379
commit 6e93419f46

View file

@ -335,6 +335,7 @@ if test -n "$WSL_DISTRO_NAME" && $(echo $PATH |grep -q mingw64); then
fi
STRAWBERRY_TOOLS="$formatted_path/c/bin"
STRAWBERRY_PERL="$formatted_path/perl/bin/perl.exe"
STRAWBERRY_PERL_UNIX="$formatted_path_unix/perl/bin/perl.exe"
AC_ARG_WITH([wsl-command],
[AS_HELP_STRING([--with-wsl-command],
[Specify your wsl distro command if it isn't the default/the one used with just wsl.exe
@ -6834,14 +6835,22 @@ dnl Testing for required Perl modules
dnl ===================================================================
AC_MSG_CHECKING([for required Perl modules])
dnl Digest::MD5 seems only be used for packaging, but is basically a given
perl_use_string="use Cwd ; use Digest::MD5"
perl_use_string_spp="use Cwd ; use Digest::MD5"
if test "$_os" = "WINNT"; then
if test -n "$PKGFORMAT"; then
for i in $PKGFORMAT; do
case "$i" in
msi)
# for getting fonts versions to use in MSI
perl_use_string="$perl_use_string ; use Font::TTF::Font"
if test -n "$WSL_ONLY_AS_HELPER"; then
# in case of a wsl-as-helper build, the packaging is done using strawberry-perl
# and not the perl provided by git-bash
perl_use_string_spp="$perl_use_string_spp ; use Font::TTF::Font"
else
perl_use_string="$perl_use_string ; use Font::TTF::Font"
fi
;;
esac
done
@ -6852,10 +6861,38 @@ if test "$with_system_hsqldb" = "yes"; then
fi
if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
# OpenSSL needs that to build
perl_use_string="$perl_use_string ; use FindBin"
if test -n "$WSL_ONLY_AS_HELPER"; then
# OpenSSL is built via spp, FindBin is provided by default, but deps might change in future
perl_use_string_spp="$perl_use_string_spp ; use FindBin"
else
perl_use_string="$perl_use_string ; use FindBin"
fi
fi
dnl in WSL_ONLY_AS_HELPER case the test should be done with git-bash-provided-perl and not perl from
dnl the wsl container, but that can wait until we require a module that's not provided by default
if $PERL -e "$perl_use_string">/dev/null 2>&1; then
AC_MSG_RESULT([all modules found])
if test -n "$WSL_ONLY_AS_HELPER"; then
AC_MSG_CHECKING([for required Perl modules in Strawberry Perl])
if $STRAWBERRY_PERL_UNIX -e "$perl_use_string_spp">/dev/null 2>&1; then
AC_MSG_RESULT([all modules found])
else
AC_MSG_RESULT([failed to find some modules])
# Find out which modules are missing.
for i in $perl_use_string_spp; do
if test "$i" != "use" -a "$i" != ";"; then
if ! $STRAWBERRY_PERL_UNIX -e "use $i;">/dev/null 2>&1; then
missing_perl_modules="$missing_perl_modules $i"
fi
fi
done
PathFormat "$(dirname $STRAWBERRY_PERL_UNIX)"
spp_cpan_command='PATH="$(cygpath.exe -up "'$STRAWBERRY_TOOLS';'$formatted_path'"):$PATH" cpanm'
AC_MSG_ERROR([
The missing Perl modules are: $missing_perl_modules
Install them with »$spp_cpan_command $missing_perl_modules«])
fi
fi
else
AC_MSG_RESULT([failed to find some modules])
# Find out which modules are missing.
@ -15788,6 +15825,7 @@ if test -n "$WSL_ONLY_AS_HELPER"; then
WGET=
GNUTAR="tar.exe"
SHA256SUM="sha256sum.exe"
COMPRESSIONTOOL="/usr/bin/gzip"
# TODO: maybe switch to strawberry-perl right away?
# only openssl seems to actually require it (for Pod/Usage.pm and maybe more)
PERL="perl.exe"