sbsv1_os/e32toolp/makmake/_secure_trgtype.pm
changeset 0 83f4b4db085c
child 1 d4b442d23379
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     1 # Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # this package controls target types known to the build system
       
    15 # To add new types to the system, simply add an entry to the %Types data structure.
       
    16 # Look at the existing types for an appropriate example
       
    17 # 
       
    18 #
       
    19 
       
    20 package Trgtype;
       
    21 
       
    22 require Exporter;
       
    23 @ISA=qw(Exporter);
       
    24 @EXPORT=qw(
       
    25 	Trg_GetL
       
    26 	Trg_List
       
    27 );
       
    28 
       
    29 use strict;
       
    30 use Genutl;
       
    31 
       
    32 my %Types=(
       
    33 	ANI=>{
       
    34 		'Exports'=>{
       
    35 			MARM=>['CreateCAnimDllL__Fv'],
       
    36 			EABI=>['_Z15CreateCAnimDllLv'],
       
    37 			WINS=>['?CreateCAnimDllL@@YAPAVCAnimDll@@XZ'],
       
    38 			X86=>['?CreateCAnimDllL@@YAPAVCAnimDll@@XZ'],
       
    39 			x86gcc=>['_Z15CreateCAnimDllLv']
       
    40 		},
       
    41 		UID2=>'0x10003b22',
       
    42 	},
       
    43 	APP=>{
       
    44 		'Exports'=>{
       
    45 			MARM=>['NewApplication__Fv'],
       
    46 			EABI=>['_Z14NewApplicationv'],
       
    47 			WINS=>['?NewApplication@@YAPAVCApaApplication@@XZ'],
       
    48 			X86=>['?NewApplication@@YAPAVCApaApplication@@XZ'],
       
    49 		},
       
    50 		NeedUID3=>1,
       
    51 		UID2=>'0x100039ce',
       
    52 		Deprecated=>"Convert to EXE",
       
    53 	},
       
    54 	CTL=>{
       
    55 		'Exports'=>{
       
    56 			MARM=>['CreateControlL__FRC7TDesC16'],
       
    57 			EABI=>['_Z14CreateControlLRK7TDesC16'], 
       
    58 			WINS=>['?CreateControlL@@YAXABVTDesC16@@@Z'],
       
    59 			X86=>['?CreateControlL@@YAXABVTDesC16@@@Z'],
       
    60 		},
       
    61 		UID2=>'0x10003a34',
       
    62 		Deprecated=>"Convert to application",
       
    63 	},
       
    64 	DLL=>{
       
    65 		NeedDeffile=>1,
       
    66 	},	
       
    67 	EPOCEXE=>{
       
    68 		Basic=>'EXEDLL',
       
    69 		'Exports'=>{
       
    70 			WINS=>['?WinsMain@@YAHXZ'],
       
    71 		},
       
    72 	},
       
    73 	EXE=>{
       
    74 		Basic=>'EXE',
       
    75 	},
       
    76 	EXEDLL=>{
       
    77 		Basic=>'EXEDLL',
       
    78 		NeedDeffile=>1,
       
    79 	},
       
    80 	EXEXP=>{
       
    81 		Basic=>'EXE',
       
    82 		NeedDeffile=>1,
       
    83 	},
       
    84 	FSY=>{
       
    85 		'Exports'=>{
       
    86 			MARM=>['CreateFileSystem'],
       
    87 			EABI=>['CreateFileSystem'],
       
    88 			WINS=>['CreateFileSystem'],
       
    89 			X86=>['CreateFileSystem'],
       
    90 			x86gcc=>['CreateFileSystem']
       
    91 		},
       
    92 		UID2=>'0x100039df',
       
    93 	},
       
    94 	IMPLIB=>{
       
    95 		NeedDeffile=>1,
       
    96 		Basic=>'IMPLIB',
       
    97 	},	
       
    98 	KDLL=>{
       
    99 		FirstLib=>'EKLL.LIB',
       
   100 #		Kernel=>1,
       
   101 		System=>1,
       
   102 	},
       
   103 	KEXT=>{
       
   104 		FirstLib=>'EEXT.LIB',
       
   105 #		Kernel=>1,
       
   106 		System=>1,
       
   107 	},
       
   108 	KLIB=>{
       
   109 		Basic=>'LIB',
       
   110 #		Kernel=>1,
       
   111 		System=>1,
       
   112 	},
       
   113 	LDD=>{
       
   114 		FirstLib=>'EDEV.LIB',
       
   115 #		Kernel=>1,
       
   116 		System=>1,
       
   117 		'Exports'=>{
       
   118 			MARM=>['CreateLogicalDevice__Fv'],
       
   119 			EABI=>['_Z19CreateLogicalDevicev'],
       
   120 			WINS=>['?CreateLogicalDevice@@YAPAVDLogicalDevice@@XZ'],
       
   121 			X86=>['?CreateLogicalDevice@@YAPAVDLogicalDevice@@XZ'],
       
   122 			x86gcc=>['_Z19CreateLogicalDevicev']
       
   123 		},
       
   124 		UID2=>'0x100000af',
       
   125 	},
       
   126 	LIB=>{
       
   127 		Basic=>'LIB',
       
   128 	},
       
   129 	ECOMIIC=>{
       
   130 		'Exports'=>{
       
   131 			MARM=>['ImplementationGroupProxy__FRi'],
       
   132 			EABI=>['_Z24ImplementationGroupProxyRi'], 
       
   133 			WINS=>['?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z'],
       
   134 			X86=>['?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z'],
       
   135 		},
       
   136 		Path=>'System\Libs\Plugins',
       
   137 		UID2=>'0x10009D8D',
       
   138 		Deprecated=>"Convert to PLUGIN (ECOM)",
       
   139 	},
       
   140 	PLUGIN=>{
       
   141 		'Exports'=>{
       
   142 			MARM=>['ImplementationGroupProxy__FRi'],
       
   143 			EABI=>['_Z24ImplementationGroupProxyRi'],
       
   144 			WINS=>['?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z'],
       
   145 			X86=>['?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z'],
       
   146 			x86gcc=>['_Z24ImplementationGroupProxyRi']
       
   147 		},
       
   148 		ResourcePath=>'Resource\Plugins',
       
   149 		UID2=>'0x10009D8D',
       
   150 	},
       
   151 	PLUGIN3=>{
       
   152 		'Exports'=>{
       
   153 			MARM=>['ImplementationGroupProxy__FRi'],
       
   154 			EABI=>['_Z24ImplementationGroupProxyRi'],
       
   155 			WINS=>['?ImplementationGroupProxy@@YAPBUTImplementationProxy3@@AAH@Z'],
       
   156 			X86=>['?ImplementationGroupProxy@@YAPBUTImplementationProxy3@@AAH@Z'],
       
   157 			x86gcc=>['_Z24ImplementationGroupProxyRi']
       
   158 		},
       
   159 		ResourcePath=>'Resource\Plugins',
       
   160 		UID2=>'0x10009D93',
       
   161 	},
       
   162 	MDA=>{
       
   163 		'Exports'=>{
       
   164 			MARM=>['NewMediaLibraryL__Fv'],
       
   165 			EABI=>['_Z16NewMediaLibraryLv'],
       
   166 			WINS=>['?NewMediaLibraryL@@YAPAVCMdaLibrary@@XZ'],
       
   167 			X86=>['?NewMediaLibraryL@@YAPAVCMdaLibrary@@XZ'],
       
   168 		},
       
   169 		UID2=>'0x1000393f',
       
   170 		Deprecated=>"Convert to ???",
       
   171 	},
       
   172 	MDL=>{
       
   173 		'Exports'=>{
       
   174 			MARM=>['CreateRecognizer__Fv'],
       
   175 			EABI=>['_Z16CreateRecognizerv'],
       
   176 			WINS=>['?CreateRecognizer@@YAPAVCApaDataRecognizerType@@XZ'],
       
   177 			X86=>['?CreateRecognizer@@YAPAVCApaDataRecognizerType@@XZ'],
       
   178 		},
       
   179 		UID2=>'0x10003a19',
       
   180 		Deprecated=>"Convert to PLUGIN (ECOM)",
       
   181 	},
       
   182 	RDL=>{
       
   183 		'Exports'=>{
       
   184 			MARM=>['CreateRecognizer__Fv'],
       
   185 			EABI=>['_Z16CreateRecognizerv'],
       
   186 			WINS=>['?CreateRecognizer@@YAPAVCApaFileRecognizerType@@XZ'],
       
   187 		},
       
   188 		UID2=>'0x10003a37',
       
   189 		Deprecated=>"Convert to PLUGIN (ECOM)",
       
   190 	},
       
   191 	NOTIFIER=>{
       
   192 		'Exports'=>{
       
   193 			MARM=>['NotifierArray__Fv'],
       
   194 			EABI=>['_Z13NotifierArrayv'],
       
   195 			WINS=>['?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase@@@@XZ'],
       
   196 			X86=>['?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase@@@@XZ'],
       
   197 		},
       
   198 		Path=>'System\Notifiers',
       
   199 		UID2=>'0x10005522',
       
   200 		Deprecated=>"Convert to PLUGIN (ECOM)",
       
   201 	},
       
   202 	NOTIFIER2=>{
       
   203 		'Exports'=>{
       
   204 			MARM=>['NotifierArray__Fv'],
       
   205 			EABI=>['_Z13NotifierArrayv'],
       
   206 			WINS=>['?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ'],
       
   207 			X86=>['?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ'],
       
   208 		},
       
   209 		Path=>'System\Notifiers',
       
   210 		UID2=>'0x101fdfae',
       
   211 		Deprecated=>"Convert to PLUGIN (ECOM)",
       
   212 	},
       
   213 	TEXTNOTIFIER2=>{
       
   214 		'Exports'=>{
       
   215 			MARM=>['NotifierArray__Fv'],
       
   216 			EABI=>['_Z13NotifierArrayv'],
       
   217 			WINS=>['?NotifierArray@@YAPAV?$CArrayPtr@VMNotifierBase2@@@@XZ'],
       
   218 			X86=>['?NotifierArray@@YAPAV?$CArrayPtr@VMNotifierBase2@@@@XZ'],
       
   219 			x86gcc=>['_Z13NotifierArrayv']
       
   220 		},
       
   221 		Path=>'System\Notifiers',
       
   222 		UID2=>'0x101fe38b',
       
   223 		# Not deprecated - the Text Window Server will have AllFiles, 
       
   224 		# so it can continue scanning for binaries
       
   225 	},
       
   226 	PDD=>{
       
   227 		FirstLib=>'EDEV.LIB',
       
   228 #		Kernel=>1,
       
   229 		System=>1,
       
   230 		'Exports'=>{
       
   231 			MARM=>['CreatePhysicalDevice__Fv'],
       
   232 			EABI=>['_Z20CreatePhysicalDevicev'],
       
   233 			WINS=>['?CreatePhysicalDevice@@YAPAVDPhysicalDevice@@XZ'],
       
   234 			X86=>['?CreatePhysicalDevice@@YAPAVDPhysicalDevice@@XZ'],
       
   235 			x86gcc=>['_Z20CreatePhysicalDevicev']
       
   236 		},
       
   237 		UID2=>'0x100039d0',
       
   238 	},
       
   239 	PDL=>{
       
   240 		'Exports'=>{
       
   241 			MARM=>['NewPrinterDeviceL__Fv'],
       
   242 			EABI=>['_Z17NewPrinterDeviceLv'],
       
   243 			WINS=>['?NewPrinterDeviceL@@YAPAVCPrinterDevice@@XZ'],
       
   244 			X86=>['?NewPrinterDeviceL@@YAPAVCPrinterDevice@@XZ'],
       
   245 			x86gcc=>['_Z17NewPrinterDeviceLv']
       
   246 		},
       
   247 		UID2=>'0x10003b1c',
       
   248 		ResourcePath=>'Resource\Printers',
       
   249 	},
       
   250 	STDDLL=>{
       
   251 		NeedDeffile=>1,
       
   252 		UID2=>'0x20004C45',
       
   253 	},
       
   254 	STDEXE=>{
       
   255 		Basic=>'EXE',
       
   256 		UID2=>'0x20004C45',
       
   257 	},
       
   258 	STDLIB=>{
       
   259 		Basic=>'LIB',
       
   260 	},
       
   261 	VAR=>{
       
   262 		'Exports'=>{
       
   263 			MARM=>['VariantInitialise__Fv'],
       
   264 			EABI=>['_Z17VariantInitialisev'],
       
   265 			X86=>['?VariantInitialise@@YAPAVAsic@@XZ'],
       
   266 			x86gcc=>['_Z17VariantInitialisev']
       
   267 		},
       
   268 		FirstLib=>'EVAR.LIB',
       
   269 #		Kernel=>1,
       
   270 		System=>1,
       
   271 	},
       
   272 	VAR2=>{
       
   273 		'Exports'=>{
       
   274 			MARM=>['VariantInitialise'],
       
   275 			EABI=>['VariantInitialise'],
       
   276 			X86=>['VariantInitialise'],
       
   277 			x86gcc=>['VariantInitialise']
       
   278 		},
       
   279 		FirstLib=>'EVAR.LIB',
       
   280 		System=>1,
       
   281 	},
       
   282 	NONE=>{
       
   283 		Basic=>'IMPLIB',
       
   284 	},
       
   285 );
       
   286 
       
   287 sub Trg_GetL ($$$) {
       
   288 #	takes target type, followed by a ref to a data structure
       
   289 #	to fill with exports, second UID and default targetpath, etc.,
       
   290 #
       
   291 #	dies upon error
       
   292 
       
   293 	my ($Candidate, $TrgHash_ref)=@_;
       
   294 	$Candidate= uc $Candidate;
       
   295 
       
   296 #	Is type in our list?
       
   297 	unless (defined $Types{$Candidate}) {
       
   298 		die "ERROR: Target type \"$Candidate\" not supported\n";
       
   299 	}
       
   300 
       
   301 #	Get the data
       
   302 	my %TrgHash=%{$Types{$Candidate}};
       
   303 
       
   304 
       
   305 #	Set the defaults
       
   306 	$TrgHash{Name}=$Candidate;
       
   307 
       
   308 	
       
   309 	unless ($TrgHash{Basic}) {
       
   310 		$TrgHash{Basic}='DLL';
       
   311 	}
       
   312 
       
   313 	unless ($TrgHash{FirstLib}) {
       
   314 		$TrgHash{FirstLib}='';
       
   315 	}
       
   316 
       
   317 	unless ($TrgHash{Kernel}) {
       
   318 		$TrgHash{Kernel}=0;
       
   319 	}
       
   320 
       
   321 	unless ($TrgHash{System}) {
       
   322 		$TrgHash{System}=0;
       
   323 	}
       
   324 
       
   325 	unless ($TrgHash{Exports}{MARM}) {
       
   326 		$TrgHash{Exports}{MARM}=[];
       
   327 	}
       
   328 	else {
       
   329 		unless (@{$TrgHash{Exports}{MARM}}<=2) {
       
   330 			die "INTERNAL ERROR: Too many MARM exports defined for type \"$TrgHash{Name}\" in Trgtype.pm\n";
       
   331 		}
       
   332 	}
       
   333 
       
   334 	unless ($TrgHash{Exports}{EABI}) {
       
   335 		$TrgHash{Exports}{EABI}=[];
       
   336 	}
       
   337 	else {
       
   338 		unless (@{$TrgHash{Exports}{EABI}}<=2) {
       
   339 			die "INTERNAL ERROR: Too many EABI exports defined for type \"$TrgHash{Name}\" in Trgtype.pm\n";
       
   340 		}
       
   341 	}
       
   342 
       
   343 	unless ($TrgHash{Exports}{WINS}) {
       
   344 		$TrgHash{Exports}{'WINS'}=[];
       
   345 	}
       
   346 	else {
       
   347 		unless (@{$TrgHash{Exports}{WINS}}<=2) {
       
   348 			die "INTERNAL ERROR: Too many WINS exports defined for type \"$TrgHash{Name}\" in Trgtype.pm\n";
       
   349 		}
       
   350 	}
       
   351 
       
   352 	unless ($TrgHash{Exports}{X86}) {
       
   353 		$TrgHash{Exports}{X86}=[];
       
   354 	}
       
   355 	else {
       
   356 		unless (@{$TrgHash{Exports}{X86}}<=2) {
       
   357 			die "INTERNAL ERROR: Too many X86 exports defined for type \"$TrgHash{Name}\" in Trgtype.pm\n";
       
   358 		}
       
   359 	}
       
   360 
       
   361 	unless ($TrgHash{Exports}{x86gcc}) {
       
   362 		$TrgHash{Exports}{x86gcc}=[];
       
   363 	}
       
   364 	else {
       
   365 		unless (@{$TrgHash{Exports}{x86gcc}}<=2) {
       
   366 			die "INTERNAL ERROR: Too many x86gcc exports defined for type \"$TrgHash{Name}\" in Trgtype.pm\n";
       
   367 		}
       
   368 	}
       
   369 
       
   370 
       
   371 	unless ($TrgHash{NeedDeffile}) {
       
   372 		$TrgHash{NeedDeffile}=0;
       
   373 	}
       
   374 
       
   375 	unless ($TrgHash{NeedUID3}) {
       
   376 		$TrgHash{NeedUID3}=0;
       
   377 	}
       
   378 
       
   379 	unless ($TrgHash{Path}) {
       
   380 		$TrgHash{Path}='';
       
   381 	}
       
   382 	else {
       
   383 		# apply terminating backslash
       
   384 		$TrgHash{Path}=~s-^(.*[^\\])$-$1\\-o;
       
   385 		# apply Z drive
       
   386 		$TrgHash{Path}="Z\\$TrgHash{Path}";
       
   387 	}
       
   388 
       
   389 	unless ($TrgHash{ResourcePath}) {
       
   390 		$TrgHash{ResourcePath}='';
       
   391 	}
       
   392 	else {
       
   393 		# apply terminating backslash & Z drive
       
   394 		$TrgHash{ResourcePath}=~s-^(.*[^\\])$-Z\\$1\\-o;
       
   395 	}
       
   396 
       
   397 	unless ($TrgHash{UID2}) {
       
   398 		$TrgHash{UID2}='';
       
   399 	}
       
   400 	else {
       
   401 		$TrgHash{UID2}=&Genutl_AnyToHex($TrgHash{UID2});
       
   402 		unless (defined $TrgHash{UID2}) {
       
   403 			die "INTERNAL ERROR: UID2 badly defined for type \"$TrgHash{Name}\" in Trgtype.pm\n";
       
   404 		}
       
   405 	}
       
   406 
       
   407 #	Deprecated target warnings
       
   408 
       
   409 	if ($TrgHash{Deprecated}) {
       
   410 		print "MIGRATION_NOTE: type \"$TrgHash{Name}\" is deprecated - $TrgHash{Deprecated}\n";
       
   411 	}
       
   412 	
       
   413 #	Pass the data
       
   414 	%{$TrgHash_ref}=%TrgHash;
       
   415 }
       
   416 
       
   417 sub Trg_List () {
       
   418 #	returns a list of known poly types
       
   419 
       
   420 	sort keys %Types;
       
   421 }
       
   422 
       
   423 
       
   424 1;