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