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