configure.ac |   42 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

New commits:
commit c7ddf1c42ee693c2cce21ff1cfeb1f124cdf7ec8
Author:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
AuthorDate: Fri Nov 29 18:53:20 2024 +0100
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Fri Jan 10 21:21:03 2025 +0100

    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+libreoff...@googlemail.com>
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    (cherry picked from commit 6e93419f46924876da1f0c52d27c03968becf046)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177725

diff --git a/configure.ac b/configure.ac
index ffc82ad77ce8..4998b2d1e3be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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 –
@@ -6604,14 +6605,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
@@ -6622,10 +6631,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.
@@ -15481,6 +15518,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"

Reply via email to