sbsv1/abld/e32util/createrfifile.pl
author jjkang
Fri, 25 Jun 2010 17:29:25 +0800
changeset 599 fa7a3cc6effd
child 606 30b30f9da0b7
permissions -rw-r--r--
Add sbsv1 to new structure
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
#!/usr/bin/perl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
use File::Basename;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
if (@ARGV <2)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
	print (STDERR "\ncreaterfifile.pl\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
	print STDERR << 'END_OF_HELP';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
Usage: createrfifile.pl rss_cpp_deps_file.d output_file.rfi [exclude path]
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
Takes a file containing CPP dependency output from the preprocessing of a .rss file and
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
generates a "combined resource" .rfi that can  be consumed by CDB.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
Optionally takes an exclusion path under which "found" dependencies are then ignored.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
END_OF_HELP
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
	exit(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
my ($deps, $rfi, $exclude) = @ARGV;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
if ($exclude)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
	$exclude =~ s/\\/\//g;			# Ensure consistent slashes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
	$exclude =~ s/\/\//\//g;		# Remove double slashes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
	$exclude = quotemeta($exclude);	# Convert for regex match
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
print ("RFI : exclude under - \"$exclude\"\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
my @resources;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
open DEPS, "< $deps" or die "\nCannot read \"$deps\"!\n\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
while (<DEPS>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
	# .d file format - whitespace at front is key, path format varies depending on platform
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
	# the aim is to get a list of the "real" files. Missing files can appear "unpathed", although
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
	# this isn't currently dealt with.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
	#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
	#HelloWorld_reg.o:  \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
	# F:/source/personal/misc/filenamepolicy/ported/examples/helloworld/HelloWorld_reg.rss \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
	#  F:/builds/sbs/9.5/epoc32/include/variant/Symbian_OS.hrh \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
	#  F:/builds/sbs/9.5/epoc32/include/appinfo.rh \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
	#  F:/builds/sbs/9.5/epoc32/include/helloworld.rsg
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
	#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
	s/^.*\.o\://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
	s/^\s+//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
	s/\s*\\$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
	s/\/\//\//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
	chomp ($_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
	next if !/\S/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
	print ("WARNING: Could not find dependency \"$_\" in \"$deps\"\n") if !(-e $_);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
	print ("RFI : processing - \"$_\"\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
	next if ($exclude && /^$exclude/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
	push @resources,$_;	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
close DEPS;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
open RFI, "> $rfi" or die "\nCannot write \"$deps\"!\n\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
foreach my $resource (@resources)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
	print RFI "\n\n/* GXP ***********************\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
	print RFI " * ".basename($resource)."\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
	print RFI " ****************************/\n\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
	open RESOURCE, "< $resource" or die "\nCannot read \"$resource\"!\n\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
	print RFI $_ while (<RESOURCE>);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
	close RESOURCE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
close RFI;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87