tools/filter_obyfile.pl
changeset 135 b9832c8d3f36
parent 100 6dfa3bdbdfba
equal deleted inserted replaced
134:79169c91b472 135:b9832c8d3f36
   130 			{
   130 			{
   131 			# print STDERR "Ignoring dependencies of $hostfile because of stem substitution of $romfile\n";
   131 			# print STDERR "Ignoring dependencies of $hostfile because of stem substitution of $romfile\n";
   132 			next;
   132 			next;
   133 			}
   133 			}
   134 		}
   134 		}
       
   135 	else
       
   136 		{
       
   137 		if ($hostfile =~ /\/stem_/)
       
   138 			{
       
   139 			# print STDERR "Ignoring dependencies of $hostfile because there is no stem substitution of $romfile\n";
       
   140 			next;
       
   141 			}
       
   142 		}
   135 
   143 
   136 	$lc_romfiles{lc $romfile} = $romfile;
   144 	$lc_romfiles{lc $romfile} = $romfile;
   137 	
   145 	
   138 	my $romexe = "";
   146 	my $romexe = "";
   139 	if ($romfile =~ /^sys.bin.(.*)$/i)
   147 	if ($romfile =~ /^sys.bin.(.*)$/i)
   220 		}
   228 		}
   221 	}
   229 	}
   222 
   230 
   223 if (0)
   231 if (0)
   224 	{
   232 	{
   225 	foreach my $exe ("libopenvg.dll", "libopenvg_sw.dll", "backend.dll", "qtgui.dll")
   233 	foreach my $exe ("libopenvg.dll", "libopenvg_sw.dll", "backend.dll", "qtgui.dll", "mediaclientaudio.dll")
   226 		{
   234 		{
   227 		printf STDERR "Dependents of %s = %s\n", $exe, join(", ", @{$exe_dependencies{$exe}});
   235 		printf STDERR "Dependents of %s = %s\n", $exe, join(", ", @{$exe_dependencies{$exe}});
   228 		}
   236 		}
   229 	}
   237 	}
   230 
   238 
   287 	my %exports;
   295 	my %exports;
   288 	expand_list(\%exports, $exported_ordinals);
   296 	expand_list(\%exports, $exported_ordinals);
   289 	my $namelength = length($romexe);
   297 	my $namelength = length($romexe);
   290 	foreach my $dependent (@{$exe_dependencies{$romexe}})
   298 	foreach my $dependent (@{$exe_dependencies{$romexe}})
   291 		{
   299 		{
   292 		next if (defined $deletions{$dependent});   # already 
   300 		if (defined $deletions{$dependent})
       
   301 			{
       
   302 			# print STDERR "Already deleted $dependent of $romexe\n";
       
   303 			next;   # already deleted
       
   304 			}
   293 		
   305 		
   294 		if ($dependent =~ /^sys.bin.(.*)$/i)
   306 		if ($dependent =~ /^sys.bin.(.*)$/i)
   295 			{
   307 			{
   296 			my $depexe = lc $1;
   308 			my $depexe = lc $1;
   297 			my $imports;
   309 			my $imports;
       
   310 			# print STDERR "Checking $depexe for detailed dependency on $romexe\n";
   298 			foreach my $prerequisite (@{$exe_prerequisites{$depexe}})
   311 			foreach my $prerequisite (@{$exe_prerequisites{$depexe}})
   299 				{
   312 				{
   300 				if (substr($prerequisite, 0, $namelength) eq $romexe)
   313 				if (substr($prerequisite, 0, $namelength) eq $romexe)
   301 					{
   314 					{
   302 					$imports = substr($prerequisite, $namelength+1);	# skip name and "@"
   315 					$imports = substr($prerequisite, $namelength+1);	# skip name and "@"
       
   316 					# print STDERR "Found imports >$imports<\n";
   303 					last;
   317 					last;
   304 					}
   318 					}
   305 				}
   319 				}
   306 			if (!defined $imports)
   320 			if (!defined $imports)
   307 				{
   321 				{
   308 				printf STDERR "Failed to find ordinals imported from %s by %s (in %s)\n", 
   322 				printf STDERR "Internal error: Failed to find ordinals imported from %s by %s (in %s)\n", 
   309 					$romexe, $dependent, join(":",@{$exe_prerequisites{$depexe}});
   323 					$romexe, $dependent, join(":",@{$exe_prerequisites{$depexe}});
   310 				next;
   324 				next;
   311 				}
   325 				}
   312 			my $compatible = check_list(\%exports,$imports);
   326 			my $compatible = check_list(\%exports,$imports);
   313 			if ($compatible ne "OK")
   327 			if ($compatible ne "OK")
   314 				{
   328 				{
   315 				$deletions{$dependent} = "$romexe $compatible";
   329 				$deletions{$dependent} = "$romexe $compatible";
   316 				# print_detail("Deleting $dependent because of slimmed $romexe ($compatible)");
   330 				print_detail("Deleting $dependent because of slimmed $romexe ($compatible)");
   317 				}
   331 				}
   318 			}
   332 			}
   319 		}
   333 		}
   320 	}
   334 	}
   321 
   335