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