tsrc/data/genatsmodules_mediamgmt.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_mediamgmt.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 @sapidlllist = 
       
   597 	("tmediamgmttest_image",
       
   598 	"tmediamgmttest_music",
       
   599 	"tmediamgmttest_sound",
       
   600 	"tmediamgmttest_video",
       
   601 	"tmediamgmttest_streaming",
       
   602 	"tmediamgmttest_twice",
       
   603 	"tmediamgmttest_cancel",
       
   604 	"tmediamgmttest_pos" 
       
   605   );
       
   606   
       
   607 	@generatedModules = @sapidlllist;
       
   608 	DoGen("sapi",".dll");
       
   609 	
       
   610 	my @mysapidependcies = 
       
   611 	(
       
   612 	#first the file to copy, next the test for which to copy, next is relative locate, 
       
   613 	#if cfg, General,
       
   614 	#last the location on the phone where the cfg should go
       
   615 	#for us c:\\TestFramework
       
   616   
       
   617   ["tmediamgmttest_image.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   618   ["tmediamgmttest_image1.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   619   ["tmediamgmttest_image2.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   620   ["tmediamgmttest_image3.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   621   ["tmediamgmttest_image4.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   622   ["tmediamgmttest_image5.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   623   ["tmediamgmttest_image6.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   624   ["tmediamgmttest_image7.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   625   ["tmediamgmttest_image8.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   626   ["tmediamgmttest_image9.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   627   ["tmediamgmttest_image10.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   628   ["tmediamgmttest_image11.cfg", "tmediamgmttest_image", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   629   
       
   630   ["tmediamgmttest_sound.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   631   ["tmediamgmttest_sound1.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   632   ["tmediamgmttest_sound2.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   633   ["tmediamgmttest_sound3.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   634   ["tmediamgmttest_sound4.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   635   ["tmediamgmttest_sound5.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   636   ["tmediamgmttest_sound6.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   637   ["tmediamgmttest_sound7.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   638   ["tmediamgmttest_sound8.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   639   ["tmediamgmttest_sound9.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   640   ["tmediamgmttest_sound10.cfg", "tmediamgmttest_sound", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   641   
       
   642   ["tmediamgmttest_music.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   643   ["tmediamgmttest_music1.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   644   ["tmediamgmttest_music2.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   645   ["tmediamgmttest_music3.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   646   ["tmediamgmttest_music4.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   647   ["tmediamgmttest_music5.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   648   ["tmediamgmttest_music6.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   649   ["tmediamgmttest_music7.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   650   ["tmediamgmttest_music8.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   651   ["tmediamgmttest_music9.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   652   ["tmediamgmttest_music10.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   653   ["tmediamgmttest_music11.cfg", "tmediamgmttest_music", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   654   
       
   655   ["tmediamgmttest_video.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   656   ["tmediamgmttest_video1.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   657   ["tmediamgmttest_video2.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   658   ["tmediamgmttest_video3.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   659   ["tmediamgmttest_video4.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   660   ["tmediamgmttest_video5.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   661   ["tmediamgmttest_video6.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   662   ["tmediamgmttest_video7.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   663   ["tmediamgmttest_video8.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   664   ["tmediamgmttest_video9.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   665   ["tmediamgmttest_video10.cfg", "tmediamgmttest_video", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   666   
       
   667   ["tmediamgmttest_cancel.cfg", "tmediamgmttest_cancel", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   668   ["tmediamgmttest_pos.cfg", "tmediamgmttest_pos", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   669   ["tmediamgmttest_twice.cfg", "tmediamgmttest_twice", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"], 
       
   670   
       
   671   ["tmediamgmttest_streaming.cfg", "tmediamgmttest_streaming", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   672   ["tmediamgmttest_streaming1.cfg", "tmediamgmttest_streaming", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   673   ["tmediamgmttest_streaming2.cfg", "tmediamgmttest_streaming", "/../mediamanagement/internal/testing/tmediamgmttest/group/", "/General/", "C:\\TestFramework"],
       
   674   
       
   675   
       
   676   
       
   677   );
       
   678 
       
   679 	CopyArbitDatFiles("sapi",\@mysapidependcies);   	#CopyArbitDatFiles("stdcpp",\@mysapidependcies);
       
   680 	if($install eq "yes")
       
   681 	{
       
   682 	
       
   683 		@generatedModules = (@sapidlllist);      #(@sapidlllist, @sapiexelist);
       
   684 		my @saved = @dllList;
       
   685 		#this list is where the libraries to be tested goes
       
   686 		my @cppList = ("cameraservice.dll",
       
   687 		               "locationservice.dll",
       
   688 		               #"mediamanagementservice.dll",
       
   689 		               "messagingservice.dll",
       
   690 		               		
       
   691 		             );
       
   692     @dllList = @cppList;
       
   693 		CopySharedDlls("sapi",\@dllList);     #CopySharedDlls("stdcpp",\@dllList); 
       
   694 	  TransformXmls("sapi", "shared");      #TransformXmls("stdcpp", "shared");
       
   695 		@dllList = @saved;
       
   696 		exit;
       
   697 	}#if install
       
   698 }
       
   699 	
       
   700 
       
   701 if($suite eq "lsb" || $suite eq "all")
       
   702 {
       
   703 	my @lsbModules = GetLsbModules();
       
   704 	@generatedModules = @lsbModules;
       
   705 	DoGen("lsb",".exe");
       
   706 	
       
   707 	my @depDlls;
       
   708 	my $dll;
       
   709 	
       
   710 	#copying the common dlls
       
   711 	@depDlls  = 
       
   712 	(
       
   713 	 "libapi.dll",
       
   714 	 "tcm.dll",
       
   715 	 "vlib.dll",
       
   716 	);
       
   717 		
       
   718 	foreach $dll (@depDlls)
       
   719 	{
       
   720 		CopyDeps("lsb",$dll);
       
   721 	}
       
   722 	#now copy the cfg files
       
   723 	CopyLsbCfg("lsb");	
       
   724 	#now copy the extra dependency dlls
       
   725 	
       
   726 	#dlopen
       
   727 	@generatedModules = ("dlopen");
       
   728 	
       
   729 	
       
   730 	
       
   731 	@depDlls  = 
       
   732 	(
       
   733 	 "dynlibtest.1.dll",
       
   734 	 "dynlibtest.11.1.dll",
       
   735 	 "dynlibtest.11.2.dll",
       
   736 	 "dynlibtest.12g.dll",
       
   737 	 "dynlibtest.12r.dll",
       
   738 	 "dynlibtest.14.1.dll",
       
   739 	 "dynlibtest.14.2.dll",
       
   740 	 "dynlibtest.14.3.dll",
       
   741 	 "dynlibtest.3.1.dll",
       
   742 	 "dynlibtest.3.2.dll",
       
   743 	 "dynlibtest.3.dll",
       
   744 	 "dynlibtest.4.dll",
       
   745 	 "dynlibtest.8.dll",
       
   746 	 "dynlibtest.9.dll",
       
   747 	 "dynlibtest.3.dll",
       
   748 	 "dynlibtest.8.dll",
       
   749 	);
       
   750 	
       
   751 	foreach $dll (@depDlls)
       
   752 	{
       
   753 		CopyDeps("lsb",$dll);
       
   754 	}
       
   755 	
       
   756 	#dlclose
       
   757 	@generatedModules = ("dlclose");
       
   758 	@depDlls = ("dynlibclose.1.dll");
       
   759 	foreach $dll (@depDlls)
       
   760 	{
       
   761 		CopyDeps("lsb",$dll);
       
   762 	}
       
   763 	
       
   764 	#dlerror
       
   765 	@generatedModules = ("dlerror");
       
   766 	@depDlls = ("dynlib.dll");
       
   767 	foreach $dll (@depDlls)
       
   768 	{
       
   769 		CopyDeps("lsb",$dll);
       
   770 	}
       
   771 	
       
   772 	#now copy the xmls!
       
   773 	my $srcDir = $templateRoot."/ts/lsbsuites/group/";
       
   774 	
       
   775 	my $dst;
       
   776 	
       
   777 	foreach my $dllib("dlopen", "dlclose", "dlerror")
       
   778 	{
       
   779 		$dst  = $ATSRoot."\\components\\lsb_".$dllib."\\";
       
   780 		copy($srcDir."/lsb_".$dllib."_module_blr_hw_component.xml", $dst) || die("DIED: unable to copy from $srcDir!\n");
       
   781 		copy($srcDir."/lsb_".$dllib."_module_blr_winsspd_component.xml", $dst) || die("DIED: unable to copy from $srcDir!\n");
       
   782 	}
       
   783 	
       
   784 }
       
   785 
       
   786 if($suite eq "gcce")
       
   787 {
       
   788 
       
   789 	mkdir $ATSRoot;
       
   790 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
   791 	
       
   792 	@generatedModules = ("gcce-validate", "gcce-load");
       
   793 		
       
   794 	my @depDlls  = 
       
   795 	(
       
   796 		"gcce-lib.dll",
       
   797 	);
       
   798 	
       
   799 	my $suffix = ".exe";
       
   800 	my $libname = "gcce";
       
   801 	
       
   802 	
       
   803 	my $src;
       
   804 	my $dst;
       
   805 	foreach my $module(@generatedModules)
       
   806 	{
       
   807 		my $relroot = $ATSRoot."\\components\\$libname"."_$module";
       
   808 		mkdir $relroot || die("DIED: unable to create dir $module\n");
       
   809 		mkdir $relroot."\\armv5_urel" || die("DIED: unable to create dir $relroot\\armv5_urel\n");
       
   810 		
       
   811 		#GenExeXmls($module,$libname);
       
   812 		
       
   813 		$src = $rootDrive."\\epoc32\\release\\gcce\\urel\\".$module.$suffix;
       
   814 		$dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module);
       
   815 		$dst = $dst."\\armv5_urel\\";
       
   816 		copy($src, $dst)  || warn("unable to copy $src to $dst");
       
   817 	}
       
   818 	$src = $rootDrive."\\epoc32\\release\\gcce\\urel\\"."gcce-lib.dll";
       
   819 	$dst = $ATSRoot."\\components\\gcce_gcce-load";
       
   820 	$dst = $dst."\\armv5_urel\\";
       
   821 	copy($src, $dst)  || warn("unable to copy $src to $dst");
       
   822 	
       
   823 	
       
   824 	my @list = (
       
   825   				 ["gcce_gcce-load_module_blr_hw_component.xml", "gcce-load", "./","/", ""],
       
   826   				 ["gcce_gcce-validate_module_blr_hw_component.xml", "gcce-validate", "./","/", ""],
       
   827   				 );
       
   828  
       
   829   my $bDataRef = \@list;  				 
       
   830 	CopyArbitDatFiles("gcce",$bDataRef);  				 
       
   831 
       
   832 	
       
   833 }#if gcce
       
   834 
       
   835 
       
   836 
       
   837 if($suite eq "libc-locale")
       
   838 {
       
   839 	$dontStrip = 0;
       
   840 	mkdir $ATSRoot;
       
   841 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
   842 	
       
   843 	@generatedModules = ("tstring");
       
   844 	DoGen("libc",".dll");
       
   845 	
       
   846 	my @localelist = (
       
   847 	  				 ["locales.txt", "string", "../libc/internal/testapps/tstring/data/", "/General/", ""],
       
   848 	  				 ["tstring_locale_component.xml", "string", "../libc/internal/testapps/tstring/group/", "/", ""],
       
   849 	 
       
   850 	  				 );
       
   851 		
       
   852   my $bDataRef = \@localelist;  				 
       
   853 	CopyArbitDatFiles("libc",$bDataRef);  				 
       
   854 	#delete($ATSRoot."/components/libc_string/"."libc_string_module_blr_hw_component.xml") || die("unable to delete");
       
   855 	my $my_src = $ATSRoot."/components/libc_string/"."tstring_locale_component.xml";
       
   856 	my $my_dst = $ATSRoot."/components/libc_string/"."libc_string_module_blr_hw_component.xml";
       
   857 	
       
   858 	unlink($my_dst) ||warn("unable to delete $my_dst");
       
   859 	rename($my_src,$my_dst) || move($my_src,$my_dst) || die("Unable to rename!");
       
   860 	
       
   861 }#if libc-locale
       
   862 
       
   863 
       
   864 if($suite eq "pcts")
       
   865 {
       
   866 	my $bldfile = $templateRoot."/group/bld.inf";
       
   867 	my @pctsModules = GetCompiledModules($bldfile);
       
   868 	@generatedModules = @pctsModules;
       
   869 	DoGen("pcts",".exe");
       
   870 	
       
   871 	my @depDlls;
       
   872 	my $dll;
       
   873 	
       
   874 	
       
   875 	#copying the common dlls
       
   876 	@depDlls  = 
       
   877 	(
       
   878 		"vsxlibapi.dll",
       
   879 		"rttm.exe",
       
   880 		"rtlibapi.dll",
       
   881 		"vsxvlib.dll",
       
   882 		"vsxgenlib.dll",
       
   883 		"vsxtsetlib.dll",
       
   884 		"vsxvport.dll",
       
   885 	);
       
   886 	
       
   887 	if($install eq "yes")
       
   888 	{
       
   889 		my @saved = @dllList; 
       
   890 		@dllList = @depDlls;	
       
   891 		CopySharedDlls("pcts", \@depDlls);
       
   892 		TransformXmls("pcts","shared");
       
   893 		@dllList = @saved;
       
   894 		
       
   895 		#now copy the cfg files
       
   896 		my $dst;
       
   897 		my $srcDir = "/epoc32/winscw/c/data/tet/";
       
   898 		my $file1 = $srcDir."tet_code";
       
   899 		my $file2 = $srcDir."tetexec.cfg";
       
   900 		foreach my $module(@generatedModules)
       
   901 		{
       
   902 			$dst = $ATSRoot."\\components\\pcts_".$module;
       
   903 			$dst = $dst."\\General\\";
       
   904 			copy($file1, $dst) or die "copy: $! $file1 $dst";
       
   905 			copy($file2,$dst) or die "copy: $! $file2 $dst";
       
   906 		}
       
   907 	}
       
   908 		
       
   909 	
       
   910 	
       
   911 	
       
   912 	my $dst;	
       
   913 	foreach my $module(@generatedModules)
       
   914 	{
       
   915 		my $file3 = "/epoc32/winscw/c/logs/tet/m.".$module;
       
   916 
       
   917 		$dst = $ATSRoot."\\components\\pcts_".$module;
       
   918 		$dst = $dst."\\General\\";
       
   919 		copy($file3, $dst) or die "copy: $! $file3 $dst";
       
   920 	}#module
       
   921 }
       
   922 
       
   923 
       
   924 
       
   925 $dontStrip = 0;
       
   926 
       
   927 if($suite eq "stdlibs" || $suite eq "all")
       
   928 {
       
   929 	@generatedModules = ("tzlib");
       
   930 	DoGen("libz", ".dll");
       
   931 
       
   932 	@generatedModules = ("tlibcrypt");
       
   933 	DoGen("libcrypt",".dll");
       
   934 
       
   935 	@generatedModules = @libcModules;
       
   936 	DoGen("libc",".dll");
       
   937 	GenBackendTest();
       
   938 	
       
   939 	@generatedModules = ("twchar");
       
   940 	CopyDeps("libc","twchar_helloworld.exe");
       
   941 	
       
   942 	@generatedModules = ("twopen");
       
   943 	CopyDeps("libc","twpopenwritechild.exe");
       
   944 	CopyDeps("libc","twpopenreadchild.exe");
       
   945 
       
   946 
       
   947 	@generatedModules = @libdlModules;
       
   948 	DoGen("libdl",".dll");
       
   949 	CopyDeps("libdl","Dll1.dll");
       
   950 	CopyDeps("libdl","Dll2.dll");
       
   951 	CopyDeps("libdl","DependencyTestDll.dll");
       
   952 
       
   953 	@generatedModules = @libmModules;
       
   954 	DoGen("libm",".dll");
       
   955 
       
   956 	$TDIR = "\\internal\\";
       
   957 	@generatedModules = @pthreadModules;
       
   958 	DoGen("libpthread",".dll");
       
   959 	CopyDeps("libpthread","testharness.dll");
       
   960 
       
   961 	CopyDatFiles();
       
   962 }
       
   963 
       
   964 if($install eq "yes")
       
   965 {
       
   966 	foreach my $lib(@liblist)
       
   967 	{   
       
   968 		#print "Transforming lib $lib\n";       
       
   969 		@generatedModules = GenGenModules($lib);
       
   970 		my @oldList = @dllList;
       
   971 		if($do_winscw)
       
   972   	{
       
   973   		@dllList = (@dllList, "wsdsoln.dll", "libestw32.dll");
       
   974   		CopySharedDlls($lib,\@dllList,"winscw");     	
       
   975 	  	TransformXmls($lib, "shared","winscw");
       
   976   	}
       
   977   	@dllList = @oldList;
       
   978   	if($do_armv5)
       
   979   	{
       
   980 	  	CopySharedDlls($lib,\@dllList,"armv5");     	
       
   981 	  	TransformXmls($lib, "shared","armv5");
       
   982   	}
       
   983 	}#FOREACH
       
   984 }#if install
       
   985 
       
   986 
       
   987 
       
   988 #function to generate ModuleList for a compiled bld.inf
       
   989 sub GetCompiledModules($)
       
   990 {
       
   991 	my $file = shift @_;
       
   992 	my @moduleList;
       
   993 	
       
   994 	
       
   995 	# Open input file
       
   996 	open (INFILE, "<".$file ) || die ("DIED: Can not find $file!");
       
   997 
       
   998 	while (<INFILE>)
       
   999 	{
       
  1000 		if(/(.*)\.mmp/ && $1 !~ /^\/\//) 
       
  1001 	  {
       
  1002 	  		if($_ !~ /\/\/Not for ATS/)
       
  1003 	  		{
       
  1004 	  			push @moduleList, $1;
       
  1005 	  		}
       
  1006 	  }
       
  1007 	}
       
  1008 	close (INFILE);
       
  1009 	return @moduleList;
       
  1010 }
       
  1011 
       
  1012 my @groupList;
       
  1013 sub GetLtpModules()
       
  1014 {
       
  1015         my $prevDir = getcwd();
       
  1016         my @rootList = ("kernel", "misc");
       
  1017         my @totalgroupList;
       
  1018         foreach my $node(@rootList)
       
  1019         {
       
  1020         	chdir $ltpPath."/$node";
       
  1021         	@groupList = ();
       
  1022         	find(\&MakeGroupList, ".");
       
  1023         	@totalgroupList = (@totalgroupList, @groupList);
       
  1024         }
       
  1025         chdir $prevDir;
       
  1026         return @totalgroupList;
       
  1027 }
       
  1028 
       
  1029 sub GetstdexeModules()
       
  1030 {
       
  1031       my $prevDir = getcwd();
       
  1032       my @fullList = ();
       
  1033       foreach my $group(@stdexeList)
       
  1034       {
       
  1035       	my $groupPath = $templateRoot."/testapps/".$group. "/";
       
  1036       	chdir $groupPath;
       
  1037       	@groupList = ();
       
  1038       	find(\&grovelAllMmpFiles, ".");
       
  1039       	chdir $prevDir;
       
  1040       	@fullList = (@fullList,@groupList);
       
  1041       }
       
  1042       return @fullList;      
       
  1043 }
       
  1044 
       
  1045 sub grovelAllMmpFiles()
       
  1046 {
       
  1047 	if($_ =~ /(.*)\.mmp/ && ! ($_ =~ /manual/))
       
  1048 	{
       
  1049 		push @groupList, $1;#get name of module
       
  1050 	}
       
  1051 }
       
  1052 
       
  1053 sub GetstdcppModules()
       
  1054 {
       
  1055         my $prevDir = getcwd();
       
  1056         my @rootList = ("auto");
       
  1057         my @totalgroupList;
       
  1058         foreach my $node(@rootList)
       
  1059         {
       
  1060         	chdir $stdcppPath."/$node";
       
  1061         	@groupList = ();
       
  1062         	find(\&MakeGroupList, ".");
       
  1063         	@totalgroupList = (@totalgroupList, @groupList);
       
  1064         }
       
  1065         chdir $prevDir;
       
  1066         return @totalgroupList;
       
  1067 }
       
  1068 
       
  1069 sub GetTstdcppModules()
       
  1070 {
       
  1071       my $prevDir = getcwd();
       
  1072       #chdir $tstdcppPath;
       
  1073       @groupList = ();
       
  1074       find(\&grovelAllMmpFiles, ".");
       
  1075       chdir $prevDir;
       
  1076       return @groupList;
       
  1077 }
       
  1078 
       
  1079 sub MakeGroupList()
       
  1080 {
       
  1081 	my $currentDir = $File::Find::dir;
       
  1082 	
       
  1083 	#print "Current dir:$currentDir\n";
       
  1084 	if( $currentDir =~ /.*\/(.*)\/group/)
       
  1085 	{
       
  1086 		if($cfglocation{$1} eq "")
       
  1087 		{
       
  1088 			$cfglocation{$1} = getcwd()."\/$1.cfg";
       
  1089 			push @groupList, $1;#get name of module
       
  1090 		}#first time in group
       
  1091 	}#group found
       
  1092 }#subrtn end
       
  1093 
       
  1094 
       
  1095 #function that generates the ATS setup
       
  1096 sub DoGen($$)
       
  1097 {
       
  1098 	my $libname = shift @_;
       
  1099 	my $ext = shift @_;
       
  1100 	mkdir $ATSRoot;
       
  1101 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
  1102 	
       
  1103 	
       
  1104 	GenDirs($libname);
       
  1105 	my $module;
       
  1106 	foreach my $listed(@generatedModules)
       
  1107 	{
       
  1108 	my @filesToProcess =
       
  1109         (
       
  1110          "LibXXX_ATSTemplateXXX_module_blr_hw_component.xml",
       
  1111          "LibXXX_ATSTemplateXXX_module_blr_winsspd_component.xml",
       
  1112          "testframework.ini",
       
  1113         );
       
  1114 		if(rindex($noXmlsGenList, $libname) != -1 )	
       
  1115 		{
       
  1116 			@filesToProcess = ("testframework.ini",);
       
  1117 		}
       
  1118 
       
  1119 			if($ext eq ".exe")
       
  1120 			{
       
  1121 				GenExeXmls($listed,$libname);
       
  1122 			}
       
  1123 			else
       
  1124 			{
       
  1125 				#just in case no xml file was supplied
       
  1126 				
       
  1127         my $ref = \@filesToProcess;
       
  1128 				GenXmls($libname, $listed,$ref);
       
  1129 			}
       
  1130 	}#foreach
       
  1131 	
       
  1132 	CopyDlls($libname,$ext);
       
  1133 	#copy the provided cfg, ini and xmls
       
  1134 	if($libname eq "opts")
       
  1135 	{
       
  1136 		CopyOptsCfg($libname);
       
  1137 	}
       
  1138 	elsif($libname eq "ltp" || $libname eq "lsb" || $libname eq "glib")
       
  1139 	{
       
  1140 	  #copy latter and  dont copy respectively for ltp and lsb
       
  1141 	}
       
  1142 	else
       
  1143 	{
       
  1144 	  CopyCfgIniXmls($libname);
       
  1145 	}
       
  1146 }
       
  1147 
       
  1148 sub CopyCfgIniXmls()
       
  1149 {
       
  1150 	my $libname = pop @_;
       
  1151 	
       
  1152 	my $libRoot = $templateRoot;
       
  1153 	$libRoot =~ /(.*)internal.*/;
       
  1154 	$libRoot = $1;
       
  1155 
       
  1156 
       
  1157 	my $module;
       
  1158 	my $src;
       
  1159 	my $dst;
       
  1160 		
       
  1161 	foreach my $listed(@generatedModules)
       
  1162 	{
       
  1163 	  my $dirname = $listed;
       
  1164 	  $dirname =~ s/test/t/;
       
  1165 	  $module = StripModulePrefix($listed);
       
  1166 	    
       
  1167 		$src = $libRoot.$libname.$TDIR.$dirname."\\group\\";
       
  1168 				
       
  1169 		my $xmlCopied = "0";
       
  1170 		my @globpattern = ("*.ini", "*.xml","*.cfg");
       
  1171 		foreach my $pat(@globpattern)
       
  1172 		{
       
  1173 			$dst = $ATSRoot."\\components\\".$libname."_".$module;
       
  1174 			if($pat ne "*.xml")
       
  1175 			{
       
  1176 				$dst = $dst."\\General\\";
       
  1177 			}
       
  1178 			else
       
  1179 			{
       
  1180 				$dst = $dst."\\";
       
  1181 			}
       
  1182 			my @filesFound = glob($src."\\$pat");
       
  1183 			if(scalar @filesFound eq "0")
       
  1184 			{
       
  1185 				#print "No files found for module $module $pat!\n";
       
  1186 				#print $src;
       
  1187 			}
       
  1188 			
       
  1189 			#handcoded
       
  1190 			if($pat eq "*.cfg" && $xmlCopied eq "0")#rename only if xml not copied
       
  1191 			{
       
  1192 				if(scalar @filesFound > 1)
       
  1193 				{
       
  1194 					print "Multiple cfg files found. Copying all!\n";
       
  1195 				}
       
  1196 				else
       
  1197 				{
       
  1198 						$dst = $dst.$listed.".cfg";
       
  1199 				}
       
  1200 			}				
       
  1201 			elsif($pat eq "*.xml")
       
  1202 			{
       
  1203 				my $folder = $dst;
       
  1204 				foreach my $from (@filesFound) 
       
  1205 				{
       
  1206 					if($from =~ /winscw_component/)
       
  1207 					{
       
  1208 						$dst = $folder.$libname."_".$module."_module_blr_winscw_component.xml";
       
  1209 						copy($from, $dst) or die "DIED: copy: $! $from $dst";
       
  1210 						$xmlCopied = "1";
       
  1211 					}
       
  1212 					elsif($from =~ /winsspd_component/)
       
  1213 					{
       
  1214 						$dst = $folder.$libname."_".$module."_module_blr_winsspd_component.xml";
       
  1215 						copy($from, $dst) or die "DIED: copy: $! $from $dst";
       
  1216 						$xmlCopied = "1";
       
  1217 					}
       
  1218 					elsif($from =~ /hw_component/)
       
  1219 					{
       
  1220 						$dst = $folder.$libname."_".$module."_module_blr_hw_component.xml";
       
  1221 						copy($from, $dst) or die "DIED: copy: $! $from $dst";
       
  1222 						$xmlCopied = "1";
       
  1223 					}
       
  1224 				}#examine individually			
       
  1225 				if(scalar @filesFound > 2)
       
  1226 				{
       
  1227 					#print "Multiple xml files found!!!\n";
       
  1228 				}
       
  1229 				@filesFound = ();
       
  1230 			}	
       
  1231 				
       
  1232 			
       
  1233 			foreach my $from (@filesFound) 
       
  1234 			{
       
  1235 					copy($from, $dst) or die "DIED: copy: $! $from $dst";
       
  1236 			}#copy individually			
       
  1237 		}#globpattern
       
  1238 	}#module
       
  1239 }#fn
       
  1240 
       
  1241 #copy the cfg files for the opts test suite
       
  1242 sub CopyOptsCfg()
       
  1243 {
       
  1244 	my $libname = pop @_;
       
  1245 	
       
  1246 	my $libRoot = $optsGroupPath."\\";
       
  1247 	my $module;
       
  1248 	my $src;
       
  1249 	my $dst;
       
  1250 		
       
  1251 	foreach $module(@generatedModules)
       
  1252 	{
       
  1253 		$src = $libRoot.$module."\.cfg";
       
  1254 		$dst = $ATSRoot."\\components\\".$libname."_".$module;
       
  1255 		$dst = $dst."\\General\\";
       
  1256 		copy($src, $dst) or warn "copy: $! $src $dst";
       
  1257 	}#module
       
  1258 }#fn
       
  1259 
       
  1260 #copy the lsb cfg files
       
  1261 sub CopyLsbCfg()
       
  1262 {
       
  1263 	my $libname = pop @_;
       
  1264 	
       
  1265 	my $module;
       
  1266 	
       
  1267 	my $dst;
       
  1268 	
       
  1269 	my $srcDir = $templateRoot."/ts/lsbsuites/lsblib/data/";
       
  1270 		
       
  1271 	foreach $module(@generatedModules)
       
  1272 	{
       
  1273 		my $file1 = $srcDir."tet_code.cfg";
       
  1274 		my $file2 = $srcDir."tetexec.cfg";
       
  1275 		$dst = $ATSRoot."\\components\\".$libname."_".$module;
       
  1276 		$dst = $dst."\\General\\";
       
  1277 		copy($file1, $dst) or die "copy: $! $file1 $dst";
       
  1278 		copy($file2, $dst) or die "copy: $! $file2 $dst";
       
  1279 	}#module
       
  1280 }#fn
       
  1281 
       
  1282 
       
  1283 #copy the ltp cfg files
       
  1284 sub CopyLtpCfg($)
       
  1285 {
       
  1286 	my $libname = pop @_;
       
  1287 	
       
  1288 	my $module;
       
  1289 	my $src;
       
  1290 	my $dst;
       
  1291 		
       
  1292 	foreach $module(@generatedModules)
       
  1293 	{
       
  1294 		$src = $cfglocation{$module};
       
  1295 		$dst = $ATSRoot."\\components\\".$libname."_".$module;
       
  1296 		$dst = $dst."\\General\\";
       
  1297 		copy($src, $dst) or warn "copy: $! $src $dst";
       
  1298 	}#module
       
  1299 }#fn
       
  1300 
       
  1301 
       
  1302 sub CopyDlls($$)
       
  1303 {
       
  1304 	my $libname = shift @_;
       
  1305 	my $suffix = shift @_;
       
  1306 	
       
  1307 	my $module;
       
  1308 	my $src;
       
  1309 	my $dst;
       
  1310 	
       
  1311 	
       
  1312 	foreach $module(@generatedModules)
       
  1313 	{
       
  1314 	  if($do_winscw == 1)
       
  1315 	  { 	  
       
  1316 			$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$module.$suffix;
       
  1317 			$dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module);
       
  1318 			$dst = $dst."\\winscw_udeb\\";
       
  1319 			copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  1320 		}
       
  1321 	  if($do_armv5 == 1)
       
  1322 	  {
       
  1323 			$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$module.$suffix;
       
  1324 			$dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module);
       
  1325 			$dst = $dst."\\armv5_urel\\";
       
  1326 			copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  1327 		}
       
  1328 	}#foreach
       
  1329 }
       
  1330 #fn to generate the session file
       
  1331 sub GenerateSessionFile($$$$)
       
  1332 {
       
  1333 	my $libname = shift @_;
       
  1334 	my $target = shift @_;
       
  1335 	my $name = shift @_;
       
  1336 	my $listptr = shift @_;
       
  1337 	my $outdir = $ATSRoot;
       
  1338 	my $infile = $templateRoot."\\testsession.xml";
       
  1339 	chdir $outdir || die("DIED: Unable to chdir!"); 
       
  1340 	#open INFILE, $infile || die ("DIED: Can not open input file $infile");
       
  1341 	my $prefix = $name."_".$target;
       
  1342 	if($sdkversion ne "")
       
  1343 	{
       
  1344 		$prefix = $prefix."_".$sdkversion;
       
  1345 	}
       
  1346 	
       
  1347 	open OUTFILE, ">".$outdir."\\".$prefix."_testsession.xml" || die ("DIED: Can not open output file");
       
  1348 	my $line;
       
  1349   my $snippet = $target;
       
  1350   if($target ne "winscw" && $target ne "winsspd")
       
  1351   {
       
  1352   	$snippet = "hw";
       
  1353   }
       
  1354 
       
  1355 print OUTFILE "<?xml version=\"1.0\"?>\n";
       
  1356 print OUTFILE "<testsession>\n";
       
  1357 #print OUTFILE "<symbian-version>$libname"."_".$snippet."_TestDrop_blr_component</symbian-version>\n";	
       
  1358 print OUTFILE "<symbian-version>sapi_testing_combined_test_session</symbian-version>\n";	
       
  1359 print OUTFILE "<testitem>at</testitem>\n";	
       
  1360 print OUTFILE "<resultfile>ATSOUTPUT\\".$prefix."_testsession_results.xml</resultfile>\n";		
       
  1361 if($sendEmail eq "yes")
       
  1362 {
       
  1363 print OUTFILE <<EOEmailNote;
       
  1364 <email_notification>
       
  1365 <include_test_cases>false</include_test_cases>
       
  1366 <message_file>C:\\\\lm.txt </message_file>
       
  1367 <send_after_rerun>false</send_after_rerun>
       
  1368 <subject>Stdcpp-Plumhall $snippet testreport</subject>
       
  1369 <from>swbuild\@nokia.com</from>
       
  1370 <to>ajith.narayanan\@nokia.com</to>
       
  1371 <to>hrishikesh.brahmakal\@nokia.com</to>
       
  1372 <to>santosh.ks\@nokia.com</to>
       
  1373 <to>shilpa.sharma\@nokia.com</to>
       
  1374 <to>kasthuri.n-s\@nokia.com</to>
       
  1375 <to>hema.1.s\@nokia.com</to>
       
  1376 <to>vineetha.hari-pai\@nokia.com</to>
       
  1377 <to>madhusudhan.p.reddy\@nokia.com</to>
       
  1378 </email_notification>
       
  1379 EOEmailNote
       
  1380 }
       
  1381 
       
  1382 	if($libname ne "combined")
       
  1383 	{
       
  1384 		AddAssumedIncludes($libname,$snippet);
       
  1385 	}
       
  1386 	else
       
  1387 	{
       
  1388 		if($listptr ne "")
       
  1389 		{
       
  1390 			AddFileList($libname,$listptr);
       
  1391 		}
       
  1392 		else
       
  1393 		{
       
  1394 			AddActualIncludes($libname);
       
  1395 		}
       
  1396 	}
       
  1397    				
       
  1398 	print OUTFILE "</testsession>\n";
       
  1399 
       
  1400 	close(OUTFILE);
       
  1401 	#close(INFILE);
       
  1402 }#fn
       
  1403 
       
  1404 
       
  1405 sub AddAssumedIncludes($$)
       
  1406 {
       
  1407 	my $libname = shift @_; 
       
  1408 	my $snippet = shift @_;
       
  1409 	
       
  1410 	my $APITest;
       
  1411 	foreach my $listed(@generatedModules)
       
  1412 						{
       
  1413 							$APITest = StripModulePrefix($listed);
       
  1414 							print OUTFILE  "\n";
       
  1415 							print OUTFILE "	<!--Inclusion of $target xml for $APITest -->\n";
       
  1416 							print OUTFILE "	<component>\n";
       
  1417 							print OUTFILE "		<factory>Symbian</factory>\n";
       
  1418 							if($libname eq "all")
       
  1419 							{
       
  1420 									print OUTFILE "		 <testplan>ATSINPUT\\components\\$listed\\$listed"."_module_blr_".$snippet."_component.xml</testplan>\n";	 
       
  1421 							}
       
  1422 							else
       
  1423 							{
       
  1424 									print OUTFILE "		 <testplan>ATSINPUT\\components\\$libname"."_"."$APITest\\$libname"."_$APITest"."_module_blr_".$snippet."_component.xml</testplan>\n";	 
       
  1425 							}
       
  1426 							if($target eq "winscw")
       
  1427 							{
       
  1428 									print OUTFILE "		<target hardware=\"winscw\" build=\"udeb\" />\n";
       
  1429 							}
       
  1430 							elsif($target eq "winsspd")
       
  1431 							{
       
  1432 								print OUTFILE " <target hardware=\"winsspd\" platform=\"winscw\" build=\"udeb\" />\n"; 
       
  1433 							}
       
  1434 							else
       
  1435 							{
       
  1436 										print OUTFILE "		<target hardware=\"$target\" build=\"urel\" />\n";
       
  1437 							}
       
  1438 							print OUTFILE "	</component>\n";
       
  1439 							print OUTFILE "\n";
       
  1440 	           }#foreach @generatedModules
       
  1441 }
       
  1442 
       
  1443 
       
  1444 sub AddFileList($$)
       
  1445 {
       
  1446 	my $libname = shift @_; 
       
  1447 	my $listptr = shift @_;
       
  1448 	my @componentfiles = @$listptr;
       
  1449 	
       
  1450 			foreach my $listed(@componentfiles)
       
  1451 						{
       
  1452 								print OUTFILE  "\n";
       
  1453 							print OUTFILE "	<!--Inclusion of $target xml -->\n";
       
  1454 							print OUTFILE "	<component>\n";
       
  1455 							print OUTFILE "		<factory>Symbian</factory>\n";
       
  1456 							print OUTFILE "		 <testplan>ATSINPUT\\components\\$listed</testplan>\n";	 
       
  1457 							if($target eq "winscw")
       
  1458 							{
       
  1459 									print OUTFILE "		<target hardware=\"winscw\" build=\"udeb\" />\n";
       
  1460 							}
       
  1461 							elsif($target eq "winsspd")
       
  1462 							{
       
  1463 								print OUTFILE " <target hardware=\"winsspd\" platform=\"winscw\" build=\"udeb\" />\n"; 
       
  1464 							}
       
  1465 							else
       
  1466 							{
       
  1467 										print OUTFILE "		<target hardware=\"$target\" build=\"urel\" />\n";
       
  1468 							}
       
  1469 							print OUTFILE "	</component>\n";
       
  1470 							print OUTFILE "\n";
       
  1471 	           }#foreach @componentfiles
       
  1472 }
       
  1473 
       
  1474 
       
  1475 
       
  1476 sub GetSslXmls()
       
  1477 {
       
  1478 	my $APITest;
       
  1479 	my @componentfiles;
       
  1480 	
       
  1481 	my @emulatorfiles = 
       
  1482 	(
       
  1483 	"libssl_ssltest\\libssl_blr_winsspd_component.xml",
       
  1484 	"libcrypto_crypto_test\\libcrypto_blr_winsspd_component.xml",
       
  1485 	"libcrypto_openssl\\libcrypto_topenssltestss_blr_winsspd_component.xml",
       
  1486 	"libcrypto_openssl\\libcrypto_topenssltestverify_blr_winsspd_component.xml",
       
  1487 	"libcrypto_openssl\\libcrypto_topenssltestenc_blr_winsspd_component.xml",
       
  1488 	"libcrypto_openssl\\libcrypto_topenssltestgen_blr_winsspd_component.xml",
       
  1489 	"libcrypto_openssl\\libcrypto_topenssltpkcs7_blr_winsspd_component.xml",
       
  1490 	"libcrypto_openssl\\libcrypto_topenssltpkcs7d_blr_winsspd_component.xml",
       
  1491 	"libcrypto_openssl\\libcrypto_topenssltreq_blr_winsspd_component.xml",
       
  1492 	"libcrypto_openssl\\libcrypto_topenssltreq2_blr_winsspd_component.xml",
       
  1493 	"libcrypto_openssl\\libcrypto_topenssltrsa_blr_winsspd_component.xml",
       
  1494 	"libcrypto_openssl\\libcrypto_topenssltcrl_blr_winsspd_component.xml",
       
  1495 	"libcrypto_openssl\\libcrypto_topenssltsid_blr_winsspd_component.xml",
       
  1496 	"libcrypto_openssl\\libcrypto_topenssltx509_blr_winsspd_component.xml",
       
  1497 	"libcrypto_openssl\\libcrypto_topenssltx5091_blr_winsspd_component.xml",
       
  1498 	"libcrypto_openssl\\libcrypto_topenssltx5092_blr_winsspd_component.xml",
       
  1499 	 );
       
  1500 	 
       
  1501 	my @hwfiles =
       
  1502 	(
       
  1503 		"libcrypto_openssl\\libcrypto_topenssltestss_blr_hw_component.xml",
       
  1504 		"libcrypto_openssl\\libcrypto_topenssltestverify_blr_hw_component.xml",
       
  1505 		"libcrypto_openssl\\libcrypto_topenssltestenc_blr_hw_component.xml",
       
  1506 		"libcrypto_openssl\\libcrypto_topenssltestgen_blr_hw_component.xml",
       
  1507 		"libcrypto_openssl\\libcrypto_topenssltpkcs7_blr_hw_component.xml",
       
  1508 		"libcrypto_openssl\\libcrypto_topenssltpkcs7d_blr_hw_component.xml",
       
  1509 		"libcrypto_openssl\\libcrypto_topenssltreq_blr_hw_component.xml",
       
  1510 		"libcrypto_openssl\\libcrypto_topenssltreq2_blr_hw_component.xml",
       
  1511 		"libcrypto_openssl\\libcrypto_topenssltrsa_blr_hw_component.xml",
       
  1512 		"libcrypto_openssl\\libcrypto_topenssltcrl_blr_hw_component.xml",
       
  1513 		"libcrypto_openssl\\libcrypto_topenssltsid_blr_hw_component.xml",
       
  1514 		"libcrypto_openssl\\libcrypto_topenssltx509_blr_hw_component.xml",
       
  1515 		"libcrypto_openssl\\libcrypto_topenssltx5091_blr_hw_component.xml",
       
  1516 		"libcrypto_openssl\\libcrypto_topenssltx5092_blr_hw_component.xml",		
       
  1517 		"libssl_ssltest\\libssl_blr_hw_component.xml",
       
  1518 		"libcrypto_crypto_test\\libcrypto_blr_hw_component.xml",
       
  1519 	);
       
  1520 	if($target eq "winsspd" || $target eq "winscw")
       
  1521 	{
       
  1522 		@componentfiles = @emulatorfiles;
       
  1523 	}
       
  1524 	else
       
  1525 	{
       
  1526 		@componentfiles = @hwfiles;
       
  1527 	}
       
  1528 	return @componentfiles;
       
  1529 }
       
  1530 
       
  1531 
       
  1532 
       
  1533 sub AddActualIncludes($)
       
  1534 {
       
  1535 	my $libname = shift @_; 
       
  1536 	find(\&XmlComponentFiles, ".");
       
  1537 	my $key;
       
  1538 	my $value;
       
  1539 	while(($key, $value) = each(%DirHash)) 
       
  1540 	{
       
  1541 							$value =~ s/\//\\/g;
       
  1542 							print OUTFILE  "\n";
       
  1543 							print OUTFILE "	<!--Inclusion of dynamically found $target xml -->\n";
       
  1544 							print OUTFILE "	<component>\n";
       
  1545 							print OUTFILE "		<factory>Symbian</factory>\n";
       
  1546 							print OUTFILE "		 <testplan>$value</testplan>\n";	 
       
  1547 							if($target eq "winscw")
       
  1548 							{
       
  1549 									print OUTFILE "		<target hardware=\"winscw\" build=\"udeb\" />\n";
       
  1550 							}
       
  1551 							elsif($target eq "winsspd")
       
  1552 							{
       
  1553 								print OUTFILE " <target hardware=\"winsspd\" platform=\"winscw\" build=\"udeb\" />\n"; 
       
  1554 							}
       
  1555 							else
       
  1556 							{
       
  1557 										print OUTFILE "		<target hardware=\"$target\" build=\"urel\" />\n";
       
  1558 							}
       
  1559 							print OUTFILE "	</component>\n";
       
  1560 							print OUTFILE "\n";
       
  1561 	
       
  1562 	}#while
       
  1563 }#fn
       
  1564 
       
  1565 sub XmlComponentFiles()
       
  1566 {
       
  1567 	if($_ !~ /\.xml/ || $_ =~ /manual/)
       
  1568 	{
       
  1569 		return;
       
  1570 	}
       
  1571 	#print "Processing $_\n";
       
  1572 	my $dir = getcwd();
       
  1573 	if($dir =~ /.*(ATSINPUT.*)/)
       
  1574 	{
       
  1575 			$dir = $1;
       
  1576 			if($dir !~ /.*components.*/)
       
  1577 			{
       
  1578 				return;
       
  1579 			}
       
  1580 			#print "The dir is $dir\n";
       
  1581 	}
       
  1582 	else
       
  1583 	{
       
  1584 		return;
       
  1585 	}
       
  1586 	
       
  1587 	if($target eq "winsspd" )
       
  1588 	{
       
  1589 		if($_ =~ /winsspd/)
       
  1590 		{
       
  1591 			#print "Adding $target file $_ for $dir\n";
       
  1592 			$DirHash{$dir} = $dir."/".$_;
       
  1593 		}
       
  1594 	}
       
  1595 	elsif($target eq "winscw")
       
  1596 	{
       
  1597 		if($_ =~ /winscw/)
       
  1598 		{
       
  1599 			#print "Adding $target file $_ for $dir\n";
       
  1600 			$DirHash{$dir} = $dir."/".$_;
       
  1601 		}
       
  1602 	}
       
  1603 	elsif($_ =~ /$target/)
       
  1604 	{
       
  1605 		#print "$_ matched $target \n";
       
  1606 		#print "Adding $target file $_ for $dir\n";
       
  1607 		$DirHash{$dir} = $dir."/".$_;
       
  1608 	}
       
  1609 	elsif($_ =~/hw/)
       
  1610 	{
       
  1611 		#print "$_ matched hw";
       
  1612 		if(scalar $DirHash{$dir} == 0)
       
  1613 		{
       
  1614 			#print "Adding hw file $_ for $dir\n";
       
  1615 			$DirHash{$dir} = $dir."/".$_;
       
  1616 			#print " and added\n"
       
  1617 		}
       
  1618 		else
       
  1619 		{
       
  1620 			#print " and not added\n";
       
  1621 		}
       
  1622 	}
       
  1623 }
       
  1624 
       
  1625 
       
  1626 
       
  1627 sub emptyArray()
       
  1628 {
       
  1629 	@generatedModules = ();
       
  1630 }
       
  1631 
       
  1632 sub GenDirs($)
       
  1633 {
       
  1634  my $libname = shift @_;
       
  1635  my $dirname;
       
  1636  foreach my $module(@generatedModules)
       
  1637  {
       
  1638   $dirname = StripModulePrefix($module);
       
  1639 	my $relroot = $ATSRoot."\\components\\$libname"."_$dirname";
       
  1640 	mkdir $relroot || die("DIED: unable to create dir $dirname\n");
       
  1641 	mkdir $relroot."\\General" || die("DIED: unable to create dir $relroot\\General\n");
       
  1642 	if($do_armv5 == 1)
       
  1643 	{
       
  1644 		mkdir $relroot."\\armv5_urel" || die("DIED: unable to create dir $relroot\\armv5_urel\n");
       
  1645 	}
       
  1646 	if($do_winscw == 1)
       
  1647 	{
       
  1648 		mkdir $relroot."\\winscw_udeb" || die("DIED: unable to create dir $relroot\\winscw_udeb\n");
       
  1649 	}
       
  1650  }
       
  1651 }
       
  1652 
       
  1653 sub GenXmls($$$)
       
  1654 {
       
  1655 	my $libname = shift @_;
       
  1656 	my $listedName = shift @_;
       
  1657 	my $bref = shift @_;
       
  1658 	my @filesToProcess = @$bref;
       
  1659 	
       
  1660 	#strip leading test and t names from module
       
  1661 	my $moduleName = StripModulePrefix($listedName);
       
  1662 
       
  1663       my $toPath = $ATSRoot."\\components\\$libname"."_$moduleName\\"; 
       
  1664         
       
  1665 
       
  1666        my $dst;
       
  1667        my $src;
       
  1668        foreach $src(@filesToProcess)
       
  1669        {
       
  1670                $dst = $src;
       
  1671                $dst =~ s/ATSTemplateXXX/$moduleName/;
       
  1672                $dst =~ s/LibXXX/$libname/;
       
  1673              
       
  1674 
       
  1675                if($src eq "testframework.ini")
       
  1676                {
       
  1677 					$dst =  $toPath."General\\".$dst;
       
  1678                }
       
  1679                else
       
  1680                {
       
  1681 					$dst =  $toPath.$dst;
       
  1682                }
       
  1683                copy($templateRoot."\\".$src, $dst) || die("DIED: Unable to copy $src to $dst\n");
       
  1684                ExpandModuleMacros($dst, $libname, $listedName);
       
  1685        }#foreach file
       
  1686 }
       
  1687 
       
  1688 
       
  1689 sub GenExeXmls()
       
  1690 {
       
  1691 	my $moduleName = shift @_;
       
  1692 	my $libname = shift @_;
       
  1693 			
       
  1694 	my $toPath = $ATSRoot."\\components\\$libname"."_$moduleName\\"; 
       
  1695   my @filesToProcess =
       
  1696   (
       
  1697      "LibXXX_ATSTemplateXXX_exemodule_blr_hw_component.xml",
       
  1698      "LibXXX_ATSTemplateXXX_exemodule_blr_winsspd_component.xml",
       
  1699   );
       
  1700 	
       
  1701 	my $dst;
       
  1702   my $src;
       
  1703   foreach $src(@filesToProcess)
       
  1704   {
       
  1705         $dst = $src;
       
  1706         $dst =~ s/ATSTemplateXXX/$moduleName/;
       
  1707         $dst =~ s/LibXXX/$libname/;
       
  1708         $dst =~ s/_exemodule_/_module_/;
       
  1709 				$dst =  $toPath.$dst;
       
  1710         copy($templateRoot."\\".$src, $dst) || die("DIED: Unable to copy to $dst\n");
       
  1711         ExpandModuleMacros($dst, $libname, $moduleName);
       
  1712    }#foreach file
       
  1713 }
       
  1714 
       
  1715 #function to expand the macros existing in a file
       
  1716 #file is replaced by new version
       
  1717 #args are relativePath. filename and  $moduleName
       
  1718 sub ExpandModuleMacros()
       
  1719 {
       
  1720 	# Take module name
       
  1721 	my $moduleName = pop @_;
       
  1722 	my $libname = pop @_;
       
  1723 	my $filename = pop @_;
       
  1724 
       
  1725 	my $MODULENAME = $moduleName;
       
  1726 	$MODULENAME =~ tr/[a-z]/[A-Z]/;
       
  1727 
       
  1728 	# Open input file
       
  1729 	open (INFILE, $filename ) || die ("DIED: Can not find $filename");
       
  1730 
       
  1731 	#Open output file
       
  1732 	my $newOutput = $filename."new";
       
  1733 	open (OUTFILE, ">".$newOutput ) || die ("DIED: Can not open $newOutput");
       
  1734 
       
  1735 	# Replace text in files
       
  1736 	while (<INFILE>)
       
  1737 	{
       
  1738 	  s/ATSTemplateXXX/$moduleName/g;
       
  1739 	  s/LibXXX/$libname/g;
       
  1740     	  print OUTFILE $_;
       
  1741 	}
       
  1742 
       
  1743 	# Close filehandles
       
  1744 	close (INFILE);
       
  1745 	close (OUTFILE);
       
  1746 
       
  1747 	# Rename result file
       
  1748 	unlink $filename;
       
  1749 	rename $newOutput,$filename;
       
  1750 }
       
  1751 
       
  1752 
       
  1753 
       
  1754 sub CopyDeps($$)
       
  1755 {
       
  1756   my $libname = shift @_;
       
  1757   my $copyDll = shift @_;
       
  1758 	my $src;
       
  1759 	my $dst;
       
  1760 	foreach my $listed(@generatedModules)
       
  1761 	{
       
  1762 				my $module = StripModulePrefix($listed);
       
  1763 				if($do_winscw == 1)
       
  1764 				{
       
  1765 					$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll;
       
  1766 					$dst = $ATSRoot."\\components\\$libname"."_$module";
       
  1767 					$dst = $dst."\\winscw_udeb\\";
       
  1768 					copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  1769 				}
       
  1770 				if($do_armv5 == 1)
       
  1771 				{
       
  1772 					$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll;
       
  1773 					$dst = $ATSRoot."\\components\\$libname"."_$module";
       
  1774 					$dst = $dst."\\armv5_urel\\";
       
  1775 					copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  1776 				}
       
  1777 	}#foreach
       
  1778 }#fn
       
  1779 
       
  1780 #dat file copy
       
  1781 sub CopyDatFiles()
       
  1782 {
       
  1783 	my $libRoot = $templateRoot;
       
  1784 	$libRoot =~ /(.*)internal.*/;
       
  1785 	$libRoot = $1;
       
  1786 
       
  1787  my @list = (
       
  1788   				 ["libcrypt", "tlibcrypt", "group/Test_Data.dat"],
       
  1789   				 ["libc", "tnetdb", "data/services.txt"],
       
  1790   				 ["libc", "tstring", "data/locales.txt"],
       
  1791   				 ["libc", "libc_loc_blr", "data/locales.txt"],
       
  1792   				 ["libz", "tzlib", "data/*.*"],
       
  1793   				 ["libc", "tlink", "data/*.*"],
       
  1794   				 ["libc", "tmmap", "data/*.*"],
       
  1795            );
       
  1796 
       
  1797 	 my $libname;
       
  1798 	 my $dirname;
       
  1799 	 my $glob;
       
  1800 	foreach my $ref(@list)
       
  1801 	{
       
  1802 			my @inarr = @$ref;
       
  1803 			($libname, $dirname, $glob) = @inarr;
       
  1804 			my $modulename = StripModulePrefix($dirname);
       
  1805 			my $src = "$libRoot/$libname/internal/testapps/$dirname/$glob";
       
  1806 			my $dst = $ATSRoot."\\components\\$libname"."_"."$modulename\\General\\";
       
  1807   		if($dirname eq "libc_loc_blr")
       
  1808   		{
       
  1809   			$src = "$libRoot/libc/src/locales.txt";
       
  1810   		}
       
  1811   		my @filesFound = glob($src);
       
  1812   		if(scalar @filesFound == 0)
       
  1813   		{
       
  1814   			die("DIED: no Dat file found to copy!");
       
  1815   		}
       
  1816   		foreach my $file(@filesFound)
       
  1817   		{
       
  1818   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  1819   		}
       
  1820   }#ref processing
       
  1821 }#fn
       
  1822 
       
  1823 
       
  1824 #glib dat file copy
       
  1825 sub CopyArbitDatFiles($$)
       
  1826 {
       
  1827 	
       
  1828 	 my $libname = shift @_;
       
  1829 	 my $refArr = shift @_;
       
  1830 	 my @list = @$refArr;
       
  1831 	 
       
  1832  	
       
  1833 	my $fname;
       
  1834 	my $modulename;
       
  1835 	my $location;
       
  1836 	my $atsDst;
       
  1837 	my $targetDst;
       
  1838 	
       
  1839 	#now copy the files appropriately
       
  1840 	foreach my $ref(@list)
       
  1841 	{
       
  1842 			my @inarr = @$ref;
       
  1843 			($fname, $modulename, $location, $atsDst, $targetDst) = @inarr;
       
  1844 			#print "[$fname, $modulename, $location, $atsDst, $targetDst]\n";
       
  1845 			if($location =~ /(.*)\.\.(.*)/)
       
  1846 			{
       
  1847 				$location = GetPathPrefix().$2;
       
  1848 			}
       
  1849 			else
       
  1850 			{
       
  1851 				$location = $rootDrive.$location;
       
  1852 			}
       
  1853 			my $src = $location.$fname;
       
  1854 			my $dst = $ATSRoot."\\components\\$libname"."_".$modulename.$atsDst;
       
  1855 			if($libname eq "")
       
  1856 			{
       
  1857 				$dst = $ATSRoot."\\components\\".$modulename.$atsDst;
       
  1858 				#print "$dst CHANGED!\n"
       
  1859 			}
       
  1860   		
       
  1861   		my @filesFound = glob($src);
       
  1862   		if(scalar @filesFound == 0)
       
  1863   		{
       
  1864   			die("DIED: no Dat file  $src found to copy!");
       
  1865   		}
       
  1866   		foreach my $file(@filesFound)
       
  1867   		{
       
  1868   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  1869   		}
       
  1870   		
       
  1871   		if($targetDst ne "")
       
  1872   		{
       
  1873   			 		my @filesToChange = ();
       
  1874 			  		if($atsDst =~ "armv5")
       
  1875 			  		{
       
  1876 			  			#armv5 component file
       
  1877 			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_hw_component.xml";
       
  1878 			  			
       
  1879 			  		}
       
  1880 			  		elsif($atsDst =~ "winscw")
       
  1881 			  		{
       
  1882 			  			#winscw component file
       
  1883 			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_winsspd_component.xml";
       
  1884 			  		}
       
  1885 			  		else
       
  1886 			  		{
       
  1887 			  			#add entry to both xmls
       
  1888 			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_hw_component.xml";
       
  1889 			  			unshift @filesToChange, $libname."_".$modulename."_module_blr_winsspd_component.xml";
       
  1890 			  		}
       
  1891 			  		foreach my $file(@filesToChange)
       
  1892 			  		{
       
  1893 			  			$src = $ATSRoot."/components/".$libname."_"."$modulename/".$file;
       
  1894 			  			ModifyXml($src,$libname,$fname,$atsDst,$targetDst);
       
  1895 			  		}
       
  1896 			  }#updating the xmls
       
  1897     		
       
  1898   }#ref processing
       
  1899  
       
  1900   
       
  1901 }#fn
       
  1902 
       
  1903 sub ModifyXml($$$$$)
       
  1904 {
       
  1905 	my $filename = shift @_;
       
  1906 	my $lib = shift @_;
       
  1907 	my $fname = shift @_;
       
  1908 	my $atsDst = shift @_;
       
  1909 	my $targetDst = shift @_;
       
  1910 	
       
  1911 	
       
  1912 	#printf("Modifying $filename with lib= $lib fname= $fname atsDst = $atsDst targetDst = $targetDst\n");
       
  1913 	
       
  1914 	# Open input file
       
  1915 	open (INFILE, $filename ) || die ("Can not find $filename");
       
  1916 
       
  1917 	#Open output file
       
  1918 	my $newOutput = $filename."new";
       
  1919 	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
       
  1920 
       
  1921 		
       
  1922 	# Replace text in files
       
  1923 	while (<INFILE>)
       
  1924 	{
       
  1925 	 
       
  1926 	  if(/\<stif\>/ || /\<execute\>/)
       
  1927 	  {
       
  1928 	  	if(/\<stif\>/)
       
  1929 	  	{
       
  1930 	  		print OUTFILE "\<stif\>\n";
       
  1931 	  	}
       
  1932 	  	else
       
  1933 	  	{
       
  1934 	  		print OUTFILE "\<execute\>\n";
       
  1935 	  	}
       
  1936 	  	my $type = "data";
       
  1937 	  	if($atsDst !~ "General")
       
  1938 			{
       
  1939 				$type = "binary";
       
  1940 			}
       
  1941 			print OUTFILE <<EObinary;
       
  1942 				
       
  1943 	  		<install type=\"$type\">
       
  1944 				<src>$fname</src>
       
  1945 				<dst>$targetDst\\$fname</dst>
       
  1946  				</install>
       
  1947 EObinary
       
  1948 	  }#stif or execute tag found
       
  1949 	  else
       
  1950 	  {
       
  1951 	  	  print OUTFILE $_;
       
  1952 	  }
       
  1953 	}#while
       
  1954 	# Close filehandles
       
  1955 	close (INFILE);
       
  1956 	close (OUTFILE);
       
  1957 
       
  1958 	# Rename result file
       
  1959 	unlink $filename;
       
  1960 	rename $newOutput,$filename;
       
  1961 	
       
  1962 }#fn
       
  1963 sub GenGenModules($)
       
  1964 {
       
  1965 	my $libname = shift @_;
       
  1966 	
       
  1967 		
       
  1968 	my $src = $ATSRoot."/components/";
       
  1969 	my @fileList = ();
       
  1970 	opendir(DIRHANDLE, "$src") || die "Cannot opendir $src";
       
  1971   foreach my $name (readdir(DIRHANDLE)) 
       
  1972   {
       
  1973     if($name =~ /^$libname/)
       
  1974     {
       
  1975     	if($libname ne "libc" || $name !~ /^libcrypt/) 
       
  1976     	{
       
  1977     		$name =~ s/^$libname//;
       
  1978     		$name =~ s/^_//;
       
  1979     		unshift @fileList, $name;
       
  1980     	}#excluded libcrypt from libc list
       
  1981     }#libname match
       
  1982   }#foreach
       
  1983   closedir(DIRHANDLE);
       
  1984 	return @fileList;
       
  1985 }
       
  1986 
       
  1987 
       
  1988 sub GetAllModules()
       
  1989 {
       
  1990 	
       
  1991 	my $src = $ATSRoot."/components/";
       
  1992 	my @fileList = ();
       
  1993 	opendir(DIRHANDLE, "$src") || die "Cannot opendir $src";
       
  1994   foreach my $name (readdir(DIRHANDLE)) 
       
  1995   {
       
  1996     	if($name ne "." && $name ne ".." && $name ne "shared")
       
  1997 			{
       
  1998 				unshift @fileList, $name;
       
  1999 			}
       
  2000 
       
  2001   }#foreach
       
  2002   closedir(DIRHANDLE);
       
  2003 	return @fileList;
       
  2004 }
       
  2005 
       
  2006 
       
  2007 
       
  2008 sub TransformXmls($$)
       
  2009 {
       
  2010 	my $libname = shift @_;
       
  2011 	my $shared = shift @_;
       
  2012 	my $target = shift @_;
       
  2013 	my $module;
       
  2014 	my $src;
       
  2015 	my $dst;
       
  2016 
       
  2017 	my $armv5 = 0;
       
  2018 	my $winscw = 0;
       
  2019 	if($target eq "armv5")
       
  2020 	{
       
  2021 			$armv5 = 1;
       
  2022   }	
       
  2023   elsif($target eq "winscw")
       
  2024   {
       
  2025   		$winscw = 1;
       
  2026   }
       
  2027   else
       
  2028   {
       
  2029   	$armv5  = $do_armv5;
       
  2030   	$winscw = $do_winscw;
       
  2031 	}
       
  2032 		
       
  2033 
       
  2034 	foreach $module(@generatedModules)
       
  2035 	{
       
  2036 	  if($armv5 == 1 && $winscw == 1)
       
  2037 	  {
       
  2038 			$src = $ATSRoot."/components/".$libname."_"."$module/*.xml";
       
  2039 		}
       
  2040 		elsif($armv5 == 1)
       
  2041 		{
       
  2042 			$src = $ATSRoot."/components/".$libname."_"."$module/*_hw_component.xml";
       
  2043 		}
       
  2044 		elsif($winscw == 1)
       
  2045 		{
       
  2046 			$src = $ATSRoot."/components/".$libname."_"."$module/*_winsspd_component.xml";
       
  2047 		}
       
  2048 		my @fileList = glob($src);
       
  2049 		foreach my $file(@fileList)
       
  2050 		{
       
  2051 		 	#print"$file to  be transformed!\n";
       
  2052 			AddLibsInXml($libname,$file,$shared);
       
  2053 		}
       
  2054    }
       
  2055 }#fn
       
  2056 
       
  2057 sub AddLibsInXml($$$)
       
  2058 {
       
  2059 	my $libname = shift @_;
       
  2060 	my $filename = shift @_;
       
  2061 	my $shared = shift @_;
       
  2062 	
       
  2063 	# Open input file
       
  2064 	open (INFILE, $filename ) || die ("Can not find $filename");
       
  2065 
       
  2066 	#Open output file
       
  2067 	my $newOutput = $filename."new";
       
  2068 	open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput");
       
  2069 
       
  2070 	my $drive = "c:";
       
  2071 	
       
  2072 	# Replace text in files
       
  2073 	while (<INFILE>)
       
  2074 	{
       
  2075 	  if(/\<stif\>/ || /\<execute\>/)
       
  2076 	  {
       
  2077 	  	if(/\<stif\>/)
       
  2078 	  	{
       
  2079 	  		print OUTFILE "\<stif\>\n";
       
  2080 	  	}
       
  2081 	  	else
       
  2082 	  	{
       
  2083 	  		print OUTFILE "\<execute\>\n";
       
  2084 	  		if($filename =~ /winsspd/)
       
  2085 				{
       
  2086 					$drive = "z:";
       
  2087 				}
       
  2088 	  	}
       
  2089 	  	foreach my $installable(@dllList)
       
  2090 			{
       
  2091 				print OUTFILE <<EOLine;
       
  2092 				
       
  2093 	  		<install type=\"$shared binary\">
       
  2094 				<src>$installable</src>
       
  2095 				<dst>$drive\\sys\\bin\\$installable</dst>
       
  2096  				</install>
       
  2097 EOLine
       
  2098 			}
       
  2099 
       
  2100 	  }
       
  2101 	  else
       
  2102 	  {
       
  2103 	  	  print OUTFILE $_;
       
  2104 	  }
       
  2105 	}#while
       
  2106 	# Close filehandles
       
  2107 	close (INFILE);
       
  2108 	close (OUTFILE);
       
  2109 
       
  2110 	# Rename result file
       
  2111 	unlink $filename;
       
  2112 	rename $newOutput,$filename;
       
  2113 }
       
  2114 
       
  2115 sub CopySharedDlls()
       
  2116 {
       
  2117   my $libname = shift @_;
       
  2118   my $ref = shift @_;
       
  2119   my @ListOfDlls = @$ref;
       
  2120   my $target = shift @_;
       
  2121 	my $module;
       
  2122 	my $src;
       
  2123 	my $dst;
       
  2124 	
       
  2125 	my $do_armv5 = 0;
       
  2126 	my $do_winscw = 0;
       
  2127 	if($target eq "armv5")
       
  2128 	{
       
  2129 		$do_armv5 = 1;
       
  2130 	}
       
  2131 	elsif($target eq "winscw")
       
  2132 	{
       
  2133 		$do_winscw =  1;
       
  2134 	}
       
  2135 	else
       
  2136 	{
       
  2137 		$do_armv5  = 1;
       
  2138 		$do_winscw = 1;
       
  2139 	}
       
  2140 	
       
  2141 	
       
  2142 	mkdir  $ATSRoot."\\components\\shared" || die("Wouldn't make shared folder in $ATSRoot\\components");
       
  2143 	if($do_winscw == 1)
       
  2144 	{
       
  2145 		mkdir  $ATSRoot."\\components\\shared\\winscw_udeb" || die("Wouldn't make shared folder in $ATSRoot\\components\winscw_udeb");
       
  2146 	}
       
  2147 	if($do_armv5 == 1)
       
  2148 	{
       
  2149 		mkdir  $ATSRoot."\\components\\shared\\armv5_urel" || die("Wouldn't make shared folder in $ATSRoot\\components\armv5_urel");
       
  2150 	}
       
  2151 	
       
  2152 	foreach my $copyDll(@ListOfDlls)
       
  2153 	{
       
  2154 		if($do_winscw == 1)
       
  2155 		{
       
  2156 			$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll;
       
  2157 			$dst = $ATSRoot."\\components\\shared";
       
  2158 			$dst = $dst."\\winscw_udeb\\";
       
  2159 			copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  2160 		}	
       
  2161 		if($do_armv5 == 1)
       
  2162 		{	
       
  2163 			$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll;
       
  2164 			$dst = $ATSRoot."\\components\\shared";
       
  2165 			$dst = $dst."\\armv5_urel\\";
       
  2166 			copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  2167 		}
       
  2168 	}#foreach
       
  2169 }#fn
       
  2170 
       
  2171 
       
  2172 sub CopyMultiDlls($)
       
  2173 {
       
  2174   my $libname = shift @_;
       
  2175 	my $module;
       
  2176 	my $src;
       
  2177 	my $dst;
       
  2178 	foreach my $listed(@generatedModules)
       
  2179 	{
       
  2180 		foreach my $copyDll(@dllList)
       
  2181 		{
       
  2182 			if($do_winscw == 1)
       
  2183 			{
       
  2184 				$src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll;
       
  2185 				$dst = $ATSRoot."\\components\\$libname"."_$listed";
       
  2186 				$dst = $dst."\\winscw_udeb\\";
       
  2187 				copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  2188 			}
       
  2189 			if($do_armv5 == 1)
       
  2190 			{
       
  2191 				$src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll;
       
  2192 				$dst = $ATSRoot."\\components\\$libname"."_$listed";
       
  2193 				$dst = $dst."\\armv5_urel\\";
       
  2194 				copy($src, $dst)  || warn("unable to copy $src to $dst");
       
  2195 			}
       
  2196 		}#foreach
       
  2197 	}
       
  2198 }#fn
       
  2199 
       
  2200 sub StripModulePrefix($)
       
  2201 {
       
  2202 	my $listed = pop @_;
       
  2203 	my $module = $listed;
       
  2204 	if($dontStrip == 0)
       
  2205 	{
       
  2206 		$module =~ s/^test//;
       
  2207 		$module =~ s/^t//;
       
  2208 		$module =~ s/^libc_//;
       
  2209 		$module =~ s/^libm_//;
       
  2210   }
       
  2211   return $module;
       
  2212   	
       
  2213 }
       
  2214 
       
  2215 sub GetLsbModules()
       
  2216 {
       
  2217 	my @lsbList = 
       
  2218 	(
       
  2219 	 "abs",
       
  2220 "acos",
       
  2221 "asctime",
       
  2222 "asin",
       
  2223 "atan",
       
  2224 "atan2",
       
  2225 "atof",
       
  2226 "atoi",
       
  2227 "atol",
       
  2228 "bsearch",
       
  2229 "calloc",
       
  2230 "ceil",
       
  2231 "chdir",
       
  2232 "clearerr",
       
  2233 "close",
       
  2234 "closedir",
       
  2235 "cos",
       
  2236 "cosh",
       
  2237 "creat",
       
  2238 "lsb_ctime",
       
  2239 "lsb_difftime",
       
  2240 "dlclose",
       
  2241 "dlerror",
       
  2242 "dlopen",
       
  2243 "dup",
       
  2244 "dup2",
       
  2245 "exp",
       
  2246 "fabs",
       
  2247 "fclose",
       
  2248 "fcntl_x",
       
  2249 "fdopen",
       
  2250 "feof",
       
  2251 "ferror",
       
  2252 "fflush",
       
  2253 "fgetpos",
       
  2254 "fgets",
       
  2255 "fileno",
       
  2256 "floor",
       
  2257 "fmod",
       
  2258 "fopen",
       
  2259 "fopen_X",
       
  2260 "fprintf",
       
  2261 "fputs",
       
  2262 "fread",
       
  2263 "free",
       
  2264 "freopen",
       
  2265 "freopen_X",
       
  2266 "frexp",
       
  2267 "fseek",
       
  2268 "fsetpos",
       
  2269 "fstat",
       
  2270 "ftell",
       
  2271 "ftok",
       
  2272 "ftok_l",
       
  2273 "fwrite",
       
  2274 "getc",
       
  2275 "getcwd",
       
  2276 "gets",
       
  2277 "lsb_gmtime",
       
  2278 "ldexp",
       
  2279 "link",
       
  2280 "lsb_localtime",
       
  2281 "log",
       
  2282 "log10",
       
  2283 "longjmp",
       
  2284 "lseek",
       
  2285 "malloc",
       
  2286 "memchr_X",
       
  2287 "memcmp_X",
       
  2288 "memcpy_X",
       
  2289 "memmove",
       
  2290 "memset_X",
       
  2291 "mkdir",
       
  2292 "mkfifo",
       
  2293 "lsb_mktime",
       
  2294 "modf",
       
  2295 "msgctl",
       
  2296 "msgget",
       
  2297 "msgsnd",
       
  2298 "open",
       
  2299 "opendir",
       
  2300 "open_x",
       
  2301 "perror",
       
  2302 "pipe",
       
  2303 "pow",
       
  2304 "printf",
       
  2305 "qsort",
       
  2306 "rand",
       
  2307 "read",
       
  2308 "readdir",
       
  2309 "readv_l",
       
  2310 "realloc",
       
  2311 "remove",
       
  2312 "rename",
       
  2313 "rewind",
       
  2314 "rewinddir",
       
  2315 "rmdir",
       
  2316 "scanf",
       
  2317 "scanf_X",
       
  2318 "seekdir",
       
  2319 "semctl",
       
  2320 "semget",
       
  2321 "semop",
       
  2322 "setbuf",
       
  2323 "setjmp",
       
  2324 "shmat",
       
  2325 "shmdt",
       
  2326 "shmget",
       
  2327 "sin",
       
  2328 "sinh",
       
  2329 "sqrt",
       
  2330 "srand",
       
  2331 "stat",
       
  2332 "strcat",
       
  2333 "strchr",
       
  2334 "strcmp",
       
  2335 "strcoll_X",
       
  2336 "strcpy",
       
  2337 "strcspn",
       
  2338 "strerror_X",
       
  2339 "strftime",
       
  2340 "strftime_X",
       
  2341 "strlen",
       
  2342 "strncat",
       
  2343 "strncmp",
       
  2344 "strncpy",
       
  2345 "strpbrk",
       
  2346 "strptime",
       
  2347 "strrchr",
       
  2348 "strspn",
       
  2349 "strstr",
       
  2350 "strtod_X",
       
  2351 "strtok",
       
  2352 "strtol_X",
       
  2353 "strxfrm_X",
       
  2354 "tan",
       
  2355 "tanh",
       
  2356 "telldir",
       
  2357 "telldir_l",
       
  2358 "lsb_time",
       
  2359 "tmpfile",
       
  2360 "tmpnam",
       
  2361 "ungetc",
       
  2362 "unlink",
       
  2363 "utime",
       
  2364 "vfprintf",
       
  2365 "vprintf",
       
  2366 "write",
       
  2367 "writev_l",
       
  2368 
       
  2369 	);
       
  2370   return @lsbList;
       
  2371 }
       
  2372 
       
  2373 
       
  2374 
       
  2375 sub GenBackendTest()
       
  2376 {
       
  2377 
       
  2378 	my @datList = 
       
  2379 	(
       
  2380 	["libc", "tlibcbackend"],
       
  2381 	);
       
  2382 	
       
  2383 	mkdir $ATSRoot;
       
  2384 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
  2385 		
       
  2386 	my $lib;
       
  2387 	my $module;
       
  2388 	my $ext;
       
  2389 	foreach my $ref(@datList)
       
  2390 	{
       
  2391 			my @inarr = @$ref;
       
  2392 			($lib, $module,$ext) = @inarr;
       
  2393 			@generatedModules = ($module);
       
  2394 			GenDirs($lib);
       
  2395 			CopyDlls($lib,".dll");
       
  2396 	}
       
  2397  #now copy xmls			
       
  2398  CopyAtsSetup();
       
  2399  #extra exes
       
  2400  @generatedModules = ("tlibcbackend");
       
  2401  CopyDeps("libc","TPopenReadChild.exe");
       
  2402  CopyDeps("libc","TPopenWriteChild.exe");
       
  2403 			
       
  2404 }#fn
       
  2405 
       
  2406 sub CopyAtsSetup()
       
  2407 {
       
  2408 	 my $libname = "libc"; 
       
  2409 	 my @list = (
       
  2410   				 ["*.xml", "libcbackend", "/../backend/internal/tlibcbackend/group/","/", ""],
       
  2411   				 ["*.cfg", "libcbackend", "/../backend/internal/tlibcbackend/group/","/General/", ""],
       
  2412   				 ["*.ini", "libcbackend", "/../backend/internal/tlibcbackend/group/","/General/", ""],
       
  2413   				 );
       
  2414  
       
  2415   my $bDataRef = \@list;  				 
       
  2416 	CopyArbitDatFiles("libc",$bDataRef);  				 
       
  2417 
       
  2418 }#fn
       
  2419 sub GetPathPrefix()
       
  2420 {
       
  2421 	 my $srcPrefix = $templateRoot;
       
  2422 	 $srcPrefix =~ /(.*)internal.*/;
       
  2423 	 $srcPrefix = $1;
       
  2424 	 return $srcPrefix;
       
  2425 }
       
  2426 	
       
  2427 
       
  2428 #dat file copy
       
  2429 sub CopyCryptoDat()
       
  2430 {
       
  2431 	my $libRoot = $templateRoot;
       
  2432 	$libRoot =~ /(.*)internal.*/;
       
  2433 	$libRoot = $1;
       
  2434 
       
  2435  my @list = (
       
  2436  								 ["libssl", "ssltest", "libssl/internal/testapps/ssl_test/data/*"],
       
  2437  								 ["libcrypto", "topenssl", "/libcrypto/internal/testapps/topenssl/data/*"],
       
  2438            );
       
  2439 
       
  2440 	 my $libname;
       
  2441 	 my $dirname;
       
  2442 	 my $glob;
       
  2443 	foreach my $ref(@list)
       
  2444 	{
       
  2445 			my @inarr = @$ref;
       
  2446 			($libname, $dirname, $glob) = @inarr;
       
  2447 			my $modulename = StripModulePrefix($dirname);
       
  2448 			my	$srcPrefix = GetPathPrefix();
       
  2449 			
       
  2450 			my $src = "$srcPrefix"."$glob";
       
  2451 			
       
  2452 			my $dst = $ATSRoot."\\components\\$libname"."_"."$modulename\\General\\";
       
  2453   		my @filesFound = glob($src);
       
  2454   		if(scalar @filesFound == 0)
       
  2455   		{
       
  2456   			die("DIED: no Dat file found to copy!");
       
  2457   		}
       
  2458   		foreach my $file(@filesFound)
       
  2459   		{
       
  2460   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  2461   		}
       
  2462   }#ref processing
       
  2463 }#fn
       
  2464 
       
  2465 #Crypto xmls copy
       
  2466 sub CopyCryptoXmls()
       
  2467 {
       
  2468 	  my @list = (
       
  2469   				 ["*.xml", "libssl_ssltest/", "/libssl/internal/testapps/ssl_test/group/"],
       
  2470    				 ["*.xml", "libcrypto_crypto_test/", "/libcrypto/internal/testapps/crypto_test/group/"],
       
  2471    				 ["*.xml", "libcrypto_openssl/", "/libcrypto/internal/testapps/topenssl/group/"],   				    				 			 
       
  2472   				 );
       
  2473 
       
  2474 	
       
  2475 	my $fname;
       
  2476 	my $moduleDst;
       
  2477 	my $location;
       
  2478 	
       
  2479 	#now copy the files appropriately
       
  2480 	foreach my $ref(@list)
       
  2481 	{
       
  2482 			my @inarr = @$ref;
       
  2483 			($fname, $moduleDst, $location) = @inarr;
       
  2484 			my $src = GetPathPrefix().$location.$fname;
       
  2485 			my $dst = $ATSRoot."\\components\\$moduleDst";
       
  2486   		
       
  2487   		my @filesFound = glob($src);
       
  2488   		if(scalar @filesFound == 0)
       
  2489   		{
       
  2490   			die("DIED: no xml file found to copy!");
       
  2491   		}
       
  2492   		foreach my $file(@filesFound)
       
  2493   		{
       
  2494   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  2495   		}
       
  2496   	}#ref
       
  2497   	
       
  2498   	my @crypto_copyList = ("*.txt", "*cfg", "*.ini");
       
  2499   	
       
  2500   	foreach my $item(@crypto_copyList)
       
  2501   	{
       
  2502   			$location = "/libcrypto/internal/testapps/crypto_test/group/";
       
  2503   			$fname = GetPathPrefix().$location.$item;
       
  2504   			my @filesFound = glob($fname);
       
  2505   			foreach my $file(@filesFound)
       
  2506   			{
       
  2507     			$moduleDst = "libcrypto_crypto_test/";	
       
  2508   				my $dst = $ATSRoot."\\components\\".$moduleDst."/General/";
       
  2509   				copy($file, $dst);
       
  2510   			}
       
  2511   	}
       
  2512 }#fn
       
  2513 
       
  2514 sub GenCryptoTest()
       
  2515 {
       
  2516 
       
  2517 	my @datList = 
       
  2518 	(
       
  2519 	["libssl", "ssltest", ".exe"],
       
  2520 	["libcrypto", "crypto_test",".dll"],
       
  2521 	["libcrypto", "openssl",".exe"],
       
  2522 	);
       
  2523 	
       
  2524 	mkdir $ATSRoot;
       
  2525 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
  2526 		
       
  2527 	my $lib;
       
  2528 	my $module;
       
  2529 	my $ext;
       
  2530 	foreach my $ref(@datList)
       
  2531 	{
       
  2532 			my @inarr = @$ref;
       
  2533 			($lib, $module,$ext) = @inarr;
       
  2534 			@generatedModules = ($module);
       
  2535 			GenDirs($lib);
       
  2536 			CopyDlls($lib,$ext);
       
  2537 	}
       
  2538 	CopyCryptoDat();
       
  2539 	CopyCryptoXmls();
       
  2540 	
       
  2541 			
       
  2542 }#fn
       
  2543 
       
  2544 
       
  2545 #ngi xml copy
       
  2546 sub CopyNgiXmls()
       
  2547 {
       
  2548 	  my @list = (
       
  2549    				 ["*.xml", "ngi_sa_amrrecording", "/audio/lowlevelaudio/internal/sa_amrrecording/group/"],
       
  2550    				 ["*.xml", "ngi_sa_highlevelaudio", "/audio/highlevelaudio/internal/sa_highlevelaudio/group/"],
       
  2551   				 ["*.xml", "ngi_sa_audiomixing", "/audio/lowlevelaudio/internal/sa_audiomixing/group/"],
       
  2552   				 ["*.xml", "ngi_sa_audiorecording", "/audio/lowlevelaudio/internal/sa_audiorecording/group/"],
       
  2553   				 ["*.xml", "ngi_sa_clip", "/audio/lowlevelaudio/internal/sa_clip/group/"],
       
  2554   				 ["*.xml", "ngi_sa_lowlevelaudio", "/audio/lowlevelaudio/internal/sa_lowlevelaudio/group/"],
       
  2555   				 ["*.xml", "ngi_sa_stream", "/audio/lowlevelaudio/internal/sa_stream/group/"],
       
  2556   				 
       
  2557   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_antitearing/group/"],
       
  2558   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_colortranslation/group/"],
       
  2559   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_createfb565/group/"],
       
  2560   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_createfb888/group/"],
       
  2561   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_heapusage/group/"],
       
  2562   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_multibb/group/"],
       
  2563   				 ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_performance/group/"],
       
  2564            ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_plswitching/group/"],
       
  2565            ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_misc/group/"],
       
  2566   				 ["*.xml", "ngi_sa_bitmap", "/graphics/bitmap/internal/sa_bitmap/group/"],
       
  2567   				 ["*.xml", "ngi_sa_camera", "/graphics/camera/internal/sa_camera/group/"],
       
  2568   				 ["*.xml", "ngi_sa_images", "/graphics/images/internal/sa_images/group/"],
       
  2569   				 ["*.xml", "ngi_sa_display", "/graphics/display/internal/sa_display/group/"],
       
  2570   				 ["*.xml", "ngi_sa_lights", "/graphics/lights/internal/sa_lights/group/"],
       
  2571   				 ["*.xml", "ngi_sa_videoplayback", "/graphics/video/internal/sa_videoplayback/group/"],
       
  2572   				 
       
  2573   				 ["*.xml", "ngi_sa_input", "/input/input/internal/sa_input/group/"],
       
  2574   				 ["*.xml", "ngi_sa_textinput", "/input/textinput/internal/sa_textinput/group/"],
       
  2575   				 ["*.xml", "ngi_sa_devicecapabilities", "/system/devicecapabilities/internal/sa_devicecapabilities/group/"],
       
  2576   				 ["*.xml", "ngi_sa_devicestatus", "/system/devicestatus/internal/sa_phone/group/"],
       
  2577   				 ["*.xml", "ngi_sa_runtimetester", "/system/runtime/internal/sa_runtimetester/group/"],
       
  2578   				 ["*.xml", "ngi_sa_timing", "/timing/internal/sa_timing/group/"],
       
  2579 	  				 );
       
  2580 
       
  2581 	
       
  2582 	my $fname;
       
  2583 	my $moduleDst;
       
  2584 	my $location;
       
  2585 	
       
  2586 	#now copy the files appropriately
       
  2587 	foreach my $ref(@list)
       
  2588 	{
       
  2589 			my @inarr = @$ref;
       
  2590 			($fname, $moduleDst, $location) = @inarr;
       
  2591 			my $src = GetPathPrefix().$location.$fname;
       
  2592 			my $dst = $ATSRoot."\\components\\$moduleDst";
       
  2593 			
       
  2594 			#print "My src is $src\n";
       
  2595 			#print "My dst is $dst\n";
       
  2596 			  		
       
  2597   		my @filesFound = glob($src);
       
  2598   		if(scalar @filesFound == 0)
       
  2599   		{
       
  2600   			warn("warning: no xml file found to copy from $src!");
       
  2601   		}
       
  2602   		foreach my $file(@filesFound)
       
  2603   		{
       
  2604   			copy($file, $dst) || die("DIED: unable to copy $file to $dst");
       
  2605   		}
       
  2606   	}#ref
       
  2607     	
       
  2608 }#fn
       
  2609 
       
  2610 
       
  2611 sub GenNgiTest()
       
  2612 {
       
  2613 
       
  2614 	my @datList = 
       
  2615 	(
       
  2616 	["ngi", "sa_amrrecording", ".dll"],
       
  2617 	["ngi", "sa_highlevelaudio", ".dll"],
       
  2618 	["ngi", "sa_audiomixing", ".dll"],
       
  2619 	["ngi", "sa_audiorecording", ".dll"],
       
  2620 	["ngi", "sa_clip", ".dll"],
       
  2621 	["ngi", "sa_lowlevelaudio", ".dll"],
       
  2622 	["ngi", "sa_stream", ".dll"],
       
  2623 	["ngi", "sa_bitmap", ".dll"],
       
  2624 	["ngi", "sa_camera", ".dll"],
       
  2625 	["ngi", "sa_images", ".dll"],
       
  2626 	["ngi", "sa_display", ".dll"],
       
  2627 	["ngi", "sa_lights", ".dll"],	
       
  2628 	["ngi", "sa_videoplayback", ".dll"],	
       
  2629 	["ngi", "sa_input", ".dll"],	
       
  2630 	["ngi", "sa_textinput", ".dll"],
       
  2631 	["ngi", "sa_devicecapabilities", ".dll"],	
       
  2632 	["ngi", "sa_devicestatus", ".dll"],	
       
  2633 	["ngi", "sa_runtimetester", ".dll"],	
       
  2634 	["ngi", "sa_timing", ".dll"],	
       
  2635 		
       
  2636 	);
       
  2637 	
       
  2638 	mkdir $ATSRoot;
       
  2639 	mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir");
       
  2640 
       
  2641 		
       
  2642 	my $lib;
       
  2643 	my $module;
       
  2644 	my $ext;
       
  2645 	foreach my $ref(@datList)
       
  2646 	{
       
  2647 			my @inarr = @$ref;
       
  2648 			($lib, $module,$ext) = @inarr;
       
  2649 			@generatedModules = ($module);
       
  2650 			GenDirs($lib);
       
  2651 			CopyDlls($lib,$ext);
       
  2652 	}
       
  2653 	
       
  2654    @generatedModules =("sa_backbuffer");
       
  2655    GenDirs($lib);
       
  2656    @dllList = 
       
  2657    (
       
  2658    	"sa_bb_antitearing.dll",
       
  2659    	"sa_bb_colortranslation.dll",
       
  2660    	"sa_bb_createfb444.dll",
       
  2661    	"sa_bb_createfb565.dll",
       
  2662    	"sa_bb_createfb888.dll",
       
  2663    	"sa_bb_misc.dll",
       
  2664    	"sa_bb_heapusage.dll",
       
  2665    	"sa_bb_multibb.dll",
       
  2666    	"sa_bb_performance.dll",
       
  2667    	"sa_bb_plswitch.dll",
       
  2668    	"sa_bb_testenv.dll"
       
  2669    );
       
  2670    CopyMultiDlls("ngi");
       
  2671 
       
  2672 	
       
  2673  	mkdir  $ATSRoot."\\components\\shared" || die("Wouldn't make shared folder in $ATSRoot\\components");
       
  2674   mkdir  $ATSRoot."\\components\\shared\\winscw_udeb" || die("Wouldn't make shared folder in $ATSRoot\\components\winscw_udeb");
       
  2675   mkdir  $ATSRoot."\\components\\shared\\armv5_urel" || die("Wouldn't make shared folder in $ATSRoot\\components\armv5_urel");
       
  2676 			
       
  2677 }#fn
       
  2678 
       
  2679 
       
  2680 sub GetXmls()
       
  2681 {
       
  2682   my @foundList;
       
  2683   my $libname = shift @_;
       
  2684 	my @globlist = ();
       
  2685 	if($target eq "winsspd" && $sdkversion ne "")
       
  2686 	{
       
  2687 		@globlist = ("winsspd_".$sdkversion);
       
  2688 		#print "winsspd ".$sdkversion." selected\n";
       
  2689 	}
       
  2690 	elsif($target eq "winsspd")
       
  2691 	{
       
  2692 		@globlist = ("winsspd");
       
  2693 		#print "winsspd selected\n";
       
  2694 	}
       
  2695 	elsif($sdkversion ne "")
       
  2696 	{
       
  2697 		@globlist = ($target,"hw_".$sdkversion);
       
  2698 		#print "$target $sdkversion selected\n";
       
  2699 	}
       
  2700 	else
       
  2701 	{
       
  2702 		@globlist = ($target,"hw");
       
  2703 		#print "$target $sdkversion selected\n";
       
  2704 	}
       
  2705 	
       
  2706 	foreach my $module(@generatedModules)
       
  2707 	{
       
  2708 	  my $glob_to_use = "";
       
  2709 	  my @fileList;
       
  2710 	  foreach my $glob(@globlist)
       
  2711 	  {
       
  2712 			my $src = $ATSRoot."/components/".$libname."_"."$module/*.xml";
       
  2713 			#print "Analysing $module and  $glob\n";
       
  2714 			@fileList = glob($src);
       
  2715 			foreach my $file(@fileList)
       
  2716 			{
       
  2717 			 my $pat = $glob."\_component\.xml";
       
  2718 			 #print "[$file - $glob"."_component.xml"."]\n";
       
  2719 				if($file =~ /$pat/)
       
  2720 				{
       
  2721 					$glob_to_use = $pat;
       
  2722 					#print "[$file - $glob"."_component.xml"."]\n";
       
  2723 					last
       
  2724 				}
       
  2725 			}#foreach FILE
       
  2726 			if($glob_to_use ne "")
       
  2727 			{
       
  2728 				last;
       
  2729 			}
       
  2730 		}#finding glob	
       
  2731 		if($glob_to_use ne "")
       
  2732 		{
       
  2733 				#print "Using the glob $glob_to_use\n";
       
  2734 				my $src = $ATSRoot."/components/".$libname."_"."$module/*.xml";
       
  2735 				@fileList = glob($src);
       
  2736 				foreach my $file(@fileList)
       
  2737 				{
       
  2738 					#print "[$file - $glob_to_use]\n";
       
  2739 					if($file =~ /$glob_to_use/)
       
  2740 					{
       
  2741 				  	$file =~ /.*components[\\\/](.*)/;
       
  2742 				  	my $value = $1;
       
  2743 				  	$value =~ s/\//\\/g;
       
  2744 				  	#print "adding $value for $module with $glob_to_use\n";
       
  2745 						unshift @foundList,$value;
       
  2746 				  }#if
       
  2747 				}#foreach
       
  2748 		}#glob is present
       
  2749 		else
       
  2750 		{
       
  2751 			warn("Unable to figure out glob to use for $module. Skipping...\n");
       
  2752 		}
       
  2753 	}#each module
       
  2754   return @foundList;
       
  2755  }#fn
       
  2756 
       
  2757 __END__
       
  2758 :end
       
  2759 
       
  2760 
       
  2761 
       
  2762