Bring the naming of libraries and executable up to current standards.

Install dlls and executables in dlldir.
It is no longer necessary to import ntdll.dll.
This commit is contained in:
Francois Gouget 2002-09-26 03:20:59 +00:00 committed by Alexandre Julliard
parent 58e8807a71
commit 635eb3c2ae
1 changed files with 31 additions and 67 deletions

View File

@ -548,11 +548,7 @@ sub source_scan_directory($$$$)
# 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)$/i, @{get_directory_contents("$fullentry")};
foreach my $candidate (@candidates) { foreach my $candidate (@candidates) {
if ($candidate =~ s/\.exe$//i) { $targets{$candidate}=1;
$targets{$candidate}=1;
} elsif ($candidate =~ s/^(.*)\.dll$/lib$1.so/i) {
$targets{$candidate}=1;
}
} }
} elsif ($dentry =~ /^include/i) { } elsif ($dentry =~ /^include/i) {
# This directory must contain headers we're going to need # This directory must contain headers we're going to need
@ -565,9 +561,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 =~ s/\.exe$//i) { if ($dentry =~ /\.(exe|dll)$/i) {
$targets{$dentry}=1;
} elsif ($dentry =~ s/^(.*)\.dll$/lib$1.so/i) {
$targets{$dentry}=1; $targets{$dentry}=1;
} elsif ($dentry =~ /\.c$/i and $dentry !~ /\.spec\.c$/) { } elsif ($dentry =~ /\.c$/i and $dentry !~ /\.spec\.c$/) {
push @sources_c,"$dentry"; push @sources_c,"$dentry";
@ -653,7 +647,7 @@ sub source_scan_directory($$$$)
foreach my $filename (@$prj_list) { foreach my $filename (@$prj_list) {
$filename =~ s/\.(dsp|mak)$//i; $filename =~ s/\.(dsp|mak)$//i;
if ($opt_target_type == $TT_DLL) { if ($opt_target_type == $TT_DLL) {
$filename = "lib$filename.so"; $filename = "$filename.dll";
} }
$targets{$filename}=1; $targets{$filename}=1;
} }
@ -682,7 +676,7 @@ sub source_scan_directory($$$$)
} }
$name =~ s+(/|\.[^.]*)$++; $name =~ s+(/|\.[^.]*)$++;
if ($opt_target_type == $TT_DLL) { if ($opt_target_type == $TT_DLL) {
$name = "lib$name.so"; $name = "$name.dll";
} }
$targets{$name}=1; $targets{$name}=1;
} }
@ -713,9 +707,6 @@ sub source_scan_directory($$$$)
foreach my $target (split /,/,$target_list) { foreach my $target (split /,/,$target_list) {
$target =~ s+^\s*++; $target =~ s+^\s*++;
$target =~ s+\s*$++; $target =~ s+\s*$++;
# Also accept .exe and .dll as a courtesy
$target =~ s+(.*)\.dll$+lib$1.so+;
$target =~ s+\.exe$++;
$targets{$target}=1; $targets{$target}=1;
} }
} }
@ -786,28 +777,26 @@ sub source_scan_directory($$$$)
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))) {
# Create the target... # Create the target...
my $basename;
my $target=[]; my $target=[];
target_init($target); target_init($target);
@$target[$T_NAME]=$target_name; @$target[$T_NAME]=$target_name;
@$target[$T_FLAGS]|=@$project_settings[$T_FLAGS]; @$target[$T_FLAGS]|=@$project_settings[$T_FLAGS];
if ($target_name =~ /^lib(.*)\.so$/) { if ($target_name =~ /\.dll$/) {
@$target[$T_TYPE]=$TT_DLL; @$target[$T_TYPE]=$TT_DLL;
@$target[$T_INIT]=get_default_init($TT_DLL); @$target[$T_INIT]=get_default_init($TT_DLL);
@$target[$T_FLAGS]&=~$TF_WRAP; @$target[$T_FLAGS]&=~$TF_WRAP;
$basename=$1; push @local_depends,"$target_name.so";
push @local_depends,$target_name; push @local_dlls,$target_name;
push @local_dlls,$basename;
} else { } else {
@$target[$T_TYPE]=$opt_target_type; @$target[$T_TYPE]=$opt_target_type;
@$target[$T_INIT]=get_default_init($opt_target_type); @$target[$T_INIT]=get_default_init($opt_target_type);
$basename=$target_name;
push @exe_list,$target; push @exe_list,$target;
} }
my $basename=$target_name;
$basename=~ s/\.(dll|exe)$//i;
# This is the default link list of Visual Studio, except odbccp32 # This is the default link list of Visual Studio, except odbccp32
# which we don't have in Wine. Also I add ntdll which seems # which we don't have in Wine.
# necessary for Winelib. my @std_dlls=qw(advapi32.dll comdlg32.dll gdi32.dll kernel32.dll odbc32.dll ole32.dll oleaut32.dll shell32.dll user32.dll winspool.drv);
my @std_dlls=qw(advapi32.dll comdlg32.dll gdi32.dll kernel32.dll ntdll.dll odbc32.dll ole32.dll oleaut32.dll shell32.dll user32.dll winspool.drv);
if ((@$target[$T_FLAGS] & $TF_NODLLS) == 0) { if ((@$target[$T_FLAGS] & $TF_NODLLS) == 0) {
@$target[$T_DLLS]=\@std_dlls; @$target[$T_DLLS]=\@std_dlls;
} else { } else {
@ -946,11 +935,7 @@ sub source_scan_directory($$$$)
if (@local_dlls > 0 and @exe_list > 0) { if (@local_dlls > 0 and @exe_list > 0) {
foreach my $target (@exe_list) { foreach my $target (@exe_list) {
push @{@$target[$T_DLL_PATH]},"-L."; push @{@$target[$T_DLL_PATH]},"-L.";
push @{@$target[$T_DLLS]},map { "$_.dll" } @local_dlls; push @{@$target[$T_DLLS]},@local_dlls;
# Also link in the Unix sense since none of the functions
# will be exported.
push @{@$target[$T_LIBRARY_PATH]},"-L.";
push @{@$target[$T_LIBRARIES]},@local_dlls;
push @{@$target[$T_DEPENDS]},@local_depends; push @{@$target[$T_DEPENDS]},@local_depends;
} }
} }
@ -965,11 +950,7 @@ sub source_scan()
# Create the main target # Create the main target
my $main_target=[]; my $main_target=[];
target_init($main_target); target_init($main_target);
if ($opt_target_type == $TT_DLL) { @$main_target[$T_NAME]=$opt_single_target;
@$main_target[$T_NAME]="lib$opt_single_target.so";
} else {
@$main_target[$T_NAME]="$opt_single_target";
}
@$main_target[$T_TYPE]=$opt_target_type; @$main_target[$T_TYPE]=$opt_target_type;
# Add it to the list # Add it to the list
@ -1018,7 +999,7 @@ sub postprocess_targets()
@$wrapper[$T_TYPE]=@$target[$T_TYPE]; @$wrapper[$T_TYPE]=@$target[$T_TYPE];
@$wrapper[$T_INIT]=get_default_init(@$target[$T_TYPE]); @$wrapper[$T_INIT]=get_default_init(@$target[$T_TYPE]);
@$wrapper[$T_FLAGS]=$TF_WRAPPER | (@$target[$T_FLAGS] & $TF_MFC); @$wrapper[$T_FLAGS]=$TF_WRAPPER | (@$target[$T_FLAGS] & $TF_MFC);
@$wrapper[$T_DLLS]=[ "kernel32.dll", "ntdll.dll", "user32.dll" ]; @$wrapper[$T_DLLS]=[ "kernel32.dll", "user32.dll" ];
push @{@$wrapper[$T_LIBRARIES]}, "dl"; push @{@$wrapper[$T_LIBRARIES]}, "dl";
push @{@$wrapper[$T_SOURCES_C]},"@$wrapper[$T_NAME]_wrapper.c"; push @{@$wrapper[$T_SOURCES_C]},"@$wrapper[$T_NAME]_wrapper.c";
@ -1026,7 +1007,8 @@ sub postprocess_targets()
if (defined $index) { if (defined $index) {
splice(@{@$target[$T_SOURCES_C]},$index,1); splice(@{@$target[$T_SOURCES_C]},$index,1);
} }
@$target[$T_NAME]="lib@$target[$T_NAME].so"; @$target[$T_NAME]=@$target[$T_NAME];
@$target[$T_NAME]=~ s/.exe$/.dll/;
@$target[$T_TYPE]=$TT_DLL; @$target[$T_TYPE]=$TT_DLL;
push @{@$project[$P_TARGETS]},$wrapper; push @{@$project[$P_TARGETS]},$wrapper;
@ -1627,23 +1609,16 @@ sub fix_source()
# Generates a target's .spec file # Generates a target's .spec file
sub generate_spec_file($$$) sub generate_spec_file($$$)
{ {
if ($opt_no_generated_specs) { return if ($opt_no_generated_specs);
return;
}
my $path=$_[0]; my $path=$_[0];
my $target=$_[1]; my $target=$_[1];
my $project_settings=$_[2]; my $project_settings=$_[2];
my $basename=@$target[$T_NAME]; my $basename=@$target[$T_NAME];
$basename =~ s+\.so$++; if (@$target[$T_FLAGS] & $TF_WRAPPER) {
if (@$target[$T_FLAGS] & $TF_WRAP) {
$basename =~ s+^lib++;
} elsif (@$target[$T_FLAGS] & $TF_WRAPPER) {
$basename.="_wrapper"; $basename.="_wrapper";
} }
if (@$target[$T_TYPE] != $TT_DLL) {
$basename .= '.exe';
}
if (!open(FILEO,">$path$basename.spec")) { if (!open(FILEO,">$path$basename.spec")) {
print STDERR "error: could not open \"$path$basename.spec\" for writing\n"; print STDERR "error: could not open \"$path$basename.spec\" for writing\n";
@ -1783,7 +1758,7 @@ sub generate_project_files($)
}); });
generate_list("EXES",1,\@exe_list,sub generate_list("EXES",1,\@exe_list,sub
{ {
return "@{$_[0]}[$T_NAME].exe"; return "@{$_[0]}[$T_NAME]";
}); });
print FILEO "\n\n\n"; print FILEO "\n\n\n";
@ -1818,18 +1793,7 @@ sub generate_project_files($)
generate_list("${canon}_C_SRCS",1,@$target[$T_SOURCES_C]); generate_list("${canon}_C_SRCS",1,@$target[$T_SOURCES_C]);
generate_list("${canon}_CXX_SRCS",1,@$target[$T_SOURCES_CXX]); generate_list("${canon}_CXX_SRCS",1,@$target[$T_SOURCES_CXX]);
generate_list("${canon}_RC_SRCS",1,@$target[$T_SOURCES_RC]); generate_list("${canon}_RC_SRCS",1,@$target[$T_SOURCES_RC]);
my $basename=@$target[$T_NAME]; generate_list("${canon}_SPEC_SRCS",1,[ "@$target[$T_NAME].spec" ]);
$basename =~ s+\.so$++;
if (@$target[$T_FLAGS] & $TF_WRAP) {
$basename =~ s+^lib++;
} elsif (@$target[$T_FLAGS] & $TF_WRAPPER) {
$basename.="_wrapper";
}
if (@$target[$T_TYPE] != $TT_DLL) {
generate_list("${canon}_SPEC_SRCS",1,[ "$basename.exe.spec" ]);
} else {
generate_list("${canon}_SPEC_SRCS",1,[ "$basename.spec" ]);
}
generate_list("${canon}_DLL_PATH",1,@$target[$T_DLL_PATH]); generate_list("${canon}_DLL_PATH",1,@$target[$T_DLL_PATH]);
generate_list("${canon}_DLLS",1,@$target[$T_DLLS]); generate_list("${canon}_DLLS",1,@$target[$T_DLLS]);
generate_list("${canon}_LIBRARY_PATH",1,@$target[$T_LIBRARY_PATH]); generate_list("${canon}_LIBRARY_PATH",1,@$target[$T_LIBRARY_PATH]);
@ -1883,7 +1847,7 @@ sub generate_project_files($)
print FILEO " \$(SUBDIRS)"; print FILEO " \$(SUBDIRS)";
} }
if (@{@$project[$P_TARGETS]} > 0) { if (@{@$project[$P_TARGETS]} > 0) {
print FILEO " \$(DLLS) \$(EXES:%=%.so)"; print FILEO " \$(DLLS:%=%.so) \$(EXES:%=%.so)";
} }
print FILEO "\n\n"; print FILEO "\n\n";
if (@$project[$P_PATH] eq "") { if (@$project[$P_PATH] eq "") {
@ -1902,8 +1866,8 @@ sub generate_project_files($)
print FILEO "\t_list=\"\$(SUBDIRS)\"; for i in \$\$_list; do (cd \$\$i; \$(MAKE) install) || exit 1; done\n"; print FILEO "\t_list=\"\$(SUBDIRS)\"; for i in \$\$_list; do (cd \$\$i; \$(MAKE) install) || exit 1; done\n";
} }
if (@{@$project[$P_TARGETS]} > 0) { if (@{@$project[$P_TARGETS]} > 0) {
print FILEO "\t_list=\"\$(EXES:%=%.so)\"; for i in \$\$_list; do \$(INSTALL_PROGRAM) \$\$i \$(dlldir); done\n"; print FILEO "\t_list=\"\$(EXES)\"; for i in \$\$_list; do \$(INSTALL_SCRIPT) \$\$i \$(bindir); done\n";
print FILEO "\t_list=\"\$(DLLS)\"; for i in \$\$_list; do \$(INSTALL_PROGRAM) \$\$i \$(libdir); done\n"; print FILEO "\t_list=\"$(EXES:%=%.so) \$(DLLS:%=%.so)\"; for i in \$\$_list; do \$(INSTALL_PROGRAM) \$\$i \$(dlldir); done\n";
} }
print FILEO "\n"; print FILEO "\n";
print FILEO "uninstall::\n"; print FILEO "uninstall::\n";
@ -1913,8 +1877,8 @@ sub generate_project_files($)
print FILEO "\t_list=\"\$(SUBDIRS)\"; for i in \$\$_list; do (cd \$\$i; \$(MAKE) uninstall) || exit 1; done\n"; print FILEO "\t_list=\"\$(SUBDIRS)\"; for i in \$\$_list; do (cd \$\$i; \$(MAKE) uninstall) || exit 1; done\n";
} }
if (@{@$project[$P_TARGETS]} > 0) { if (@{@$project[$P_TARGETS]} > 0) {
print FILEO "\t_list=\"\$(EXES:%=%.so)\"; for i in \$\$_list; do \$(RM) \$(dlldir)/\$\$i;done\n"; print FILEO "\t_list=\"\$(EXES)\"; for i in \$\$_list; do \$(RM) \$(bindir)/\$\$i;done\n";
print FILEO "\t_list=\"\$(DLLS)\"; for i in \$\$_list; do \$(RM) \$(libdir)/\$\$i;done\n"; print FILEO "\t_list=\"$(EXES:%=%.so) \$(DLLS:%=%.so)\"; for i in \$\$_list; do \$(RM) \$(dlldir)/\$\$i;done\n";
} }
print FILEO "\n"; print FILEO "\n";
print FILEO "clean::\n"; print FILEO "clean::\n";
@ -1952,20 +1916,20 @@ sub generate_project_files($)
$all_libs="\$(${canon}_LIBRARIES:%=-l%) \$(ALL_LIBRARIES)"; $all_libs="\$(${canon}_LIBRARIES:%=-l%) \$(ALL_LIBRARIES)";
} }
print FILEO "\$(${canon}_SPEC_SRCS:.spec=.spec.c): \$(${canon}_SPEC_SRCS) \$(${canon}_OBJS) \$(${canon}_RC_SRCS:.rc=.res)\n"; print FILEO "@$target[$T_NAME].spec.c: \$(${canon}_SPEC_SRCS) \$(${canon}_RC_SRCS:.rc=.res) \$(${canon}_OBJS)\n";
print FILEO "\t\$(LD_PATH) \$(WINEBUILD) -fPIC \$(${canon}_DLL_PATH) \$(ALL_DLL_PATH) $all_dlls \$(${canon}_RC_SRCS:%.rc=-res %.res) $mode \$(${canon}_OBJS) -o \$\@ -spec \$(SRCDIR)/\$(${canon}_SPEC_SRCS)\n"; print FILEO "\t\$(LD_PATH) \$(WINEBUILD) -fPIC -o \$\@ \$(${canon}_SPEC_SRCS:%=-spec %) \$(${canon}_RC_SRCS:%.rc=-res %.res) \$(${canon}_DLL_PATH) \$(WINE_DLL_PATH) \$(GLOBAL_DLL_PATH) $all_dlls $mode \$(${canon}_OBJS)\n";
print FILEO "\n"; print FILEO "\n";
my $t_name=@$target[$T_NAME]; my $t_name=@$target[$T_NAME];
if (@$target[$T_TYPE]!=$TT_DLL) { if (@$target[$T_TYPE]!=$TT_DLL) {
$t_name.=".exe.so"; $t_name.=".exe.so";
} }
print FILEO "$t_name: \$(${canon}_SPEC_SRCS:.spec=.spec.o) \$(${canon}_OBJS) \$(${canon}_DEPENDS) \n"; print FILEO "@$target[$T_NAME].so: @$target[$T_NAME].spec.o \$(${canon}_OBJS) \$(${canon}_DEPENDS) \n";
if (@{@$target[$T_SOURCES_CXX]} > 0 or @{@$project_settings[$T_SOURCES_CXX]} > 0) { if (@{@$target[$T_SOURCES_CXX]} > 0 or @{@$project_settings[$T_SOURCES_CXX]} > 0) {
print FILEO "\t\$(LDXXSHARED)"; print FILEO "\t\$(LDXXSHARED)";
} else { } else {
print FILEO "\t\$(LDSHARED)"; print FILEO "\t\$(LDSHARED)";
} }
print FILEO " \$(LDDLLFLAGS) -o \$\@ \$(${canon}_OBJS) \$(${canon}_SPEC_SRCS:.spec=.spec.o) \$(${canon}_LIBRARY_PATH) \$(ALL_LIBRARY_PATH) $all_libs \$(LIBS)\n"; print FILEO " \$(LDDLLFLAGS) -o \$\@ \$(${canon}_OBJS) @$target[$T_NAME].spec.o \$(${canon}_LIBRARY_PATH) \$(ALL_LIBRARY_PATH) $all_libs \$(LIBS)\n";
if (@$target[$T_TYPE] ne $TT_DLL) { if (@$target[$T_TYPE] ne $TT_DLL) {
print FILEO "\ttest -f @$target[$T_NAME] || \$(INSTALL_SCRIPT) wineapploader @$target[$T_NAME]\n"; print FILEO "\ttest -f @$target[$T_NAME] || \$(INSTALL_SCRIPT) wineapploader @$target[$T_NAME]\n";
} }
@ -3165,7 +3129,7 @@ $(EXTRASUBDIRS:%=%/__clean__): dummy
-cd `dirname $@` && $(RM) $(CLEAN_FILES) -cd `dirname $@` && $(RM) $(CLEAN_FILES)
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__) clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(OBJS) $(EXES) $(EXES:%=%.so) $(DLLS) $(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(OBJS) $(EXES:%.exe=%) $(EXES:%=%.so) $(EXES:%=%.spec.o) $(DLLS:%=%.so) $(DLLS:%=%.spec.o)
# Rules for installing # Rules for installing