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