os/ossrv/stdcpp/tsrc/stdcpp_genatsmodules.bat
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/stdcpp/tsrc/stdcpp_genatsmodules.bat	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2683 @@
     1.4 +@rem
     1.5 +@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +@rem All rights reserved.
     1.7 +@rem This component and the accompanying materials are made available
     1.8 +@rem under the terms of "Eclipse Public License v1.0"
     1.9 +@rem which accompanies this distribution, and is available
    1.10 +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +@rem
    1.12 +@rem Initial Contributors:
    1.13 +@rem Nokia Corporation - initial contribution.
    1.14 +@rem
    1.15 +@rem Contributors:
    1.16 +@rem
    1.17 +@rem Description: 
    1.18 +@rem
    1.19 +
    1.20 +
    1.21 +@perl -x stdcpp_GenATSModules.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 
    1.22 +@goto end
    1.23 +
    1.24 +#!perl
    1.25 +use strict;
    1.26 +use File::Find;
    1.27 +use File::Copy;
    1.28 +use Cwd;
    1.29 +
    1.30 +
    1.31 +my $target = "winsspd";
    1.32 +my $suite;
    1.33 +my $install = "no";
    1.34 +my $session = "no";
    1.35 +my $combinedSession = "no";
    1.36 +my $sdkversion="";
    1.37 +my $noXmlsGenList = "play_new";
    1.38 +
    1.39 +my %DirHash;
    1.40 +
    1.41 +my $sendEmail = "no";
    1.42 +my $rootDrive = substr(getcwd(), 0,2);
    1.43 +my $templateRoot = getcwd();
    1.44 +my	$ATSRoot = getcwd()."\\ATSINPUT";
    1.45 +
    1.46 +if($ENV{'ATS_SETUP'}  ne "")
    1.47 +{
    1.48 + $sendEmail = "yes";
    1.49 + $rootDrive = $ENV{'ATS_INDRIVE'};
    1.50 + $templateRoot = $ENV{'ATS_TEMPLATEROOT'};
    1.51 + $ATSRoot = $ENV{'ATS_ATSOUTDRIVE'};
    1.52 +}
    1.53 +
    1.54 +
    1.55 +if(scalar @ARGV ==0 || $ARGV[0] =~ /[\-\\\/][h\?]/ || $ARGV[0] =~ /help/ )
    1.56 +{
    1.57 +	print <<EOHelp;
    1.58 +genatsmodules.bat - hardcoded script to generate ATSINPUT folders for mobileruntime and ngi projects	
    1.59 +Usage:
    1.60 +	genatsmodules.bat
    1.61 +		Create ATSINPUT for the default testsuite based on 
    1.62 +		location it is executed from place in stdlibs/internal 
    1.63 +		and run and it generates ATSINPUT for stdlibs
    1.64 +		similiarly place it in ssl/internal or glib/internal or 
    1.65 +    ngi/internal and run to generate  ATSINPUT for ssl, glib  
    1.66 +    and ngi respectively	
    1.67 +  
    1.68 +  genatsmodules [libname]
    1.69 +			where libname can be stdlibs, ssl, glib, etc. Creates 
    1.70 +			ats test drop for given library. Valid from any internal
    1.71 +			folder of mobileruntime.
    1.72 +			
    1.73 +  
    1.74 +  genatsmodules ngi
    1.75 +			create ngi testsuite. Valid inside ngi/internal only
    1.76 +			
    1.77 +genatsmodules play_new
    1.78 +			create play_new testsuite. Valid inside play_new/internal only
    1.79 +				
    1.80 +	
    1.81 +      
    1.82 +	genatsmodules ltp
    1.83 +			create ltp testsuite. Valid inside stdlibs/internal only
    1.84 +	
    1.85 +	genatsmodules lsb
    1.86 +			create lsb testsuite. Valid inside stdlibs/internal only
    1.87 +			
    1.88 +	genatsmodules stdcpp
    1.89 +			create stdcpp testsuite. Valid inside stdcpp/internal only
    1.90 +			
    1.91 +	genatsmodules [libname] install 
    1.92 +		 where libname can be stdlibs, ssl, glib, ltp, lsb to create a 
    1.93 +		 ATSINPUT where the dependent mobileruntime libraries are also 
    1.94 +		 copied and used (It copies the dependent libraries using the 
    1.95 +		 ATS component files)
    1.96 +		
    1.97 +	genatsmodules session [libname] [target] 		
    1.98 +		where libname is any of the standard libs as shown above and 
    1.99 +		target can be winsspd, winscw, scarfe, zeus etc. to create 
   1.100 +		session files for scarfe, winsspd etc. 
   1.101 +		
   1.102 +genatsmodules session combined [target] 				
   1.103 +      will look at the existing ATSINPUT(which can have any 
   1.104 +      combination of created components and create a combined 
   1.105 +      session file. This way you get increased flexibility in 
   1.106 +      the libraries you choose to combine into a single session 
   1.107 +      file. If the target is a hardware target(that is not winsspd
   1.108 +      or winscw), the script will first attempt to find a target 
   1.109 +      specific component file and if not found, the generic hw 
   1.110 +      component file. 
   1.111 +	
   1.112 +
   1.113 +	Note:
   1.114 +	ATSINPUT creation is a 2 stage process. First we create 
   1.115 +	the components and then we run (for example) 
   1.116 +	"genatsmodules session stdlibs winscw" and 
   1.117 +	"genatsmodules session stdlibs scarfe" to create the 
   1.118 +	session files.
   1.119 +EOHelp
   1.120 +		exit();
   1.121 +}
   1.122 +my $do_armv5 = 1;
   1.123 +my $do_winscw = 1;
   1.124 +
   1.125 +if(scalar @ARGV == 1)
   1.126 +{
   1.127 +	if($ARGV[0] eq "session")
   1.128 +	{
   1.129 +		die("parameter session must be followed by libname and target platform");
   1.130 +	}
   1.131 +	else
   1.132 +	{
   1.133 +		$suite = $ARGV[0];
   1.134 +	}
   1.135 +}
   1.136 +elsif(scalar @ARGV == 2)
   1.137 +{
   1.138 +	if($ARGV[0] eq  "session")
   1.139 +	{
   1.140 +		die("parameter session must be followed by libname and target platform");
   1.141 +	}
   1.142 +	elsif($ARGV[1] eq "install")
   1.143 +	{
   1.144 +		$suite = $ARGV[0];
   1.145 +		$install = "yes";
   1.146 +	}
   1.147 +	elsif($ARGV[1] eq "armv5")
   1.148 +	{
   1.149 +		$do_winscw = 0;
   1.150 +	}
   1.151 +	elsif($ARGV[1] eq "winscw")
   1.152 +	{
   1.153 +		$do_armv5 = 0; 
   1.154 +	}
   1.155 +	else
   1.156 +	{
   1.157 +		die("second parameter after target platform $ARGV[0] can only be \"install\" ");
   1.158 +	}
   1.159 +}
   1.160 +elsif(scalar @ARGV == 3)
   1.161 +{
   1.162 +		if($ARGV[0] ne "session")
   1.163 +		{
   1.164 +			die("invalid combination of parameters. Program expected 1st parameter to be \"session\" ");
   1.165 +		}
   1.166 +		else
   1.167 +		{
   1.168 +			$session = "yes";
   1.169 +			$suite = $ARGV[1];
   1.170 +			$target = $ARGV[2];
   1.171 +	
   1.172 +			if($suite eq "combined")
   1.173 +			{		
   1.174 +				$combinedSession = "yes";
   1.175 +	  	}
   1.176 +			
   1.177 +		}
   1.178 +}
   1.179 +elsif(scalar @ARGV == 4)
   1.180 +{
   1.181 +		if($ARGV[0] ne "session")
   1.182 +		{
   1.183 +			die("invalid combination of parameters. Program expected 1st parameter to be \"session\" ");
   1.184 +		}
   1.185 +		else
   1.186 +		{
   1.187 +			$session = "yes";
   1.188 +			$suite = $ARGV[1];
   1.189 +			$target = $ARGV[2];
   1.190 +			$sdkversion = $ARGV[3];
   1.191 +			if($suite eq "combined")
   1.192 +			{		
   1.193 +				$combinedSession = "yes";
   1.194 +	  	}
   1.195 +		}
   1.196 +}
   1.197 +else
   1.198 +{
   1.199 +		die("program recieved too many parameters!");
   1.200 +}#end of commandline processing
   1.201 +
   1.202 +
   1.203 +	
   1.204 +if( 0 )
   1.205 +{
   1.206 +	die("Please run the script from the appropriate internal folder in the mobileruntime /omerta project!!");
   1.207 +}
   1.208 +else
   1.209 +{
   1.210 +
   1.211 +	 my $srcPrefix = getcwd();
   1.212 +	 $srcPrefix =~ /(.*)internal.*/;
   1.213 +	 $srcPrefix = $1;
   1.214 +	 if(rindex($templateRoot, "stdlibs") != -1)
   1.215 +	 {
   1.216 +	 	$srcPrefix =~ /(.*)stdlibs.*/;
   1.217 +	 	$srcPrefix = $1;
   1.218 +	 	
   1.219 +	 	if($suite eq "glib")
   1.220 +	 	{
   1.221 +	 		$templateRoot = $srcPrefix."/glib/internal/";
   1.222 +	 	}
   1.223 +	 	elsif($suite eq "ssl")
   1.224 +	 	{
   1.225 +	 		$templateRoot = $srcPrefix."/ssl/internal/";
   1.226 +	 	}
   1.227 +	 	elsif($suite eq "ngi" && $session ne "yes")
   1.228 +	 	{
   1.229 +	 		print "ngi atsinput creation not supported from mobileruntime\n";
   1.230 +	 		exit();
   1.231 +	 	}
   1.232 +	 }
   1.233 +	 
   1.234 +	if(rindex($templateRoot, "glib") != -1)
   1.235 +	{
   1.236 +		$suite = "glib";
   1.237 +	}
   1.238 +	elsif(rindex($templateRoot, "ssl") != -1)
   1.239 +	{
   1.240 +		$suite = "ssl";
   1.241 +	}
   1.242 +	
   1.243 +}
   1.244 +
   1.245 +
   1.246 +my $optsGroupPath = $templateRoot."/ts/ltp/opts/group/";
   1.247 +#$optsGroupPath = getcwd()."/ts/ltp/opts/group/";
   1.248 +my $ltpPath =$templateRoot."/ts/ltp/";
   1.249 +my $stdcppPath =$templateRoot."/Stdcpp_test/stlport/";
   1.250 +my @stdexeList = ("tstdcpp","stdcxx/tstapps");
   1.251 +#my $gnuPath =getcwd()."/testapps/gnu/";
   1.252 +#my $tstdcppPath =getcwd()."/testapps/tstdcpp/";
   1.253 +
   1.254 +
   1.255 +my @generatedModules;
   1.256 +my %cfglocation;
   1.257 +
   1.258 +my $TDIR = "\\internal\\testapps\\";
   1.259 +
   1.260 +my @libcModules = ( "libc_loc_blr",  "libc_time_blr", "libc_db_blr","tctype", "tifioctls", "tinet",
   1.261 +                      "tlibcwchar", "tlink", "tmkfifo", "tmmap", "tmsgqueue",
   1.262 +		      "tnetdb", "tpipe","tregex", "tsemaphore", "tshm","tsocket" ,
   1.263 +		      "tstdio", "tstdlib", "tstring", "tsyscalls",
   1.264 +		      "tsyssim", "twctype", "tselect", "tsysunistd", "twideapis", "twopen", "twchar",
   1.265 +		      "twcharapi",
   1.266 +               );
   1.267 +
   1.268 +my @libdlModules = ("tlibdl");
   1.269 +my @libmModules = ("libm_double_blr", "libm_float_blr","libm_ldouble_blr");
   1.270 +
   1.271 +
   1.272 +my @pthreadModules = ( "testcondbroadcast", "testconddestroy", "testcondinit", "testcondsignal", "testcondtimedwait", "testcondwait",
   1.273 +"tmutex", "tpthread", "testpthreadonce", "testsemclose", "testsemdestroy", "testsemgetvalue", "testseminit", "testsemopen", "testsempost",
   1.274 +"testsemtimedwait", "testsemtrywait", "testsemunlink", "testsemwait");
   1.275 +
   1.276 +
   1.277 +my @stdliblist = ( "libc", "libpthread", "libdl", "libm", "libz", "libcrypt");
   1.278 + #my @dllList = ("backend.dll", "libc.dll", "LibCIpcClient.dll", "LibCIpcServer.exe", "libdl.dll", "libm.dll", "libpthread.dll", "libcrypt.dll", "libz.dll", "libclogger.dll");
   1.279 + my @dllList = ();
   1.280 +
   1.281 +
   1.282 +my @stdcpplist = (
   1.283 +["basicfilebuf.txt", "twiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.284 +  				 ["fstream1_input.txt", "stlport_fstream", "Stdcpp_test/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
   1.285 +  				 ["nextperm1_good.txt", "stlport_nextprm", "Stdcpp_test/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
   1.286 +  				 ["nextperm2_good.txt", "stlport_nextprm", "Stdcpp_test/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
   1.287 +  				 ["ostmit_good.txt", "stlport_ostmit", "Stdcpp_test/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
   1.288 +  				 ["seek.txt", "stlport_seek", "Stdcpp_test/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
   1.289 +  				 ["test.txt", "platsectest6", "Stdcpp_test/tstdcpp/platsec/", "/General/", "c:\\resource"],
   1.290 +  				 ["test.txt", "platsectest11", "Stdcpp_test/tstdcpp/platsec/", "/General/", "c:\\sys"],
   1.291 + 			 ["basicistream.txt", "twiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.292 + ["example.txt", "tiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.293 + ["filebuf.txt", "tiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.294 + ["fpos_state.txt", "tiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.295 + ["fstream.txt", "tiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.296 + ["istream.txt", "tiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.297 + ["ostream.txt", "tiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.298 + ["streambuf.txt", "tiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.299 + ["wfstream.txt", "twiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.300 + ["wifstream.txt", "twiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.301 + ["wistream.txt", "twiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.302 + ["wstreambuf.txt", "twiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.303 + ["wostream.txt", "twiostreams", "Stdcpp_test/bcdrivers/docs/", "/General/", "C:\\TestFramework\\docs"],
   1.304 + ["locales.txt", "tlocale", "Stdcpp_test/", "/General/", "C:\\resource"],
   1.305 + ["locales.txt", "tstl_1", "Stdcpp_test/", "/General/", "C:\\resource"],
   1.306 + ["tstl_2_1.cfg", "tstl_2", "Stdcpp_test/bcdrivers/tstl_2/group/", "/General/", "C:\\TestFramework"],
   1.307 +  ["testframework.ini", "tstl_2", "Stdcpp_test/bcdrivers/tstl_2/group/", "/General/", "C:\\TestFramework"],
   1.308 +);
   1.309 +
   1.310 +my @gliblist = (
   1.311 +  				 ["1.gmarkup", "markup_test", "/epoc32/winscw/c/", "/General/", "C:"],
   1.312 +   				 ["1.gmarkup", "markup-test", "/epoc32/winscw/c/", "/General/", "C:"],
   1.313 +  				 ["iochannel-test-infile", "iochannel_test",  "/epoc32/winscw/c/", "/General/", "C:"],
   1.314 +  				 ["iochannel-test-infile", "iochannel-test",  "/epoc32/winscw/c/", "/General/", "C:"],
   1.315 +#  				 ["casemap.bin",  "unicode-caseconv",  "/epoc32/winscw/c/", "/General/", "C:"],
   1.316 +#  				 ["casefold.bin", "unicode-caseconv",  "/epoc32/winscw/c/", "/General/", "C:"],
   1.317 +  				 ["utf8.txt", "unicode-encoding","/epoc32/winscw/c/", "/General/", "C:"],
   1.318 +  				 ["casecollate.txt", "unicode-collate","/epoc32/winscw/c/", "/General/", "C:"],
   1.319 +  				 ["utf8_hindi.txt", "tutf8","/epoc32/winscw/c/", "/General/", "C:"],
   1.320 +  				 ["scanfile.txt", "tscanner","/epoc32/winscw/c/", "/General/", "C:"],
   1.321 +  				 ["test.txt", "dir_test","/epoc32/winscw/c/temp/tmp/", "/General/", "C:\\temp\\tmp"],
   1.322 +  				 ["NormalizationTest.txt", "unicode-normalize","/epoc32/winscw/c/", "/General/", "C:"],
   1.323 +  				 
   1.324 +  				 ["helloworld.exe", "spawn_test","/epoc32/release/armv5/urel/", "/armv5_urel/", "C:\\sys\\bin"],
   1.325 +  				 ["helloworld.exe", "spawn_test","/epoc32/release/winscw/udeb/", "/winscw_udeb/", "Z:\\sys\\bin"],
   1.326 +  				 
   1.327 +  				 ["libmoduletestplugin_a.dll", "module-test","/epoc32/release/armv5/urel/", "/armv5_urel/", "C:\\sys\\bin"],
   1.328 +  				 ["libmoduletestplugin_a.dll", "module-test","/epoc32/release/winscw/udeb/", "/winscw_udeb/", "Z:\\sys\\bin"],
   1.329 +  				 
   1.330 +  				 ["libmoduletestplugin_b.dll", "module-test","/epoc32/release/armv5/urel/", "/armv5_urel/", "C:\\sys\\bin"],
   1.331 +  				 ["libmoduletestplugin_b.dll", "module-test","/epoc32/release/winscw/udeb/", "/winscw_udeb/", "Z:\\sys\\bin"],
   1.332 +  				 
   1.333 +  			  				 
   1.334 +  				 );
   1.335 +  				 
   1.336 +my @ngilist = (
   1.337 +           ["Test.txt", "ngi_sa_runtimetester", "/EPOC32/winscw/c/Private/10202be9/", "/General/", ""],
   1.338 +  				 ["sa_input_repository.txt", "shared","/EPOC32/armv5/c/TestFramework/", "/armv5_urel/", ""],
   1.339 +  				 ["sa_input_repository.txt", "shared","/EPOC32/winscw/c/TestFramework/", "/winscw_udeb/", ""],
   1.340 +  				 ["audiomixingfiles.ini", "ngi_sa_audiomixing","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
   1.341 +  				 ["sa_camera_supported.ini", "ngi_sa_camera","/EPOC32/armv5/c/TestFramework/", "/general/", ""],
   1.342 +  				 ["sa_clip.ini", "ngi_sa_clip","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
   1.343 +  				 ["devicecapabilitiesdata.ini", "ngi_sa_devicecapabilities","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
   1.344 +   				 ["highlevelaudiofiles.ini", "ngi_sa_highlevelaudio","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
   1.345 +					 ["lowlevelaudiofiles.ini", "ngi_sa_lowlevelaudio","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
   1.346 +					 ["runtimedata.ini", "ngi_sa_runtimetester","/EPOC32/winscw/c/TestFramework/", "/general/", ""],						
   1.347 +					 ["sa_stream.ini", "ngi_sa_stream","/EPOC32/winscw/c/TestFramework/", "/general/", ""],						
   1.348 +					 #["*", "ngi_sa_videoplayback","/../graphics/video/internal/sa_videoplayback/data/", "/general/", ""],
   1.349 +					 ["test.*", "ngi_sa_images","/Epoc32/winscw/c/Data/", "/general/", ""]
   1.350 +					);
   1.351 +
   1.352 +  				 
   1.353 +
   1.354 +
   1.355 +my $validexpansions = "all stdlibs combined";
   1.356 +my $validLibraries = "ltp opts lsb glib ssl ngi pcts stdcpp gcce libc-locale play_new phall";
   1.357 +if(rindex($validexpansions, $suite)== -1 && rindex($validLibraries, $suite) == -1)
   1.358 +{
   1.359 +	die("$suite is not a valid library. Valid options are $validexpansions $validLibraries");
   1.360 +}
   1.361 +
   1.362 +my $dontStrip = 1;
   1.363 +my	@liblist;
   1.364 +if($suite eq "all")
   1.365 +{
   1.366 +		@liblist = split " ", $validLibraries;
   1.367 +		@liblist = (@liblist, @stdliblist);
   1.368 +		
   1.369 +}#suite all
   1.370 +elsif($suite eq "ltp")
   1.371 +{
   1.372 +	 @liblist = ("ltp", "opts");
   1.373 +}
   1.374 +elsif($suite eq "stdlibs")
   1.375 +{
   1.376 +		@liblist = @stdliblist;
   1.377 +}
   1.378 +elsif($suite eq "ssl")
   1.379 +{
   1.380 +	@liblist = ("libcrypto", "libssl");
   1.381 +}
   1.382 +else
   1.383 +{
   1.384 +		@liblist = ("$suite");
   1.385 +}
   1.386 +
   1.387 +#	foreach my $l(@liblist)
   1.388 +#	{
   1.389 +#			print "$l was there\n";
   1.390 +#	}
   1.391 +
   1.392 +
   1.393 +if($combinedSession eq "yes")
   1.394 +{
   1.395 +	GenerateSessionFile("combined", $target,"combined");
   1.396 +	exit();
   1.397 +}
   1.398 +
   1.399 +if($session eq "yes")
   1.400 +{
   1.401 +	my $file = $templateRoot."/testsession.xml";
   1.402 +	opendir(DIRHANDLE, $ATSRoot) || die("Please try to create Session files only after ATSINPUT/components has been created!");
   1.403 +	closedir(DIRHANDLE);
   1.404 +	$dontStrip = 1;
   1.405 +	
   1.406 +	if($suite eq "stdlibs")
   1.407 +	{
   1.408 +		#my $dst = $ATSRoot."/$suite"."_testsession.xml";
   1.409 +		#copy($file, $dst);
   1.410 +		GenerateSessionFile("combined",$target,$suite);
   1.411 +		exit();
   1.412 +	}
   1.413 +	elsif($suite eq "ssl")
   1.414 +	{
   1.415 +		my @componentFiles = GetSslXmls();
   1.416 +		GenerateSessionFile("combined",$target,$suite,\@componentFiles);
   1.417 +		exit();
   1.418 +	}
   1.419 +	else
   1.420 +	{
   1.421 +		@generatedModules = GenGenModules($suite);
   1.422 +		my @componentFiles = GetXmls($suite);
   1.423 +		GenerateSessionFile("combined",$target,$suite,\@componentFiles);
   1.424 +		exit();
   1.425 +	}
   1.426 +	foreach my $lib(@liblist)
   1.427 +	{          
   1.428 +			@generatedModules = GenGenModules($lib);
   1.429 +			if(scalar @generatedModules != 0)
   1.430 +			{
   1.431 +				#print "Generating for $lib\n";
   1.432 +				GenerateSessionFile($lib, $target,$lib);
   1.433 +			}
   1.434 +	}
   1.435 +	
   1.436 +	#@generatedModules = GetAllModules();
   1.437 +	#if(scalar @generatedModules != 0)
   1.438 +	#{
   1.439 +	#		GenerateSessionFile("combined",$target, "combined");
   1.440 +	#}
   1.441 +	exit();
   1.442 +}#session generation code
   1.443 +
   1.444 +
   1.445 +if ($suite eq "ltp" || $suite eq "all")
   1.446 +{
   1.447 +	my @ltpModules = GetLtpModules();
   1.448 +	@generatedModules = @ltpModules;
   1.449 +	DoGen("ltp", ".dll");
   1.450 +	CopyLtpCfg("ltp");
   1.451 +	
   1.452 +	
   1.453 +	my @saved = @dllList;
   1.454 +	@dllList = ("ltplib.dll");
   1.455 +	CopySharedDlls("ltp", \@dllList);
   1.456 +	TransformXmls("ltp","shared");
   1.457 +	@dllList = @saved;
   1.458 +	
   1.459 +	@generatedModules = GetCompiledModules($optsGroupPath."/bld.inf");
   1.460 +	DoGen("opts",".dll");
   1.461 +
   1.462 +}
   1.463 +if ($suite eq "glib")
   1.464 +{
   1.465 +	my $bldfile = $templateRoot."/testapps/group/bld.inf";
   1.466 +	my @glibModules = GetCompiledModules($bldfile);
   1.467 +	@generatedModules = @glibModules;
   1.468 +	DoGen("glib",".exe");
   1.469 +	my $gDataRef = \@gliblist;
   1.470 +	CopyArbitDatFiles("glib",$gDataRef);
   1.471 +	
   1.472 +	if($install eq "yes")
   1.473 +	{
   1.474 +		my @saved = @dllList;
   1.475 +		my @glib2dllList = ("glibbackend.dll", "Libgobject.dll", "libgmodule.dll", "libgthread.dll",
   1.476 +                "libglib.dll");
   1.477 +                
   1.478 +   my  @glib1List = ( "libgobject.dll", "libgmodule.dll", "libgthread.dll",  "libglib.dll", );
   1.479 +  @dllList = @glib2dllList;
   1.480 +  CopySharedDlls("glib",\@dllList);     	
   1.481 +  TransformXmls("glib", "shared");
   1.482 +   	
   1.483 +		@dllList = @saved;
   1.484 +	}#if install
   1.485 +}#glib
   1.486 +
   1.487 +if ($suite eq "phall")
   1.488 +{
   1.489 +	my $bldfile = getcwd()."/group/bld.inf";
   1.490 +	my @hallModules = GetCompiledModules($bldfile);
   1.491 +	@generatedModules = @hallModules;
   1.492 +	DoGen($suite,".exe");
   1.493 +	#my $gDataRef = \@gliblist;
   1.494 +	#CopyArbitDatFiles("glib",$gDataRef);
   1.495 +	
   1.496 +	if($install eq "yes")
   1.497 +	{
   1.498 +		my @saved = @dllList;
   1.499 +                
   1.500 +   my  @phallList = ( "libstdcpp.dll" );
   1.501 +   @dllList = @phallList;
   1.502 +   CopySharedDlls($suite,\@dllList);     	
   1.503 +   TransformXmls($suite, "shared");
   1.504 +   @dllList = @saved;
   1.505 +   exit;
   1.506 +	}#if install
   1.507 +}#phall
   1.508 +
   1.509 +if ($suite eq "ssl")
   1.510 +{
   1.511 +	my $stripStatus = $dontStrip;
   1.512 +	$dontStrip = 0;
   1.513 +	GenCryptoTest();
   1.514 +	if($install eq "yes")
   1.515 +	{
   1.516 +		@dllList = (@dllList, "libcrypto.dll", "libssl.dll");   
   1.517 +	}#if install
   1.518 +	$dontStrip = $stripStatus;
   1.519 +}#ssl
   1.520 +
   1.521 +if($suite eq "ngi")
   1.522 +{
   1.523 +
   1.524 +	GenNgiTest();
   1.525 +	CopyNgiXmls();
   1.526 +	CopyArbitDatFiles("",\@ngilist);
   1.527 +
   1.528 +}
   1.529 +
   1.530 +if($suite eq "play_new")
   1.531 +{
   1.532 +	my @play_newModules = ("fonttestmodule", "messagingtestmodule","locationtestmodule", "alertstestmodule", 
   1.533 +	"libxmlstiff","ngisvgtestmodule");
   1.534 +	@generatedModules = @play_newModules;
   1.535 +	DoGen("play_new",".dll");
   1.536 +	
   1.537 +	 my @list = (
   1.538 +  				 			 ["*.cfg", "fonttestmodule", "/../fonts/internal/testmodules/fonttestmodule/group/","/General/", ""],
   1.539 +	 				 			 ["*.xml", "fonttestmodule", "/../fonts/internal/testmodules/fonttestmodule/group/","/", ""],
   1.540 +	 				 			 
   1.541 +	 				 			 ["*.cfg", "messagingtestmodule", "/../ngimessaging/internal/testmodules/messagingtestmodule/group/","/General/", ""],
   1.542 +	 				 			 ["*.xml", "messagingtestmodule", "/../ngimessaging/internal/testmodules/messagingtestmodule/group/","/", ""],
   1.543 +	 				 			 ["*", "messagingtestmodule", "/EPOC32/winscw/c/messagingtestmodule/","/General/", ""],
   1.544 +	 				 			 
   1.545 +	 				 			 ["*.cfg", "locationtestmodule", "/../ngilocation/internal/testmodules/locationtestmodule/group/","/General/", ""],
   1.546 +	 				 			 ["*.xml", "locationtestmodule", "/../ngilocation/internal/testmodules/locationtestmodule/group/","/", ""],
   1.547 +	 				 			 
   1.548 +	 				 			 ["*.cfg", "alertstestmodule", "/../ngialerts/internal/testmodules/alertstestmodule/group/","/General/", ""],
   1.549 +								 ["*.xml", "alertstestmodule", "/../ngialerts/internal/testmodules/alertstestmodule/group/","/", ""],	 				 			 
   1.550 +								 ["vertigo.wav", "alertstestmodule", "/Epoc32/winscw/c/alertstestmodule/","/General/", ""],	 				 			 	 				 			 
   1.551 +	 		
   1.552 +	 			 			  ["*.cfg", "libxmlstiff", "/../libxmlpp/internal/group/","/General/", ""],
   1.553 +	 		 	 			  ["*.xml", "libxmlstiff", "/../libxmlpp/internal/group/","/", ""],
   1.554 +	 		 	 			  ["*.*", "libxmlstiff", "/../libxmlpp/internal/data/","/General/", ""],
   1.555 +	 		 	 			  
   1.556 +	 		 	 			  ["*.cfg", "ngisvgtestmodule", "/../ngisvg/internal/testmodules/ngisvgtestmodule/group/","/General/", ""],
   1.557 +   		 	 			  ["*.xml", "ngisvgtestmodule", "/../ngisvg/internal/testmodules/ngisvgtestmodule/group/","/", ""],
   1.558 +	 		 	 			  ["*.*", "ngisvgtestmodule", "/epoc32/winscw/c/ngisvgtest/","/General/", ""],
   1.559 +	 				 			 
   1.560 +  				 );
   1.561 + 
   1.562 +  my $bDataRef = \@list;  				 
   1.563 +	CopyArbitDatFiles("play_new",$bDataRef);  				 
   1.564 +	if($install eq "yes")
   1.565 +	{
   1.566 +		@generatedModules = GenGenModules("play_new");
   1.567 +		my @saved = @dllList;
   1.568 +		my @playList = (
   1.569 +"ngifonts.dll",
   1.570 +"ngimessaging.dll",
   1.571 +"ngisvg.dll",
   1.572 +"ngilocation.dll",
   1.573 +"ngialerts.dll",
   1.574 +"libstdcpp.dll",
   1.575 +"libxmlpp.dll",
   1.576 +"FeedsLibXml2xmlpp.dll");
   1.577 +       @dllList = @playList;
   1.578 +		CopySharedDlls("play_new",\@dllList);     
   1.579 +	  TransformXmls("play_new", "shared");
   1.580 +		@dllList = @saved;
   1.581 +
   1.582 +	}#end install
   1.583 +
   1.584 +
   1.585 +}
   1.586 +
   1.587 +if($suite eq "stdcpp")
   1.588 +{
   1.589 +	@generatedModules = GetstdcppModules();
   1.590 +	DoGen("stdcpp",".dll");
   1.591 +	CopyLtpCfg("stdcpp");
   1.592 +	@generatedModules = GetstdexeModules();
   1.593 +	DoGen("stdcpp",".exe");
   1.594 +	
   1.595 +	my @saved = @dllList;
   1.596 +	@dllList = ("stdcxxtestengine.dll");
   1.597 +	CopySharedDlls("stdcpp", \@dllList);
   1.598 +	TransformXmls("stdcpp","shared");
   1.599 +	@dllList = @saved;
   1.600 +	
   1.601 +	CopyArbitDatFiles("stdcpp",\@stdcpplist);
   1.602 +	
   1.603 +	if($install eq "yes")
   1.604 +	{
   1.605 +		@generatedModules = GenGenModules("stdcpp");
   1.606 +		my @saved = @dllList;
   1.607 +		my @cppList = ("libstdcpp.dll");
   1.608 +       @dllList = @cppList;
   1.609 +		CopySharedDlls("stdcpp",\@dllList);     
   1.610 +	  TransformXmls("stdcpp", "shared");
   1.611 +		@dllList = @saved;
   1.612 +		exit;
   1.613 +	}#if install
   1.614 +}
   1.615 +	
   1.616 +
   1.617 +if($suite eq "lsb" || $suite eq "all")
   1.618 +{
   1.619 +	my @lsbModules = GetLsbModules();
   1.620 +	@generatedModules = @lsbModules;
   1.621 +	DoGen("lsb",".exe");
   1.622 +	
   1.623 +	my @depDlls;
   1.624 +	my $dll;
   1.625 +	
   1.626 +	#copying the common dlls
   1.627 +	@depDlls  = 
   1.628 +	(
   1.629 +	 "libapi.dll",
   1.630 +	 "tcm.dll",
   1.631 +	 "vlib.dll",
   1.632 +	);
   1.633 +		
   1.634 +	foreach $dll (@depDlls)
   1.635 +	{
   1.636 +		CopyDeps("lsb",$dll);
   1.637 +	}
   1.638 +	#now copy the cfg files
   1.639 +	CopyLsbCfg("lsb");	
   1.640 +	#now copy the extra dependency dlls
   1.641 +	
   1.642 +	#dlopen
   1.643 +	@generatedModules = ("dlopen");
   1.644 +	
   1.645 +	
   1.646 +	
   1.647 +	@depDlls  = 
   1.648 +	(
   1.649 +	 "dynlibtest.1.dll",
   1.650 +	 "dynlibtest.11.1.dll",
   1.651 +	 "dynlibtest.11.2.dll",
   1.652 +	 "dynlibtest.12g.dll",
   1.653 +	 "dynlibtest.12r.dll",
   1.654 +	 "dynlibtest.14.1.dll",
   1.655 +	 "dynlibtest.14.2.dll",
   1.656 +	 "dynlibtest.14.3.dll",
   1.657 +	 "dynlibtest.3.1.dll",
   1.658 +	 "dynlibtest.3.2.dll",
   1.659 +	 "dynlibtest.3.dll",
   1.660 +	 "dynlibtest.4.dll",
   1.661 +	 "dynlibtest.8.dll",
   1.662 +	 "dynlibtest.9.dll",
   1.663 +	 "dynlibtest.3.dll",
   1.664 +	 "dynlibtest.8.dll",
   1.665 +	);
   1.666 +	
   1.667 +	foreach $dll (@depDlls)
   1.668 +	{
   1.669 +		CopyDeps("lsb",$dll);
   1.670 +	}
   1.671 +	
   1.672 +	#dlclose
   1.673 +	@generatedModules = ("dlclose");
   1.674 +	@depDlls = ("dynlibclose.1.dll");
   1.675 +	foreach $dll (@depDlls)
   1.676 +	{
   1.677 +		CopyDeps("lsb",$dll);
   1.678 +	}
   1.679 +	
   1.680 +	#dlerror
   1.681 +	@generatedModules = ("dlerror");
   1.682 +	@depDlls = ("dynlib.dll");
   1.683 +	foreach $dll (@depDlls)
   1.684 +	{
   1.685 +		CopyDeps("lsb",$dll);
   1.686 +	}
   1.687 +	
   1.688 +	#now copy the xmls!
   1.689 +	my $srcDir = $templateRoot."/ts/lsbsuites/group/";
   1.690 +	
   1.691 +	my $dst;
   1.692 +	
   1.693 +	foreach my $dllib("dlopen", "dlclose", "dlerror")
   1.694 +	{
   1.695 +		$dst  = $ATSRoot."\\components\\lsb_".$dllib."\\";
   1.696 +		copy($srcDir."/lsb_".$dllib."_module_blr_hw_component.xml", $dst) || die("DIED: unable to copy from $srcDir!\n");
   1.697 +		copy($srcDir."/lsb_".$dllib."_module_blr_winsspd_component.xml", $dst) || die("DIED: unable to copy from $srcDir!\n");
   1.698 +	}
   1.699 +	
   1.700 +}
   1.701 +
   1.702 +if($suite eq "gcce")
   1.703 +{
   1.704 +
   1.705 +	mkdir $ATSRoot;
   1.706 +	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
   1.707 +	
   1.708 +	@generatedModules = ("gcce-validate", "gcce-load");
   1.709 +		
   1.710 +	my @depDlls  = 
   1.711 +	(
   1.712 +		"gcce-lib.dll",
   1.713 +	);
   1.714 +	
   1.715 +	my $suffix = ".exe";
   1.716 +	my $libname = "gcce";
   1.717 +	
   1.718 +	
   1.719 +	my $src;
   1.720 +	my $dst;
   1.721 +	foreach my $module(@generatedModules)
   1.722 +	{
   1.723 +		my $relroot = $ATSRoot."\\components\\$libname"."_$module";
   1.724 +		mkdir $relroot || die("DIED: unable to create dir $module\n");
   1.725 +		mkdir $relroot."\\armv5_urel" || die("DIED: unable to create dir $relroot\\armv5_urel\n");
   1.726 +		
   1.727 +		#GenExeXmls($module,$libname);
   1.728 +		
   1.729 +		$src = $rootDrive."\\epoc32\\release\\gcce\\urel\\".$module.$suffix;
   1.730 +		$dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module);
   1.731 +		$dst = $dst."\\armv5_urel\\";
   1.732 +		copy($src, $dst)  || warn("unable to copy $src to $dst");
   1.733 +	}
   1.734 +	$src = $rootDrive."\\epoc32\\release\\gcce\\urel\\"."gcce-lib.dll";
   1.735 +	$dst = $ATSRoot."\\components\\gcce_gcce-load";
   1.736 +	$dst = $dst."\\armv5_urel\\";
   1.737 +	copy($src, $dst)  || warn("unable to copy $src to $dst");
   1.738 +	
   1.739 +	
   1.740 +	my @list = (
   1.741 +  				 ["gcce_gcce-load_module_blr_hw_component.xml", "gcce-load", "./","/", ""],
   1.742 +  				 ["gcce_gcce-validate_module_blr_hw_component.xml", "gcce-validate", "./","/", ""],
   1.743 +  				 );
   1.744 + 
   1.745 +  my $bDataRef = \@list;  				 
   1.746 +	CopyArbitDatFiles("gcce",$bDataRef);  				 
   1.747 +
   1.748 +	
   1.749 +}#if gcce
   1.750 +
   1.751 +
   1.752 +
   1.753 +if($suite eq "libc-locale")
   1.754 +{
   1.755 +	$dontStrip = 0;
   1.756 +	mkdir $ATSRoot;
   1.757 +	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
   1.758 +	
   1.759 +	@generatedModules = ("tstring");
   1.760 +	DoGen("libc",".dll");
   1.761 +	
   1.762 +	my @localelist = (
   1.763 +	  				 ["locales.txt", "string", "../libc/internal/testapps/tstring/data/", "/General/", ""],
   1.764 +	  				 ["tstring_locale_component.xml", "string", "../libc/internal/testapps/tstring/group/", "/", ""],
   1.765 +	 
   1.766 +	  				 );
   1.767 +		
   1.768 +  my $bDataRef = \@localelist;  				 
   1.769 +	CopyArbitDatFiles("libc",$bDataRef);  				 
   1.770 +	#delete($ATSRoot."/components/libc_string/"."libc_string_module_blr_hw_component.xml") || die("unable to delete");
   1.771 +	my $my_src = $ATSRoot."/components/libc_string/"."tstring_locale_component.xml";
   1.772 +	my $my_dst = $ATSRoot."/components/libc_string/"."libc_string_module_blr_hw_component.xml";
   1.773 +	
   1.774 +	unlink($my_dst) ||warn("unable to delete $my_dst");
   1.775 +	rename($my_src,$my_dst) || move($my_src,$my_dst) || die("Unable to rename!");
   1.776 +	
   1.777 +}#if libc-locale
   1.778 +
   1.779 +
   1.780 +if($suite eq "pcts")
   1.781 +{
   1.782 +	my $bldfile = $templateRoot."/group/bld.inf";
   1.783 +	my @pctsModules = GetCompiledModules($bldfile);
   1.784 +	@generatedModules = @pctsModules;
   1.785 +	DoGen("pcts",".exe");
   1.786 +	
   1.787 +	my @depDlls;
   1.788 +	my $dll;
   1.789 +	
   1.790 +	
   1.791 +	#copying the common dlls
   1.792 +	@depDlls  = 
   1.793 +	(
   1.794 +		"vsxlibapi.dll",
   1.795 +		"rttm.exe",
   1.796 +		"rtlibapi.dll",
   1.797 +		"vsxvlib.dll",
   1.798 +		"vsxgenlib.dll",
   1.799 +		"vsxtsetlib.dll",
   1.800 +		"vsxvport.dll",
   1.801 +	);
   1.802 +	
   1.803 +	if($install eq "yes")
   1.804 +	{
   1.805 +		my @saved = @dllList; 
   1.806 +		@dllList = @depDlls;	
   1.807 +		CopySharedDlls("pcts", \@depDlls);
   1.808 +		TransformXmls("pcts","shared");
   1.809 +		@dllList = @saved;
   1.810 +		
   1.811 +		#now copy the cfg files
   1.812 +		my $dst;
   1.813 +		my $srcDir = "/epoc32/winscw/c/data/tet/";
   1.814 +		my $file1 = $srcDir."tet_code";
   1.815 +		my $file2 = $srcDir."tetexec.cfg";
   1.816 +		foreach my $module(@generatedModules)
   1.817 +		{
   1.818 +			$dst = $ATSRoot."\\components\\pcts_".$module;
   1.819 +			$dst = $dst."\\General\\";
   1.820 +			copy($file1, $dst) or die "copy: $! $file1 $dst";
   1.821 +			copy($file2,$dst) or die "copy: $! $file2 $dst";
   1.822 +		}
   1.823 +	}
   1.824 +		
   1.825 +	
   1.826 +	
   1.827 +	
   1.828 +	my $dst;	
   1.829 +	foreach my $module(@generatedModules)
   1.830 +	{
   1.831 +		my $file3 = "/epoc32/winscw/c/logs/tet/m.".$module;
   1.832 +
   1.833 +		$dst = $ATSRoot."\\components\\pcts_".$module;
   1.834 +		$dst = $dst."\\General\\";
   1.835 +		copy($file3, $dst) or die "copy: $! $file3 $dst";
   1.836 +	}#module
   1.837 +}
   1.838 +
   1.839 +
   1.840 +
   1.841 +$dontStrip = 0;
   1.842 +
   1.843 +if($suite eq "stdlibs" || $suite eq "all")
   1.844 +{
   1.845 +	@generatedModules = ("tzlib");
   1.846 +	DoGen("libz", ".dll");
   1.847 +
   1.848 +	@generatedModules = ("tlibcrypt");
   1.849 +	DoGen("libcrypt",".dll");
   1.850 +
   1.851 +	@generatedModules = @libcModules;
   1.852 +	DoGen("libc",".dll");
   1.853 +	GenBackendTest();
   1.854 +	
   1.855 +	@generatedModules = ("twchar");
   1.856 +	CopyDeps("libc","twchar_helloworld.exe");
   1.857 +	
   1.858 +	@generatedModules = ("twopen");
   1.859 +	CopyDeps("libc","twpopenwritechild.exe");
   1.860 +	CopyDeps("libc","twpopenreadchild.exe");
   1.861 +
   1.862 +
   1.863 +	@generatedModules = @libdlModules;
   1.864 +	DoGen("libdl",".dll");
   1.865 +	CopyDeps("libdl","Dll1.dll");
   1.866 +	CopyDeps("libdl","Dll2.dll");
   1.867 +	CopyDeps("libdl","DependencyTestDll.dll");
   1.868 +
   1.869 +	@generatedModules = @libmModules;
   1.870 +	DoGen("libm",".dll");
   1.871 +
   1.872 +	$TDIR = "\\internal\\";
   1.873 +	@generatedModules = @pthreadModules;
   1.874 +	DoGen("libpthread",".dll");
   1.875 +	CopyDeps("libpthread","testharness.dll");
   1.876 +
   1.877 +	CopyDatFiles();
   1.878 +}
   1.879 +
   1.880 +if($install eq "yes")
   1.881 +{
   1.882 +	foreach my $lib(@liblist)
   1.883 +	{   
   1.884 +		#print "Transforming lib $lib\n";       
   1.885 +		@generatedModules = GenGenModules($lib);
   1.886 +		my @oldList = @dllList;
   1.887 +		if($do_winscw)
   1.888 +  	{
   1.889 +  		@dllList = (@dllList, "wsdsoln.dll", "libestw32.dll");
   1.890 +  		CopySharedDlls($lib,\@dllList,"winscw");     	
   1.891 +	  	TransformXmls($lib, "shared","winscw");
   1.892 +  	}
   1.893 +  	@dllList = @oldList;
   1.894 +  	if($do_armv5)
   1.895 +  	{
   1.896 +	  	CopySharedDlls($lib,\@dllList,"armv5");     	
   1.897 +	  	TransformXmls($lib, "shared","armv5");
   1.898 +  	}
   1.899 +	}#FOREACH
   1.900 +}#if install
   1.901 +
   1.902 +
   1.903 +
   1.904 +#function to generate ModuleList for a compiled bld.inf
   1.905 +sub GetCompiledModules($)
   1.906 +{
   1.907 +	my $file = shift @_;
   1.908 +	my @moduleList;
   1.909 +	
   1.910 +	
   1.911 +	# Open input file
   1.912 +	open (INFILE, "<".$file ) || die ("DIED: Can not find $file!");
   1.913 +
   1.914 +	while (<INFILE>)
   1.915 +	{
   1.916 +		if(/(.*)\.mmp/ && $1 !~ /^\/\//) 
   1.917 +	  {
   1.918 +	  		if($_ !~ /\/\/Not for ATS/)
   1.919 +	  		{
   1.920 +	  			push @moduleList, $1;
   1.921 +	  		}
   1.922 +	  }
   1.923 +	}
   1.924 +	close (INFILE);
   1.925 +	return @moduleList;
   1.926 +}
   1.927 +
   1.928 +my @groupList;
   1.929 +sub GetLtpModules()
   1.930 +{
   1.931 +        my $prevDir = getcwd();
   1.932 +        my @rootList = ("kernel", "misc");
   1.933 +        my @totalgroupList;
   1.934 +        foreach my $node(@rootList)
   1.935 +        {
   1.936 +        	chdir $ltpPath."/$node";
   1.937 +        	@groupList = ();
   1.938 +        	find(\&MakeGroupList, ".");
   1.939 +        	@totalgroupList = (@totalgroupList, @groupList);
   1.940 +        }
   1.941 +        chdir $prevDir;
   1.942 +        return @totalgroupList;
   1.943 +}
   1.944 +
   1.945 +sub GetstdexeModules()
   1.946 +{
   1.947 +      my $prevDir = getcwd();
   1.948 +      my @fullList = ();
   1.949 +      foreach my $group(@stdexeList)
   1.950 +      {
   1.951 +      	my $groupPath = $templateRoot."/Stdcpp_test/".$group. "/";
   1.952 +      	chdir $groupPath;
   1.953 +      	@groupList = ();
   1.954 +      	find(\&grovelAllMmpFiles, ".");
   1.955 +      	chdir $prevDir;
   1.956 +      	@fullList = (@fullList,@groupList);
   1.957 +      }
   1.958 +      return @fullList;      
   1.959 +}
   1.960 +
   1.961 +sub grovelAllMmpFiles()
   1.962 +{
   1.963 +	if($_ =~ /(.*)\.mmp/ && ! ($_ =~ /manual/))
   1.964 +	{
   1.965 +		push @groupList, $1;#get name of module
   1.966 +	}
   1.967 +}
   1.968 +
   1.969 +sub GetstdcppModules()
   1.970 +{
   1.971 +        my $prevDir = getcwd();
   1.972 +        my @rootList = ("auto");
   1.973 +        my @totalgroupList;
   1.974 +        foreach my $node(@rootList)
   1.975 +        {
   1.976 +        	chdir $stdcppPath."/$node";
   1.977 +        	@groupList = ();
   1.978 +        	find(\&MakeGroupList, ".");
   1.979 +        	@totalgroupList = (@totalgroupList, @groupList);
   1.980 +        }
   1.981 +        chdir $prevDir;
   1.982 +        my @newmodules = ("tiostreams", "tlocale", "tstl_1", "tstl_2", "tstl_3","tstl_4", "twiostreams" );
   1.983 +        @totalgroupList = (@totalgroupList, @newmodules); 
   1.984 +        foreach my $mod(@newmodules)
   1.985 +        {
   1.986 +         $cfglocation{$mod} = getcwd()."/Stdcpp_test/bcdrivers/$mod/group"."\/$mod.cfg";
   1.987 +         #print "$cfglocation{$mod} - $mod\n";
   1.988 +        }
   1.989 +				return @totalgroupList;
   1.990 +}
   1.991 +
   1.992 +sub GetTstdcppModules()
   1.993 +{
   1.994 +      my $prevDir = getcwd();
   1.995 +      #chdir $tstdcppPath;
   1.996 +      @groupList = ();
   1.997 +      find(\&grovelAllMmpFiles, ".");
   1.998 +      chdir $prevDir;
   1.999 +      return @groupList;
  1.1000 +}
  1.1001 +
  1.1002 +sub MakeGroupList()
  1.1003 +{
  1.1004 +	my $currentDir = $File::Find::dir;
  1.1005 +	
  1.1006 +	#print "Current dir:$currentDir\n";
  1.1007 +	if( $currentDir =~ /.*\/(.*)\/group/)
  1.1008 +	{
  1.1009 +		if($cfglocation{$1} eq "")
  1.1010 +		{
  1.1011 +			$cfglocation{$1} = getcwd()."\/$1.cfg";
  1.1012 +			push @groupList, $1;#get name of module
  1.1013 +		}#first time in group
  1.1014 +	}#group found
  1.1015 +}#subrtn end
  1.1016 +
  1.1017 +
  1.1018 +#function that generates the ATS setup
  1.1019 +sub DoGen($$)
  1.1020 +{
  1.1021 +	my $libname = shift @_;
  1.1022 +	my $ext = shift @_;
  1.1023 +	mkdir $ATSRoot;
  1.1024 +	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
  1.1025 +	
  1.1026 +	
  1.1027 +	GenDirs($libname);
  1.1028 +	my $module;
  1.1029 +	foreach my $listed(@generatedModules)
  1.1030 +	{
  1.1031 +	my @filesToProcess =
  1.1032 +        (
  1.1033 +         "LibXXX_ATSTemplateXXX_module_blr_hw_component.xml",
  1.1034 +         "LibXXX_ATSTemplateXXX_module_blr_winsspd_component.xml",
  1.1035 +         "testframework.ini",
  1.1036 +        );
  1.1037 +		if(rindex($noXmlsGenList, $libname) != -1 )	
  1.1038 +		{
  1.1039 +			@filesToProcess = ("testframework.ini",);
  1.1040 +		}
  1.1041 +
  1.1042 +			if($ext eq ".exe")
  1.1043 +			{
  1.1044 +				GenExeXmls($listed,$libname);
  1.1045 +			}
  1.1046 +			else
  1.1047 +			{
  1.1048 +				#just in case no xml file was supplied
  1.1049 +				
  1.1050 +        my $ref = \@filesToProcess;
  1.1051 +				GenXmls($libname, $listed,$ref);
  1.1052 +			}
  1.1053 +	}#foreach
  1.1054 +	
  1.1055 +	CopyDlls($libname,$ext);
  1.1056 +	#copy the provided cfg, ini and xmls
  1.1057 +	if($libname eq "opts")
  1.1058 +	{
  1.1059 +		CopyOptsCfg($libname);
  1.1060 +	}
  1.1061 +	elsif($libname eq "ltp" || $libname eq "lsb" || $libname eq "glib")
  1.1062 +	{
  1.1063 +	  #copy latter and  dont copy respectively for ltp and lsb
  1.1064 +	}
  1.1065 +	else
  1.1066 +	{
  1.1067 +	  CopyCfgIniXmls($libname);
  1.1068 +	}
  1.1069 +}
  1.1070 +
  1.1071 +sub CopyCfgIniXmls()
  1.1072 +{
  1.1073 +	my $libname = pop @_;
  1.1074 +	
  1.1075 +	my $libRoot = $templateRoot;
  1.1076 +	$libRoot =~ /(.*)internal.*/;
  1.1077 +	$libRoot = $1;
  1.1078 +
  1.1079 +
  1.1080 +	my $module;
  1.1081 +	my $src;
  1.1082 +	my $dst;
  1.1083 +		
  1.1084 +	foreach my $listed(@generatedModules)
  1.1085 +	{
  1.1086 +	  my $dirname = $listed;
  1.1087 +	  $dirname =~ s/test/t/;
  1.1088 +	  $module = StripModulePrefix($listed);
  1.1089 +	    
  1.1090 +		$src = $libRoot.$libname.$TDIR.$dirname."\\group\\";
  1.1091 +				
  1.1092 +		my $xmlCopied = "0";
  1.1093 +		my @globpattern = ("*.ini", "*.xml","*.cfg");
  1.1094 +		foreach my $pat(@globpattern)
  1.1095 +		{
  1.1096 +			$dst = $ATSRoot."\\components\\".$libname."_".$module;
  1.1097 +			if($pat ne "*.xml")
  1.1098 +			{
  1.1099 +				$dst = $dst."\\General\\";
  1.1100 +			}
  1.1101 +			else
  1.1102 +			{
  1.1103 +				$dst = $dst."\\";
  1.1104 +			}
  1.1105 +			my @filesFound = glob($src."\\$pat");
  1.1106 +			if(scalar @filesFound eq "0")
  1.1107 +			{
  1.1108 +				#print "No files found for module $module $pat!\n";
  1.1109 +				#print $src;
  1.1110 +			}
  1.1111 +			
  1.1112 +			#handcoded
  1.1113 +			if($pat eq "*.cfg" && $xmlCopied eq "0")#rename only if xml not copied
  1.1114 +			{
  1.1115 +				if(scalar @filesFound > 1)
  1.1116 +				{
  1.1117 +					print "Multiple cfg files found. Copying all!\n";
  1.1118 +				}
  1.1119 +				else
  1.1120 +				{
  1.1121 +						$dst = $dst.$listed.".cfg";
  1.1122 +				}
  1.1123 +			}				
  1.1124 +			elsif($pat eq "*.xml")
  1.1125 +			{
  1.1126 +				my $folder = $dst;
  1.1127 +				foreach my $from (@filesFound) 
  1.1128 +				{
  1.1129 +					if($from =~ /winscw_component/)
  1.1130 +					{
  1.1131 +						$dst = $folder.$libname."_".$module."_module_blr_winscw_component.xml";
  1.1132 +						copy($from, $dst) or die "DIED: copy: $! $from $dst";
  1.1133 +						$xmlCopied = "1";
  1.1134 +					}
  1.1135 +					elsif($from =~ /winsspd_component/)
  1.1136 +					{
  1.1137 +						$dst = $folder.$libname."_".$module."_module_blr_winsspd_component.xml";
  1.1138 +						copy($from, $dst) or die "DIED: copy: $! $from $dst";
  1.1139 +						$xmlCopied = "1";
  1.1140 +					}
  1.1141 +					elsif($from =~ /hw_component/)
  1.1142 +					{
  1.1143 +						$dst = $folder.$libname."_".$module."_module_blr_hw_component.xml";
  1.1144 +						copy($from, $dst) or die "DIED: copy: $! $from $dst";
  1.1145 +						$xmlCopied = "1";
  1.1146 +					}
  1.1147 +				}#examine individually			
  1.1148 +				if(scalar @filesFound > 2)
  1.1149 +				{
  1.1150 +					#print "Multiple xml files found!!!\n";
  1.1151 +				}
  1.1152 +				@filesFound = ();
  1.1153 +			}	
  1.1154 +				
  1.1155 +			
  1.1156 +			foreach my $from (@filesFound) 
  1.1157 +			{
  1.1158 +					copy($from, $dst) or die "DIED: copy: $! $from $dst";
  1.1159 +			}#copy individually			
  1.1160 +		}#globpattern
  1.1161 +	}#module
  1.1162 +}#fn
  1.1163 +
  1.1164 +#copy the cfg files for the opts test suite
  1.1165 +sub CopyOptsCfg()
  1.1166 +{
  1.1167 +	my $libname = pop @_;
  1.1168 +	
  1.1169 +	my $libRoot = $optsGroupPath."\\";
  1.1170 +	my $module;
  1.1171 +	my $src;
  1.1172 +	my $dst;
  1.1173 +		
  1.1174 +	foreach $module(@generatedModules)
  1.1175 +	{
  1.1176 +		$src = $libRoot.$module."\.cfg";
  1.1177 +		$dst = $ATSRoot."\\components\\".$libname."_".$module;
  1.1178 +		$dst = $dst."\\General\\";
  1.1179 +		copy($src, $dst) or warn "copy: $! $src $dst";
  1.1180 +	}#module
  1.1181 +}#fn
  1.1182 +
  1.1183 +#copy the lsb cfg files
  1.1184 +sub CopyLsbCfg()
  1.1185 +{
  1.1186 +	my $libname = pop @_;
  1.1187 +	
  1.1188 +	my $module;
  1.1189 +	
  1.1190 +	my $dst;
  1.1191 +	
  1.1192 +	my $srcDir = $templateRoot."/ts/lsbsuites/lsblib/data/";
  1.1193 +		
  1.1194 +	foreach $module(@generatedModules)
  1.1195 +	{
  1.1196 +		my $file1 = $srcDir."tet_code.cfg";
  1.1197 +		my $file2 = $srcDir."tetexec.cfg";
  1.1198 +		$dst = $ATSRoot."\\components\\".$libname."_".$module;
  1.1199 +		$dst = $dst."\\General\\";
  1.1200 +		copy($file1, $dst) or die "copy: $! $file1 $dst";
  1.1201 +		copy($file2, $dst) or die "copy: $! $file2 $dst";
  1.1202 +	}#module
  1.1203 +}#fn
  1.1204 +
  1.1205 +
  1.1206 +#copy the ltp cfg files
  1.1207 +sub CopyLtpCfg($)
  1.1208 +{
  1.1209 +	my $libname = pop @_;
  1.1210 +	
  1.1211 +	my $module;
  1.1212 +	my $src;
  1.1213 +	my $dst;
  1.1214 +		
  1.1215 +	foreach $module(@generatedModules)
  1.1216 +	{
  1.1217 +		$src = $cfglocation{$module};
  1.1218 +		$dst = $ATSRoot."\\components\\".$libname."_".$module;
  1.1219 +		$dst = $dst."\\General\\";
  1.1220 +		copy($src, $dst) or warn "copy: $! $src $dst";
  1.1221 +	}#module
  1.1222 +}#fn
  1.1223 +
  1.1224 +
  1.1225 +sub CopyDlls($$)
  1.1226 +{
  1.1227 +	my $libname = shift @_;
  1.1228 +	my $suffix = shift @_;
  1.1229 +	
  1.1230 +	my $module;
  1.1231 +	my $src;
  1.1232 +	my $dst;
  1.1233 +	
  1.1234 +	
  1.1235 +	foreach $module(@generatedModules)
  1.1236 +	{
  1.1237 +	  if($do_winscw == 1)
  1.1238 +	  { 	  
  1.1239 +			$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$module.$suffix;
  1.1240 +			$dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module);
  1.1241 +			$dst = $dst."\\winscw_udeb\\";
  1.1242 +			copy($src, $dst)  || warn("unable to copy $src to $dst");
  1.1243 +		}
  1.1244 +	  if($do_armv5 == 1)
  1.1245 +	  {
  1.1246 +			$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$module.$suffix;
  1.1247 +			$dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module);
  1.1248 +			$dst = $dst."\\armv5_urel\\";
  1.1249 +			copy($src, $dst)  || warn("unable to copy $src to $dst");
  1.1250 +		}
  1.1251 +	}#foreach
  1.1252 +}
  1.1253 +#fn to generate the session file
  1.1254 +sub GenerateSessionFile($$$$)
  1.1255 +{
  1.1256 +	my $libname = shift @_;
  1.1257 +	my $target = shift @_;
  1.1258 +	my $name = shift @_;
  1.1259 +	my $listptr = shift @_;
  1.1260 +	my $outdir = $ATSRoot;
  1.1261 +	my $infile = $templateRoot."\\testsession.xml";
  1.1262 +	chdir $outdir || die("DIED: Unable to chdir!"); 
  1.1263 +	#open INFILE, $infile || die ("DIED: Can not open input file $infile");
  1.1264 +	my $prefix = $name."_".$target;
  1.1265 +	if($sdkversion ne "")
  1.1266 +	{
  1.1267 +		$prefix = $prefix."_".$sdkversion;
  1.1268 +	}
  1.1269 +	
  1.1270 +	open OUTFILE, ">".$outdir."\\".$prefix."_testsession.xml" || die ("DIED: Can not open output file");
  1.1271 +	my $line;
  1.1272 +  my $snippet = $target;
  1.1273 +  if($target ne "winscw" && $target ne "winsspd")
  1.1274 +  {
  1.1275 +  	$snippet = "hw";
  1.1276 +  }
  1.1277 +
  1.1278 +print OUTFILE "<?xml version=\"1.0\"?>\n";
  1.1279 +print OUTFILE "<testsession>\n";
  1.1280 +#print OUTFILE "<symbian-version>$libname"."_".$snippet."_TestDrop_blr_component</symbian-version>\n";	
  1.1281 +print OUTFILE "<symbian-version>stdcpp_combined_test_session</symbian-version>\n";	
  1.1282 +print OUTFILE "<testitem>at</testitem>\n";	
  1.1283 +print OUTFILE "<resultfile>ATSOUTPUT\\".$prefix."_testsession_results.xml</resultfile>\n";		
  1.1284 +if($sendEmail eq "yes")
  1.1285 +{
  1.1286 +print OUTFILE <<EOEmailNote;
  1.1287 +<email_notification>
  1.1288 +<include_test_cases>false</include_test_cases>
  1.1289 +<message_file>C:\\\\lm.txt </message_file>
  1.1290 +<send_after_rerun>false</send_after_rerun>
  1.1291 +<subject>Stdcpp-Plumhall $snippet testreport</subject>
  1.1292 +<from>swbuild\@nokia.com</from>
  1.1293 +<to>ajith.narayanan\@nokia.com</to>
  1.1294 +<to>hrishikesh.brahmakal\@nokia.com</to>
  1.1295 +<to>santosh.ks\@nokia.com</to>
  1.1296 +<to>shilpa.sharma\@nokia.com</to>
  1.1297 +<to>kasthuri.n-s\@nokia.com</to>
  1.1298 +<to>hema.1.s\@nokia.com</to>
  1.1299 +<to>vineetha.hari-pai\@nokia.com</to>
  1.1300 +<to>madhusudhan.p.reddy\@nokia.com</to>
  1.1301 +</email_notification>
  1.1302 +EOEmailNote
  1.1303 +}
  1.1304 +
  1.1305 +	if($libname ne "combined")
  1.1306 +	{
  1.1307 +		AddAssumedIncludes($libname,$snippet);
  1.1308 +	}
  1.1309 +	else
  1.1310 +	{
  1.1311 +		if($listptr ne "")
  1.1312 +		{
  1.1313 +			AddFileList($libname,$listptr);
  1.1314 +		}
  1.1315 +		else
  1.1316 +		{
  1.1317 +			AddActualIncludes($libname);
  1.1318 +		}
  1.1319 +	}
  1.1320 +   				
  1.1321 +	print OUTFILE "</testsession>\n";
  1.1322 +
  1.1323 +	close(OUTFILE);
  1.1324 +	#close(INFILE);
  1.1325 +}#fn
  1.1326 +
  1.1327 +
  1.1328 +sub AddAssumedIncludes($$)
  1.1329 +{
  1.1330 +	my $libname = shift @_; 
  1.1331 +	my $snippet = shift @_;
  1.1332 +	
  1.1333 +	my $APITest;
  1.1334 +	foreach my $listed(@generatedModules)
  1.1335 +						{
  1.1336 +							$APITest = StripModulePrefix($listed);
  1.1337 +							print OUTFILE  "\n";
  1.1338 +							print OUTFILE "	<!--Inclusion of $target xml for $APITest -->\n";
  1.1339 +							print OUTFILE "	<component>\n";
  1.1340 +							print OUTFILE "		<factory>Symbian</factory>\n";
  1.1341 +							if($libname eq "all")
  1.1342 +							{
  1.1343 +									print OUTFILE "		 <testplan>ATSINPUT\\components\\$listed\\$listed"."_module_blr_".$snippet."_component.xml</testplan>\n";	 
  1.1344 +							}
  1.1345 +							else
  1.1346 +							{
  1.1347 +									print OUTFILE "		 <testplan>ATSINPUT\\components\\$libname"."_"."$APITest\\$libname"."_$APITest"."_module_blr_".$snippet."_component.xml</testplan>\n";	 
  1.1348 +							}
  1.1349 +							if($target eq "winscw")
  1.1350 +							{
  1.1351 +									print OUTFILE "		<target hardware=\"winscw\" build=\"udeb\" />\n";
  1.1352 +							}
  1.1353 +							elsif($target eq "winsspd")
  1.1354 +							{
  1.1355 +								print OUTFILE " <target hardware=\"winsspd\" platform=\"winscw\" build=\"udeb\" />\n"; 
  1.1356 +							}
  1.1357 +							else
  1.1358 +							{
  1.1359 +										print OUTFILE "		<target hardware=\"$target\" build=\"urel\" />\n";
  1.1360 +							}
  1.1361 +							print OUTFILE "	</component>\n";
  1.1362 +							print OUTFILE "\n";
  1.1363 +	           }#foreach @generatedModules
  1.1364 +}
  1.1365 +
  1.1366 +
  1.1367 +sub AddFileList($$)
  1.1368 +{
  1.1369 +	my $libname = shift @_; 
  1.1370 +	my $listptr = shift @_;
  1.1371 +	my @componentfiles = @$listptr;
  1.1372 +	
  1.1373 +			foreach my $listed(@componentfiles)
  1.1374 +						{
  1.1375 +								print OUTFILE  "\n";
  1.1376 +							print OUTFILE "	<!--Inclusion of $target xml -->\n";
  1.1377 +							print OUTFILE "	<component>\n";
  1.1378 +							print OUTFILE "		<factory>Symbian</factory>\n";
  1.1379 +							print OUTFILE "		 <testplan>ATSINPUT\\components\\$listed</testplan>\n";	 
  1.1380 +							if($target eq "winscw")
  1.1381 +							{
  1.1382 +									print OUTFILE "		<target hardware=\"winscw\" build=\"udeb\" />\n";
  1.1383 +							}
  1.1384 +							elsif($target eq "winsspd")
  1.1385 +							{
  1.1386 +								print OUTFILE " <target hardware=\"winsspd\" platform=\"winscw\" build=\"udeb\" />\n"; 
  1.1387 +							}
  1.1388 +							else
  1.1389 +							{
  1.1390 +										print OUTFILE "		<target hardware=\"$target\" build=\"urel\" />\n";
  1.1391 +							}
  1.1392 +							print OUTFILE "	</component>\n";
  1.1393 +							print OUTFILE "\n";
  1.1394 +	           }#foreach @componentfiles
  1.1395 +}
  1.1396 +
  1.1397 +
  1.1398 +
  1.1399 +sub GetSslXmls()
  1.1400 +{
  1.1401 +	my $APITest;
  1.1402 +	my @componentfiles;
  1.1403 +	
  1.1404 +	my @emulatorfiles = 
  1.1405 +	(
  1.1406 +	"libssl_ssltest\\libssl_blr_winsspd_component.xml",
  1.1407 +	"libcrypto_crypto_test\\libcrypto_blr_winsspd_component.xml",
  1.1408 +	"libcrypto_openssl\\libcrypto_topenssltestss_blr_winsspd_component.xml",
  1.1409 +	"libcrypto_openssl\\libcrypto_topenssltestverify_blr_winsspd_component.xml",
  1.1410 +	"libcrypto_openssl\\libcrypto_topenssltestenc_blr_winsspd_component.xml",
  1.1411 +	"libcrypto_openssl\\libcrypto_topenssltestgen_blr_winsspd_component.xml",
  1.1412 +	"libcrypto_openssl\\libcrypto_topenssltpkcs7_blr_winsspd_component.xml",
  1.1413 +	"libcrypto_openssl\\libcrypto_topenssltpkcs7d_blr_winsspd_component.xml",
  1.1414 +	"libcrypto_openssl\\libcrypto_topenssltreq_blr_winsspd_component.xml",
  1.1415 +	"libcrypto_openssl\\libcrypto_topenssltreq2_blr_winsspd_component.xml",
  1.1416 +	"libcrypto_openssl\\libcrypto_topenssltrsa_blr_winsspd_component.xml",
  1.1417 +	"libcrypto_openssl\\libcrypto_topenssltcrl_blr_winsspd_component.xml",
  1.1418 +	"libcrypto_openssl\\libcrypto_topenssltsid_blr_winsspd_component.xml",
  1.1419 +	"libcrypto_openssl\\libcrypto_topenssltx509_blr_winsspd_component.xml",
  1.1420 +	"libcrypto_openssl\\libcrypto_topenssltx5091_blr_winsspd_component.xml",
  1.1421 +	"libcrypto_openssl\\libcrypto_topenssltx5092_blr_winsspd_component.xml",
  1.1422 +	 );
  1.1423 +	 
  1.1424 +	my @hwfiles =
  1.1425 +	(
  1.1426 +		"libcrypto_openssl\\libcrypto_topenssltestss_blr_hw_component.xml",
  1.1427 +		"libcrypto_openssl\\libcrypto_topenssltestverify_blr_hw_component.xml",
  1.1428 +		"libcrypto_openssl\\libcrypto_topenssltestenc_blr_hw_component.xml",
  1.1429 +		"libcrypto_openssl\\libcrypto_topenssltestgen_blr_hw_component.xml",
  1.1430 +		"libcrypto_openssl\\libcrypto_topenssltpkcs7_blr_hw_component.xml",
  1.1431 +		"libcrypto_openssl\\libcrypto_topenssltpkcs7d_blr_hw_component.xml",
  1.1432 +		"libcrypto_openssl\\libcrypto_topenssltreq_blr_hw_component.xml",
  1.1433 +		"libcrypto_openssl\\libcrypto_topenssltreq2_blr_hw_component.xml",
  1.1434 +		"libcrypto_openssl\\libcrypto_topenssltrsa_blr_hw_component.xml",
  1.1435 +		"libcrypto_openssl\\libcrypto_topenssltcrl_blr_hw_component.xml",
  1.1436 +		"libcrypto_openssl\\libcrypto_topenssltsid_blr_hw_component.xml",
  1.1437 +		"libcrypto_openssl\\libcrypto_topenssltx509_blr_hw_component.xml",
  1.1438 +		"libcrypto_openssl\\libcrypto_topenssltx5091_blr_hw_component.xml",
  1.1439 +		"libcrypto_openssl\\libcrypto_topenssltx5092_blr_hw_component.xml",		
  1.1440 +		"libssl_ssltest\\libssl_blr_hw_component.xml",
  1.1441 +		"libcrypto_crypto_test\\libcrypto_blr_hw_component.xml",
  1.1442 +	);
  1.1443 +	if($target eq "winsspd" || $target eq "winscw")
  1.1444 +	{
  1.1445 +		@componentfiles = @emulatorfiles;
  1.1446 +	}
  1.1447 +	else
  1.1448 +	{
  1.1449 +		@componentfiles = @hwfiles;
  1.1450 +	}
  1.1451 +	return @componentfiles;
  1.1452 +}
  1.1453 +
  1.1454 +
  1.1455 +
  1.1456 +sub AddActualIncludes($)
  1.1457 +{
  1.1458 +	my $libname = shift @_; 
  1.1459 +	find(\&XmlComponentFiles, ".");
  1.1460 +	my $key;
  1.1461 +	my $value;
  1.1462 +	while(($key, $value) = each(%DirHash)) 
  1.1463 +	{
  1.1464 +							$value =~ s/\//\\/g;
  1.1465 +							print OUTFILE  "\n";
  1.1466 +							print OUTFILE "	<!--Inclusion of dynamically found $target xml -->\n";
  1.1467 +							print OUTFILE "	<component>\n";
  1.1468 +							print OUTFILE "		<factory>Symbian</factory>\n";
  1.1469 +							print OUTFILE "		 <testplan>$value</testplan>\n";	 
  1.1470 +							if($target eq "winscw")
  1.1471 +							{
  1.1472 +									print OUTFILE "		<target hardware=\"winscw\" build=\"udeb\" />\n";
  1.1473 +							}
  1.1474 +							elsif($target eq "winsspd")
  1.1475 +							{
  1.1476 +								print OUTFILE " <target hardware=\"winsspd\" platform=\"winscw\" build=\"udeb\" />\n"; 
  1.1477 +							}
  1.1478 +							else
  1.1479 +							{
  1.1480 +										print OUTFILE "		<target hardware=\"$target\" build=\"urel\" />\n";
  1.1481 +							}
  1.1482 +							print OUTFILE "	</component>\n";
  1.1483 +							print OUTFILE "\n";
  1.1484 +	
  1.1485 +	}#while
  1.1486 +}#fn
  1.1487 +
  1.1488 +sub XmlComponentFiles()
  1.1489 +{
  1.1490 +	if($_ !~ /\.xml/ || $_ =~ /manual/)
  1.1491 +	{
  1.1492 +		return;
  1.1493 +	}
  1.1494 +	#print "Processing $_\n";
  1.1495 +	my $dir = getcwd();
  1.1496 +	if($dir =~ /.*(ATSINPUT.*)/)
  1.1497 +	{
  1.1498 +			$dir = $1;
  1.1499 +			if($dir !~ /.*components.*/)
  1.1500 +			{
  1.1501 +				return;
  1.1502 +			}
  1.1503 +			#print "The dir is $dir\n";
  1.1504 +	}
  1.1505 +	else
  1.1506 +	{
  1.1507 +		return;
  1.1508 +	}
  1.1509 +	
  1.1510 +	if($target eq "winsspd" )
  1.1511 +	{
  1.1512 +		if($_ =~ /winsspd/)
  1.1513 +		{
  1.1514 +			#print "Adding $target file $_ for $dir\n";
  1.1515 +			$DirHash{$dir} = $dir."/".$_;
  1.1516 +		}
  1.1517 +	}
  1.1518 +	elsif($target eq "winscw")
  1.1519 +	{
  1.1520 +		if($_ =~ /winscw/)
  1.1521 +		{
  1.1522 +			#print "Adding $target file $_ for $dir\n";
  1.1523 +			$DirHash{$dir} = $dir."/".$_;
  1.1524 +		}
  1.1525 +	}
  1.1526 +	elsif($_ =~ /$target/)
  1.1527 +	{
  1.1528 +		#print "$_ matched $target \n";
  1.1529 +		#print "Adding $target file $_ for $dir\n";
  1.1530 +		$DirHash{$dir} = $dir."/".$_;
  1.1531 +	}
  1.1532 +	elsif($_ =~/hw/)
  1.1533 +	{
  1.1534 +		#print "$_ matched hw";
  1.1535 +		if(scalar $DirHash{$dir} == 0)
  1.1536 +		{
  1.1537 +			#print "Adding hw file $_ for $dir\n";
  1.1538 +			$DirHash{$dir} = $dir."/".$_;
  1.1539 +			#print " and added\n"
  1.1540 +		}
  1.1541 +		else
  1.1542 +		{
  1.1543 +			#print " and not added\n";
  1.1544 +		}
  1.1545 +	}
  1.1546 +}
  1.1547 +
  1.1548 +
  1.1549 +
  1.1550 +sub emptyArray()
  1.1551 +{
  1.1552 +	@generatedModules = ();
  1.1553 +}
  1.1554 +
  1.1555 +sub GenDirs($)
  1.1556 +{
  1.1557 + my $libname = shift @_;
  1.1558 + my $dirname;
  1.1559 + foreach my $module(@generatedModules)
  1.1560 + {
  1.1561 +  $dirname = StripModulePrefix($module);
  1.1562 +	my $relroot = $ATSRoot."\\components\\$libname"."_$dirname";
  1.1563 +	mkdir $relroot || die("DIED: unable to create dir $dirname\n");
  1.1564 +	mkdir $relroot."\\General" || die("DIED: unable to create dir $relroot\\General\n");
  1.1565 +	if($do_armv5 == 1)
  1.1566 +	{
  1.1567 +		mkdir $relroot."\\armv5_urel" || die("DIED: unable to create dir $relroot\\armv5_urel\n");
  1.1568 +	}
  1.1569 +	if($do_winscw == 1)
  1.1570 +	{
  1.1571 +		mkdir $relroot."\\winscw_udeb" || die("DIED: unable to create dir $relroot\\winscw_udeb\n");
  1.1572 +	}
  1.1573 + }
  1.1574 +}
  1.1575 +
  1.1576 +sub GenXmls($$$)
  1.1577 +{
  1.1578 +	my $libname = shift @_;
  1.1579 +	my $listedName = shift @_;
  1.1580 +	my $bref = shift @_;
  1.1581 +	my @filesToProcess = @$bref;
  1.1582 +	
  1.1583 +	#strip leading test and t names from module
  1.1584 +	my $moduleName = StripModulePrefix($listedName);
  1.1585 +
  1.1586 +      my $toPath = $ATSRoot."\\components\\$libname"."_$moduleName\\"; 
  1.1587 +        
  1.1588 +
  1.1589 +       my $dst;
  1.1590 +       my $src;
  1.1591 +       foreach $src(@filesToProcess)
  1.1592 +       {
  1.1593 +               $dst = $src;
  1.1594 +               $dst =~ s/ATSTemplateXXX/$moduleName/;
  1.1595 +               $dst =~ s/LibXXX/$libname/;
  1.1596 +             
  1.1597 +
  1.1598 +               if($src eq "testframework.ini")
  1.1599 +               {
  1.1600 +					$dst =  $toPath."General\\".$dst;
  1.1601 +               }
  1.1602 +               else
  1.1603 +               {
  1.1604 +					$dst =  $toPath.$dst;
  1.1605 +               }
  1.1606 +               copy($templateRoot."\\".$src, $dst) || die("DIED: Unable to copy $src to $dst\n");
  1.1607 +               ExpandModuleMacros($dst, $libname, $listedName);
  1.1608 +       }#foreach file
  1.1609 +}
  1.1610 +
  1.1611 +
  1.1612 +sub GenExeXmls()
  1.1613 +{
  1.1614 +	my $moduleName = shift @_;
  1.1615 +	my $libname = shift @_;
  1.1616 +			
  1.1617 +	my $toPath = $ATSRoot."\\components\\$libname"."_$moduleName\\"; 
  1.1618 +  my @filesToProcess =
  1.1619 +  (
  1.1620 +     "LibXXX_ATSTemplateXXX_exemodule_blr_hw_component.xml",
  1.1621 +     "LibXXX_ATSTemplateXXX_exemodule_blr_winsspd_component.xml",
  1.1622 +  );
  1.1623 +	
  1.1624 +	my $dst;
  1.1625 +  my $src;
  1.1626 +  foreach $src(@filesToProcess)
  1.1627 +  {
  1.1628 +        $dst = $src;
  1.1629 +        $dst =~ s/ATSTemplateXXX/$moduleName/;
  1.1630 +        $dst =~ s/LibXXX/$libname/;
  1.1631 +        $dst =~ s/_exemodule_/_module_/;
  1.1632 +				$dst =  $toPath.$dst;
  1.1633 +        copy($templateRoot."\\".$src, $dst) || die("DIED: Unable to copy to $dst\n");
  1.1634 +        ExpandModuleMacros($dst, $libname, $moduleName);
  1.1635 +   }#foreach file
  1.1636 +}
  1.1637 +
  1.1638 +#function to expand the macros existing in a file
  1.1639 +#file is replaced by new version
  1.1640 +#args are relativePath. filename and  $moduleName
  1.1641 +sub ExpandModuleMacros()
  1.1642 +{
  1.1643 +	# Take module name
  1.1644 +	my $moduleName = pop @_;
  1.1645 +	my $libname = pop @_;
  1.1646 +	my $filename = pop @_;
  1.1647 +
  1.1648 +	my $MODULENAME = $moduleName;
  1.1649 +	$MODULENAME =~ tr/[a-z]/[A-Z]/;
  1.1650 +
  1.1651 +	# Open input file
  1.1652 +	open (INFILE, $filename ) || die ("DIED: Can not find $filename");
  1.1653 +
  1.1654 +	#Open output file
  1.1655 +	my $newOutput = $filename."new";
  1.1656 +	open (OUTFILE, ">".$newOutput ) || die ("DIED: Can not open $newOutput");
  1.1657 +
  1.1658 +	# Replace text in files
  1.1659 +	while (<INFILE>)
  1.1660 +	{
  1.1661 +	  s/ATSTemplateXXX/$moduleName/g;
  1.1662 +	  s/LibXXX/$libname/g;
  1.1663 +    	  print OUTFILE $_;
  1.1664 +	}
  1.1665 +
  1.1666 +	# Close filehandles
  1.1667 +	close (INFILE);
  1.1668 +	close (OUTFILE);
  1.1669 +
  1.1670 +	# Rename result file
  1.1671 +	unlink $filename;
  1.1672 +	rename $newOutput,$filename;
  1.1673 +}
  1.1674 +
  1.1675 +
  1.1676 +
  1.1677 +sub CopyDeps($$)
  1.1678 +{
  1.1679 +  my $libname = shift @_;
  1.1680 +  my $copyDll = shift @_;
  1.1681 +	my $src;
  1.1682 +	my $dst;
  1.1683 +	foreach my $listed(@generatedModules)
  1.1684 +	{
  1.1685 +				my $module = StripModulePrefix($listed);
  1.1686 +				if($do_winscw == 1)
  1.1687 +				{
  1.1688 +					$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll;
  1.1689 +					$dst = $ATSRoot."\\components\\$libname"."_$module";
  1.1690 +					$dst = $dst."\\winscw_udeb\\";
  1.1691 +					copy($src, $dst)  || warn("unable to copy $src to $dst");
  1.1692 +				}
  1.1693 +				if($do_armv5 == 1)
  1.1694 +				{
  1.1695 +					$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll;
  1.1696 +					$dst = $ATSRoot."\\components\\$libname"."_$module";
  1.1697 +					$dst = $dst."\\armv5_urel\\";
  1.1698 +					copy($src, $dst)  || warn("unable to copy $src to $dst");
  1.1699 +				}
  1.1700 +	}#foreach
  1.1701 +}#fn
  1.1702 +
  1.1703 +#dat file copy
  1.1704 +sub CopyDatFiles()
  1.1705 +{
  1.1706 +	my $libRoot = $templateRoot;
  1.1707 +	$libRoot =~ /(.*)internal.*/;
  1.1708 +	$libRoot = $1;
  1.1709 +
  1.1710 + my @list = (
  1.1711 +  				 ["libcrypt", "tlibcrypt", "group/Test_Data.dat"],
  1.1712 +  				 ["libc", "tnetdb", "data/services.txt"],
  1.1713 +  				 ["libc", "tstring", "data/locales.txt"],
  1.1714 +  				 ["libc", "libc_loc_blr", "data/locales.txt"],
  1.1715 +  				 ["libz", "tzlib", "data/*.*"],
  1.1716 +  				 ["libc", "tlink", "data/*.*"],
  1.1717 +  				 ["libc", "tmmap", "data/*.*"],
  1.1718 +           );
  1.1719 +
  1.1720 +	 my $libname;
  1.1721 +	 my $dirname;
  1.1722 +	 my $glob;
  1.1723 +	foreach my $ref(@list)
  1.1724 +	{
  1.1725 +			my @inarr = @$ref;
  1.1726 +			($libname, $dirname, $glob) = @inarr;
  1.1727 +			my $modulename = StripModulePrefix($dirname);
  1.1728 +			my $src = "$libRoot/$libname/internal/testapps/$dirname/$glob";
  1.1729 +			my $dst = $ATSRoot."\\components\\$libname"."_"."$modulename\\General\\";
  1.1730 +  		if($dirname eq "libc_loc_blr")
  1.1731 +  		{
  1.1732 +  			$src = "$libRoot/libc/src/locales.txt";
  1.1733 +  		}
  1.1734 +  		my @filesFound = glob($src);
  1.1735 +  		if(scalar @filesFound == 0)
  1.1736 +  		{
  1.1737 +  			die("DIED: no Dat file found to copy!");
  1.1738 +  		}
  1.1739 +  		foreach my $file(@filesFound)
  1.1740 +  		{
  1.1741 +  			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
  1.1742 +  		}
  1.1743 +  }#ref processing
  1.1744 +}#fn
  1.1745 +
  1.1746 +
  1.1747 +#glib dat file copy
  1.1748 +sub CopyArbitDatFiles($$)
  1.1749 +{
  1.1750 +	
  1.1751 +	 my $libname = shift @_;
  1.1752 +	 my $refArr = shift @_;
  1.1753 +	 my @list = @$refArr;
  1.1754 +	 
  1.1755 + 	
  1.1756 +	my $fname;
  1.1757 +	my $modulename;
  1.1758 +	my $location;
  1.1759 +	my $atsDst;
  1.1760 +	my $targetDst;
  1.1761 +	
  1.1762 +	#now copy the files appropriately
  1.1763 +	foreach my $ref(@list)
  1.1764 +	{
  1.1765 +			my @inarr = @$ref;
  1.1766 +			($fname, $modulename, $location, $atsDst, $targetDst) = @inarr;
  1.1767 +			#print "[$fname, $modulename, $location, $atsDst, $targetDst]\n";
  1.1768 +			if($location =~ /(.*)\.\.(.*)/)
  1.1769 +			{
  1.1770 +				$location = GetPathPrefix().$2;
  1.1771 +				
  1.1772 +			}
  1.1773 +			else
  1.1774 +			{
  1.1775 +				$location = $rootDrive.$location;
  1.1776 +				
  1.1777 +			}
  1.1778 +			my $src = $location.$fname;
  1.1779 +			my $dst = $ATSRoot."\\components\\$libname"."_".$modulename.$atsDst;
  1.1780 +			if($libname eq "")
  1.1781 +			{
  1.1782 +				$dst = $ATSRoot."\\components\\".$modulename.$atsDst;
  1.1783 +				#print "$dst CHANGED!\n"
  1.1784 +			}
  1.1785 +  		
  1.1786 +  		my @filesFound = glob($src);
  1.1787 +  		if(scalar @filesFound == 0)
  1.1788 +  		{
  1.1789 +  			die("DIED: no Dat file  $src found to copy!");
  1.1790 +  		}
  1.1791 +  		foreach my $file(@filesFound)
  1.1792 +  		{
  1.1793 +  			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
  1.1794 +  		}
  1.1795 +  		
  1.1796 +  		if($targetDst ne "")
  1.1797 +  		{
  1.1798 +  			 		my @filesToChange = ();
  1.1799 +			  		if($atsDst =~ "armv5")
  1.1800 +			  		{
  1.1801 +			  			#armv5 component file
  1.1802 +			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_hw_component.xml";
  1.1803 +			  			
  1.1804 +			  		}
  1.1805 +			  		elsif($atsDst =~ "winscw")
  1.1806 +			  		{
  1.1807 +			  			#winscw component file
  1.1808 +			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_winsspd_component.xml";
  1.1809 +			  		}
  1.1810 +			  		else
  1.1811 +			  		{
  1.1812 +			  			#add entry to both xmls
  1.1813 +			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_hw_component.xml";
  1.1814 +			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_winsspd_component.xml";
  1.1815 +			  		}
  1.1816 +			  		foreach my $file(@filesToChange)
  1.1817 +			  		{
  1.1818 +			  			$src = $ATSRoot."/components/".$libname."_"."$modulename/".$file;
  1.1819 +			  			ModifyXml($src,$libname,$fname,$atsDst,$targetDst);
  1.1820 +			  		}
  1.1821 +			  }#updating the xmls
  1.1822 +    		
  1.1823 +  }#ref processing
  1.1824 + 
  1.1825 +  
  1.1826 +}#fn
  1.1827 +
  1.1828 +sub ModifyXml($$$$$)
  1.1829 +{
  1.1830 +	my $filename = shift @_;
  1.1831 +	my $lib = shift @_;
  1.1832 +	my $fname = shift @_;
  1.1833 +	my $atsDst = shift @_;
  1.1834 +	my $targetDst = shift @_;
  1.1835 +	
  1.1836 +	
  1.1837 +	#printf("Modifying $filename with lib= $lib fname= $fname atsDst = $atsDst targetDst = $targetDst\n");
  1.1838 +	
  1.1839 +	# Open input file
  1.1840 +	open (INFILE, $filename ) || die ("Can not find $filename");
  1.1841 +
  1.1842 +	#Open output file
  1.1843 +	my $newOutput = $filename."new";
  1.1844 +	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
  1.1845 +
  1.1846 +		
  1.1847 +	# Replace text in files
  1.1848 +	while (<INFILE>)
  1.1849 +	{
  1.1850 +	  if(/\<stif\>/ || /\<execute\>/)
  1.1851 +	  {
  1.1852 +	  	if(/\<stif\>/)
  1.1853 +	  	{
  1.1854 +	  		print OUTFILE "\<stif\>\n";
  1.1855 +	  	}
  1.1856 +	  	else
  1.1857 +	  	{
  1.1858 +	  		print OUTFILE "\<execute\>\n";
  1.1859 +	  	}
  1.1860 +	  	my $type = "data";
  1.1861 +	  	if($atsDst !~ "General")
  1.1862 +			{
  1.1863 +				$type = "binary";
  1.1864 +			}
  1.1865 +			print OUTFILE <<EObinary;
  1.1866 +				
  1.1867 +	  		<install type=\"$type\">
  1.1868 +				<src>$fname</src>
  1.1869 +				<dst>$targetDst\\$fname</dst>
  1.1870 + 				</install>
  1.1871 +EObinary
  1.1872 +	  }#stif or execute tag found
  1.1873 +	  else
  1.1874 +	  {
  1.1875 +	  	  print OUTFILE $_;
  1.1876 +	  }
  1.1877 +	}#while
  1.1878 +	# Close filehandles
  1.1879 +	close (INFILE);
  1.1880 +	close (OUTFILE);
  1.1881 +
  1.1882 +	# Rename result file
  1.1883 +	unlink $filename;
  1.1884 +	rename $newOutput,$filename;
  1.1885 +	
  1.1886 +}#fn
  1.1887 +sub GenGenModules($)
  1.1888 +{
  1.1889 +	my $libname = shift @_;
  1.1890 +	
  1.1891 +		
  1.1892 +	my $src = $ATSRoot."/components/";
  1.1893 +	my @fileList = ();
  1.1894 +	opendir(DIRHANDLE, "$src") || die "Cannot opendir $src";
  1.1895 +  foreach my $name (readdir(DIRHANDLE)) 
  1.1896 +  {
  1.1897 +    if($name =~ /^$libname/)
  1.1898 +    {
  1.1899 +    	if($libname ne "libc" || $name !~ /^libcrypt/) 
  1.1900 +    	{
  1.1901 +    		$name =~ s/^$libname//;
  1.1902 +    		$name =~ s/^_//;
  1.1903 +    		unshift @fileList, $name;
  1.1904 +    	}#excluded libcrypt from libc list
  1.1905 +    }#libname match
  1.1906 +  }#foreach
  1.1907 +  closedir(DIRHANDLE);
  1.1908 +	return @fileList;
  1.1909 +}
  1.1910 +
  1.1911 +
  1.1912 +sub GetAllModules()
  1.1913 +{
  1.1914 +	
  1.1915 +	my $src = $ATSRoot."/components/";
  1.1916 +	my @fileList = ();
  1.1917 +	opendir(DIRHANDLE, "$src") || die "Cannot opendir $src";
  1.1918 +  foreach my $name (readdir(DIRHANDLE)) 
  1.1919 +  {
  1.1920 +    	if($name ne "." && $name ne ".." && $name ne "shared")
  1.1921 +			{
  1.1922 +				unshift @fileList, $name;
  1.1923 +			}
  1.1924 +
  1.1925 +  }#foreach
  1.1926 +  closedir(DIRHANDLE);
  1.1927 +	return @fileList;
  1.1928 +}
  1.1929 +
  1.1930 +
  1.1931 +
  1.1932 +sub TransformXmls($$)
  1.1933 +{
  1.1934 +	my $libname = shift @_;
  1.1935 +	my $shared = shift @_;
  1.1936 +	my $target = shift @_;
  1.1937 +	my $module;
  1.1938 +	my $src;
  1.1939 +	my $dst;
  1.1940 +
  1.1941 +	my $armv5 = 0;
  1.1942 +	my $winscw = 0;
  1.1943 +	if($target eq "armv5")
  1.1944 +	{
  1.1945 +			$armv5 = 1;
  1.1946 +  }	
  1.1947 +  elsif($target eq "winscw")
  1.1948 +  {
  1.1949 +  		$winscw = 1;
  1.1950 +  }
  1.1951 +  else
  1.1952 +  {
  1.1953 +  	$armv5  = $do_armv5;
  1.1954 +  	$winscw = $do_winscw;
  1.1955 +	}
  1.1956 +		
  1.1957 +
  1.1958 +	foreach $module(@generatedModules)
  1.1959 +	{
  1.1960 +	  if($armv5 == 1 && $winscw == 1)
  1.1961 +	  {
  1.1962 +			$src = $ATSRoot."/components/".$libname."_"."$module/*.xml";
  1.1963 +		}
  1.1964 +		elsif($armv5 == 1)
  1.1965 +		{
  1.1966 +			$src = $ATSRoot."/components/".$libname."_"."$module/*_hw_component.xml";
  1.1967 +		}
  1.1968 +		elsif($winscw == 1)
  1.1969 +		{
  1.1970 +			$src = $ATSRoot."/components/".$libname."_"."$module/*_winsspd_component.xml";
  1.1971 +		}
  1.1972 +		my @fileList = glob($src);
  1.1973 +		foreach my $file(@fileList)
  1.1974 +		{
  1.1975 +		 	#print"$file to  be transformed!\n";
  1.1976 +			AddLibsInXml($libname,$file,$shared);
  1.1977 +		}
  1.1978 +   }
  1.1979 +}#fn
  1.1980 +
  1.1981 +sub AddLibsInXml($$$)
  1.1982 +{
  1.1983 +	my $libname = shift @_;
  1.1984 +	my $filename = shift @_;
  1.1985 +	my $shared = shift @_;
  1.1986 +	
  1.1987 +	# Open input file
  1.1988 +	open (INFILE, $filename ) || die ("Can not find $filename");
  1.1989 +
  1.1990 +	#Open output file
  1.1991 +	my $newOutput = $filename."new";
  1.1992 +	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
  1.1993 +
  1.1994 +	my $drive = "c:";
  1.1995 +	
  1.1996 +	# Replace text in files
  1.1997 +	while (<INFILE>)
  1.1998 +	{
  1.1999 +	  if(/\<stif\>/ || /\<execute\>/)
  1.2000 +	  {
  1.2001 +	  	if(/\<stif\>/)
  1.2002 +	  	{
  1.2003 +	  		print OUTFILE "\<stif\>\n";
  1.2004 +	  	}
  1.2005 +	  	else
  1.2006 +	  	{
  1.2007 +	  		print OUTFILE "\<execute\>\n";
  1.2008 +	  		if($filename =~ /winsspd/)
  1.2009 +				{
  1.2010 +					$drive = "z:";
  1.2011 +				}
  1.2012 +	  	}
  1.2013 +	  	foreach my $installable(@dllList)
  1.2014 +			{
  1.2015 +				print OUTFILE <<EOLine;
  1.2016 +				
  1.2017 +	  		<install type=\"$shared binary\">
  1.2018 +				<src>$installable</src>
  1.2019 +				<dst>$drive\\sys\\bin\\$installable</dst>
  1.2020 + 				</install>
  1.2021 +EOLine
  1.2022 +			}
  1.2023 +
  1.2024 +	  }
  1.2025 +	  else
  1.2026 +	  {
  1.2027 +	  	  print OUTFILE $_;
  1.2028 +	  }
  1.2029 +	}#while
  1.2030 +	# Close filehandles
  1.2031 +	close (INFILE);
  1.2032 +	close (OUTFILE);
  1.2033 +
  1.2034 +	# Rename result file
  1.2035 +	unlink $filename;
  1.2036 +	rename $newOutput,$filename;
  1.2037 +}
  1.2038 +
  1.2039 +sub CopySharedDlls()
  1.2040 +{
  1.2041 +  my $libname = shift @_;
  1.2042 +  my $ref = shift @_;
  1.2043 +  my @ListOfDlls = @$ref;
  1.2044 +  my $target = shift @_;
  1.2045 +	my $module;
  1.2046 +	my $src;
  1.2047 +	my $dst;
  1.2048 +	
  1.2049 +	my $do_armv5 = 0;
  1.2050 +	my $do_winscw = 0;
  1.2051 +	if($target eq "armv5")
  1.2052 +	{
  1.2053 +		$do_armv5 = 1;
  1.2054 +	}
  1.2055 +	elsif($target eq "winscw")
  1.2056 +	{
  1.2057 +		$do_winscw =  1;
  1.2058 +	}
  1.2059 +	else
  1.2060 +	{
  1.2061 +		$do_armv5  = 1;
  1.2062 +		$do_winscw = 1;
  1.2063 +	}
  1.2064 +	
  1.2065 +	
  1.2066 +	mkdir  $ATSRoot."\\components\\shared" || die("Wouldn't make shared folder in $ATSRoot\\components");
  1.2067 +	if($do_winscw == 1)
  1.2068 +	{
  1.2069 +		mkdir  $ATSRoot."\\components\\shared\\winscw_udeb" || die("Wouldn't make shared folder in $ATSRoot\\components\winscw_udeb");
  1.2070 +	}
  1.2071 +	if($do_armv5 == 1)
  1.2072 +	{
  1.2073 +		mkdir  $ATSRoot."\\components\\shared\\armv5_urel" || die("Wouldn't make shared folder in $ATSRoot\\components\armv5_urel");
  1.2074 +	}
  1.2075 +	
  1.2076 +	foreach my $copyDll(@ListOfDlls)
  1.2077 +	{
  1.2078 +		if($do_winscw == 1)
  1.2079 +		{
  1.2080 +			$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll;
  1.2081 +			$dst = $ATSRoot."\\components\\shared";
  1.2082 +			$dst = $dst."\\winscw_udeb\\";
  1.2083 +			copy($src, $dst)  || warn("unable to copy $src to $dst");
  1.2084 +		}	
  1.2085 +		if($do_armv5 == 1)
  1.2086 +		{	
  1.2087 +			$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll;
  1.2088 +			$dst = $ATSRoot."\\components\\shared";
  1.2089 +			$dst = $dst."\\armv5_urel\\";
  1.2090 +			copy($src, $dst)  || warn("unable to copy $src to $dst");
  1.2091 +		}
  1.2092 +	}#foreach
  1.2093 +}#fn
  1.2094 +
  1.2095 +
  1.2096 +sub CopyMultiDlls($)
  1.2097 +{
  1.2098 +  my $libname = shift @_;
  1.2099 +	my $module;
  1.2100 +	my $src;
  1.2101 +	my $dst;
  1.2102 +	foreach my $listed(@generatedModules)
  1.2103 +	{
  1.2104 +		foreach my $copyDll(@dllList)
  1.2105 +		{
  1.2106 +			if($do_winscw == 1)
  1.2107 +			{
  1.2108 +				$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll;
  1.2109 +				$dst = $ATSRoot."\\components\\$libname"."_$listed";
  1.2110 +				$dst = $dst."\\winscw_udeb\\";
  1.2111 +				copy($src, $dst)  || warn("unable to copy $src to $dst");
  1.2112 +			}
  1.2113 +			if($do_armv5 == 1)
  1.2114 +			{
  1.2115 +				$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll;
  1.2116 +				$dst = $ATSRoot."\\components\\$libname"."_$listed";
  1.2117 +				$dst = $dst."\\armv5_urel\\";
  1.2118 +				copy($src, $dst)  || warn("unable to copy $src to $dst");
  1.2119 +			}
  1.2120 +		}#foreach
  1.2121 +	}
  1.2122 +}#fn
  1.2123 +
  1.2124 +sub StripModulePrefix($)
  1.2125 +{
  1.2126 +	my $listed = pop @_;
  1.2127 +	my $module = $listed;
  1.2128 +	if($dontStrip == 0)
  1.2129 +	{
  1.2130 +		$module =~ s/^test//;
  1.2131 +		$module =~ s/^t//;
  1.2132 +		$module =~ s/^libc_//;
  1.2133 +		$module =~ s/^libm_//;
  1.2134 +  }
  1.2135 +  return $module;
  1.2136 +  	
  1.2137 +}
  1.2138 +
  1.2139 +sub GetLsbModules()
  1.2140 +{
  1.2141 +	my @lsbList = 
  1.2142 +	(
  1.2143 +	 "abs",
  1.2144 +"acos",
  1.2145 +"asctime",
  1.2146 +"asin",
  1.2147 +"atan",
  1.2148 +"atan2",
  1.2149 +"atof",
  1.2150 +"atoi",
  1.2151 +"atol",
  1.2152 +"bsearch",
  1.2153 +"calloc",
  1.2154 +"ceil",
  1.2155 +"chdir",
  1.2156 +"clearerr",
  1.2157 +"close",
  1.2158 +"closedir",
  1.2159 +"cos",
  1.2160 +"cosh",
  1.2161 +"creat",
  1.2162 +"lsb_ctime",
  1.2163 +"lsb_difftime",
  1.2164 +"dlclose",
  1.2165 +"dlerror",
  1.2166 +"dlopen",
  1.2167 +"dup",
  1.2168 +"dup2",
  1.2169 +"exp",
  1.2170 +"fabs",
  1.2171 +"fclose",
  1.2172 +"fcntl_x",
  1.2173 +"fdopen",
  1.2174 +"feof",
  1.2175 +"ferror",
  1.2176 +"fflush",
  1.2177 +"fgetpos",
  1.2178 +"fgets",
  1.2179 +"fileno",
  1.2180 +"floor",
  1.2181 +"fmod",
  1.2182 +"fopen",
  1.2183 +"fopen_X",
  1.2184 +"fprintf",
  1.2185 +"fputs",
  1.2186 +"fread",
  1.2187 +"free",
  1.2188 +"freopen",
  1.2189 +"freopen_X",
  1.2190 +"frexp",
  1.2191 +"fseek",
  1.2192 +"fsetpos",
  1.2193 +"fstat",
  1.2194 +"ftell",
  1.2195 +"ftok",
  1.2196 +"ftok_l",
  1.2197 +"fwrite",
  1.2198 +"getc",
  1.2199 +"getcwd",
  1.2200 +"gets",
  1.2201 +"lsb_gmtime",
  1.2202 +"ldexp",
  1.2203 +"link",
  1.2204 +"lsb_localtime",
  1.2205 +"log",
  1.2206 +"log10",
  1.2207 +"longjmp",
  1.2208 +"lseek",
  1.2209 +"malloc",
  1.2210 +"memchr_X",
  1.2211 +"memcmp_X",
  1.2212 +"memcpy_X",
  1.2213 +"memmove",
  1.2214 +"memset_X",
  1.2215 +"mkdir",
  1.2216 +"mkfifo",
  1.2217 +"lsb_mktime",
  1.2218 +"modf",
  1.2219 +"msgctl",
  1.2220 +"msgget",
  1.2221 +"msgsnd",
  1.2222 +"open",
  1.2223 +"opendir",
  1.2224 +"open_x",
  1.2225 +"perror",
  1.2226 +"pipe",
  1.2227 +"pow",
  1.2228 +"printf",
  1.2229 +"qsort",
  1.2230 +"rand",
  1.2231 +"read",
  1.2232 +"readdir",
  1.2233 +"readv_l",
  1.2234 +"realloc",
  1.2235 +"remove",
  1.2236 +"rename",
  1.2237 +"rewind",
  1.2238 +"rewinddir",
  1.2239 +"rmdir",
  1.2240 +"scanf",
  1.2241 +"scanf_X",
  1.2242 +"seekdir",
  1.2243 +"semctl",
  1.2244 +"semget",
  1.2245 +"semop",
  1.2246 +"setbuf",
  1.2247 +"setjmp",
  1.2248 +"shmat",
  1.2249 +"shmdt",
  1.2250 +"shmget",
  1.2251 +"sin",
  1.2252 +"sinh",
  1.2253 +"sqrt",
  1.2254 +"srand",
  1.2255 +"stat",
  1.2256 +"strcat",
  1.2257 +"strchr",
  1.2258 +"strcmp",
  1.2259 +"strcoll_X",
  1.2260 +"strcpy",
  1.2261 +"strcspn",
  1.2262 +"strerror_X",
  1.2263 +"strftime",
  1.2264 +"strftime_X",
  1.2265 +"strlen",
  1.2266 +"strncat",
  1.2267 +"strncmp",
  1.2268 +"strncpy",
  1.2269 +"strpbrk",
  1.2270 +"strptime",
  1.2271 +"strrchr",
  1.2272 +"strspn",
  1.2273 +"strstr",
  1.2274 +"strtod_X",
  1.2275 +"strtok",
  1.2276 +"strtol_X",
  1.2277 +"strxfrm_X",
  1.2278 +"tan",
  1.2279 +"tanh",
  1.2280 +"telldir",
  1.2281 +"telldir_l",
  1.2282 +"lsb_time",
  1.2283 +"tmpfile",
  1.2284 +"tmpnam",
  1.2285 +"ungetc",
  1.2286 +"unlink",
  1.2287 +"utime",
  1.2288 +"vfprintf",
  1.2289 +"vprintf",
  1.2290 +"write",
  1.2291 +"writev_l",
  1.2292 +
  1.2293 +	);
  1.2294 +  return @lsbList;
  1.2295 +}
  1.2296 +
  1.2297 +
  1.2298 +
  1.2299 +sub GenBackendTest()
  1.2300 +{
  1.2301 +
  1.2302 +	my @datList = 
  1.2303 +	(
  1.2304 +	["libc", "tlibcbackend"],
  1.2305 +	);
  1.2306 +	
  1.2307 +	mkdir $ATSRoot;
  1.2308 +	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
  1.2309 +		
  1.2310 +	my $lib;
  1.2311 +	my $module;
  1.2312 +	my $ext;
  1.2313 +	foreach my $ref(@datList)
  1.2314 +	{
  1.2315 +			my @inarr = @$ref;
  1.2316 +			($lib, $module,$ext) = @inarr;
  1.2317 +			@generatedModules = ($module);
  1.2318 +			GenDirs($lib);
  1.2319 +			CopyDlls($lib,".dll");
  1.2320 +	}
  1.2321 + #now copy xmls			
  1.2322 + CopyAtsSetup();
  1.2323 + #extra exes
  1.2324 + @generatedModules = ("tlibcbackend");
  1.2325 + CopyDeps("libc","TPopenReadChild.exe");
  1.2326 + CopyDeps("libc","TPopenWriteChild.exe");
  1.2327 +			
  1.2328 +}#fn
  1.2329 +
  1.2330 +sub CopyAtsSetup()
  1.2331 +{
  1.2332 +	 my $libname = "libc"; 
  1.2333 +	 my @list = (
  1.2334 +  				 ["*.xml", "libcbackend", "/../backend/internal/tlibcbackend/group/","/", ""],
  1.2335 +  				 ["*.cfg", "libcbackend", "/../backend/internal/tlibcbackend/group/","/General/", ""],
  1.2336 +  				 ["*.ini", "libcbackend", "/../backend/internal/tlibcbackend/group/","/General/", ""],
  1.2337 +  				 );
  1.2338 + 
  1.2339 +  my $bDataRef = \@list;  				 
  1.2340 +	CopyArbitDatFiles("libc",$bDataRef);  				 
  1.2341 +
  1.2342 +}#fn
  1.2343 +sub GetPathPrefix()
  1.2344 +{
  1.2345 +	 my $srcPrefix = $templateRoot;
  1.2346 +	 $srcPrefix =~ /(.*)internal.*/;
  1.2347 +	 $srcPrefix = $1;
  1.2348 +	 return $srcPrefix;
  1.2349 +}
  1.2350 +	
  1.2351 +
  1.2352 +#dat file copy
  1.2353 +sub CopyCryptoDat()
  1.2354 +{
  1.2355 +	my $libRoot = $templateRoot;
  1.2356 +	$libRoot =~ /(.*)internal.*/;
  1.2357 +	$libRoot = $1;
  1.2358 +
  1.2359 + my @list = (
  1.2360 + 								 ["libssl", "ssltest", "libssl/internal/testapps/ssl_test/data/*"],
  1.2361 + 								 ["libcrypto", "topenssl", "/libcrypto/internal/testapps/topenssl/data/*"],
  1.2362 +           );
  1.2363 +
  1.2364 +	 my $libname;
  1.2365 +	 my $dirname;
  1.2366 +	 my $glob;
  1.2367 +	foreach my $ref(@list)
  1.2368 +	{
  1.2369 +			my @inarr = @$ref;
  1.2370 +			($libname, $dirname, $glob) = @inarr;
  1.2371 +			my $modulename = StripModulePrefix($dirname);
  1.2372 +			my	$srcPrefix = GetPathPrefix();
  1.2373 +			
  1.2374 +			my $src = "$srcPrefix"."$glob";
  1.2375 +			
  1.2376 +			my $dst = $ATSRoot."\\components\\$libname"."_"."$modulename\\General\\";
  1.2377 +  		my @filesFound = glob($src);
  1.2378 +  		if(scalar @filesFound == 0)
  1.2379 +  		{
  1.2380 +  			die("DIED: no Dat file found to copy!");
  1.2381 +  		}
  1.2382 +  		foreach my $file(@filesFound)
  1.2383 +  		{
  1.2384 +  			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
  1.2385 +  		}
  1.2386 +  }#ref processing
  1.2387 +}#fn
  1.2388 +
  1.2389 +#Crypto xmls copy
  1.2390 +sub CopyCryptoXmls()
  1.2391 +{
  1.2392 +	  my @list = (
  1.2393 +  				 ["*.xml", "libssl_ssltest/", "/libssl/internal/testapps/ssl_test/group/"],
  1.2394 +   				 ["*.xml", "libcrypto_crypto_test/", "/libcrypto/internal/testapps/crypto_test/group/"],
  1.2395 +   				 ["*.xml", "libcrypto_openssl/", "/libcrypto/internal/testapps/topenssl/group/"],   				    				 			 
  1.2396 +  				 );
  1.2397 +
  1.2398 +	
  1.2399 +	my $fname;
  1.2400 +	my $moduleDst;
  1.2401 +	my $location;
  1.2402 +	
  1.2403 +	#now copy the files appropriately
  1.2404 +	foreach my $ref(@list)
  1.2405 +	{
  1.2406 +			my @inarr = @$ref;
  1.2407 +			($fname, $moduleDst, $location) = @inarr;
  1.2408 +			my $src = GetPathPrefix().$location.$fname;
  1.2409 +			my $dst = $ATSRoot."\\components\\$moduleDst";
  1.2410 +  		
  1.2411 +  		my @filesFound = glob($src);
  1.2412 +  		if(scalar @filesFound == 0)
  1.2413 +  		{
  1.2414 +  			die("DIED: no xml file found to copy!");
  1.2415 +  		}
  1.2416 +  		foreach my $file(@filesFound)
  1.2417 +  		{
  1.2418 +  			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
  1.2419 +  		}
  1.2420 +  	}#ref
  1.2421 +  	
  1.2422 +  	my @crypto_copyList = ("*.txt", "*cfg", "*.ini");
  1.2423 +  	
  1.2424 +  	foreach my $item(@crypto_copyList)
  1.2425 +  	{
  1.2426 +  			$location = "/libcrypto/internal/testapps/crypto_test/group/";
  1.2427 +  			$fname = GetPathPrefix().$location.$item;
  1.2428 +  			my @filesFound = glob($fname);
  1.2429 +  			foreach my $file(@filesFound)
  1.2430 +  			{
  1.2431 +    			$moduleDst = "libcrypto_crypto_test/";	
  1.2432 +  				my $dst = $ATSRoot."\\components\\".$moduleDst."/General/";
  1.2433 +  				copy($file, $dst);
  1.2434 +  			}
  1.2435 +  	}
  1.2436 +}#fn
  1.2437 +
  1.2438 +sub GenCryptoTest()
  1.2439 +{
  1.2440 +
  1.2441 +	my @datList = 
  1.2442 +	(
  1.2443 +	["libssl", "ssltest", ".exe"],
  1.2444 +	["libcrypto", "crypto_test",".dll"],
  1.2445 +	["libcrypto", "openssl",".exe"],
  1.2446 +	);
  1.2447 +	
  1.2448 +	mkdir $ATSRoot;
  1.2449 +	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
  1.2450 +		
  1.2451 +	my $lib;
  1.2452 +	my $module;
  1.2453 +	my $ext;
  1.2454 +	foreach my $ref(@datList)
  1.2455 +	{
  1.2456 +			my @inarr = @$ref;
  1.2457 +			($lib, $module,$ext) = @inarr;
  1.2458 +			@generatedModules = ($module);
  1.2459 +			GenDirs($lib);
  1.2460 +			CopyDlls($lib,$ext);
  1.2461 +	}
  1.2462 +	CopyCryptoDat();
  1.2463 +	CopyCryptoXmls();
  1.2464 +	
  1.2465 +			
  1.2466 +}#fn
  1.2467 +
  1.2468 +
  1.2469 +#ngi xml copy
  1.2470 +sub CopyNgiXmls()
  1.2471 +{
  1.2472 +	  my @list = (
  1.2473 +   				 ["*.xml", "ngi_sa_amrrecording", "/audio/lowlevelaudio/internal/sa_amrrecording/group/"],
  1.2474 +   				 ["*.xml", "ngi_sa_highlevelaudio", "/audio/highlevelaudio/internal/sa_highlevelaudio/group/"],
  1.2475 +  				 ["*.xml", "ngi_sa_audiomixing", "/audio/lowlevelaudio/internal/sa_audiomixing/group/"],
  1.2476 +  				 ["*.xml", "ngi_sa_audiorecording", "/audio/lowlevelaudio/internal/sa_audiorecording/group/"],
  1.2477 +  				 ["*.xml", "ngi_sa_clip", "/audio/lowlevelaudio/internal/sa_clip/group/"],
  1.2478 +  				 ["*.xml", "ngi_sa_lowlevelaudio", "/audio/lowlevelaudio/internal/sa_lowlevelaudio/group/"],
  1.2479 +  				 ["*.xml", "ngi_sa_stream", "/audio/lowlevelaudio/internal/sa_stream/group/"],
  1.2480 +  				 
  1.2481 +  				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_antitearing/group/"],
  1.2482 +  				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_colortranslation/group/"],
  1.2483 +  				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_createfb565/group/"],
  1.2484 +  				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_createfb888/group/"],
  1.2485 +  				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_heapusage/group/"],
  1.2486 +  				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_multibb/group/"],
  1.2487 +  				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_performance/group/"],
  1.2488 +           ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_plswitching/group/"],
  1.2489 +           ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_misc/group/"],
  1.2490 +  				 ["*.xml", "ngi_sa_bitmap", "/graphics/bitmap/internal/sa_bitmap/group/"],
  1.2491 +  				 ["*.xml", "ngi_sa_camera", "/graphics/camera/internal/sa_camera/group/"],
  1.2492 +  				 ["*.xml", "ngi_sa_images", "/graphics/images/internal/sa_images/group/"],
  1.2493 +  				 ["*.xml", "ngi_sa_display", "/graphics/display/internal/sa_display/group/"],
  1.2494 +  				 ["*.xml", "ngi_sa_lights", "/graphics/lights/internal/sa_lights/group/"],
  1.2495 +  				 ["*.xml", "ngi_sa_videoplayback", "/graphics/video/internal/sa_videoplayback/group/"],
  1.2496 +  				 
  1.2497 +  				 ["*.xml", "ngi_sa_input", "/input/input/internal/sa_input/group/"],
  1.2498 +  				 ["*.xml", "ngi_sa_textinput", "/input/textinput/internal/sa_textinput/group/"],
  1.2499 +  				 ["*.xml", "ngi_sa_devicecapabilities", "/system/devicecapabilities/internal/sa_devicecapabilities/group/"],
  1.2500 +  				 ["*.xml", "ngi_sa_devicestatus", "/system/devicestatus/internal/sa_phone/group/"],
  1.2501 +  				 ["*.xml", "ngi_sa_runtimetester", "/system/runtime/internal/sa_runtimetester/group/"],
  1.2502 +  				 ["*.xml", "ngi_sa_timing", "/timing/internal/sa_timing/group/"],
  1.2503 +	  				 );
  1.2504 +
  1.2505 +	
  1.2506 +	my $fname;
  1.2507 +	my $moduleDst;
  1.2508 +	my $location;
  1.2509 +	
  1.2510 +	#now copy the files appropriately
  1.2511 +	foreach my $ref(@list)
  1.2512 +	{
  1.2513 +			my @inarr = @$ref;
  1.2514 +			($fname, $moduleDst, $location) = @inarr;
  1.2515 +			my $src = GetPathPrefix().$location.$fname;
  1.2516 +			my $dst = $ATSRoot."\\components\\$moduleDst";
  1.2517 +			
  1.2518 +			#print "My src is $src\n";
  1.2519 +			#print "My dst is $dst\n";
  1.2520 +			  		
  1.2521 +  		my @filesFound = glob($src);
  1.2522 +  		if(scalar @filesFound == 0)
  1.2523 +  		{
  1.2524 +  			warn("warning: no xml file found to copy from $src!");
  1.2525 +  		}
  1.2526 +  		foreach my $file(@filesFound)
  1.2527 +  		{
  1.2528 +  			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
  1.2529 +  		}
  1.2530 +  	}#ref
  1.2531 +    	
  1.2532 +}#fn
  1.2533 +
  1.2534 +
  1.2535 +sub GenNgiTest()
  1.2536 +{
  1.2537 +
  1.2538 +	my @datList = 
  1.2539 +	(
  1.2540 +	["ngi", "sa_amrrecording", ".dll"],
  1.2541 +	["ngi", "sa_highlevelaudio", ".dll"],
  1.2542 +	["ngi", "sa_audiomixing", ".dll"],
  1.2543 +	["ngi", "sa_audiorecording", ".dll"],
  1.2544 +	["ngi", "sa_clip", ".dll"],
  1.2545 +	["ngi", "sa_lowlevelaudio", ".dll"],
  1.2546 +	["ngi", "sa_stream", ".dll"],
  1.2547 +	["ngi", "sa_bitmap", ".dll"],
  1.2548 +	["ngi", "sa_camera", ".dll"],
  1.2549 +	["ngi", "sa_images", ".dll"],
  1.2550 +	["ngi", "sa_display", ".dll"],
  1.2551 +	["ngi", "sa_lights", ".dll"],	
  1.2552 +	["ngi", "sa_videoplayback", ".dll"],	
  1.2553 +	["ngi", "sa_input", ".dll"],	
  1.2554 +	["ngi", "sa_textinput", ".dll"],
  1.2555 +	["ngi", "sa_devicecapabilities", ".dll"],	
  1.2556 +	["ngi", "sa_devicestatus", ".dll"],	
  1.2557 +	["ngi", "sa_runtimetester", ".dll"],	
  1.2558 +	["ngi", "sa_timing", ".dll"],	
  1.2559 +		
  1.2560 +	);
  1.2561 +	
  1.2562 +	mkdir $ATSRoot;
  1.2563 +	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
  1.2564 +
  1.2565 +		
  1.2566 +	my $lib;
  1.2567 +	my $module;
  1.2568 +	my $ext;
  1.2569 +	foreach my $ref(@datList)
  1.2570 +	{
  1.2571 +			my @inarr = @$ref;
  1.2572 +			($lib, $module,$ext) = @inarr;
  1.2573 +			@generatedModules = ($module);
  1.2574 +			GenDirs($lib);
  1.2575 +			CopyDlls($lib,$ext);
  1.2576 +	}
  1.2577 +	
  1.2578 +   @generatedModules =("sa_backbuffer");
  1.2579 +   GenDirs($lib);
  1.2580 +   @dllList = 
  1.2581 +   (
  1.2582 +   	"sa_bb_antitearing.dll",
  1.2583 +   	"sa_bb_colortranslation.dll",
  1.2584 +   	"sa_bb_createfb444.dll",
  1.2585 +   	"sa_bb_createfb565.dll",
  1.2586 +   	"sa_bb_createfb888.dll",
  1.2587 +   	"sa_bb_misc.dll",
  1.2588 +   	"sa_bb_heapusage.dll",
  1.2589 +   	"sa_bb_multibb.dll",
  1.2590 +   	"sa_bb_performance.dll",
  1.2591 +   	"sa_bb_plswitch.dll",
  1.2592 +   	"sa_bb_testenv.dll"
  1.2593 +   );
  1.2594 +   CopyMultiDlls("ngi");
  1.2595 +
  1.2596 +	
  1.2597 + 	mkdir  $ATSRoot."\\components\\shared" || die("Wouldn't make shared folder in $ATSRoot\\components");
  1.2598 +  mkdir  $ATSRoot."\\components\\shared\\winscw_udeb" || die("Wouldn't make shared folder in $ATSRoot\\components\winscw_udeb");
  1.2599 +  mkdir  $ATSRoot."\\components\\shared\\armv5_urel" || die("Wouldn't make shared folder in $ATSRoot\\components\armv5_urel");
  1.2600 +			
  1.2601 +}#fn
  1.2602 +
  1.2603 +
  1.2604 +sub GetXmls()
  1.2605 +{
  1.2606 +  my @foundList;
  1.2607 +  my $libname = shift @_;
  1.2608 +	my @globlist = ();
  1.2609 +	if($target eq "winsspd" && $sdkversion ne "")
  1.2610 +	{
  1.2611 +		@globlist = ("winsspd_".$sdkversion);
  1.2612 +		#print "winsspd ".$sdkversion." selected\n";
  1.2613 +	}
  1.2614 +	elsif($target eq "winsspd")
  1.2615 +	{
  1.2616 +		@globlist = ("winsspd");
  1.2617 +		#print "winsspd selected\n";
  1.2618 +	}
  1.2619 +	elsif($sdkversion ne "")
  1.2620 +	{
  1.2621 +		@globlist = ($target,"hw_".$sdkversion);
  1.2622 +		#print "$target $sdkversion selected\n";
  1.2623 +	}
  1.2624 +	else
  1.2625 +	{
  1.2626 +		@globlist = ($target,"hw");
  1.2627 +		#print "$target $sdkversion selected\n";
  1.2628 +	}
  1.2629 +	
  1.2630 +	foreach my $module(@generatedModules)
  1.2631 +	{
  1.2632 +	  my $glob_to_use = "";
  1.2633 +	  my @fileList;
  1.2634 +	  foreach my $glob(@globlist)
  1.2635 +	  {
  1.2636 +			my $src = $ATSRoot."/components/".$libname."_"."$module/*.xml";
  1.2637 +			#print "Analysing $module and  $glob\n";
  1.2638 +			@fileList = glob($src);
  1.2639 +			foreach my $file(@fileList)
  1.2640 +			{
  1.2641 +			 my $pat = $glob."\_component\.xml";
  1.2642 +			 #print "[$file - $glob"."_component.xml"."]\n";
  1.2643 +				if($file =~ /$pat/)
  1.2644 +				{
  1.2645 +					$glob_to_use = $pat;
  1.2646 +					#print "[$file - $glob"."_component.xml"."]\n";
  1.2647 +					last
  1.2648 +				}
  1.2649 +			}#foreach FILE
  1.2650 +			if($glob_to_use ne "")
  1.2651 +			{
  1.2652 +				last;
  1.2653 +			}
  1.2654 +		}#finding glob	
  1.2655 +		if($glob_to_use ne "")
  1.2656 +		{
  1.2657 +				#print "Using the glob $glob_to_use\n";
  1.2658 +				my $src = $ATSRoot."/components/".$libname."_"."$module/*.xml";
  1.2659 +				@fileList = glob($src);
  1.2660 +				foreach my $file(@fileList)
  1.2661 +				{
  1.2662 +					#print "[$file - $glob_to_use]\n";
  1.2663 +					if($file =~ /$glob_to_use/)
  1.2664 +					{
  1.2665 +				  	$file =~ /.*components[\\\/](.*)/;
  1.2666 +				  	my $value = $1;
  1.2667 +				  	$value =~ s/\//\\/g;
  1.2668 +				  	#print "adding $value for $module with $glob_to_use\n";
  1.2669 +						unshift @foundList,$value;
  1.2670 +				  }#if
  1.2671 +				}#foreach
  1.2672 +		}#glob is present
  1.2673 +		else
  1.2674 +		{
  1.2675 +			warn("Unable to figure out glob to use for $module. Skipping...\n");
  1.2676 +		}
  1.2677 +	}#each module
  1.2678 +  return @foundList;
  1.2679 + }#fn
  1.2680 +
  1.2681 +__END__
  1.2682 +:end
  1.2683 +
  1.2684 +
  1.2685 +
  1.2686 +