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