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