Step towards building for Windows on WSL: ProgramFiles(x86) handling

autogen.sh is a Perl script. When running Perl on WSL, weirdly named
environment variables like the "ProgramFiles(x86)" one don't seem to
get imported to a shell child process of the Perl process. So export
it as PROGRAMFILESX86 instead. configure.ac will look for that on WSL.
(Changes to configure.ac will be coming in small careful steps.)

Change-Id: I572c3b1e2f2fab3629d1856d33fcf0dda51217d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103921
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
Tor Lillqvist 2020-10-04 19:07:41 +03:00
parent b36df65bb2
commit d1b399b687

View file

@ -296,6 +296,18 @@ if (defined $ENV{NOCONFIGURE}) {
push @args, "--enable-option-checking=$option_checking";
print "Running ./configure with '" . join (" ", @args), "'\n";
# When running a shell script from Perl on WSL, weirdly named
# environment variables like the "ProgramFiles(x86)" one don't get
# imported by the shell. So export it as PROGRAMFILESX86 instead.
if (`wslsys 2>/dev/null` ne "") {
if (!$ENV{"ProgramFiles(x86)"}) {
print STDERR "To build on WSL, you need to set the WSLENV environment variable in the Control Panel to 'ProgramFiles(x86)'\n";
exit (1);
}
$ENV{"PROGRAMFILESX86"} = $ENV{"ProgramFiles(x86)"};
}
system ("./configure", @args) && die "Error running configure";
}