Commit 798a91a3 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

winemaker: Also detect static libraries when scanning directories.

parent 376ffdf3
...@@ -20,7 +20,7 @@ use strict; ...@@ -20,7 +20,7 @@ use strict;
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
# #
my $version="0.8.0"; my $version="0.8.1";
use Cwd; use Cwd;
use File::Basename; use File::Basename;
...@@ -1288,8 +1288,16 @@ sub source_scan_directory($$$$) ...@@ -1288,8 +1288,16 @@ sub source_scan_directory($$$$)
if ($dentry =~ /^(Release|Debug)/i) { if ($dentry =~ /^(Release|Debug)/i) {
# These directories are often used to store the object files and the # These directories are often used to store the object files and the
# resulting executable/library. They should not contain anything else. # resulting executable/library. They should not contain anything else.
my @candidates=grep /\.(exe|dll)$/i, @{get_directory_contents("$fullentry")}; my @candidates=grep /\.(exe|dll|lib)$/i, @{get_directory_contents("$fullentry")};
foreach my $candidate (@candidates) { foreach my $candidate (sort @candidates) {
my $dlldup = $candidate;
$dlldup =~ s/\.lib$/.dll/;
if ($candidate =~ /\.lib$/ and $targets{$dlldup})
{
# Often lib files are created together with dll files, even if the dll file is the
# real target.
next;
}
$targets{$candidate}=1; $targets{$candidate}=1;
} }
} elsif ($dentry =~ /^include/i) { } elsif ($dentry =~ /^include/i) {
...@@ -1303,7 +1311,7 @@ sub source_scan_directory($$$$) ...@@ -1303,7 +1311,7 @@ sub source_scan_directory($$$$)
source_scan_directory($project,"$fullentry/","$dentry/",$no_target); source_scan_directory($project,"$fullentry/","$dentry/",$no_target);
} }
} elsif (-f "$fullentry") { } elsif (-f "$fullentry") {
if ($dentry =~ /\.(exe|dll)$/i) { if ($dentry =~ /\.(exe|dll|lib)$/i) {
$targets{$dentry}=1; $targets{$dentry}=1;
} elsif ($dentry =~ /\.c$/i and $dentry !~ /\.(dbg|spec)\.c$/) { } elsif ($dentry =~ /\.c$/i and $dentry !~ /\.(dbg|spec)\.c$/) {
push @sources_c,"$dentry"; push @sources_c,"$dentry";
...@@ -1517,6 +1525,7 @@ sub source_scan_directory($$$$) ...@@ -1517,6 +1525,7 @@ sub source_scan_directory($$$$)
# - Match each target with source files (sort in reverse # - Match each target with source files (sort in reverse
# alphabetical order to get the longest matches first) # alphabetical order to get the longest matches first)
my @local_dlls=(); my @local_dlls=();
my @local_libs=();
my @local_depends=(); my @local_depends=();
my @exe_list=(); my @exe_list=();
foreach my $target_name (map (lc, (sort { $b cmp $a } keys %targets))) { foreach my $target_name (map (lc, (sort { $b cmp $a } keys %targets))) {
...@@ -1535,6 +1544,13 @@ sub source_scan_directory($$$$) ...@@ -1535,6 +1544,13 @@ sub source_scan_directory($$$$)
} else { } else {
push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:.dll=.spec)"); push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:.dll=.spec)");
} }
} elsif ($target_name =~ /\.lib$/) {
$target_name =~ s/(.*)\.lib/lib$1.a/;
@$target[$T_NAME]=$target_name;
@$target[$T_TYPE]=$TT_LIB;
push @local_depends,"$target_name";
push @local_libs,$target_name;
push @{@$target[$T_ARFLAGS]},("rc");
} else { } else {
@$target[$T_TYPE]=$opt_target_type; @$target[$T_TYPE]=$opt_target_type;
push @exe_list,$target; push @exe_list,$target;
...@@ -1694,6 +1710,12 @@ sub source_scan_directory($$$$) ...@@ -1694,6 +1710,12 @@ sub source_scan_directory($$$$)
push @{@$target[$T_DLLS]},@local_dlls; push @{@$target[$T_DLLS]},@local_dlls;
} }
} }
if (@local_libs > 0 and @exe_list > 0) {
foreach my $target (@exe_list) {
push @{@$target[$T_LIBRARY_PATH]},"-L.";
push @{@$target[$T_LIBRARIES]},@local_libs;
}
}
} }
## ##
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment