winemaker: Add def file support.

This commit is contained in:
André Hentschel 2011-01-04 22:43:01 +01:00 committed by Alexandre Julliard
parent 5fd834fc95
commit 564c7a5718
1 changed files with 28 additions and 8 deletions

View File

@ -3,7 +3,7 @@ use strict;
# Copyright 2000-2004 Francois Gouget for CodeWeavers
# Copyright 2004 Dimitrie O. Paun
# Copyright 2009 André Hentschel
# Copyright 2009-2011 André Hentschel
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@ -20,7 +20,7 @@ use strict;
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
my $version="0.7.5";
my $version="0.7.6";
use Cwd;
use File::Basename;
@ -265,6 +265,10 @@ my $TF_NODLLS=16;
# --nomsvcrt option: Do not link with msvcrt
my $TF_NOMSVCRT=32;
##
# This target has a def file (only use it with TT_DLL)
my $TF_HASDEF=64;
##
# Initialize a target:
# - set the target type to TT_SETTINGS, i.e. no real target will
@ -800,6 +804,8 @@ sub source_scan_project_file($$$)
}
} elsif ($sfilet =~ /\.rc$/i) {
push @sources_rc,$sfilet;
} elsif ($sfilet =~ /\.def$/i) {
@$project_settings[$T_FLAGS]|=$TF_HASDEF;
} elsif ($sfilet =~ /\.(h|hxx|hpp|inl|rc2|dlg)$/i) {
push @sources_misc,$sfilet;
if ($sfilet =~ /^stdafx.h$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
@ -889,6 +895,8 @@ sub source_scan_project_file($$$)
}
} elsif ($sfilet =~ /\.rc$/i) {
push @sources_rc,$sfilet;
} elsif ($sfilet =~ /\.def$/i) {
@$project_settings[$T_FLAGS]|=$TF_HASDEF;
} elsif ($sfilet =~ /\.(h|hxx|hpp|inl|rc2|dlg)$/i) {
push @sources_misc,$sfilet;
if ($sfilet =~ /^stdafx.h$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
@ -1012,7 +1020,11 @@ sub source_scan_project_file($$$)
push @local_depends,"$prj_name.so";
push @local_dlls,$prj_name;
my $canon=canonize($prj_name);
push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:.dll=.spec)");
if (@$project_settings[$T_FLAGS] & $TF_HASDEF) {
push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:.dll=.def)");
} else {
push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:.dll=.spec)");
}
}
@$target[$T_NAME]=$prj_name;
@ -1295,6 +1307,8 @@ sub source_scan_directory($$$$)
}
} elsif ($dentry =~ /\.rc$/i) {
push @sources_rc,"$dentry";
} elsif ($dentry =~ /\.def$/i) {
@$project_settings[$T_FLAGS]|=$TF_HASDEF;
} elsif ($dentry =~ /\.(h|hxx|hpp|inl|rc2|dlg)$/i) {
$has_headers=1;
push @sources_misc,"$dentry";
@ -1507,7 +1521,11 @@ sub source_scan_directory($$$$)
push @local_depends,"$target_name.so";
push @local_dlls,$target_name;
my $canon=canonize($target_name);
push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:.dll=.spec)");
if (@$project_settings[$T_FLAGS] & $TF_HASDEF) {
push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:.dll=.def)");
} else {
push @{@$target[$T_LDFLAGS]},("-shared","\$(${canon}_MODULE:.dll=.spec)");
}
} else {
@$target[$T_TYPE]=$opt_target_type;
push @exe_list,$target;
@ -1736,7 +1754,7 @@ sub fix_file_and_directory_names($)
`head -n 1 "$dirname/$dentry"` =~ /Generated by Winemaker/);
# Leave non-source files alone
next if ($new_name !~ /(^makefile|\.(c|cpp|h|rc))$/i);
next if ($new_name !~ /(^makefile|\.(c|cpp|h|rc|spec|def))$/i);
# Only all lowercase extensions are supported (because of
# rules like '.c.o:').
@ -2480,7 +2498,9 @@ sub generate_project_files($)
my $canon=canonize("@$target[$T_NAME]");
$canon =~ s/_so$//;
if (@$target[$T_TYPE] == $TT_DLL) {
if (@$target[$T_TYPE] == $TT_DLL && (@$project_settings[$T_FLAGS] & $TF_HASDEF)) {
print FILEO "\$(${canon}_MODULE).so: \$(${canon}_OBJS) \$(${canon}_MODULE:.dll=.def)\n";
} elsif (@$target[$T_TYPE] == $TT_DLL) {
print FILEO "\$(${canon}_MODULE).so: \$(${canon}_OBJS) \$(${canon}_MODULE:.dll=.spec)\n";
} else {
print FILEO "\$(${canon}_MODULE).so: \$(${canon}_OBJS)\n";
@ -2553,9 +2573,9 @@ $opt_no_banner=0;
sub print_banner()
{
print "Winemaker $version\n";
print "Copyright 2000 Francois Gouget <fgouget\@codeweavers.com> for CodeWeavers\n";
print "Copyright 2000-2004 Francois Gouget <fgouget\@codeweavers.com> for CodeWeavers\n";
print "Copyright 2004 Dimitrie O. Paun\n";
print "Copyright 2009 André Hentschel\n";
print "Copyright 2009-2011 André Hentschel\n";
}
sub usage()