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