summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac30
-rw-r--r--solenv/bin/modules/installer/windows/file.pm25
2 files changed, 31 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac
index af94d2bdbc13..fcab984b346d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4993,18 +4993,32 @@ dnl Testing for required Perl modules
dnl ===================================================================
AC_MSG_CHECKING([for required Perl modules])
-if `$PERL -e 'use Cwd; use Digest::MD5'>/dev/null 2>&1`; then
+perl_use_string="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"
+ ;;
+ esac
+ done
+ fi
+fi
+if `$PERL -e '$perl_use_string'>/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.
- if ! `$PERL -e 'use Cwd;'>/dev/null 2>&1`; then
- missing_perl_modules="$missing_perl_modules Cwd"
- fi
- if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
- missing_perl_modules="$missing_perl_modules Digest::MD5"
- fi
- AC_MSG_ERROR([
+ for i in "$perl_use_string"; do
+ if test "$i" != "use" -a "$i" != ";"; then
+ if ! `$PERL -e 'use $i;'>/dev/null 2>&1`; then
+ missing_perl_modules="$missing_perl_modules $i"
+ fi
+ fi
+ done
+ AC_MSG_ERROR([
The missing Perl modules are: $missing_perl_modules
Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
fi
diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm
index 6a0479ba49f2..72f32949bd47 100644
--- a/solenv/bin/modules/installer/windows/file.pm
+++ b/solenv/bin/modules/installer/windows/file.pm
@@ -30,6 +30,7 @@ use installer::windows::idtglobal;
use installer::windows::msiglobal;
use installer::windows::language;
use installer::windows::component;
+use Font::TTF::Font;
##########################################################################
# Assigning one cabinet file to each file. This is requrired,
@@ -552,25 +553,17 @@ sub get_fileversion
}
}
# file version for font files (tdf#76239)
- if ( $onefile->{'Name'} =~ /\.ttf$|\.TTF$/ )
+ if ( $onefile->{'Name'} =~ /\.(otf|ttf|ttc)$/i )
{
- open (TTF, "<$onefile->{'sourcepath'}");
- binmode TTF;
- {local $/ = undef; $ttfdata = <TTF>;}
- close TTF;
+ my $fnt = Font::TTF::Font->open("<$onefile->{'sourcepath'}");
+ # 5 is pre-defined name ID for version string - see
+ # https://docs.microsoft.com/en-us/typography/opentype/spec/name
+ my $ttfdata = $fnt->{'name'}->read->find_name(5);
+ $fnt->release;
- my $ttfversion = "(Version )([0-9]+[.]*([0-9][.])*[0-9]+)";
- # UTF16-encoded version string
- my $ttfversionU = "(V\0e\0r\0s\0i\0o\0n\0 \0)(([0-9]\0)+([.]\0([0-9]\0)+)*)";
-
- if ($ttfdata =~ /$ttfversion/ms)
- {
- my ($version, $subversion, $microversion, $vervariant) = split(/\./,$2);
- $fileversion = int($version) . "." . int($subversion) . "." . int($microversion) . "." . int($vervariant);
- }
- elsif ($ttfdata =~ /$ttfversionU/ms)
+ if ($ttfdata =~ /Version ([0-9]+(\.[0-9]+)*)/i)
{
- my ($version, $subversion, $microversion, $vervariant) = split(/\./,$2 =~ s/\0//g);
+ my ($version, $subversion, $microversion, $vervariant) = split(/\./,$1);
$fileversion = int($version) . "." . int($subversion) . "." . int($microversion) . "." . int($vervariant);
}
else