imgtools/romtools/rombuild/romnibus.pl
changeset 39 fa9d7d89d3d6
parent 38 620772202a07
child 40 68f68128601f
equal deleted inserted replaced
38:620772202a07 39:fa9d7d89d3d6
   120 	die "ERROR: EPOCROOT must specify an existing directory.\n" if (!-d $epocroot);
   120 	die "ERROR: EPOCROOT must specify an existing directory.\n" if (!-d $epocroot);
   121 	($epocroot_vol,$epocroot_dir,$epocroot_file) = File::Spec->splitpath($epocroot);
   121 	($epocroot_vol,$epocroot_dir,$epocroot_file) = File::Spec->splitpath($epocroot);
   122 	$epocroot = File::Spec->catfile(($epocroot_vol,$epocroot_dir,$epocroot_file),undef);
   122 	$epocroot = File::Spec->catfile(($epocroot_vol,$epocroot_dir,$epocroot_file),undef);
   123 	print "EPOCROOT=$ENV{EPOCROOT} resolved as \"$epocroot\"\n";
   123 	print "EPOCROOT=$ENV{EPOCROOT} resolved as \"$epocroot\"\n";
   124 	$lc_epocroot = lc($epocroot);
   124 	$lc_epocroot = lc($epocroot);
   125 	$epoc32path = "${epocroot}epoc32";
   125 	$epoc32path = File::Spec->catfile($epocroot,"epoc32");
   126 	$toolpath = File::Spec->catfile($epoc32path,"tools");
   126 	$toolpath = File::Spec->catfile($epoc32path,"tools");
   127 	push @INC, $toolpath;
   127 	push @INC, $toolpath;
   128 	nix_fixes(), unless ($on_windows);
   128 	nix_fixes(), unless ($on_windows);
   129 }
   129 }
   130 
   130 
   608 
   608 
   609 sub rectify($$$) {
   609 sub rectify($$$) {
   610 	my ($in, $out, $k) = @_;
   610 	my ($in, $out, $k) = @_;
   611 	my $lastblank;
   611 	my $lastblank;
   612 	my $lineno = 0;
   612 	my $lineno = 0;
   613 	my $epocroot_pattern = $on_windows ? $epocroot . '\\' : $epocroot;
   613 	my $epocroot_pattern = $on_windows ? $epocroot . '\\\\' : $epocroot;
   614 
   614 
   615 	open(OUTPUT_FILE, "> $out") or die "Cannot open $out for output";
   615 	open(OUTPUT_FILE, "> $out") or die "Cannot open $out for output";
   616 	open(INPUT_FILE, "< $in") or die "Cannot open for $in input";
   616 	open(INPUT_FILE, "< $in") or die "Cannot open for $in input";
   617   
   617   
   618 	while ($line=<INPUT_FILE>) {
   618 	while ($line=<INPUT_FILE>) {
   634 			my $epoc32_line = 0;
   634 			my $epoc32_line = 0;
   635 			$lastblank = 0;
   635 			$lastblank = 0;
   636 			$line =~ s|\#\#||g; # Delete "token-pasting" ops
   636 			$line =~ s|\#\#||g; # Delete "token-pasting" ops
   637 			$line =~ s|//.*$||g; # Delete trailing c++ comments
   637 			$line =~ s|//.*$||g; # Delete trailing c++ comments
   638 			# prefix the epocroot dir to occurrences of 'epoc32' in all "KEYWORD=..." lines.
   638 			# prefix the epocroot dir to occurrences of 'epoc32' in all "KEYWORD=..." lines.
   639 			$line =~ s/(=\s*)[\\\/]epoc32/\1${epocroot}epoc32/i;
   639 			$line =~ s/(=\s*)[\\\/]epoc32/\1$epoc32path/i;
   640 			$epoc32_line = defined($1);
   640 			$epoc32_line = defined($1);
   641 			if (!$epoc32_line) {
   641 			if (!$epoc32_line) {
   642 				$line =~ /(=.*$epocroot_pattern)/i;
   642 				$line =~ /(=.*$epocroot_pattern)/i;
   643 				$epoc32_line = defined($1);
   643 				$epoc32_line = defined($1);
   644 			}
   644 			}
  1060 			if (File::Spec->file_name_is_absolute($file)) {
  1060 			if (File::Spec->file_name_is_absolute($file)) {
  1061 				my ($vol,$dir,$leaf) = File::Spec->splitpath($file);
  1061 				my ($vol,$dir,$leaf) = File::Spec->splitpath($file);
  1062 				unless ( $vol) {
  1062 				unless ( $vol) {
  1063 					$vol = substr $epocroot,0,2;
  1063 					$vol = substr $epocroot,0,2;
  1064 					$file = substr $file,1;                 
  1064 					$file = substr $file,1;                 
  1065 					$file = File::Spec->catfile($vol,$dir,$leaf);
  1065 					$file = File::Spec->catfile($epocroot,$dir,$leaf);
  1066 				}
  1066 				}
  1067 				die "\nERROR: Variant file specified in $cfgFile is not on the same volume as EPOCROOT\n", if (lc($vol) ne lc($cfg_vol));
  1067 				die "\nERROR: Variant file specified in $cfgFile is not on the same volume as EPOCROOT\n", if (lc($vol) ne lc($cfg_vol));
  1068 			}
  1068 			}
  1069 			else {
  1069 			else {
  1070 				$file = File::Spec->catfile($epoc32path,$file);
  1070 				$file = File::Spec->catfile($epoc32path,$file);