tsrc/data/genatsmodules_testing.bat
changeset 0 14df0fbfcc4e
equal deleted inserted replaced
-1:000000000000 0:14df0fbfcc4e
       
     1 rem
       
     2 rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 rem All rights reserved.
       
     4 rem This component and the accompanying materials are made available
       
     5 rem under the terms of the License "Eclipse Public License v1.0"
       
     6 rem which accompanies this distribution, and is available
       
     7 rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 rem
       
     9 rem Initial Contributors:
       
    10 rem Nokia Corporation - initial contribution.
       
    11 rem
       
    12 rem Contributors:
       
    13 rem
       
    14 rem Description: 
       
    15 rem
       
    16 
       
    17 @perl -x GenATSModules_testing.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 
       
    18 @goto end
       
    19 
       
    20 #!perl
       
    21 use strict;
       
    22 use File::Find;
       
    23 use File::Copy;
       
    24 use Cwd;
       
    25 
       
    26 
       
    27 my $target = "winsspd";
       
    28 my $suite;
       
    29 my $install = "no";
       
    30 my $session = "no";
       
    31 my $combinedSession = "no";
       
    32 my $sdkversion="";
       
    33 my $noXmlsGenList = "play_new";
       
    34 
       
    35 my %DirHash;
       
    36 
       
    37 my $sendEmail = "no";
       
    38 my $rootDrive = substr(getcwd(), 0,2);
       
    39 my $templateRoot = getcwd();
       
    40 my	$ATSRoot = getcwd()."\\ATSINPUT";
       
    41 
       
    42 if($ENV{'ATS_SETUP'}  ne "")
       
    43 {
       
    44  $sendEmail = "yes";
       
    45  $rootDrive = $ENV{'ATS_INDRIVE'};
       
    46  $templateRoot = $ENV{'ATS_TEMPLATEROOT'};
       
    47  $ATSRoot = $ENV{'ATS_ATSOUTDRIVE'};
       
    48 }
       
    49 
       
    50 
       
    51 if(scalar @ARGV ==0 || $ARGV[0] =~ /[\-\\\/][h\?]/ || $ARGV[0] =~ /help/ )
       
    52 {
       
    53 	print <<EOHelp;
       
    54 genatsmodules.bat - hardcoded script to generate ATSINPUT folders for mobileruntime and ngi projects	
       
    55 Usage:
       
    56 	genatsmodules.bat
       
    57 		Create ATSINPUT for the default testsuite based on 
       
    58 		location it is executed from place in stdlibs/internal 
       
    59 		and run and it generates ATSINPUT for stdlibs
       
    60 		similiarly place it in ssl/internal or glib/internal or 
       
    61     ngi/internal and run to generate  ATSINPUT for ssl, glib  
       
    62     and ngi respectively	
       
    63   
       
    64   genatsmodules [libname]
       
    65 			where libname can be stdlibs, ssl, glib, etc. Creates 
       
    66 			ats test drop for given library. Valid from any internal
       
    67 			folder of mobileruntime.
       
    68 			
       
    69   
       
    70   genatsmodules ngi
       
    71 			create ngi testsuite. Valid inside ngi/internal only
       
    72 			
       
    73 genatsmodules play_new
       
    74 			create play_new testsuite. Valid inside play_new/internal only
       
    75 				
       
    76 	
       
    77       
       
    78 	genatsmodules ltp
       
    79 			create ltp testsuite. Valid inside stdlibs/internal only
       
    80 	
       
    81 	genatsmodules lsb
       
    82 			create lsb testsuite. Valid inside stdlibs/internal only
       
    83 			
       
    84 	genatsmodules stdcpp
       
    85 			create stdcpp testsuite. Valid inside stdcpp/internal only
       
    86 			
       
    87 	genatsmodules [libname] install 
       
    88 		 where libname can be stdlibs, ssl, glib, ltp, lsb to create a 
       
    89 		 ATSINPUT where the dependent mobileruntime libraries are also 
       
    90 		 copied and used (It copies the dependent libraries using the 
       
    91 		 ATS component files)
       
    92 		
       
    93 	genatsmodules session [libname] [target] 		
       
    94 		where libname is any of the standard libs as shown above and 
       
    95 		target can be winsspd, winscw, scarfe, zeus etc. to create 
       
    96 		session files for scarfe, winsspd etc. 
       
    97 		
       
    98 genatsmodules session combined [target] 				
       
    99       will look at the existing ATSINPUT(which can have any 
       
   100       combination of created components and create a combined 
       
   101       session file. This way you get increased flexibility in 
       
   102       the libraries you choose to combine into a single session 
       
   103       file. If the target is a hardware target(that is not winsspd
       
   104       or winscw), the script will first attempt to find a target 
       
   105       specific component file and if not found, the generic hw 
       
   106       component file. 
       
   107 	
       
   108 
       
   109 	Note:
       
   110 	ATSINPUT creation is a 2 stage process. First we create 
       
   111 	the components and then we run (for example) 
       
   112 	"genatsmodules session stdlibs winscw" and 
       
   113 	"genatsmodules session stdlibs scarfe" to create the 
       
   114 	session files.
       
   115 EOHelp
       
   116 		exit();
       
   117 }
       
   118 my $do_armv5 = 1;
       
   119 my $do_winscw = 1;
       
   120 
       
   121 if(scalar @ARGV == 1)
       
   122 {
       
   123 	if($ARGV[0] eq "session")
       
   124 	{
       
   125 		die("parameter session must be followed by libname and target platform");
       
   126 	}
       
   127 	else
       
   128 	{
       
   129 		$suite = $ARGV[0];
       
   130 	}
       
   131 }
       
   132 elsif(scalar @ARGV == 2)
       
   133 {
       
   134 	if($ARGV[0] eq  "session")
       
   135 	{
       
   136 		die("parameter session must be followed by libname and target platform");
       
   137 	}
       
   138 	elsif($ARGV[1] eq "install")
       
   139 	{
       
   140 		$suite = $ARGV[0];
       
   141 		$install = "yes";
       
   142 	}
       
   143 	elsif($ARGV[1] eq "armv5")
       
   144 	{
       
   145 		$do_winscw = 0;
       
   146 	}
       
   147 	elsif($ARGV[1] eq "winscw")
       
   148 	{
       
   149 		$do_armv5 = 0; 
       
   150 	}
       
   151 	else
       
   152 	{
       
   153 		die("second parameter after target platform $ARGV[0] can only be \"install\" ");
       
   154 	}
       
   155 }
       
   156 elsif(scalar @ARGV == 3)
       
   157 {
       
   158 		if($ARGV[0] ne "session")
       
   159 		{
       
   160 			die("invalid combination of parameters. Program expected 1st parameter to be \"session\" ");
       
   161 		}
       
   162 		else
       
   163 		{
       
   164 			$session = "yes";
       
   165 			$suite = $ARGV[1];
       
   166 			$target = $ARGV[2];
       
   167 	
       
   168 			if($suite eq "combined")
       
   169 			{		
       
   170 				$combinedSession = "yes";
       
   171 	  	}
       
   172 			
       
   173 		}
       
   174 }
       
   175 elsif(scalar @ARGV == 4)
       
   176 {
       
   177 		if($ARGV[0] ne "session")
       
   178 		{
       
   179 			die("invalid combination of parameters. Program expected 1st parameter to be \"session\" ");
       
   180 		}
       
   181 		else
       
   182 		{
       
   183 			$session = "yes";
       
   184 			$suite = $ARGV[1];
       
   185 			$target = $ARGV[2];
       
   186 			$sdkversion = $ARGV[3];
       
   187 			if($suite eq "combined")
       
   188 			{		
       
   189 				$combinedSession = "yes";
       
   190 	  	}
       
   191 		}
       
   192 }
       
   193 else
       
   194 {
       
   195 		die("program recieved too many parameters!");
       
   196 }#end of commandline processing
       
   197 
       
   198 
       
   199 	
       
   200 if( 0 )
       
   201 {
       
   202 	die("Please run the script from the appropriate internal folder in the mobileruntime /omerta project!!");
       
   203 }
       
   204 else
       
   205 {
       
   206 
       
   207 	 my $srcPrefix = getcwd();
       
   208 	 $srcPrefix =~ /(.*)internal.*/;
       
   209 	 $srcPrefix = $1;
       
   210 	 if(rindex($templateRoot, "stdlibs") != -1)
       
   211 	 {
       
   212 	 	$srcPrefix =~ /(.*)stdlibs.*/;
       
   213 	 	$srcPrefix = $1;
       
   214 	 	
       
   215 	 	if($suite eq "glib")
       
   216 	 	{
       
   217 	 		$templateRoot = $srcPrefix."/glib/internal/";
       
   218 	 	}
       
   219 	 	elsif($suite eq "ssl")
       
   220 	 	{
       
   221 	 		$templateRoot = $srcPrefix."/ssl/internal/";
       
   222 	 	}
       
   223 	 	elsif($suite eq "ngi" && $session ne "yes")
       
   224 	 	{
       
   225 	 		print "ngi atsinput creation not supported from mobileruntime\n";
       
   226 	 		exit();
       
   227 	 	}
       
   228 	 }
       
   229 	 
       
   230 	if(rindex($templateRoot, "glib") != -1)
       
   231 	{
       
   232 		$suite = "glib";
       
   233 	}
       
   234 	elsif(rindex($templateRoot, "ssl") != -1)
       
   235 	{
       
   236 		$suite = "ssl";
       
   237 	}
       
   238 	elsif(rindex($templateRoot, "ngi") != -1)
       
   239 	{
       
   240 		$suite = "ngi";
       
   241 	}
       
   242 }
       
   243 
       
   244 
       
   245 my $optsGroupPath = $templateRoot."/ts/ltp/opts/group/";
       
   246 #$optsGroupPath = getcwd()."/ts/ltp/opts/group/";
       
   247 my $ltpPath =$templateRoot."/ts/ltp/";
       
   248 my $stdcppPath =$templateRoot."/testapps/stlport/";
       
   249 my @stdexeList = ("tstdcpp","stdcxx/tstapps");
       
   250 #my $gnuPath =getcwd()."/testapps/gnu/";
       
   251 #my $tstdcppPath =getcwd()."/testapps/tstdcpp/";
       
   252 
       
   253 
       
   254 my @generatedModules;
       
   255 my %cfglocation;
       
   256 
       
   257 my $TDIR = "\\internal\\testapps\\";
       
   258 
       
   259 my @libcModules = ( "libc_loc_blr",  "libc_time_blr", "libc_db_blr","tctype", "tifioctls", "tinet",
       
   260                       "tlibcwchar", "tlink", "tmkfifo", "tmmap", "tmsgqueue",
       
   261 		      "tnetdb", "tpipe","tregex", "tsemaphore", "tshm","tsocket" ,
       
   262 		      "tstdio", "tstdlib", "tstring", "tsyscalls",
       
   263 		      "tsyssim", "twctype", "tselect", "tsysunistd", "twideapis", "twopen", "twchar",
       
   264 		      "twcharapi",
       
   265                );
       
   266 
       
   267 my @libdlModules = ("tlibdl");
       
   268 my @libmModules = ("libm_double_blr", "libm_float_blr","libm_ldouble_blr");
       
   269 
       
   270 
       
   271 my @pthreadModules = ( "testcondbroadcast", "testconddestroy", "testcondinit", "testcondsignal", "testcondtimedwait", "testcondwait",
       
   272 "tmutex", "tpthread", "testpthreadonce", "testsemclose", "testsemdestroy", "testsemgetvalue", "testseminit", "testsemopen", "testsempost",
       
   273 "testsemtimedwait", "testsemtrywait", "testsemunlink", "testsemwait");
       
   274 
       
   275 
       
   276 my @stdliblist = ( "libc", "libpthread", "libdl", "libm", "libz", "libcrypt");
       
   277 my @dllList = ("backend.dll", "libc.dll", "LibCIpcClient.dll", "LibCIpcServer.exe", "libdl.dll", "libm.dll", "libpthread.dll", "libcrypt.dll", "libz.dll", "libclogger.dll");
       
   278 
       
   279 
       
   280 my @stdcpplist = (
       
   281   				 ["fstream1_input.txt", "stlport_fstream", "/../internal/testapps/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
       
   282   				 ["nextperm1_good.txt", "stlport_nextprm", "/../internal/testapps/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
       
   283   				 ["nextperm2_good.txt", "stlport_nextprm", "/../internal/testapps/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
       
   284   				 ["ostmit_good.txt", "stlport_ostmit", "/../internal/testapps/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
       
   285   				 ["seek.txt", "stlport_seek", "/../internal/testapps/doc/", "/General/", "C:\\TestFramework\\tstdcpp"],
       
   286 );
       
   287 
       
   288 my @gliblist = (
       
   289   				 ["1.gmarkup", "markup_test", "/epoc32/winscw/c/", "/General/", "C:"],
       
   290    				 ["1.gmarkup", "markup-test", "/epoc32/winscw/c/", "/General/", "C:"],
       
   291   				 ["iochannel-test-infile", "iochannel_test",  "/epoc32/winscw/c/", "/General/", "C:"],
       
   292   				 ["iochannel-test-infile", "iochannel-test",  "/epoc32/winscw/c/", "/General/", "C:"],
       
   293 #  				 ["casemap.bin",  "unicode-caseconv",  "/epoc32/winscw/c/", "/General/", "C:"],
       
   294 #  				 ["casefold.bin", "unicode-caseconv",  "/epoc32/winscw/c/", "/General/", "C:"],
       
   295   				 ["utf8.txt", "unicode-encoding","/epoc32/winscw/c/", "/General/", "C:"],
       
   296   				 ["casecollate.txt", "unicode-collate","/epoc32/winscw/c/", "/General/", "C:"],
       
   297   				 ["utf8_hindi.txt", "tutf8","/epoc32/winscw/c/", "/General/", "C:"],
       
   298   				 ["scanfile.txt", "tscanner","/epoc32/winscw/c/", "/General/", "C:"],
       
   299   				 ["test.txt", "dir_test","/epoc32/winscw/c/temp/tmp/", "/General/", "C:\\temp\\tmp"],
       
   300   				 ["NormalizationTest.txt", "unicode-normalize","/epoc32/winscw/c/", "/General/", "C:"],
       
   301   				 
       
   302   				 ["helloworld.exe", "spawn_test","/epoc32/release/armv5/urel/", "/armv5_urel/", "C:\\sys\\bin"],
       
   303   				 ["helloworld.exe", "spawn_test","/epoc32/release/winscw/udeb/", "/winscw_udeb/", "Z:\\sys\\bin"],
       
   304   				 
       
   305   				 ["libmoduletestplugin_a.dll", "module-test","/epoc32/release/armv5/urel/", "/armv5_urel/", "C:\\sys\\bin"],
       
   306   				 ["libmoduletestplugin_a.dll", "module-test","/epoc32/release/winscw/udeb/", "/winscw_udeb/", "Z:\\sys\\bin"],
       
   307   				 
       
   308   				 ["libmoduletestplugin_b.dll", "module-test","/epoc32/release/armv5/urel/", "/armv5_urel/", "C:\\sys\\bin"],
       
   309   				 ["libmoduletestplugin_b.dll", "module-test","/epoc32/release/winscw/udeb/", "/winscw_udeb/", "Z:\\sys\\bin"],
       
   310   				 
       
   311   			  				 
       
   312   				 );
       
   313   				 
       
   314 my @ngilist = (
       
   315            ["Test.txt", "ngi_sa_runtimetester", "/EPOC32/winscw/c/Private/10202be9/", "/General/", ""],
       
   316   				 ["sa_input_repository.txt", "shared","/EPOC32/armv5/c/TestFramework/", "/armv5_urel/", ""],
       
   317   				 ["sa_input_repository.txt", "shared","/EPOC32/winscw/c/TestFramework/", "/winscw_udeb/", ""],
       
   318   				 ["audiomixingfiles.ini", "ngi_sa_audiomixing","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
       
   319   				 ["sa_camera_supported.ini", "ngi_sa_camera","/EPOC32/armv5/c/TestFramework/", "/general/", ""],
       
   320   				 ["sa_clip.ini", "ngi_sa_clip","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
       
   321   				 ["devicecapabilitiesdata.ini", "ngi_sa_devicecapabilities","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
       
   322    				 ["highlevelaudiofiles.ini", "ngi_sa_highlevelaudio","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
       
   323 					 ["lowlevelaudiofiles.ini", "ngi_sa_lowlevelaudio","/EPOC32/winscw/c/TestFramework/", "/general/", ""],
       
   324 					 ["runtimedata.ini", "ngi_sa_runtimetester","/EPOC32/winscw/c/TestFramework/", "/general/", ""],						
       
   325 					 ["sa_stream.ini", "ngi_sa_stream","/EPOC32/winscw/c/TestFramework/", "/general/", ""],						
       
   326 					 #["*", "ngi_sa_videoplayback","/../graphics/video/internal/sa_videoplayback/data/", "/general/", ""],
       
   327 					 ["test.*", "ngi_sa_images","/Epoc32/winscw/c/Data/", "/general/", ""]
       
   328 					);
       
   329 
       
   330   				 
       
   331 
       
   332 
       
   333 my $validexpansions = "all stdlibs combined";
       
   334 my $validLibraries = "ltp opts lsb glib ssl ngi pcts stdcpp gcce libc-locale play_new phall sapi";
       
   335 if(rindex($validexpansions, $suite)== -1 && rindex($validLibraries, $suite) == -1)
       
   336 {
       
   337 	die("$suite is not a valid library. Valid options are $validexpansions $validLibraries");
       
   338 }
       
   339 
       
   340 my $dontStrip = 1;
       
   341 my	@liblist;
       
   342 if($suite eq "all")
       
   343 {
       
   344 		@liblist = split " ", $validLibraries;
       
   345 		@liblist = (@liblist, @stdliblist);
       
   346 		
       
   347 }#suite all
       
   348 elsif($suite eq "ltp")
       
   349 {
       
   350 	 @liblist = ("ltp", "opts");
       
   351 }
       
   352 elsif($suite eq "stdlibs")
       
   353 {
       
   354 		@liblist = @stdliblist;
       
   355 }
       
   356 elsif($suite eq "ssl")
       
   357 {
       
   358 	@liblist = ("libcrypto", "libssl");
       
   359 }
       
   360 else
       
   361 {
       
   362 		@liblist = ("$suite");
       
   363 }
       
   364 
       
   365 #	foreach my $l(@liblist)
       
   366 #	{
       
   367 #			print "$l was there\n";
       
   368 #	}
       
   369 
       
   370 
       
   371 if($combinedSession eq "yes")
       
   372 {
       
   373 	GenerateSessionFile("combined", $target,"combined");
       
   374 	exit();
       
   375 }
       
   376 
       
   377 if($session eq "yes")
       
   378 {
       
   379 	my $file = $templateRoot."/testsession.xml";
       
   380 	opendir(DIRHANDLE, $ATSRoot) || die("Please try to create Session files only after ATSINPUT/components has been created!");
       
   381 	closedir(DIRHANDLE);
       
   382 	$dontStrip = 1;
       
   383 	
       
   384 	if($suite eq "stdlibs")
       
   385 	{
       
   386 		#my $dst = $ATSRoot."/$suite"."_testsession.xml";
       
   387 		#copy($file, $dst);
       
   388 		GenerateSessionFile("combined",$target,$suite);
       
   389 		exit();
       
   390 	}
       
   391 	elsif($suite eq "ssl")
       
   392 	{
       
   393 		my @componentFiles = GetSslXmls();
       
   394 		GenerateSessionFile("combined",$target,$suite,\@componentFiles);
       
   395 		exit();
       
   396 	}
       
   397 	else
       
   398 	{
       
   399 		@generatedModules = GenGenModules($suite);
       
   400 		my @componentFiles = GetXmls($suite);
       
   401 		GenerateSessionFile("combined",$target,$suite,\@componentFiles);
       
   402 		exit();
       
   403 	}
       
   404 	foreach my $lib(@liblist)
       
   405 	{          
       
   406 			@generatedModules = GenGenModules($lib);
       
   407 			if(scalar @generatedModules != 0)
       
   408 			{
       
   409 				#print "Generating for $lib\n";
       
   410 				GenerateSessionFile($lib, $target,$lib);
       
   411 			}
       
   412 	}
       
   413 	
       
   414 	#@generatedModules = GetAllModules();
       
   415 	#if(scalar @generatedModules != 0)
       
   416 	#{
       
   417 	#		GenerateSessionFile("combined",$target, "combined");
       
   418 	#}
       
   419 	exit();
       
   420 }#session generation code
       
   421 
       
   422 
       
   423 if ($suite eq "ltp" || $suite eq "all")
       
   424 {
       
   425 	my @ltpModules = GetLtpModules();
       
   426 	@generatedModules = @ltpModules;
       
   427 	DoGen("ltp", ".dll");
       
   428 	CopyLtpCfg("ltp");
       
   429 	
       
   430 	
       
   431 	my @saved = @dllList;
       
   432 	@dllList = ("ltplib.dll");
       
   433 	CopySharedDlls("ltp", \@dllList);
       
   434 	TransformXmls("ltp","shared");
       
   435 	@dllList = @saved;
       
   436 	
       
   437 	@generatedModules = GetCompiledModules($optsGroupPath."/bld.inf");
       
   438 	DoGen("opts",".dll");
       
   439 
       
   440 }
       
   441 if ($suite eq "glib")
       
   442 {
       
   443 	my $bldfile = $templateRoot."/testapps/group/bld.inf";
       
   444 	my @glibModules = GetCompiledModules($bldfile);
       
   445 	@generatedModules = @glibModules;
       
   446 	DoGen("glib",".exe");
       
   447 	my $gDataRef = \@gliblist;
       
   448 	CopyArbitDatFiles("glib",$gDataRef);
       
   449 	
       
   450 	if($install eq "yes")
       
   451 	{
       
   452 		my @saved = @dllList;
       
   453 		my @glib2dllList = ("glibbackend.dll", "Libgobject.dll", "libgmodule.dll", "libgthread.dll",
       
   454                 "libglib.dll");
       
   455                 
       
   456    my  @glib1List = ( "libgobject.dll", "libgmodule.dll", "libgthread.dll",  "libglib.dll", );
       
   457   @dllList = @glib2dllList;
       
   458   CopySharedDlls("glib",\@dllList);     	
       
   459   TransformXmls("glib", "shared");
       
   460    	
       
   461 		@dllList = @saved;
       
   462 	}#if install
       
   463 }#glib
       
   464 
       
   465 if ($suite eq "phall")
       
   466 {
       
   467 	my $bldfile = getcwd()."/group/bld.inf";
       
   468 	my @hallModules = GetCompiledModules($bldfile);
       
   469 	@generatedModules = @hallModules;
       
   470 	DoGen($suite,".exe");
       
   471 	#my $gDataRef = \@gliblist;
       
   472 	#CopyArbitDatFiles("glib",$gDataRef);
       
   473 	
       
   474 	if($install eq "yes")
       
   475 	{
       
   476 		my @saved = @dllList;
       
   477                 
       
   478    my  @phallList = ( "libstdcpp.dll" );
       
   479    @dllList = @phallList;
       
   480    CopySharedDlls($suite,\@dllList);     	
       
   481    TransformXmls($suite, "shared");
       
   482    @dllList = @saved;
       
   483    exit;
       
   484 	}#if install
       
   485 }#phall
       
   486 
       
   487 if ($suite eq "ssl")
       
   488 {
       
   489 	my $stripStatus = $dontStrip;
       
   490 	$dontStrip = 0;
       
   491 	GenCryptoTest();
       
   492 	if($install eq "yes")
       
   493 	{
       
   494 		@dllList = (@dllList, "libcrypto.dll", "libssl.dll");   
       
   495 	}#if install
       
   496 	$dontStrip = $stripStatus;
       
   497 }#ssl
       
   498 
       
   499 if($suite eq "ngi")
       
   500 {
       
   501 
       
   502 	GenNgiTest();
       
   503 	CopyNgiXmls();
       
   504 	CopyArbitDatFiles("",\@ngilist);
       
   505 
       
   506 }
       
   507 
       
   508 if($suite eq "play_new")
       
   509 {
       
   510 	my @play_newModules = ("fonttestmodule", "messagingtestmodule","locationtestmodule", "alertstestmodule", 
       
   511 	"libxmlstiff","ngisvgtestmodule");
       
   512 	@generatedModules = @play_newModules;
       
   513 	DoGen("play_new",".dll");
       
   514 	
       
   515 	 my @list = (
       
   516   				 			 ["*.cfg", "fonttestmodule", "/../fonts/internal/testmodules/fonttestmodule/group/","/General/", ""],
       
   517 	 				 			 ["*.xml", "fonttestmodule", "/../fonts/internal/testmodules/fonttestmodule/group/","/", ""],
       
   518 	 				 			 
       
   519 	 				 			 ["*.cfg", "messagingtestmodule", "/../ngimessaging/internal/testmodules/messagingtestmodule/group/","/General/", ""],
       
   520 	 				 			 ["*.xml", "messagingtestmodule", "/../ngimessaging/internal/testmodules/messagingtestmodule/group/","/", ""],
       
   521 	 				 			 ["*", "messagingtestmodule", "/EPOC32/winscw/c/messagingtestmodule/","/General/", ""],
       
   522 	 				 			 
       
   523 	 				 			 ["*.cfg", "locationtestmodule", "/../ngilocation/internal/testmodules/locationtestmodule/group/","/General/", ""],
       
   524 	 				 			 ["*.xml", "locationtestmodule", "/../ngilocation/internal/testmodules/locationtestmodule/group/","/", ""],
       
   525 	 				 			 
       
   526 	 				 			 ["*.cfg", "alertstestmodule", "/../ngialerts/internal/testmodules/alertstestmodule/group/","/General/", ""],
       
   527 								 ["*.xml", "alertstestmodule", "/../ngialerts/internal/testmodules/alertstestmodule/group/","/", ""],	 				 			 
       
   528 								 ["vertigo.wav", "alertstestmodule", "/Epoc32/winscw/c/alertstestmodule/","/General/", ""],	 				 			 	 				 			 
       
   529 	 		
       
   530 	 			 			  ["*.cfg", "libxmlstiff", "/../libxmlpp/internal/group/","/General/", ""],
       
   531 	 		 	 			  ["*.xml", "libxmlstiff", "/../libxmlpp/internal/group/","/", ""],
       
   532 	 		 	 			  ["*.*", "libxmlstiff", "/../libxmlpp/internal/data/","/General/", ""],
       
   533 	 		 	 			  
       
   534 	 		 	 			  ["*.cfg", "ngisvgtestmodule", "/../ngisvg/internal/testmodules/ngisvgtestmodule/group/","/General/", ""],
       
   535    		 	 			  ["*.xml", "ngisvgtestmodule", "/../ngisvg/internal/testmodules/ngisvgtestmodule/group/","/", ""],
       
   536 	 		 	 			  ["*.*", "ngisvgtestmodule", "/epoc32/winscw/c/ngisvgtest/","/General/", ""],
       
   537 	 				 			 
       
   538   				 );
       
   539  
       
   540   my $bDataRef = \@list;  				 
       
   541 	CopyArbitDatFiles("play_new",$bDataRef);  				 
       
   542 	if($install eq "yes")
       
   543 	{
       
   544 		@generatedModules = GenGenModules("play_new");
       
   545 		my @saved = @dllList;
       
   546 		my @playList = (
       
   547 "ngifonts.dll",
       
   548 "ngimessaging.dll",
       
   549 "ngisvg.dll",
       
   550 "ngilocation.dll",
       
   551 "ngialerts.dll",
       
   552 "libstdcpp.dll",
       
   553 "libxmlpp.dll",
       
   554 "FeedsLibXml2xmlpp.dll");
       
   555        @dllList = @playList;
       
   556 		CopySharedDlls("play_new",\@dllList);     
       
   557 	  TransformXmls("play_new", "shared");
       
   558 		@dllList = @saved;
       
   559 
       
   560 	}#end install
       
   561 
       
   562 
       
   563 }
       
   564 
       
   565 if($suite eq "stdcpp")
       
   566 {
       
   567 	@generatedModules = GetstdcppModules();
       
   568 	DoGen("stdcpp",".dll");
       
   569 	CopyLtpCfg("stdcpp");
       
   570 	@generatedModules = GetstdexeModules();
       
   571 	DoGen("stdcpp",".exe");
       
   572 	
       
   573 	my @saved = @dllList;
       
   574 	@dllList = ("stdcxxtestengine.dll");
       
   575 	CopySharedDlls("stdcpp", \@dllList);
       
   576 	TransformXmls("stdcpp","shared");
       
   577 	@dllList = @saved;
       
   578 	
       
   579 	CopyArbitDatFiles("stdcpp",\@stdcpplist);
       
   580 	
       
   581 	if($install eq "yes")
       
   582 	{
       
   583 		@generatedModules = GenGenModules("stdcpp");
       
   584 		my @saved = @dllList;
       
   585 		my @cppList = ("libstdcpp.dll");
       
   586        @dllList = @cppList;
       
   587 		CopySharedDlls("stdcpp",\@dllList);     
       
   588 	  TransformXmls("stdcpp", "shared");
       
   589 		@dllList = @saved;
       
   590 		exit;
       
   591 	}#if install
       
   592 }
       
   593 
       
   594 if($suite eq "sapi")
       
   595 {
       
   596 	my @sapiexelist = 
       
   597 	(
       
   598 "negativehighresolution",
       
   599 "negativestopwostart",
       
   600 "negativeimagecancel",
       
   601 "negativemultiplestarts",
       
   602 "negativemultiplestops",
       
   603 "negativemultipletakes",
       
   604 "negativetakewostart",
       
   605 "noofframes",
       
   606 "positivenoimage",
       
   607 "positiveoneimage",
       
   608 "postivemultipleimages",
       
   609 "negativemultipleimages",
       
   610 "positivegifimageformat",
       
   611 "positivepngimageformat",
       
   612 "negativeimageformatnone",
       
   613 "negativezeroresolution",
       
   614 );
       
   615 	@generatedModules = @sapiexelist;
       
   616 	DoGen("sapi",".exe");
       
   617 	my @sapidlllist = 
       
   618 	(
       
   619 	"tContact_add",
       
   620 	"tContact_delete",
       
   621 	"tContact_edit",
       
   622 	"tContact_export",
       
   623 	"tContact_getlist",
       
   624 	"tContact_import",
       
   625 	"tContact_organise",
       
   626 	"tsapiloctest", 
       
   627 	"tsapiloctotest", 
       
   628 	"async_send_message", 
       
   629 	"change_status_message", 
       
   630 	"delete_message", 
       
   631 	"get_header_message", 
       
   632 	"send_message", 
       
   633 	"tsensorservice_test",
       
   634   "tsysbattery",
       
   635   "tsysconnectivity",
       
   636   "tsysdevice",
       
   637   "tsysdisplay",
       
   638 "tsysfeatures",
       
   639 "tsysgeneral",
       
   640 "tsysmemory",
       
   641 "tsysnetwork",
       
   642 "tloggingservicetest",
       
   643 "Tlogprovidertest",
       
   644 "tcal_add",
       
   645 "tcal_getlist",
       
   646 "tcal_update",
       
   647 "tcal_delete",
       
   648 "tcal_import",
       
   649 "tcal_export",
       
   650 "tcal_changenotify",
       
   651 "tcal_providertest",
       
   652 "tcalprovider_combined",
       
   653 "tappmgrtest",
       
   654 "tappmgrprovider",
       
   655   );
       
   656   
       
   657 	@generatedModules = @sapidlllist;
       
   658 	DoGen("sapi",".dll");
       
   659 	
       
   660 	my @mysapidependcies = 
       
   661 	(
       
   662 	#first the file to copy, next the test for which to copy, next is relative locate, 
       
   663 	#if cfg, General,
       
   664 	#last the location on the phone where the cfg should go
       
   665 	#for us c:\\TestFramework
       
   666 	["tsapiloctest.cfg", "tsapiloctest", "/..location/internal/testing/tsapiloctest/group/", "/General/", "C:\\TestFramework"],
       
   667 	["tsapiloctotest.cfg", "tsapiloctotest", "/..location/internal/testing/tsapiloctotest/group/", "/General/", "C:\\TestFramework"],
       
   668   ["async_send_message.cfg", "async_send_message", "/..messaging/internal/testing/tmessagingtest/async_send_message/group/", "/General/", "C:\\TestFramework"],
       
   669   ["change_status_message.cfg", "change_status_message", "/..messaging/internal/testing/tmessagingtest/change_status_message/group/", "/General/", "C:\\TestFramework"],
       
   670   ["delete_message.cfg", "delete_message", "/..messaging/internal/testing/tmessagingtest/delete_message/group/", "/General/", "C:\\TestFramework"],
       
   671   ["get_header_message.cfg", "get_header_message", "/..messaging/internal/testing/tmessagingtest/get_header_message/group/", "/General/", "C:\\TestFramework"],
       
   672   ["send_message.cfg", "send_message", "/..messaging/internal/testing/tmessagingtest/send_message/group/", "/General/", "C:\\TestFramework"],
       
   673   ["ant.jpg", "send_message", "/..messaging/internal/testing/data/", "/General/", "C:\\data\\Images"],
       
   674   ["ant.jpg", "async_send_message", "/..messaging/internal/testing/data/", "/General/", "C:\\data\\Images"],
       
   675   ["dhoom2whis192701.mp3", "send_message", "/..messaging/internal/testing/data/", "/General/", "C:\\data\\sounds\\digital"],
       
   676   ["dhoom2whis192701.mp3", "async_send_message", "/..messaging/internal/testing/data/", "/General/", "C:\\data\\sounds\\digital"],
       
   677   ["tContact_add.cfg", "tContact_add", "/../contacts_vpbk/internal/testing/tContact_add/group/", "/General/", "C:\\TestFramework"],
       
   678 	["tContact_delete.cfg", "tContact_delete", "/../contacts_vpbk/internal/testing/tContact_delete/group/", "/General/", "C:\\TestFramework"],
       
   679 	["tContact_edit.cfg", "tContact_edit", "/../contacts_vpbk/internal/testing/tContact_edit/group/", "/General/", "C:\\TestFramework"],
       
   680 	["tContact_export.cfg", "tContact_export", "/../contacts_vpbk/internal/testing/tContact_export/group/", "/General/", "C:\\TestFramework"],
       
   681 	["tContact_getlist.cfg", "tContact_getlist", "/../contacts_vpbk/internal/testing/tContact_getlist/group/", "/General/", "C:\\TestFramework"],
       
   682 	["tContact_import.cfg", "tContact_import", "/../contacts_vpbk/internal/testing/tContact_import/group/", "/General/", "C:\\TestFramework"],
       
   683 	["tContact_organise.cfg", "tContact_organise", "/../contacts_vpbk/internal/testing/tContact_organise/group/", "/General/", "C:\\TestFramework"],
       
   684 	["around.mp3", "tContact_add", "/..contacts_vpbk/internal/testing/group/data/sounds/digital/", "/General/", "c:\\data\\sounds\\digital"],	
       
   685 	["singlecontact.vcf", "tContact_export", "/..contacts_vpbk/internal/testing/group/data/exports/", "/General/", "c:\\data\\exports"],	
       
   686   ["cAgent.VCF", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   687   ["details.vcf", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   688   ["doublecontact.vcf", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   689   ["empty.vcf", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   690   ["HalfLine.VCF", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   691   ["mti.vcf", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   692   ["singlecontact1.vcf", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   693   ["singlecontact2.vcf", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   694   ["singlecontact.txt", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   695   ["singlecontact.vcf", "tContact_import", "/..contacts_vpbk/internal/testing/group/data/", "/General/", "c:\\data"],
       
   696   ["tsysbattery.cfg", "tsysbattery", "/..sysinfo/internal/testing/tsysbattery/group/", "/General/", "C:\\TestFramework"],
       
   697 	["tsysconnectivity.cfg", "tsysconnectivity", "/..sysinfo/internal/testing/tsysconnectivity/group/", "/General/", "C:\\TestFramework"],
       
   698 	["tsysdevice.cfg", "tsysdevice", "/..sysinfo/internal/testing/tsysdevice/group/", "/General/", "C:\\TestFramework"],
       
   699 	["tsysdisplay.cfg", "tsysdisplay", "/..sysinfo/internal/testing/tsysdisplay/group/", "/General/", "C:\\TestFramework"],
       
   700 	["tsysfeatures.cfg", "tsysfeatures", "/..sysinfo/internal/testing/tsysfeatures/group/", "/General/", "C:\\TestFramework"],
       
   701 	["tsysgeneral.cfg", "tsysgeneral", "/..sysinfo/internal/testing/tsysgeneral/group/", "/General/", "C:\\TestFramework"],
       
   702 	["tsysmemory.cfg", "tsysmemory", "/..sysinfo/internal/testing/tsysmemory/group/", "/General/", "C:\\TestFramework"],
       
   703 	["tsysnetwork.cfg", "tsysnetwork", "/..sysinfo/internal/testing/tsysnetwork/group/", "/General/", "C:\\TestFramework"],
       
   704 	["sysinfotest1.jpg", "tsysdisplay", "/..sysinfo/internal/testing/tsysdisplay/data/", "/General/", "c:\\data\\Images"],
       
   705 	["sysinfotest3.jpg", "tsysdisplay", "/..sysinfo/internal/testing/tsysdisplay/data/", "/General/", "c:\\data\\Images"],
       
   706 	["sysinfotest3.txt", "tsysdisplay", "/..sysinfo/internal/testing/tsysdisplay/data/", "/General/", "c:\\data\\Images"],
       
   707 	["tsensorservice_test.cfg", "tsensorservice_test", "/..sensor/internal/testing/tsensorservice_test/group/", "/General/", "C:\\TestFramework"],
       
   708 	["launch_app_test.jpg", "tcal_providertest", "/..calendar/internal/testing/tcalprovider_combined/data/", "/General/", "c:\\data\\Images"],
       
   709 	["tloggingservicetest.cfg", "tloggingservicetest", "/..logging/internal/testing/tloggingservicetest/group/", "/General/", "C:\\TestFramework"],
       
   710 	["Tlogprovidertest.cfg", "Tlogprovidertest", "/..logging/internal/testing/Tlogprovidertest/group/", "/General/", "C:\\TestFramework"],
       
   711 	["tcal_add.cfg", "tcal_add", "/..calendar/internal/testing/tcalendarservice/tcal_add/group/", "/General/", "C:\\TestFramework"],
       
   712 	["tcal_getlist.cfg", "tcal_getlist", "/..calendar/internal/testing/tcalendarservice/tcal_getlist/group/", "/General/", "C:\\TestFramework"],
       
   713 	["tcal_update.cfg", "tcal_update", "/..calendar/internal/testing/tcalendarservice/tcal_update/group/", "/General/", "C:\\TestFramework"],
       
   714 	["tcal_delete.cfg", "tcal_delete", "/..calendar/internal/testing/tcalendarservice/tcal_delete/group/", "/General/", "C:\\TestFramework"],
       
   715 	["tcal_import.cfg", "tcal_import", "/..calendar/internal/testing/tcalendarservice/tcal_import/group/", "/General/", "C:\\TestFramework"],
       
   716 	["tcal_export.cfg", "tcal_export", "/..calendar/internal/testing/tcalendarservice/tcal_export/group/", "/General/", "C:\\TestFramework"],
       
   717 	["tcal_changenotify.cfg", "tcal_changenotify", "/..calendar/internal/testing/tcalendarservice/tcal_changenotify/group/", "/General/", "C:\\TestFramework"],
       
   718 	["tcal_provider.cfg", "tcal_providertest", "/..calendar/internal/testing/tcal_providertest/group/", "/General/", "C:\\TestFramework"],
       
   719 	["tcalprovider_combined.cfg", "tcalprovider_combined", "/..calendar/internal/testing/tcalprovider_combined/group/", "/General/", "C:\\TestFramework"],
       
   720 	["ant.jpg", "tcalprovider_combined", "/..calendar/internal/testing/tcalprovider_combined/data/", "/General/", "c:\\data\\Images"],
       
   721 	["launch_app_test.jpg", "tcalprovider_combined", "/..calendar/internal/testing/tcalprovider_combined/data/", "/General/", "c:\\data\\Images"],
       
   722 	["ant.jpg", "tcal_providertest", "/..calendar/internal/testing/tcalprovider_combined/data/", "/General/", "c:\\data\\Images"],
       
   723 	["tappmgrtest.cfg", "tappmgrtest", "/..applicationmanager/internal/testing/tappmgrtest/group/", "/General/", "C:\\TestFramework"],
       
   724 	["tappmgrprovider.cfg", "tappmgrprovider", "/..applicationmanager/internal/testing/tappmgrprovider/group/", "/General/", "C:\\TestFramework"],
       
   725 	["Test.txt", "tappmgrtest", "/..applicationmanager/internal/testing/tappmgrtest/group/data/", "/General/", "c:\\data"],
       
   726 	["pict.jpg", "tappmgrtest", "/..applicationmanager/internal/testing/tappmgrtest/group/data/images/", "/General/", "c:\\data\\Images"],
       
   727 	["sapi.jpg", "tappmgrtest", "/..applicationmanager/internal/testing/tappmgrtest/group/data/images/", "/General/", "c:\\data\\Images"],
       
   728 	["Test.txt", "tappmgrprovider", "/..applicationmanager/internal/testing/tappmgrprovider/group/data/", "/General/", "c:\\data"],
       
   729 	["pict.jpg", "tappmgrprovider", "/..applicationmanager/internal/testing/tappmgrprovider/group/data/images/", "/General/", "c:\\data\\Images"],
       
   730 	["sapi.jpg", "tappmgrprovider", "/..applicationmanager/internal/testing/tappmgrprovider/group/data/images/", "/General/", "c:\\data\\Images"],
       
   731 	
       
   732 	
       
   733   );
       
   734 
       
   735 	CopyArbitDatFiles("sapi",\@mysapidependcies);   	#CopyArbitDatFiles("stdcpp",\@mysapidependcies);
       
   736 	if($install eq "yes")
       
   737 	{
       
   738 	
       
   739 		@generatedModules = (@sapidlllist);      #(@sapidlllist, @sapiexelist);
       
   740 		my @saved = @dllList;
       
   741 		#this list is where the libraries to be tested goes
       
   742 		my @cppList = ("cameraservice.dll",
       
   743 		               "locationservice.dll",
       
   744 		               "mediamanagementservice.dll",
       
   745 		               "messagingservice.dll",
       
   746 		               		
       
   747 		             );
       
   748     @dllList = @cppList;
       
   749 		CopySharedDlls("sapi",\@dllList);     #CopySharedDlls("stdcpp",\@dllList); 
       
   750 	  TransformXmls("sapi", "shared");      #TransformXmls("stdcpp", "shared");
       
   751 		@dllList = @saved;
       
   752 		exit;
       
   753 	}#if install
       
   754 }
       
   755 	
       
   756 
       
   757 if($suite eq "lsb" || $suite eq "all")
       
   758 {
       
   759 	my @lsbModules = GetLsbModules();
       
   760 	@generatedModules = @lsbModules;
       
   761 	DoGen("lsb",".exe");
       
   762 	
       
   763 	my @depDlls;
       
   764 	my $dll;
       
   765 	
       
   766 	#copying the common dlls
       
   767 	@depDlls  = 
       
   768 	(
       
   769 	 "libapi.dll",
       
   770 	 "tcm.dll",
       
   771 	 "vlib.dll",
       
   772 	);
       
   773 		
       
   774 	foreach $dll (@depDlls)
       
   775 	{
       
   776 		CopyDeps("lsb",$dll);
       
   777 	}
       
   778 	#now copy the cfg files
       
   779 	CopyLsbCfg("lsb");	
       
   780 	#now copy the extra dependency dlls
       
   781 	
       
   782 	#dlopen
       
   783 	@generatedModules = ("dlopen");
       
   784 	
       
   785 	
       
   786 	
       
   787 	@depDlls  = 
       
   788 	(
       
   789 	 "dynlibtest.1.dll",
       
   790 	 "dynlibtest.11.1.dll",
       
   791 	 "dynlibtest.11.2.dll",
       
   792 	 "dynlibtest.12g.dll",
       
   793 	 "dynlibtest.12r.dll",
       
   794 	 "dynlibtest.14.1.dll",
       
   795 	 "dynlibtest.14.2.dll",
       
   796 	 "dynlibtest.14.3.dll",
       
   797 	 "dynlibtest.3.1.dll",
       
   798 	 "dynlibtest.3.2.dll",
       
   799 	 "dynlibtest.3.dll",
       
   800 	 "dynlibtest.4.dll",
       
   801 	 "dynlibtest.8.dll",
       
   802 	 "dynlibtest.9.dll",
       
   803 	 "dynlibtest.3.dll",
       
   804 	 "dynlibtest.8.dll",
       
   805 	);
       
   806 	
       
   807 	foreach $dll (@depDlls)
       
   808 	{
       
   809 		CopyDeps("lsb",$dll);
       
   810 	}
       
   811 	
       
   812 	#dlclose
       
   813 	@generatedModules = ("dlclose");
       
   814 	@depDlls = ("dynlibclose.1.dll");
       
   815 	foreach $dll (@depDlls)
       
   816 	{
       
   817 		CopyDeps("lsb",$dll);
       
   818 	}
       
   819 	
       
   820 	#dlerror
       
   821 	@generatedModules = ("dlerror");
       
   822 	@depDlls = ("dynlib.dll");
       
   823 	foreach $dll (@depDlls)
       
   824 	{
       
   825 		CopyDeps("lsb",$dll);
       
   826 	}
       
   827 	
       
   828 	#now copy the xmls!
       
   829 	my $srcDir = $templateRoot."/ts/lsbsuites/group/";
       
   830 	
       
   831 	my $dst;
       
   832 	
       
   833 	foreach my $dllib("dlopen", "dlclose", "dlerror")
       
   834 	{
       
   835 		$dst  = $ATSRoot."\\components\\lsb_".$dllib."\\";
       
   836 		copy($srcDir."/lsb_".$dllib."_module_blr_hw_component.xml", $dst) || die("DIED: unable to copy from $srcDir!\n");
       
   837 		copy($srcDir."/lsb_".$dllib."_module_blr_winsspd_component.xml", $dst) || die("DIED: unable to copy from $srcDir!\n");
       
   838 	}
       
   839 	
       
   840 }
       
   841 
       
   842 if($suite eq "gcce")
       
   843 {
       
   844 
       
   845 	mkdir $ATSRoot;
       
   846 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
   847 	
       
   848 	@generatedModules = ("gcce-validate", "gcce-load");
       
   849 		
       
   850 	my @depDlls  = 
       
   851 	(
       
   852 		"gcce-lib.dll",
       
   853 	);
       
   854 	
       
   855 	my $suffix = ".exe";
       
   856 	my $libname = "gcce";
       
   857 	
       
   858 	
       
   859 	my $src;
       
   860 	my $dst;
       
   861 	foreach my $module(@generatedModules)
       
   862 	{
       
   863 		my $relroot = $ATSRoot."\\components\\$libname"."_$module";
       
   864 		mkdir $relroot || die("DIED: unable to create dir $module\n");
       
   865 		mkdir $relroot."\\armv5_urel" || die("DIED: unable to create dir $relroot\\armv5_urel\n");
       
   866 		
       
   867 		#GenExeXmls($module,$libname);
       
   868 		
       
   869 		$src = $rootDrive."\\epoc32\\release\\gcce\\urel\\".$module.$suffix;
       
   870 		$dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module);
       
   871 		$dst = $dst."\\armv5_urel\\";
       
   872 		copy($src, $dst)  || warn("unable to copy $src to $dst");
       
   873 	}
       
   874 	$src = $rootDrive."\\epoc32\\release\\gcce\\urel\\"."gcce-lib.dll";
       
   875 	$dst = $ATSRoot."\\components\\gcce_gcce-load";
       
   876 	$dst = $dst."\\armv5_urel\\";
       
   877 	copy($src, $dst)  || warn("unable to copy $src to $dst");
       
   878 	
       
   879 	
       
   880 	my @list = (
       
   881   				 ["gcce_gcce-load_module_blr_hw_component.xml", "gcce-load", "./","/", ""],
       
   882   				 ["gcce_gcce-validate_module_blr_hw_component.xml", "gcce-validate", "./","/", ""],
       
   883   				 );
       
   884  
       
   885   my $bDataRef = \@list;  				 
       
   886 	CopyArbitDatFiles("gcce",$bDataRef);  				 
       
   887 
       
   888 	
       
   889 }#if gcce
       
   890 
       
   891 
       
   892 
       
   893 if($suite eq "libc-locale")
       
   894 {
       
   895 	$dontStrip = 0;
       
   896 	mkdir $ATSRoot;
       
   897 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
   898 	
       
   899 	@generatedModules = ("tstring");
       
   900 	DoGen("libc",".dll");
       
   901 	
       
   902 	my @localelist = (
       
   903 	  				 ["locales.txt", "string", "../libc/internal/testapps/tstring/data/", "/General/", ""],
       
   904 	  				 ["tstring_locale_component.xml", "string", "../libc/internal/testapps/tstring/group/", "/", ""],
       
   905 	 
       
   906 	  				 );
       
   907 		
       
   908   my $bDataRef = \@localelist;  				 
       
   909 	CopyArbitDatFiles("libc",$bDataRef);  				 
       
   910 	#delete($ATSRoot."/components/libc_string/"."libc_string_module_blr_hw_component.xml") || die("unable to delete");
       
   911 	my $my_src = $ATSRoot."/components/libc_string/"."tstring_locale_component.xml";
       
   912 	my $my_dst = $ATSRoot."/components/libc_string/"."libc_string_module_blr_hw_component.xml";
       
   913 	
       
   914 	unlink($my_dst) ||warn("unable to delete $my_dst");
       
   915 	rename($my_src,$my_dst) || move($my_src,$my_dst) || die("Unable to rename!");
       
   916 	
       
   917 }#if libc-locale
       
   918 
       
   919 
       
   920 if($suite eq "pcts")
       
   921 {
       
   922 	my $bldfile = $templateRoot."/group/bld.inf";
       
   923 	my @pctsModules = GetCompiledModules($bldfile);
       
   924 	@generatedModules = @pctsModules;
       
   925 	DoGen("pcts",".exe");
       
   926 	
       
   927 	my @depDlls;
       
   928 	my $dll;
       
   929 	
       
   930 	
       
   931 	#copying the common dlls
       
   932 	@depDlls  = 
       
   933 	(
       
   934 		"vsxlibapi.dll",
       
   935 		"rttm.exe",
       
   936 		"rtlibapi.dll",
       
   937 		"vsxvlib.dll",
       
   938 		"vsxgenlib.dll",
       
   939 		"vsxtsetlib.dll",
       
   940 		"vsxvport.dll",
       
   941 	);
       
   942 	
       
   943 	if($install eq "yes")
       
   944 	{
       
   945 		my @saved = @dllList; 
       
   946 		@dllList = @depDlls;	
       
   947 		CopySharedDlls("pcts", \@depDlls);
       
   948 		TransformXmls("pcts","shared");
       
   949 		@dllList = @saved;
       
   950 		
       
   951 		#now copy the cfg files
       
   952 		my $dst;
       
   953 		my $srcDir = "/epoc32/winscw/c/data/tet/";
       
   954 		my $file1 = $srcDir."tet_code";
       
   955 		my $file2 = $srcDir."tetexec.cfg";
       
   956 		foreach my $module(@generatedModules)
       
   957 		{
       
   958 			$dst = $ATSRoot."\\components\\pcts_".$module;
       
   959 			$dst = $dst."\\General\\";
       
   960 			copy($file1, $dst) or die "copy: $! $file1 $dst";
       
   961 			copy($file2,$dst) or die "copy: $! $file2 $dst";
       
   962 		}
       
   963 	}
       
   964 		
       
   965 	
       
   966 	
       
   967 	
       
   968 	my $dst;	
       
   969 	foreach my $module(@generatedModules)
       
   970 	{
       
   971 		my $file3 = "/epoc32/winscw/c/logs/tet/m.".$module;
       
   972 
       
   973 		$dst = $ATSRoot."\\components\\pcts_".$module;
       
   974 		$dst = $dst."\\General\\";
       
   975 		copy($file3, $dst) or die "copy: $! $file3 $dst";
       
   976 	}#module
       
   977 }
       
   978 
       
   979 
       
   980 
       
   981 $dontStrip = 0;
       
   982 
       
   983 if($suite eq "stdlibs" || $suite eq "all")
       
   984 {
       
   985 	@generatedModules = ("tzlib");
       
   986 	DoGen("libz", ".dll");
       
   987 
       
   988 	@generatedModules = ("tlibcrypt");
       
   989 	DoGen("libcrypt",".dll");
       
   990 
       
   991 	@generatedModules = @libcModules;
       
   992 	DoGen("libc",".dll");
       
   993 	GenBackendTest();
       
   994 	
       
   995 	@generatedModules = ("twchar");
       
   996 	CopyDeps("libc","twchar_helloworld.exe");
       
   997 	
       
   998 	@generatedModules = ("twopen");
       
   999 	CopyDeps("libc","twpopenwritechild.exe");
       
  1000 	CopyDeps("libc","twpopenreadchild.exe");
       
  1001 
       
  1002 
       
  1003 	@generatedModules = @libdlModules;
       
  1004 	DoGen("libdl",".dll");
       
  1005 	CopyDeps("libdl","Dll1.dll");
       
  1006 	CopyDeps("libdl","Dll2.dll");
       
  1007 	CopyDeps("libdl","DependencyTestDll.dll");
       
  1008 
       
  1009 	@generatedModules = @libmModules;
       
  1010 	DoGen("libm",".dll");
       
  1011 
       
  1012 	$TDIR = "\\internal\\";
       
  1013 	@generatedModules = @pthreadModules;
       
  1014 	DoGen("libpthread",".dll");
       
  1015 	CopyDeps("libpthread","testharness.dll");
       
  1016 
       
  1017 	CopyDatFiles();
       
  1018 }
       
  1019 
       
  1020 if($install eq "yes")
       
  1021 {
       
  1022 	foreach my $lib(@liblist)
       
  1023 	{   
       
  1024 		#print "Transforming lib $lib\n";       
       
  1025 		@generatedModules = GenGenModules($lib);
       
  1026 		my @oldList = @dllList;
       
  1027 		if($do_winscw)
       
  1028   	{
       
  1029   		@dllList = (@dllList, "wsdsoln.dll", "libestw32.dll");
       
  1030   		CopySharedDlls($lib,\@dllList,"winscw");     	
       
  1031 	  	TransformXmls($lib, "shared","winscw");
       
  1032   	}
       
  1033   	@dllList = @oldList;
       
  1034   	if($do_armv5)
       
  1035   	{
       
  1036 	  	CopySharedDlls($lib,\@dllList,"armv5");     	
       
  1037 	  	TransformXmls($lib, "shared","armv5");
       
  1038   	}
       
  1039 	}#FOREACH
       
  1040 }#if install
       
  1041 
       
  1042 
       
  1043 
       
  1044 #function to generate ModuleList for a compiled bld.inf
       
  1045 sub GetCompiledModules($)
       
  1046 {
       
  1047 	my $file = shift @_;
       
  1048 	my @moduleList;
       
  1049 	
       
  1050 	
       
  1051 	# Open input file
       
  1052 	open (INFILE, "<".$file ) || die ("DIED: Can not find $file!");
       
  1053 
       
  1054 	while (<INFILE>)
       
  1055 	{
       
  1056 		if(/(.*)\.mmp/ && $1 !~ /^\/\//) 
       
  1057 	  {
       
  1058 	  		if($_ !~ /\/\/Not for ATS/)
       
  1059 	  		{
       
  1060 	  			push @moduleList, $1;
       
  1061 	  		}
       
  1062 	  }
       
  1063 	}
       
  1064 	close (INFILE);
       
  1065 	return @moduleList;
       
  1066 }
       
  1067 
       
  1068 my @groupList;
       
  1069 sub GetLtpModules()
       
  1070 {
       
  1071         my $prevDir = getcwd();
       
  1072         my @rootList = ("kernel", "misc");
       
  1073         my @totalgroupList;
       
  1074         foreach my $node(@rootList)
       
  1075         {
       
  1076         	chdir $ltpPath."/$node";
       
  1077         	@groupList = ();
       
  1078         	find(\&MakeGroupList, ".");
       
  1079         	@totalgroupList = (@totalgroupList, @groupList);
       
  1080         }
       
  1081         chdir $prevDir;
       
  1082         return @totalgroupList;
       
  1083 }
       
  1084 
       
  1085 sub GetstdexeModules()
       
  1086 {
       
  1087       my $prevDir = getcwd();
       
  1088       my @fullList = ();
       
  1089       foreach my $group(@stdexeList)
       
  1090       {
       
  1091       	my $groupPath = $templateRoot."/testapps/".$group. "/";
       
  1092       	chdir $groupPath;
       
  1093       	@groupList = ();
       
  1094       	find(\&grovelAllMmpFiles, ".");
       
  1095       	chdir $prevDir;
       
  1096       	@fullList = (@fullList,@groupList);
       
  1097       }
       
  1098       return @fullList;      
       
  1099 }
       
  1100 
       
  1101 sub grovelAllMmpFiles()
       
  1102 {
       
  1103 	if($_ =~ /(.*)\.mmp/ && ! ($_ =~ /manual/))
       
  1104 	{
       
  1105 		push @groupList, $1;#get name of module
       
  1106 	}
       
  1107 }
       
  1108 
       
  1109 sub GetstdcppModules()
       
  1110 {
       
  1111         my $prevDir = getcwd();
       
  1112         my @rootList = ("auto");
       
  1113         my @totalgroupList;
       
  1114         foreach my $node(@rootList)
       
  1115         {
       
  1116         	chdir $stdcppPath."/$node";
       
  1117         	@groupList = ();
       
  1118         	find(\&MakeGroupList, ".");
       
  1119         	@totalgroupList = (@totalgroupList, @groupList);
       
  1120         }
       
  1121         chdir $prevDir;
       
  1122         return @totalgroupList;
       
  1123 }
       
  1124 
       
  1125 sub GetTstdcppModules()
       
  1126 {
       
  1127       my $prevDir = getcwd();
       
  1128       #chdir $tstdcppPath;
       
  1129       @groupList = ();
       
  1130       find(\&grovelAllMmpFiles, ".");
       
  1131       chdir $prevDir;
       
  1132       return @groupList;
       
  1133 }
       
  1134 
       
  1135 sub MakeGroupList()
       
  1136 {
       
  1137 	my $currentDir = $File::Find::dir;
       
  1138 	
       
  1139 	#print "Current dir:$currentDir\n";
       
  1140 	if( $currentDir =~ /.*\/(.*)\/group/)
       
  1141 	{
       
  1142 		if($cfglocation{$1} eq "")
       
  1143 		{
       
  1144 			$cfglocation{$1} = getcwd()."\/$1.cfg";
       
  1145 			push @groupList, $1;#get name of module
       
  1146 		}#first time in group
       
  1147 	}#group found
       
  1148 }#subrtn end
       
  1149 
       
  1150 
       
  1151 #function that generates the ATS setup
       
  1152 sub DoGen($$)
       
  1153 {
       
  1154 	my $libname = shift @_;
       
  1155 	my $ext = shift @_;
       
  1156 	mkdir $ATSRoot;
       
  1157 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
  1158 	
       
  1159 	
       
  1160 	GenDirs($libname);
       
  1161 	my $module;
       
  1162 	foreach my $listed(@generatedModules)
       
  1163 	{
       
  1164 	my @filesToProcess =
       
  1165         (
       
  1166          "LibXXX_ATSTemplateXXX_module_blr_hw_component.xml",
       
  1167          "LibXXX_ATSTemplateXXX_module_blr_winsspd_component.xml",
       
  1168          "testframework.ini",
       
  1169         );
       
  1170 		if(rindex($noXmlsGenList, $libname) != -1 )	
       
  1171 		{
       
  1172 			@filesToProcess = ("testframework.ini",);
       
  1173 		}
       
  1174 
       
  1175 			if($ext eq ".exe")
       
  1176 			{
       
  1177 				GenExeXmls($listed,$libname);
       
  1178 			}
       
  1179 			else
       
  1180 			{
       
  1181 				#just in case no xml file was supplied
       
  1182 				
       
  1183         my $ref = \@filesToProcess;
       
  1184 				GenXmls($libname, $listed,$ref);
       
  1185 			}
       
  1186 	}#foreach
       
  1187 	
       
  1188 	CopyDlls($libname,$ext);
       
  1189 	#copy the provided cfg, ini and xmls
       
  1190 	if($libname eq "opts")
       
  1191 	{
       
  1192 		CopyOptsCfg($libname);
       
  1193 	}
       
  1194 	elsif($libname eq "ltp" || $libname eq "lsb" || $libname eq "glib")
       
  1195 	{
       
  1196 	  #copy latter and  dont copy respectively for ltp and lsb
       
  1197 	}
       
  1198 	else
       
  1199 	{
       
  1200 	  CopyCfgIniXmls($libname);
       
  1201 	}
       
  1202 }
       
  1203 
       
  1204 sub CopyCfgIniXmls()
       
  1205 {
       
  1206 	my $libname = pop @_;
       
  1207 	
       
  1208 	my $libRoot = $templateRoot;
       
  1209 	$libRoot =~ /(.*)internal.*/;
       
  1210 	$libRoot = $1;
       
  1211 
       
  1212 
       
  1213 	my $module;
       
  1214 	my $src;
       
  1215 	my $dst;
       
  1216 		
       
  1217 	foreach my $listed(@generatedModules)
       
  1218 	{
       
  1219 	  my $dirname = $listed;
       
  1220 	  $dirname =~ s/test/t/;
       
  1221 	  $module = StripModulePrefix($listed);
       
  1222 	    
       
  1223 		$src = $libRoot.$libname.$TDIR.$dirname."\\group\\";
       
  1224 				
       
  1225 		my $xmlCopied = "0";
       
  1226 		my @globpattern = ("*.ini", "*.xml","*.cfg");
       
  1227 		foreach my $pat(@globpattern)
       
  1228 		{
       
  1229 			$dst = $ATSRoot."\\components\\".$libname."_".$module;
       
  1230 			if($pat ne "*.xml")
       
  1231 			{
       
  1232 				$dst = $dst."\\General\\";
       
  1233 			}
       
  1234 			else
       
  1235 			{
       
  1236 				$dst = $dst."\\";
       
  1237 			}
       
  1238 			my @filesFound = glob($src."\\$pat");
       
  1239 			if(scalar @filesFound eq "0")
       
  1240 			{
       
  1241 				#print "No files found for module $module $pat!\n";
       
  1242 				#print $src;
       
  1243 			}
       
  1244 			
       
  1245 			#handcoded
       
  1246 			if($pat eq "*.cfg" && $xmlCopied eq "0")#rename only if xml not copied
       
  1247 			{
       
  1248 				if(scalar @filesFound > 1)
       
  1249 				{
       
  1250 					print "Multiple cfg files found. Copying all!\n";
       
  1251 				}
       
  1252 				else
       
  1253 				{
       
  1254 						$dst = $dst.$listed.".cfg";
       
  1255 				}
       
  1256 			}				
       
  1257 			elsif($pat eq "*.xml")
       
  1258 			{
       
  1259 				my $folder = $dst;
       
  1260 				foreach my $from (@filesFound) 
       
  1261 				{
       
  1262 					if($from =~ /winscw_component/)
       
  1263 					{
       
  1264 						$dst = $folder.$libname."_".$module."_module_blr_winscw_component.xml";
       
  1265 						copy($from, $dst) or die "DIED: copy: $! $from $dst";
       
  1266 						$xmlCopied = "1";
       
  1267 					}
       
  1268 					elsif($from =~ /winsspd_component/)
       
  1269 					{
       
  1270 						$dst = $folder.$libname."_".$module."_module_blr_winsspd_component.xml";
       
  1271 						copy($from, $dst) or die "DIED: copy: $! $from $dst";
       
  1272 						$xmlCopied = "1";
       
  1273 					}
       
  1274 					elsif($from =~ /hw_component/)
       
  1275 					{
       
  1276 						$dst = $folder.$libname."_".$module."_module_blr_hw_component.xml";
       
  1277 						copy($from, $dst) or die "DIED: copy: $! $from $dst";
       
  1278 						$xmlCopied = "1";
       
  1279 					}
       
  1280 				}#examine individually			
       
  1281 				if(scalar @filesFound > 2)
       
  1282 				{
       
  1283 					#print "Multiple xml files found!!!\n";
       
  1284 				}
       
  1285 				@filesFound = ();
       
  1286 			}	
       
  1287 				
       
  1288 			
       
  1289 			foreach my $from (@filesFound) 
       
  1290 			{
       
  1291 					copy($from, $dst) or die "DIED: copy: $! $from $dst";
       
  1292 			}#copy individually			
       
  1293 		}#globpattern
       
  1294 	}#module
       
  1295 }#fn
       
  1296 
       
  1297 #copy the cfg files for the opts test suite
       
  1298 sub CopyOptsCfg()
       
  1299 {
       
  1300 	my $libname = pop @_;
       
  1301 	
       
  1302 	my $libRoot = $optsGroupPath."\\";
       
  1303 	my $module;
       
  1304 	my $src;
       
  1305 	my $dst;
       
  1306 		
       
  1307 	foreach $module(@generatedModules)
       
  1308 	{
       
  1309 		$src = $libRoot.$module."\.cfg";
       
  1310 		$dst = $ATSRoot."\\components\\".$libname."_".$module;
       
  1311 		$dst = $dst."\\General\\";
       
  1312 		copy($src, $dst) or warn "copy: $! $src $dst";
       
  1313 	}#module
       
  1314 }#fn
       
  1315 
       
  1316 #copy the lsb cfg files
       
  1317 sub CopyLsbCfg()
       
  1318 {
       
  1319 	my $libname = pop @_;
       
  1320 	
       
  1321 	my $module;
       
  1322 	
       
  1323 	my $dst;
       
  1324 	
       
  1325 	my $srcDir = $templateRoot."/ts/lsbsuites/lsblib/data/";
       
  1326 		
       
  1327 	foreach $module(@generatedModules)
       
  1328 	{
       
  1329 		my $file1 = $srcDir."tet_code.cfg";
       
  1330 		my $file2 = $srcDir."tetexec.cfg";
       
  1331 		$dst = $ATSRoot."\\components\\".$libname."_".$module;
       
  1332 		$dst = $dst."\\General\\";
       
  1333 		copy($file1, $dst) or die "copy: $! $file1 $dst";
       
  1334 		copy($file2, $dst) or die "copy: $! $file2 $dst";
       
  1335 	}#module
       
  1336 }#fn
       
  1337 
       
  1338 
       
  1339 #copy the ltp cfg files
       
  1340 sub CopyLtpCfg($)
       
  1341 {
       
  1342 	my $libname = pop @_;
       
  1343 	
       
  1344 	my $module;
       
  1345 	my $src;
       
  1346 	my $dst;
       
  1347 		
       
  1348 	foreach $module(@generatedModules)
       
  1349 	{
       
  1350 		$src = $cfglocation{$module};
       
  1351 		$dst = $ATSRoot."\\components\\".$libname."_".$module;
       
  1352 		$dst = $dst."\\General\\";
       
  1353 		copy($src, $dst) or warn "copy: $! $src $dst";
       
  1354 	}#module
       
  1355 }#fn
       
  1356 
       
  1357 
       
  1358 sub CopyDlls($$)
       
  1359 {
       
  1360 	my $libname = shift @_;
       
  1361 	my $suffix = shift @_;
       
  1362 	
       
  1363 	my $module;
       
  1364 	my $src;
       
  1365 	my $dst;
       
  1366 	
       
  1367 	
       
  1368 	foreach $module(@generatedModules)
       
  1369 	{
       
  1370 	  if($do_winscw == 1)
       
  1371 	  { 	  
       
  1372 			$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$module.$suffix;
       
  1373 			$dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module);
       
  1374 			$dst = $dst."\\winscw_udeb\\";
       
  1375 			copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  1376 		}
       
  1377 	  if($do_armv5 == 1)
       
  1378 	  {
       
  1379 			$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$module.$suffix;
       
  1380 			$dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module);
       
  1381 			$dst = $dst."\\armv5_urel\\";
       
  1382 			copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  1383 		}
       
  1384 	}#foreach
       
  1385 }
       
  1386 #fn to generate the session file
       
  1387 sub GenerateSessionFile($$$$)
       
  1388 {
       
  1389 	my $libname = shift @_;
       
  1390 	my $target = shift @_;
       
  1391 	my $name = shift @_;
       
  1392 	my $listptr = shift @_;
       
  1393 	my $outdir = $ATSRoot;
       
  1394 	my $infile = $templateRoot."\\testsession.xml";
       
  1395 	chdir $outdir || die("DIED: Unable to chdir!"); 
       
  1396 	#open INFILE, $infile || die ("DIED: Can not open input file $infile");
       
  1397 	my $prefix = $name."_".$target;
       
  1398 	if($sdkversion ne "")
       
  1399 	{
       
  1400 		$prefix = $prefix."_".$sdkversion;
       
  1401 	}
       
  1402 	
       
  1403 	open OUTFILE, ">".$outdir."\\".$prefix."_testsession.xml" || die ("DIED: Can not open output file");
       
  1404 	my $line;
       
  1405   my $snippet = $target;
       
  1406   if($target ne "winscw" && $target ne "winsspd")
       
  1407   {
       
  1408   	$snippet = "hw";
       
  1409   }
       
  1410 
       
  1411 print OUTFILE "<?xml version=\"1.0\"?>\n";
       
  1412 print OUTFILE "<testsession>\n";
       
  1413 #print OUTFILE "<symbian-version>$libname"."_".$snippet."_TestDrop_blr_component</symbian-version>\n";	
       
  1414 print OUTFILE "<symbian-version>stdcpp_combined_test_session</symbian-version>\n";	
       
  1415 print OUTFILE "<testitem>at</testitem>\n";	
       
  1416 print OUTFILE "<resultfile>ATSOUTPUT\\".$prefix."_testsession_results.xml</resultfile>\n";		
       
  1417 if($sendEmail eq "yes")
       
  1418 {
       
  1419 print OUTFILE <<EOEmailNote;
       
  1420 <email_notification>
       
  1421 <include_test_cases>false</include_test_cases>
       
  1422 <message_file>C:\\\\lm.txt </message_file>
       
  1423 <send_after_rerun>false</send_after_rerun>
       
  1424 <subject>Stdcpp-Plumhall $snippet testreport</subject>
       
  1425 <from>swbuild\@nokia.com</from>
       
  1426 <to>ajith.narayanan\@nokia.com</to>
       
  1427 <to>hrishikesh.brahmakal\@nokia.com</to>
       
  1428 <to>santosh.ks\@nokia.com</to>
       
  1429 <to>shilpa.sharma\@nokia.com</to>
       
  1430 <to>kasthuri.n-s\@nokia.com</to>
       
  1431 <to>hema.1.s\@nokia.com</to>
       
  1432 <to>vineetha.hari-pai\@nokia.com</to>
       
  1433 <to>madhusudhan.p.reddy\@nokia.com</to>
       
  1434 </email_notification>
       
  1435 EOEmailNote
       
  1436 }
       
  1437 
       
  1438 	if($libname ne "combined")
       
  1439 	{
       
  1440 		AddAssumedIncludes($libname,$snippet);
       
  1441 	}
       
  1442 	else
       
  1443 	{
       
  1444 		if($listptr ne "")
       
  1445 		{
       
  1446 			AddFileList($libname,$listptr);
       
  1447 		}
       
  1448 		else
       
  1449 		{
       
  1450 			AddActualIncludes($libname);
       
  1451 		}
       
  1452 	}
       
  1453    				
       
  1454 	print OUTFILE "</testsession>\n";
       
  1455 
       
  1456 	close(OUTFILE);
       
  1457 	#close(INFILE);
       
  1458 }#fn
       
  1459 
       
  1460 
       
  1461 sub AddAssumedIncludes($$)
       
  1462 {
       
  1463 	my $libname = shift @_; 
       
  1464 	my $snippet = shift @_;
       
  1465 	
       
  1466 	my $APITest;
       
  1467 	foreach my $listed(@generatedModules)
       
  1468 						{
       
  1469 							$APITest = StripModulePrefix($listed);
       
  1470 							print OUTFILE  "\n";
       
  1471 							print OUTFILE "	<!--Inclusion of $target xml for $APITest -->\n";
       
  1472 							print OUTFILE "	<component>\n";
       
  1473 							print OUTFILE "		<factory>Symbian</factory>\n";
       
  1474 							if($libname eq "all")
       
  1475 							{
       
  1476 									print OUTFILE "		 <testplan>ATSINPUT\\components\\$listed\\$listed"."_module_blr_".$snippet."_component.xml</testplan>\n";	 
       
  1477 							}
       
  1478 							else
       
  1479 							{
       
  1480 									print OUTFILE "		 <testplan>ATSINPUT\\components\\$libname"."_"."$APITest\\$libname"."_$APITest"."_module_blr_".$snippet."_component.xml</testplan>\n";	 
       
  1481 							}
       
  1482 							if($target eq "winscw")
       
  1483 							{
       
  1484 									print OUTFILE "		<target hardware=\"winscw\" build=\"udeb\" />\n";
       
  1485 							}
       
  1486 							elsif($target eq "winsspd")
       
  1487 							{
       
  1488 								print OUTFILE " <target hardware=\"winsspd\" platform=\"winscw\" build=\"udeb\" />\n"; 
       
  1489 							}
       
  1490 							else
       
  1491 							{
       
  1492 										print OUTFILE "		<target hardware=\"$target\" build=\"urel\" />\n";
       
  1493 							}
       
  1494 							print OUTFILE "	</component>\n";
       
  1495 							print OUTFILE "\n";
       
  1496 	           }#foreach @generatedModules
       
  1497 }
       
  1498 
       
  1499 
       
  1500 sub AddFileList($$)
       
  1501 {
       
  1502 	my $libname = shift @_; 
       
  1503 	my $listptr = shift @_;
       
  1504 	my @componentfiles = @$listptr;
       
  1505 	
       
  1506 			foreach my $listed(@componentfiles)
       
  1507 						{
       
  1508 								print OUTFILE  "\n";
       
  1509 							print OUTFILE "	<!--Inclusion of $target xml -->\n";
       
  1510 							print OUTFILE "	<component>\n";
       
  1511 							print OUTFILE "		<factory>Symbian</factory>\n";
       
  1512 							print OUTFILE "		 <testplan>ATSINPUT\\components\\$listed</testplan>\n";	 
       
  1513 							if($target eq "winscw")
       
  1514 							{
       
  1515 									print OUTFILE "		<target hardware=\"winscw\" build=\"udeb\" />\n";
       
  1516 							}
       
  1517 							elsif($target eq "winsspd")
       
  1518 							{
       
  1519 								print OUTFILE " <target hardware=\"winsspd\" platform=\"winscw\" build=\"udeb\" />\n"; 
       
  1520 							}
       
  1521 							else
       
  1522 							{
       
  1523 										print OUTFILE "		<target hardware=\"$target\" build=\"urel\" />\n";
       
  1524 							}
       
  1525 							print OUTFILE "	</component>\n";
       
  1526 							print OUTFILE "\n";
       
  1527 	           }#foreach @componentfiles
       
  1528 }
       
  1529 
       
  1530 
       
  1531 
       
  1532 sub GetSslXmls()
       
  1533 {
       
  1534 	my $APITest;
       
  1535 	my @componentfiles;
       
  1536 	
       
  1537 	my @emulatorfiles = 
       
  1538 	(
       
  1539 	"libssl_ssltest\\libssl_blr_winsspd_component.xml",
       
  1540 	"libcrypto_crypto_test\\libcrypto_blr_winsspd_component.xml",
       
  1541 	"libcrypto_openssl\\libcrypto_topenssltestss_blr_winsspd_component.xml",
       
  1542 	"libcrypto_openssl\\libcrypto_topenssltestverify_blr_winsspd_component.xml",
       
  1543 	"libcrypto_openssl\\libcrypto_topenssltestenc_blr_winsspd_component.xml",
       
  1544 	"libcrypto_openssl\\libcrypto_topenssltestgen_blr_winsspd_component.xml",
       
  1545 	"libcrypto_openssl\\libcrypto_topenssltpkcs7_blr_winsspd_component.xml",
       
  1546 	"libcrypto_openssl\\libcrypto_topenssltpkcs7d_blr_winsspd_component.xml",
       
  1547 	"libcrypto_openssl\\libcrypto_topenssltreq_blr_winsspd_component.xml",
       
  1548 	"libcrypto_openssl\\libcrypto_topenssltreq2_blr_winsspd_component.xml",
       
  1549 	"libcrypto_openssl\\libcrypto_topenssltrsa_blr_winsspd_component.xml",
       
  1550 	"libcrypto_openssl\\libcrypto_topenssltcrl_blr_winsspd_component.xml",
       
  1551 	"libcrypto_openssl\\libcrypto_topenssltsid_blr_winsspd_component.xml",
       
  1552 	"libcrypto_openssl\\libcrypto_topenssltx509_blr_winsspd_component.xml",
       
  1553 	"libcrypto_openssl\\libcrypto_topenssltx5091_blr_winsspd_component.xml",
       
  1554 	"libcrypto_openssl\\libcrypto_topenssltx5092_blr_winsspd_component.xml",
       
  1555 	 );
       
  1556 	 
       
  1557 	my @hwfiles =
       
  1558 	(
       
  1559 		"libcrypto_openssl\\libcrypto_topenssltestss_blr_hw_component.xml",
       
  1560 		"libcrypto_openssl\\libcrypto_topenssltestverify_blr_hw_component.xml",
       
  1561 		"libcrypto_openssl\\libcrypto_topenssltestenc_blr_hw_component.xml",
       
  1562 		"libcrypto_openssl\\libcrypto_topenssltestgen_blr_hw_component.xml",
       
  1563 		"libcrypto_openssl\\libcrypto_topenssltpkcs7_blr_hw_component.xml",
       
  1564 		"libcrypto_openssl\\libcrypto_topenssltpkcs7d_blr_hw_component.xml",
       
  1565 		"libcrypto_openssl\\libcrypto_topenssltreq_blr_hw_component.xml",
       
  1566 		"libcrypto_openssl\\libcrypto_topenssltreq2_blr_hw_component.xml",
       
  1567 		"libcrypto_openssl\\libcrypto_topenssltrsa_blr_hw_component.xml",
       
  1568 		"libcrypto_openssl\\libcrypto_topenssltcrl_blr_hw_component.xml",
       
  1569 		"libcrypto_openssl\\libcrypto_topenssltsid_blr_hw_component.xml",
       
  1570 		"libcrypto_openssl\\libcrypto_topenssltx509_blr_hw_component.xml",
       
  1571 		"libcrypto_openssl\\libcrypto_topenssltx5091_blr_hw_component.xml",
       
  1572 		"libcrypto_openssl\\libcrypto_topenssltx5092_blr_hw_component.xml",		
       
  1573 		"libssl_ssltest\\libssl_blr_hw_component.xml",
       
  1574 		"libcrypto_crypto_test\\libcrypto_blr_hw_component.xml",
       
  1575 	);
       
  1576 	if($target eq "winsspd" || $target eq "winscw")
       
  1577 	{
       
  1578 		@componentfiles = @emulatorfiles;
       
  1579 	}
       
  1580 	else
       
  1581 	{
       
  1582 		@componentfiles = @hwfiles;
       
  1583 	}
       
  1584 	return @componentfiles;
       
  1585 }
       
  1586 
       
  1587 
       
  1588 
       
  1589 sub AddActualIncludes($)
       
  1590 {
       
  1591 	my $libname = shift @_; 
       
  1592 	find(\&XmlComponentFiles, ".");
       
  1593 	my $key;
       
  1594 	my $value;
       
  1595 	while(($key, $value) = each(%DirHash)) 
       
  1596 	{
       
  1597 							$value =~ s/\//\\/g;
       
  1598 							print OUTFILE  "\n";
       
  1599 							print OUTFILE "	<!--Inclusion of dynamically found $target xml -->\n";
       
  1600 							print OUTFILE "	<component>\n";
       
  1601 							print OUTFILE "		<factory>Symbian</factory>\n";
       
  1602 							print OUTFILE "		 <testplan>$value</testplan>\n";	 
       
  1603 							if($target eq "winscw")
       
  1604 							{
       
  1605 									print OUTFILE "		<target hardware=\"winscw\" build=\"udeb\" />\n";
       
  1606 							}
       
  1607 							elsif($target eq "winsspd")
       
  1608 							{
       
  1609 								print OUTFILE " <target hardware=\"winsspd\" platform=\"winscw\" build=\"udeb\" />\n"; 
       
  1610 							}
       
  1611 							else
       
  1612 							{
       
  1613 										print OUTFILE "		<target hardware=\"$target\" build=\"urel\" />\n";
       
  1614 							}
       
  1615 							print OUTFILE "	</component>\n";
       
  1616 							print OUTFILE "\n";
       
  1617 	
       
  1618 	}#while
       
  1619 }#fn
       
  1620 
       
  1621 sub XmlComponentFiles()
       
  1622 {
       
  1623 	if($_ !~ /\.xml/ || $_ =~ /manual/)
       
  1624 	{
       
  1625 		return;
       
  1626 	}
       
  1627 	#print "Processing $_\n";
       
  1628 	my $dir = getcwd();
       
  1629 	if($dir =~ /.*(ATSINPUT.*)/)
       
  1630 	{
       
  1631 			$dir = $1;
       
  1632 			if($dir !~ /.*components.*/)
       
  1633 			{
       
  1634 				return;
       
  1635 			}
       
  1636 			#print "The dir is $dir\n";
       
  1637 	}
       
  1638 	else
       
  1639 	{
       
  1640 		return;
       
  1641 	}
       
  1642 	
       
  1643 	if($target eq "winsspd" )
       
  1644 	{
       
  1645 		if($_ =~ /winsspd/)
       
  1646 		{
       
  1647 			#print "Adding $target file $_ for $dir\n";
       
  1648 			$DirHash{$dir} = $dir."/".$_;
       
  1649 		}
       
  1650 	}
       
  1651 	elsif($target eq "winscw")
       
  1652 	{
       
  1653 		if($_ =~ /winscw/)
       
  1654 		{
       
  1655 			#print "Adding $target file $_ for $dir\n";
       
  1656 			$DirHash{$dir} = $dir."/".$_;
       
  1657 		}
       
  1658 	}
       
  1659 	elsif($_ =~ /$target/)
       
  1660 	{
       
  1661 		#print "$_ matched $target \n";
       
  1662 		#print "Adding $target file $_ for $dir\n";
       
  1663 		$DirHash{$dir} = $dir."/".$_;
       
  1664 	}
       
  1665 	elsif($_ =~/hw/)
       
  1666 	{
       
  1667 		#print "$_ matched hw";
       
  1668 		if(scalar $DirHash{$dir} == 0)
       
  1669 		{
       
  1670 			#print "Adding hw file $_ for $dir\n";
       
  1671 			$DirHash{$dir} = $dir."/".$_;
       
  1672 			#print " and added\n"
       
  1673 		}
       
  1674 		else
       
  1675 		{
       
  1676 			#print " and not added\n";
       
  1677 		}
       
  1678 	}
       
  1679 }
       
  1680 
       
  1681 
       
  1682 
       
  1683 sub emptyArray()
       
  1684 {
       
  1685 	@generatedModules = ();
       
  1686 }
       
  1687 
       
  1688 sub GenDirs($)
       
  1689 {
       
  1690  my $libname = shift @_;
       
  1691  my $dirname;
       
  1692  foreach my $module(@generatedModules)
       
  1693  {
       
  1694   $dirname = StripModulePrefix($module);
       
  1695 	my $relroot = $ATSRoot."\\components\\$libname"."_$dirname";
       
  1696 	mkdir $relroot || die("DIED: unable to create dir $dirname\n");
       
  1697 	mkdir $relroot."\\General" || die("DIED: unable to create dir $relroot\\General\n");
       
  1698 	if($do_armv5 == 1)
       
  1699 	{
       
  1700 		mkdir $relroot."\\armv5_urel" || die("DIED: unable to create dir $relroot\\armv5_urel\n");
       
  1701 	}
       
  1702 	if($do_winscw == 1)
       
  1703 	{
       
  1704 		mkdir $relroot."\\winscw_udeb" || die("DIED: unable to create dir $relroot\\winscw_udeb\n");
       
  1705 	}
       
  1706  }
       
  1707 }
       
  1708 
       
  1709 sub GenXmls($$$)
       
  1710 {
       
  1711 	my $libname = shift @_;
       
  1712 	my $listedName = shift @_;
       
  1713 	my $bref = shift @_;
       
  1714 	my @filesToProcess = @$bref;
       
  1715 	
       
  1716 	#strip leading test and t names from module
       
  1717 	my $moduleName = StripModulePrefix($listedName);
       
  1718 
       
  1719       my $toPath = $ATSRoot."\\components\\$libname"."_$moduleName\\"; 
       
  1720         
       
  1721 
       
  1722        my $dst;
       
  1723        my $src;
       
  1724        foreach $src(@filesToProcess)
       
  1725        {
       
  1726                $dst = $src;
       
  1727                $dst =~ s/ATSTemplateXXX/$moduleName/;
       
  1728                $dst =~ s/LibXXX/$libname/;
       
  1729              
       
  1730 
       
  1731                if($src eq "testframework.ini")
       
  1732                {
       
  1733 					$dst =  $toPath."General\\".$dst;
       
  1734                }
       
  1735                else
       
  1736                {
       
  1737 					$dst =  $toPath.$dst;
       
  1738                }
       
  1739                copy($templateRoot."\\".$src, $dst) || die("DIED: Unable to copy $src to $dst\n");
       
  1740                ExpandModuleMacros($dst, $libname, $listedName);
       
  1741        }#foreach file
       
  1742 }
       
  1743 
       
  1744 
       
  1745 sub GenExeXmls()
       
  1746 {
       
  1747 	my $moduleName = shift @_;
       
  1748 	my $libname = shift @_;
       
  1749 			
       
  1750 	my $toPath = $ATSRoot."\\components\\$libname"."_$moduleName\\"; 
       
  1751   my @filesToProcess =
       
  1752   (
       
  1753      "LibXXX_ATSTemplateXXX_exemodule_blr_hw_component.xml",
       
  1754      "LibXXX_ATSTemplateXXX_exemodule_blr_winsspd_component.xml",
       
  1755   );
       
  1756 	
       
  1757 	my $dst;
       
  1758   my $src;
       
  1759   foreach $src(@filesToProcess)
       
  1760   {
       
  1761         $dst = $src;
       
  1762         $dst =~ s/ATSTemplateXXX/$moduleName/;
       
  1763         $dst =~ s/LibXXX/$libname/;
       
  1764         $dst =~ s/_exemodule_/_module_/;
       
  1765 				$dst =  $toPath.$dst;
       
  1766         copy($templateRoot."\\".$src, $dst) || die("DIED: Unable to copy to $dst\n");
       
  1767         ExpandModuleMacros($dst, $libname, $moduleName);
       
  1768    }#foreach file
       
  1769 }
       
  1770 
       
  1771 #function to expand the macros existing in a file
       
  1772 #file is replaced by new version
       
  1773 #args are relativePath. filename and  $moduleName
       
  1774 sub ExpandModuleMacros()
       
  1775 {
       
  1776 	# Take module name
       
  1777 	my $moduleName = pop @_;
       
  1778 	my $libname = pop @_;
       
  1779 	my $filename = pop @_;
       
  1780 
       
  1781 	my $MODULENAME = $moduleName;
       
  1782 	$MODULENAME =~ tr/[a-z]/[A-Z]/;
       
  1783 
       
  1784 	# Open input file
       
  1785 	open (INFILE, $filename ) || die ("DIED: Can not find $filename");
       
  1786 
       
  1787 	#Open output file
       
  1788 	my $newOutput = $filename."new";
       
  1789 	open (OUTFILE, ">".$newOutput ) || die ("DIED: Can not open $newOutput");
       
  1790 
       
  1791 	# Replace text in files
       
  1792 	while (<INFILE>)
       
  1793 	{
       
  1794 	  s/ATSTemplateXXX/$moduleName/g;
       
  1795 	  s/LibXXX/$libname/g;
       
  1796     	  print OUTFILE $_;
       
  1797 	}
       
  1798 
       
  1799 	# Close filehandles
       
  1800 	close (INFILE);
       
  1801 	close (OUTFILE);
       
  1802 
       
  1803 	# Rename result file
       
  1804 	unlink $filename;
       
  1805 	rename $newOutput,$filename;
       
  1806 }
       
  1807 
       
  1808 
       
  1809 
       
  1810 sub CopyDeps($$)
       
  1811 {
       
  1812   my $libname = shift @_;
       
  1813   my $copyDll = shift @_;
       
  1814 	my $src;
       
  1815 	my $dst;
       
  1816 	foreach my $listed(@generatedModules)
       
  1817 	{
       
  1818 				my $module = StripModulePrefix($listed);
       
  1819 				if($do_winscw == 1)
       
  1820 				{
       
  1821 					$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll;
       
  1822 					$dst = $ATSRoot."\\components\\$libname"."_$module";
       
  1823 					$dst = $dst."\\winscw_udeb\\";
       
  1824 					copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  1825 				}
       
  1826 				if($do_armv5 == 1)
       
  1827 				{
       
  1828 					$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll;
       
  1829 					$dst = $ATSRoot."\\components\\$libname"."_$module";
       
  1830 					$dst = $dst."\\armv5_urel\\";
       
  1831 					copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  1832 				}
       
  1833 	}#foreach
       
  1834 }#fn
       
  1835 
       
  1836 #dat file copy
       
  1837 sub CopyDatFiles()
       
  1838 {
       
  1839 	my $libRoot = $templateRoot;
       
  1840 	$libRoot =~ /(.*)internal.*/;
       
  1841 	$libRoot = $1;
       
  1842 
       
  1843  my @list = (
       
  1844   				 ["libcrypt", "tlibcrypt", "group/Test_Data.dat"],
       
  1845   				 ["libc", "tnetdb", "data/services.txt"],
       
  1846   				 ["libc", "tstring", "data/locales.txt"],
       
  1847   				 ["libc", "libc_loc_blr", "data/locales.txt"],
       
  1848   				 ["libz", "tzlib", "data/*.*"],
       
  1849   				 ["libc", "tlink", "data/*.*"],
       
  1850   				 ["libc", "tmmap", "data/*.*"],
       
  1851            );
       
  1852 
       
  1853 	 my $libname;
       
  1854 	 my $dirname;
       
  1855 	 my $glob;
       
  1856 	foreach my $ref(@list)
       
  1857 	{
       
  1858 			my @inarr = @$ref;
       
  1859 			($libname, $dirname, $glob) = @inarr;
       
  1860 			my $modulename = StripModulePrefix($dirname);
       
  1861 			my $src = "$libRoot/$libname/internal/testapps/$dirname/$glob";
       
  1862 			my $dst = $ATSRoot."\\components\\$libname"."_"."$modulename\\General\\";
       
  1863   		if($dirname eq "libc_loc_blr")
       
  1864   		{
       
  1865   			$src = "$libRoot/libc/src/locales.txt";
       
  1866   		}
       
  1867   		my @filesFound = glob($src);
       
  1868   		if(scalar @filesFound == 0)
       
  1869   		{
       
  1870   			die("DIED: no Dat file found to copy!");
       
  1871   		}
       
  1872   		foreach my $file(@filesFound)
       
  1873   		{
       
  1874   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  1875   		}
       
  1876   }#ref processing
       
  1877 }#fn
       
  1878 
       
  1879 
       
  1880 #glib dat file copy
       
  1881 sub CopyArbitDatFiles($$)
       
  1882 {
       
  1883 	
       
  1884 	 my $libname = shift @_;
       
  1885 	 my $refArr = shift @_;
       
  1886 	 my @list = @$refArr;
       
  1887 	 
       
  1888  	
       
  1889 	my $fname;
       
  1890 	my $modulename;
       
  1891 	my $location;
       
  1892 	my $atsDst;
       
  1893 	my $targetDst;
       
  1894 	
       
  1895 	#now copy the files appropriately
       
  1896 	foreach my $ref(@list)
       
  1897 	{
       
  1898 			my @inarr = @$ref;
       
  1899 			($fname, $modulename, $location, $atsDst, $targetDst) = @inarr;
       
  1900 			#print "[$fname, $modulename, $location, $atsDst, $targetDst]\n";
       
  1901 			if($location =~ /(.*)\.\.(.*)/)
       
  1902 			{
       
  1903 				$location = GetPathPrefix().$2;
       
  1904 			}
       
  1905 			else
       
  1906 			{
       
  1907 				$location = $rootDrive.$location;
       
  1908 			}
       
  1909 			my $src = $location.$fname;
       
  1910 			my $dst = $ATSRoot."\\components\\$libname"."_".$modulename.$atsDst;
       
  1911 			if($libname eq "")
       
  1912 			{
       
  1913 				$dst = $ATSRoot."\\components\\".$modulename.$atsDst;
       
  1914 				#print "$dst CHANGED!\n"
       
  1915 			}
       
  1916   		
       
  1917   		my @filesFound = glob($src);
       
  1918   		if(scalar @filesFound == 0)
       
  1919   		{
       
  1920   			die("DIED: no Dat file  $src found to copy!");
       
  1921   		}
       
  1922   		foreach my $file(@filesFound)
       
  1923   		{
       
  1924   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  1925   		}
       
  1926   		
       
  1927   		if($targetDst ne "")
       
  1928   		{
       
  1929   			 		my @filesToChange = ();
       
  1930 			  		if($atsDst =~ "armv5")
       
  1931 			  		{
       
  1932 			  			#armv5 component file
       
  1933 			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_hw_component.xml";
       
  1934 			  			
       
  1935 			  		}
       
  1936 			  		elsif($atsDst =~ "winscw")
       
  1937 			  		{
       
  1938 			  			#winscw component file
       
  1939 			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_winsspd_component.xml";
       
  1940 			  		}
       
  1941 			  		else
       
  1942 			  		{
       
  1943 			  			#add entry to both xmls
       
  1944 			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_hw_component.xml";
       
  1945 			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_winsspd_component.xml";
       
  1946 			  		}
       
  1947 			  		foreach my $file(@filesToChange)
       
  1948 			  		{
       
  1949 			  			$src = $ATSRoot."/components/".$libname."_"."$modulename/".$file;
       
  1950 			  			ModifyXml($src,$libname,$fname,$atsDst,$targetDst);
       
  1951 			  		}
       
  1952 			  }#updating the xmls
       
  1953     		
       
  1954   }#ref processing
       
  1955  
       
  1956   
       
  1957 }#fn
       
  1958 
       
  1959 sub ModifyXml($$$$$)
       
  1960 {
       
  1961 	my $filename = shift @_;
       
  1962 	my $lib = shift @_;
       
  1963 	my $fname = shift @_;
       
  1964 	my $atsDst = shift @_;
       
  1965 	my $targetDst = shift @_;
       
  1966 	
       
  1967 	
       
  1968 	#printf("Modifying $filename with lib= $lib fname= $fname atsDst = $atsDst targetDst = $targetDst\n");
       
  1969 	
       
  1970 	# Open input file
       
  1971 	open (INFILE, $filename ) || die ("Can not find $filename");
       
  1972 
       
  1973 	#Open output file
       
  1974 	my $newOutput = $filename."new";
       
  1975 	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
       
  1976 
       
  1977 		
       
  1978 	# Replace text in files
       
  1979 	while (<INFILE>)
       
  1980 	{
       
  1981 	  if(/\<stif\>/ || /\<execute\>/)
       
  1982 	  {
       
  1983 	  	if(/\<stif\>/)
       
  1984 	  	{
       
  1985 	  		print OUTFILE "\<stif\>\n";
       
  1986 	  	}
       
  1987 	  	else
       
  1988 	  	{
       
  1989 	  		print OUTFILE "\<execute\>\n";
       
  1990 	  	}
       
  1991 	  	my $type = "data";
       
  1992 	  	if($atsDst !~ "General")
       
  1993 			{
       
  1994 				$type = "binary";
       
  1995 			}
       
  1996 			print OUTFILE <<EObinary;
       
  1997 				
       
  1998 	  		<install type=\"$type\">
       
  1999 				<src>$fname</src>
       
  2000 				<dst>$targetDst\\$fname</dst>
       
  2001  				</install>
       
  2002 EObinary
       
  2003 	  }#stif or execute tag found
       
  2004 	  else
       
  2005 	  {
       
  2006 	  	  print OUTFILE $_;
       
  2007 	  }
       
  2008 	}#while
       
  2009 	# Close filehandles
       
  2010 	close (INFILE);
       
  2011 	close (OUTFILE);
       
  2012 
       
  2013 	# Rename result file
       
  2014 	unlink $filename;
       
  2015 	rename $newOutput,$filename;
       
  2016 	
       
  2017 }#fn
       
  2018 sub GenGenModules($)
       
  2019 {
       
  2020 	my $libname = shift @_;
       
  2021 	
       
  2022 		
       
  2023 	my $src = $ATSRoot."/components/";
       
  2024 	my @fileList = ();
       
  2025 	opendir(DIRHANDLE, "$src") || die "Cannot opendir $src";
       
  2026   foreach my $name (readdir(DIRHANDLE)) 
       
  2027   {
       
  2028     if($name =~ /^$libname/)
       
  2029     {
       
  2030     	if($libname ne "libc" || $name !~ /^libcrypt/) 
       
  2031     	{
       
  2032     		$name =~ s/^$libname//;
       
  2033     		$name =~ s/^_//;
       
  2034     		unshift @fileList, $name;
       
  2035     	}#excluded libcrypt from libc list
       
  2036     }#libname match
       
  2037   }#foreach
       
  2038   closedir(DIRHANDLE);
       
  2039 	return @fileList;
       
  2040 }
       
  2041 
       
  2042 
       
  2043 sub GetAllModules()
       
  2044 {
       
  2045 	
       
  2046 	my $src = $ATSRoot."/components/";
       
  2047 	my @fileList = ();
       
  2048 	opendir(DIRHANDLE, "$src") || die "Cannot opendir $src";
       
  2049   foreach my $name (readdir(DIRHANDLE)) 
       
  2050   {
       
  2051     	if($name ne "." && $name ne ".." && $name ne "shared")
       
  2052 			{
       
  2053 				unshift @fileList, $name;
       
  2054 			}
       
  2055 
       
  2056   }#foreach
       
  2057   closedir(DIRHANDLE);
       
  2058 	return @fileList;
       
  2059 }
       
  2060 
       
  2061 
       
  2062 
       
  2063 sub TransformXmls($$)
       
  2064 {
       
  2065 	my $libname = shift @_;
       
  2066 	my $shared = shift @_;
       
  2067 	my $target = shift @_;
       
  2068 	my $module;
       
  2069 	my $src;
       
  2070 	my $dst;
       
  2071 
       
  2072 	my $armv5 = 0;
       
  2073 	my $winscw = 0;
       
  2074 	if($target eq "armv5")
       
  2075 	{
       
  2076 			$armv5 = 1;
       
  2077   }	
       
  2078   elsif($target eq "winscw")
       
  2079   {
       
  2080   		$winscw = 1;
       
  2081   }
       
  2082   else
       
  2083   {
       
  2084   	$armv5  = $do_armv5;
       
  2085   	$winscw = $do_winscw;
       
  2086 	}
       
  2087 		
       
  2088 
       
  2089 	foreach $module(@generatedModules)
       
  2090 	{
       
  2091 	  if($armv5 == 1 && $winscw == 1)
       
  2092 	  {
       
  2093 			$src = $ATSRoot."/components/".$libname."_"."$module/*.xml";
       
  2094 		}
       
  2095 		elsif($armv5 == 1)
       
  2096 		{
       
  2097 			$src = $ATSRoot."/components/".$libname."_"."$module/*_hw_component.xml";
       
  2098 		}
       
  2099 		elsif($winscw == 1)
       
  2100 		{
       
  2101 			$src = $ATSRoot."/components/".$libname."_"."$module/*_winsspd_component.xml";
       
  2102 		}
       
  2103 		my @fileList = glob($src);
       
  2104 		foreach my $file(@fileList)
       
  2105 		{
       
  2106 		 	#print"$file to  be transformed!\n";
       
  2107 			AddLibsInXml($libname,$file,$shared);
       
  2108 		}
       
  2109    }
       
  2110 }#fn
       
  2111 
       
  2112 sub AddLibsInXml($$$)
       
  2113 {
       
  2114 	my $libname = shift @_;
       
  2115 	my $filename = shift @_;
       
  2116 	my $shared = shift @_;
       
  2117 	
       
  2118 	# Open input file
       
  2119 	open (INFILE, $filename ) || die ("Can not find $filename");
       
  2120 
       
  2121 	#Open output file
       
  2122 	my $newOutput = $filename."new";
       
  2123 	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
       
  2124 
       
  2125 	my $drive = "c:";
       
  2126 	
       
  2127 	# Replace text in files
       
  2128 	while (<INFILE>)
       
  2129 	{
       
  2130 	  if(/\<stif\>/ || /\<execute\>/)
       
  2131 	  {
       
  2132 	  	if(/\<stif\>/)
       
  2133 	  	{
       
  2134 	  		print OUTFILE "\<stif\>\n";
       
  2135 	  	}
       
  2136 	  	else
       
  2137 	  	{
       
  2138 	  		print OUTFILE "\<execute\>\n";
       
  2139 	  		if($filename =~ /winsspd/)
       
  2140 				{
       
  2141 					$drive = "z:";
       
  2142 				}
       
  2143 	  	}
       
  2144 	  	foreach my $installable(@dllList)
       
  2145 			{
       
  2146 				print OUTFILE <<EOLine;
       
  2147 				
       
  2148 	  		<install type=\"$shared binary\">
       
  2149 				<src>$installable</src>
       
  2150 				<dst>$drive\\sys\\bin\\$installable</dst>
       
  2151  				</install>
       
  2152 EOLine
       
  2153 			}
       
  2154 
       
  2155 	  }
       
  2156 	  else
       
  2157 	  {
       
  2158 	  	  print OUTFILE $_;
       
  2159 	  }
       
  2160 	}#while
       
  2161 	# Close filehandles
       
  2162 	close (INFILE);
       
  2163 	close (OUTFILE);
       
  2164 
       
  2165 	# Rename result file
       
  2166 	unlink $filename;
       
  2167 	rename $newOutput,$filename;
       
  2168 }
       
  2169 
       
  2170 sub CopySharedDlls()
       
  2171 {
       
  2172   my $libname = shift @_;
       
  2173   my $ref = shift @_;
       
  2174   my @ListOfDlls = @$ref;
       
  2175   my $target = shift @_;
       
  2176 	my $module;
       
  2177 	my $src;
       
  2178 	my $dst;
       
  2179 	
       
  2180 	my $do_armv5 = 0;
       
  2181 	my $do_winscw = 0;
       
  2182 	if($target eq "armv5")
       
  2183 	{
       
  2184 		$do_armv5 = 1;
       
  2185 	}
       
  2186 	elsif($target eq "winscw")
       
  2187 	{
       
  2188 		$do_winscw =  1;
       
  2189 	}
       
  2190 	else
       
  2191 	{
       
  2192 		$do_armv5  = 1;
       
  2193 		$do_winscw = 1;
       
  2194 	}
       
  2195 	
       
  2196 	
       
  2197 	mkdir  $ATSRoot."\\components\\shared" || die("Wouldn't make shared folder in $ATSRoot\\components");
       
  2198 	if($do_winscw == 1)
       
  2199 	{
       
  2200 		mkdir  $ATSRoot."\\components\\shared\\winscw_udeb" || die("Wouldn't make shared folder in $ATSRoot\\components\winscw_udeb");
       
  2201 	}
       
  2202 	if($do_armv5 == 1)
       
  2203 	{
       
  2204 		mkdir  $ATSRoot."\\components\\shared\\armv5_urel" || die("Wouldn't make shared folder in $ATSRoot\\components\armv5_urel");
       
  2205 	}
       
  2206 	
       
  2207 	foreach my $copyDll(@ListOfDlls)
       
  2208 	{
       
  2209 		if($do_winscw == 1)
       
  2210 		{
       
  2211 			$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll;
       
  2212 			$dst = $ATSRoot."\\components\\shared";
       
  2213 			$dst = $dst."\\winscw_udeb\\";
       
  2214 			copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  2215 		}	
       
  2216 		if($do_armv5 == 1)
       
  2217 		{	
       
  2218 			$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll;
       
  2219 			$dst = $ATSRoot."\\components\\shared";
       
  2220 			$dst = $dst."\\armv5_urel\\";
       
  2221 			copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  2222 		}
       
  2223 	}#foreach
       
  2224 }#fn
       
  2225 
       
  2226 
       
  2227 sub CopyMultiDlls($)
       
  2228 {
       
  2229   my $libname = shift @_;
       
  2230 	my $module;
       
  2231 	my $src;
       
  2232 	my $dst;
       
  2233 	foreach my $listed(@generatedModules)
       
  2234 	{
       
  2235 		foreach my $copyDll(@dllList)
       
  2236 		{
       
  2237 			if($do_winscw == 1)
       
  2238 			{
       
  2239 				$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll;
       
  2240 				$dst = $ATSRoot."\\components\\$libname"."_$listed";
       
  2241 				$dst = $dst."\\winscw_udeb\\";
       
  2242 				copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  2243 			}
       
  2244 			if($do_armv5 == 1)
       
  2245 			{
       
  2246 				$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll;
       
  2247 				$dst = $ATSRoot."\\components\\$libname"."_$listed";
       
  2248 				$dst = $dst."\\armv5_urel\\";
       
  2249 				copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  2250 			}
       
  2251 		}#foreach
       
  2252 	}
       
  2253 }#fn
       
  2254 
       
  2255 sub StripModulePrefix($)
       
  2256 {
       
  2257 	my $listed = pop @_;
       
  2258 	my $module = $listed;
       
  2259 	if($dontStrip == 0)
       
  2260 	{
       
  2261 		$module =~ s/^test//;
       
  2262 		$module =~ s/^t//;
       
  2263 		$module =~ s/^libc_//;
       
  2264 		$module =~ s/^libm_//;
       
  2265   }
       
  2266   return $module;
       
  2267   	
       
  2268 }
       
  2269 
       
  2270 sub GetLsbModules()
       
  2271 {
       
  2272 	my @lsbList = 
       
  2273 	(
       
  2274 	 "abs",
       
  2275 "acos",
       
  2276 "asctime",
       
  2277 "asin",
       
  2278 "atan",
       
  2279 "atan2",
       
  2280 "atof",
       
  2281 "atoi",
       
  2282 "atol",
       
  2283 "bsearch",
       
  2284 "calloc",
       
  2285 "ceil",
       
  2286 "chdir",
       
  2287 "clearerr",
       
  2288 "close",
       
  2289 "closedir",
       
  2290 "cos",
       
  2291 "cosh",
       
  2292 "creat",
       
  2293 "lsb_ctime",
       
  2294 "lsb_difftime",
       
  2295 "dlclose",
       
  2296 "dlerror",
       
  2297 "dlopen",
       
  2298 "dup",
       
  2299 "dup2",
       
  2300 "exp",
       
  2301 "fabs",
       
  2302 "fclose",
       
  2303 "fcntl_x",
       
  2304 "fdopen",
       
  2305 "feof",
       
  2306 "ferror",
       
  2307 "fflush",
       
  2308 "fgetpos",
       
  2309 "fgets",
       
  2310 "fileno",
       
  2311 "floor",
       
  2312 "fmod",
       
  2313 "fopen",
       
  2314 "fopen_X",
       
  2315 "fprintf",
       
  2316 "fputs",
       
  2317 "fread",
       
  2318 "free",
       
  2319 "freopen",
       
  2320 "freopen_X",
       
  2321 "frexp",
       
  2322 "fseek",
       
  2323 "fsetpos",
       
  2324 "fstat",
       
  2325 "ftell",
       
  2326 "ftok",
       
  2327 "ftok_l",
       
  2328 "fwrite",
       
  2329 "getc",
       
  2330 "getcwd",
       
  2331 "gets",
       
  2332 "lsb_gmtime",
       
  2333 "ldexp",
       
  2334 "link",
       
  2335 "lsb_localtime",
       
  2336 "log",
       
  2337 "log10",
       
  2338 "longjmp",
       
  2339 "lseek",
       
  2340 "malloc",
       
  2341 "memchr_X",
       
  2342 "memcmp_X",
       
  2343 "memcpy_X",
       
  2344 "memmove",
       
  2345 "memset_X",
       
  2346 "mkdir",
       
  2347 "mkfifo",
       
  2348 "lsb_mktime",
       
  2349 "modf",
       
  2350 "msgctl",
       
  2351 "msgget",
       
  2352 "msgsnd",
       
  2353 "open",
       
  2354 "opendir",
       
  2355 "open_x",
       
  2356 "perror",
       
  2357 "pipe",
       
  2358 "pow",
       
  2359 "printf",
       
  2360 "qsort",
       
  2361 "rand",
       
  2362 "read",
       
  2363 "readdir",
       
  2364 "readv_l",
       
  2365 "realloc",
       
  2366 "remove",
       
  2367 "rename",
       
  2368 "rewind",
       
  2369 "rewinddir",
       
  2370 "rmdir",
       
  2371 "scanf",
       
  2372 "scanf_X",
       
  2373 "seekdir",
       
  2374 "semctl",
       
  2375 "semget",
       
  2376 "semop",
       
  2377 "setbuf",
       
  2378 "setjmp",
       
  2379 "shmat",
       
  2380 "shmdt",
       
  2381 "shmget",
       
  2382 "sin",
       
  2383 "sinh",
       
  2384 "sqrt",
       
  2385 "srand",
       
  2386 "stat",
       
  2387 "strcat",
       
  2388 "strchr",
       
  2389 "strcmp",
       
  2390 "strcoll_X",
       
  2391 "strcpy",
       
  2392 "strcspn",
       
  2393 "strerror_X",
       
  2394 "strftime",
       
  2395 "strftime_X",
       
  2396 "strlen",
       
  2397 "strncat",
       
  2398 "strncmp",
       
  2399 "strncpy",
       
  2400 "strpbrk",
       
  2401 "strptime",
       
  2402 "strrchr",
       
  2403 "strspn",
       
  2404 "strstr",
       
  2405 "strtod_X",
       
  2406 "strtok",
       
  2407 "strtol_X",
       
  2408 "strxfrm_X",
       
  2409 "tan",
       
  2410 "tanh",
       
  2411 "telldir",
       
  2412 "telldir_l",
       
  2413 "lsb_time",
       
  2414 "tmpfile",
       
  2415 "tmpnam",
       
  2416 "ungetc",
       
  2417 "unlink",
       
  2418 "utime",
       
  2419 "vfprintf",
       
  2420 "vprintf",
       
  2421 "write",
       
  2422 "writev_l",
       
  2423 
       
  2424 	);
       
  2425   return @lsbList;
       
  2426 }
       
  2427 
       
  2428 
       
  2429 
       
  2430 sub GenBackendTest()
       
  2431 {
       
  2432 
       
  2433 	my @datList = 
       
  2434 	(
       
  2435 	["libc", "tlibcbackend"],
       
  2436 	);
       
  2437 	
       
  2438 	mkdir $ATSRoot;
       
  2439 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
  2440 		
       
  2441 	my $lib;
       
  2442 	my $module;
       
  2443 	my $ext;
       
  2444 	foreach my $ref(@datList)
       
  2445 	{
       
  2446 			my @inarr = @$ref;
       
  2447 			($lib, $module,$ext) = @inarr;
       
  2448 			@generatedModules = ($module);
       
  2449 			GenDirs($lib);
       
  2450 			CopyDlls($lib,".dll");
       
  2451 	}
       
  2452  #now copy xmls			
       
  2453  CopyAtsSetup();
       
  2454  #extra exes
       
  2455  @generatedModules = ("tlibcbackend");
       
  2456  CopyDeps("libc","TPopenReadChild.exe");
       
  2457  CopyDeps("libc","TPopenWriteChild.exe");
       
  2458 			
       
  2459 }#fn
       
  2460 
       
  2461 sub CopyAtsSetup()
       
  2462 {
       
  2463 	 my $libname = "libc"; 
       
  2464 	 my @list = (
       
  2465   				 ["*.xml", "libcbackend", "/../backend/internal/tlibcbackend/group/","/", ""],
       
  2466   				 ["*.cfg", "libcbackend", "/../backend/internal/tlibcbackend/group/","/General/", ""],
       
  2467   				 ["*.ini", "libcbackend", "/../backend/internal/tlibcbackend/group/","/General/", ""],
       
  2468   				 );
       
  2469  
       
  2470   my $bDataRef = \@list;  				 
       
  2471 	CopyArbitDatFiles("libc",$bDataRef);  				 
       
  2472 
       
  2473 }#fn
       
  2474 sub GetPathPrefix()
       
  2475 {
       
  2476 	 my $srcPrefix = $templateRoot;
       
  2477 	 $srcPrefix =~ /(.*)internal.*/;
       
  2478 	 $srcPrefix = $1;
       
  2479 	 return $srcPrefix;
       
  2480 }
       
  2481 	
       
  2482 
       
  2483 #dat file copy
       
  2484 sub CopyCryptoDat()
       
  2485 {
       
  2486 	my $libRoot = $templateRoot;
       
  2487 	$libRoot =~ /(.*)internal.*/;
       
  2488 	$libRoot = $1;
       
  2489 
       
  2490  my @list = (
       
  2491  								 ["libssl", "ssltest", "libssl/internal/testapps/ssl_test/data/*"],
       
  2492  								 ["libcrypto", "topenssl", "/libcrypto/internal/testapps/topenssl/data/*"],
       
  2493            );
       
  2494 
       
  2495 	 my $libname;
       
  2496 	 my $dirname;
       
  2497 	 my $glob;
       
  2498 	foreach my $ref(@list)
       
  2499 	{
       
  2500 			my @inarr = @$ref;
       
  2501 			($libname, $dirname, $glob) = @inarr;
       
  2502 			my $modulename = StripModulePrefix($dirname);
       
  2503 			my	$srcPrefix = GetPathPrefix();
       
  2504 			
       
  2505 			my $src = "$srcPrefix"."$glob";
       
  2506 			
       
  2507 			my $dst = $ATSRoot."\\components\\$libname"."_"."$modulename\\General\\";
       
  2508   		my @filesFound = glob($src);
       
  2509   		if(scalar @filesFound == 0)
       
  2510   		{
       
  2511   			die("DIED: no Dat file found to copy!");
       
  2512   		}
       
  2513   		foreach my $file(@filesFound)
       
  2514   		{
       
  2515   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  2516   		}
       
  2517   }#ref processing
       
  2518 }#fn
       
  2519 
       
  2520 #Crypto xmls copy
       
  2521 sub CopyCryptoXmls()
       
  2522 {
       
  2523 	  my @list = (
       
  2524   				 ["*.xml", "libssl_ssltest/", "/libssl/internal/testapps/ssl_test/group/"],
       
  2525    				 ["*.xml", "libcrypto_crypto_test/", "/libcrypto/internal/testapps/crypto_test/group/"],
       
  2526    				 ["*.xml", "libcrypto_openssl/", "/libcrypto/internal/testapps/topenssl/group/"],   				    				 			 
       
  2527   				 );
       
  2528 
       
  2529 	
       
  2530 	my $fname;
       
  2531 	my $moduleDst;
       
  2532 	my $location;
       
  2533 	
       
  2534 	#now copy the files appropriately
       
  2535 	foreach my $ref(@list)
       
  2536 	{
       
  2537 			my @inarr = @$ref;
       
  2538 			($fname, $moduleDst, $location) = @inarr;
       
  2539 			my $src = GetPathPrefix().$location.$fname;
       
  2540 			my $dst = $ATSRoot."\\components\\$moduleDst";
       
  2541   		
       
  2542   		my @filesFound = glob($src);
       
  2543   		if(scalar @filesFound == 0)
       
  2544   		{
       
  2545   			die("DIED: no xml file found to copy!");
       
  2546   		}
       
  2547   		foreach my $file(@filesFound)
       
  2548   		{
       
  2549   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  2550   		}
       
  2551   	}#ref
       
  2552   	
       
  2553   	my @crypto_copyList = ("*.txt", "*cfg", "*.ini");
       
  2554   	
       
  2555   	foreach my $item(@crypto_copyList)
       
  2556   	{
       
  2557   			$location = "/libcrypto/internal/testapps/crypto_test/group/";
       
  2558   			$fname = GetPathPrefix().$location.$item;
       
  2559   			my @filesFound = glob($fname);
       
  2560   			foreach my $file(@filesFound)
       
  2561   			{
       
  2562     			$moduleDst = "libcrypto_crypto_test/";	
       
  2563   				my $dst = $ATSRoot."\\components\\".$moduleDst."/General/";
       
  2564   				copy($file, $dst);
       
  2565   			}
       
  2566   	}
       
  2567 }#fn
       
  2568 
       
  2569 sub GenCryptoTest()
       
  2570 {
       
  2571 
       
  2572 	my @datList = 
       
  2573 	(
       
  2574 	["libssl", "ssltest", ".exe"],
       
  2575 	["libcrypto", "crypto_test",".dll"],
       
  2576 	["libcrypto", "openssl",".exe"],
       
  2577 	);
       
  2578 	
       
  2579 	mkdir $ATSRoot;
       
  2580 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
  2581 		
       
  2582 	my $lib;
       
  2583 	my $module;
       
  2584 	my $ext;
       
  2585 	foreach my $ref(@datList)
       
  2586 	{
       
  2587 			my @inarr = @$ref;
       
  2588 			($lib, $module,$ext) = @inarr;
       
  2589 			@generatedModules = ($module);
       
  2590 			GenDirs($lib);
       
  2591 			CopyDlls($lib,$ext);
       
  2592 	}
       
  2593 	CopyCryptoDat();
       
  2594 	CopyCryptoXmls();
       
  2595 	
       
  2596 			
       
  2597 }#fn
       
  2598 
       
  2599 
       
  2600 #ngi xml copy
       
  2601 sub CopyNgiXmls()
       
  2602 {
       
  2603 	  my @list = (
       
  2604    				 ["*.xml", "ngi_sa_amrrecording", "/audio/lowlevelaudio/internal/sa_amrrecording/group/"],
       
  2605    				 ["*.xml", "ngi_sa_highlevelaudio", "/audio/highlevelaudio/internal/sa_highlevelaudio/group/"],
       
  2606   				 ["*.xml", "ngi_sa_audiomixing", "/audio/lowlevelaudio/internal/sa_audiomixing/group/"],
       
  2607   				 ["*.xml", "ngi_sa_audiorecording", "/audio/lowlevelaudio/internal/sa_audiorecording/group/"],
       
  2608   				 ["*.xml", "ngi_sa_clip", "/audio/lowlevelaudio/internal/sa_clip/group/"],
       
  2609   				 ["*.xml", "ngi_sa_lowlevelaudio", "/audio/lowlevelaudio/internal/sa_lowlevelaudio/group/"],
       
  2610   				 ["*.xml", "ngi_sa_stream", "/audio/lowlevelaudio/internal/sa_stream/group/"],
       
  2611   				 
       
  2612   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_antitearing/group/"],
       
  2613   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_colortranslation/group/"],
       
  2614   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_createfb565/group/"],
       
  2615   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_createfb888/group/"],
       
  2616   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_heapusage/group/"],
       
  2617   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_multibb/group/"],
       
  2618   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_performance/group/"],
       
  2619            ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_plswitching/group/"],
       
  2620            ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_misc/group/"],
       
  2621   				 ["*.xml", "ngi_sa_bitmap", "/graphics/bitmap/internal/sa_bitmap/group/"],
       
  2622   				 ["*.xml", "ngi_sa_camera", "/graphics/camera/internal/sa_camera/group/"],
       
  2623   				 ["*.xml", "ngi_sa_images", "/graphics/images/internal/sa_images/group/"],
       
  2624   				 ["*.xml", "ngi_sa_display", "/graphics/display/internal/sa_display/group/"],
       
  2625   				 ["*.xml", "ngi_sa_lights", "/graphics/lights/internal/sa_lights/group/"],
       
  2626   				 ["*.xml", "ngi_sa_videoplayback", "/graphics/video/internal/sa_videoplayback/group/"],
       
  2627   				 
       
  2628   				 ["*.xml", "ngi_sa_input", "/input/input/internal/sa_input/group/"],
       
  2629   				 ["*.xml", "ngi_sa_textinput", "/input/textinput/internal/sa_textinput/group/"],
       
  2630   				 ["*.xml", "ngi_sa_devicecapabilities", "/system/devicecapabilities/internal/sa_devicecapabilities/group/"],
       
  2631   				 ["*.xml", "ngi_sa_devicestatus", "/system/devicestatus/internal/sa_phone/group/"],
       
  2632   				 ["*.xml", "ngi_sa_runtimetester", "/system/runtime/internal/sa_runtimetester/group/"],
       
  2633   				 ["*.xml", "ngi_sa_timing", "/timing/internal/sa_timing/group/"],
       
  2634 	  				 );
       
  2635 
       
  2636 	
       
  2637 	my $fname;
       
  2638 	my $moduleDst;
       
  2639 	my $location;
       
  2640 	
       
  2641 	#now copy the files appropriately
       
  2642 	foreach my $ref(@list)
       
  2643 	{
       
  2644 			my @inarr = @$ref;
       
  2645 			($fname, $moduleDst, $location) = @inarr;
       
  2646 			my $src = GetPathPrefix().$location.$fname;
       
  2647 			my $dst = $ATSRoot."\\components\\$moduleDst";
       
  2648 			
       
  2649 			#print "My src is $src\n";
       
  2650 			#print "My dst is $dst\n";
       
  2651 			  		
       
  2652   		my @filesFound = glob($src);
       
  2653   		if(scalar @filesFound == 0)
       
  2654   		{
       
  2655   			warn("warning: no xml file found to copy from $src!");
       
  2656   		}
       
  2657   		foreach my $file(@filesFound)
       
  2658   		{
       
  2659   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  2660   		}
       
  2661   	}#ref
       
  2662     	
       
  2663 }#fn
       
  2664 
       
  2665 
       
  2666 sub GenNgiTest()
       
  2667 {
       
  2668 
       
  2669 	my @datList = 
       
  2670 	(
       
  2671 	["ngi", "sa_amrrecording", ".dll"],
       
  2672 	["ngi", "sa_highlevelaudio", ".dll"],
       
  2673 	["ngi", "sa_audiomixing", ".dll"],
       
  2674 	["ngi", "sa_audiorecording", ".dll"],
       
  2675 	["ngi", "sa_clip", ".dll"],
       
  2676 	["ngi", "sa_lowlevelaudio", ".dll"],
       
  2677 	["ngi", "sa_stream", ".dll"],
       
  2678 	["ngi", "sa_bitmap", ".dll"],
       
  2679 	["ngi", "sa_camera", ".dll"],
       
  2680 	["ngi", "sa_images", ".dll"],
       
  2681 	["ngi", "sa_display", ".dll"],
       
  2682 	["ngi", "sa_lights", ".dll"],	
       
  2683 	["ngi", "sa_videoplayback", ".dll"],	
       
  2684 	["ngi", "sa_input", ".dll"],	
       
  2685 	["ngi", "sa_textinput", ".dll"],
       
  2686 	["ngi", "sa_devicecapabilities", ".dll"],	
       
  2687 	["ngi", "sa_devicestatus", ".dll"],	
       
  2688 	["ngi", "sa_runtimetester", ".dll"],	
       
  2689 	["ngi", "sa_timing", ".dll"],	
       
  2690 		
       
  2691 	);
       
  2692 	
       
  2693 	mkdir $ATSRoot;
       
  2694 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
  2695 
       
  2696 		
       
  2697 	my $lib;
       
  2698 	my $module;
       
  2699 	my $ext;
       
  2700 	foreach my $ref(@datList)
       
  2701 	{
       
  2702 			my @inarr = @$ref;
       
  2703 			($lib, $module,$ext) = @inarr;
       
  2704 			@generatedModules = ($module);
       
  2705 			GenDirs($lib);
       
  2706 			CopyDlls($lib,$ext);
       
  2707 	}
       
  2708 	
       
  2709    @generatedModules =("sa_backbuffer");
       
  2710    GenDirs($lib);
       
  2711    @dllList = 
       
  2712    (
       
  2713    	"sa_bb_antitearing.dll",
       
  2714    	"sa_bb_colortranslation.dll",
       
  2715    	"sa_bb_createfb444.dll",
       
  2716    	"sa_bb_createfb565.dll",
       
  2717    	"sa_bb_createfb888.dll",
       
  2718    	"sa_bb_misc.dll",
       
  2719    	"sa_bb_heapusage.dll",
       
  2720    	"sa_bb_multibb.dll",
       
  2721    	"sa_bb_performance.dll",
       
  2722    	"sa_bb_plswitch.dll",
       
  2723    	"sa_bb_testenv.dll"
       
  2724    );
       
  2725    CopyMultiDlls("ngi");
       
  2726 
       
  2727 	
       
  2728  	mkdir  $ATSRoot."\\components\\shared" || die("Wouldn't make shared folder in $ATSRoot\\components");
       
  2729   mkdir  $ATSRoot."\\components\\shared\\winscw_udeb" || die("Wouldn't make shared folder in $ATSRoot\\components\winscw_udeb");
       
  2730   mkdir  $ATSRoot."\\components\\shared\\armv5_urel" || die("Wouldn't make shared folder in $ATSRoot\\components\armv5_urel");
       
  2731 			
       
  2732 }#fn
       
  2733 
       
  2734 
       
  2735 sub GetXmls()
       
  2736 {
       
  2737   my @foundList;
       
  2738   my $libname = shift @_;
       
  2739 	my @globlist = ();
       
  2740 	if($target eq "winsspd" && $sdkversion ne "")
       
  2741 	{
       
  2742 		@globlist = ("winsspd_".$sdkversion);
       
  2743 		#print "winsspd ".$sdkversion." selected\n";
       
  2744 	}
       
  2745 	elsif($target eq "winsspd")
       
  2746 	{
       
  2747 		@globlist = ("winsspd");
       
  2748 		#print "winsspd selected\n";
       
  2749 	}
       
  2750 	elsif($sdkversion ne "")
       
  2751 	{
       
  2752 		@globlist = ($target,"hw_".$sdkversion);
       
  2753 		#print "$target $sdkversion selected\n";
       
  2754 	}
       
  2755 	else
       
  2756 	{
       
  2757 		@globlist = ($target,"hw");
       
  2758 		#print "$target $sdkversion selected\n";
       
  2759 	}
       
  2760 	
       
  2761 	foreach my $module(@generatedModules)
       
  2762 	{
       
  2763 	  my $glob_to_use = "";
       
  2764 	  my @fileList;
       
  2765 	  foreach my $glob(@globlist)
       
  2766 	  {
       
  2767 			my $src = $ATSRoot."/components/".$libname."_"."$module/*.xml";
       
  2768 			#print "Analysing $module and  $glob\n";
       
  2769 			@fileList = glob($src);
       
  2770 			foreach my $file(@fileList)
       
  2771 			{
       
  2772 			 my $pat = $glob."\_component\.xml";
       
  2773 			 #print "[$file - $glob"."_component.xml"."]\n";
       
  2774 				if($file =~ /$pat/)
       
  2775 				{
       
  2776 					$glob_to_use = $pat;
       
  2777 					#print "[$file - $glob"."_component.xml"."]\n";
       
  2778 					last
       
  2779 				}
       
  2780 			}#foreach FILE
       
  2781 			if($glob_to_use ne "")
       
  2782 			{
       
  2783 				last;
       
  2784 			}
       
  2785 		}#finding glob	
       
  2786 		if($glob_to_use ne "")
       
  2787 		{
       
  2788 				#print "Using the glob $glob_to_use\n";
       
  2789 				my $src = $ATSRoot."/components/".$libname."_"."$module/*.xml";
       
  2790 				@fileList = glob($src);
       
  2791 				foreach my $file(@fileList)
       
  2792 				{
       
  2793 					#print "[$file - $glob_to_use]\n";
       
  2794 					if($file =~ /$glob_to_use/)
       
  2795 					{
       
  2796 				  	$file =~ /.*components[\\\/](.*)/;
       
  2797 				  	my $value = $1;
       
  2798 				  	$value =~ s/\//\\/g;
       
  2799 				  	#print "adding $value for $module with $glob_to_use\n";
       
  2800 						unshift @foundList,$value;
       
  2801 				  }#if
       
  2802 				}#foreach
       
  2803 		}#glob is present
       
  2804 		else
       
  2805 		{
       
  2806 			warn("Unable to figure out glob to use for $module. Skipping...\n");
       
  2807 		}
       
  2808 	}#each module
       
  2809   return @foundList;
       
  2810  }#fn
       
  2811 
       
  2812 __END__
       
  2813 :end
       
  2814 
       
  2815 
       
  2816 
       
  2817