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