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