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