imgtools/imaker/buildrom_plugins/s60ibymacros.pm
author andy simpson <andrews@symbian.org>
Fri, 30 Jul 2010 15:14:33 +0100
changeset 622 c26070468a42
parent 595 997c19261166
permissions -rw-r--r--
Add export for s60ibymacros.pm (re-applies missing part of fix for Bug 2901
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
595
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
     1
# ============================================================================
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
     2
#  Name        : s60ibymacros.pm
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
     3
#  Part of     : build_RnD
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
     4
#  Description : S60 specific IBY file macro handling
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
     5
#  Version     : %version: 1 %
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
     6
#
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
     7
#  Copyright © 2006 Nokia.  All rights reserved.
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
     8
#  This material, including documentation and any related computer
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
     9
#  programs, is protected by copyright controlled by Nokia.  All
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    10
#  rights are reserved.  Copying, including reproducing, storing,
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    11
#  adapting or translating, any or all of this material requires the
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    12
#  prior written consent of Nokia.  This material also contains
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    13
#  confidential information which may not be disclosed to others
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    14
#  without the prior written consent of Nokia.
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    15
# ============================================================================
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    16
#
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    17
# 07.08.2006 Juha Ristimäki
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    18
# Initial version.
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    19
#
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    20
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    21
package s60ibymacros;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    22
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    23
BEGIN
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    24
  {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    25
  use Exporter ();
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    26
  our ( $VERSION, @ISA, @EXPORT );
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    27
  # set the version for version checking
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    28
  $VERSION     = 1.00;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    29
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    30
  @ISA         = qw( Exporter );
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    31
  @EXPORT      = qw( &s60ibymacros_info &DoS60IbyModifications );
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    32
  }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    33
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    34
my %s60ibymacros_infostruct =
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    35
  (
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    36
  name => "s60ibymacros",
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    37
  invocation => "InvocationPoint1",
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    38
  single => "s60ibymacros::DoS60IbyModifications"
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    39
  );
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    40
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    41
my @newobydata;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    42
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    43
sub s60ibymacros_info
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    44
  {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    45
  return \%s60ibymacros_infostruct;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    46
  }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    47
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    48
sub DoS60IbyModifications
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    49
  {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    50
  my $obydata = shift;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    51
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    52
  undef @newobydata;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    53
  foreach $line (@{$obydata})
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    54
    {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    55
    if ($line =~ /^\s*REM/i)
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    56
      {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    57
      # Ignore REM statements, to avoid processing "REM __SCALABLE_IMAGE( ... )"
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    58
      push @newobydata, $line;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    59
      }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    60
    elsif( ! ( HandleIconMacros($line) || HandleCenrepMacros($line) ) )
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    61
      {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    62
      push @newobydata, $line;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    63
      }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    64
    }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    65
  @{$obydata} = @newobydata;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    66
  }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    67
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    68
sub HandleCenrepMacros
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    69
  {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    70
  my $line = shift;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    71
  if ( $line =~ m/^.*__CENREP_TXT_FILES\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/i )
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    72
  # __CENREP_TXT_FILES(dataz_, source dir, target dir)
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    73
    {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    74
    my $sourcepath="$1\\$2";
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    75
    my $targetpath=$3;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    76
    my $s60extras_export_list_filename = "$sourcepath"."\\s60extras_export_list.txt";
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    77
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    78
    open(DH, $s60extras_export_list_filename);
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    79
    my @dlist = <DH>;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    80
    chop @dlist;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    81
    close(DH);
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    82
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    83
    my $cenreptxtfile;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    84
    foreach $cenreptxtfile (@dlist)
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    85
      {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    86
      if ($cenreptxtfile =~ /^\S+\.txt/)
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    87
        {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    88
        push @newobydata, "data=$sourcepath\\$cenreptxtfile $targetpath\\$cenreptxtfile\n";
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    89
        }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    90
      }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    91
    return 1;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    92
    }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    93
  }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    94
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    95
sub HandleIconMacros
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    96
  {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    97
  my $line = shift;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    98
  if ( $line =~ m/^.*__SCALABLE_IMAGE\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/i )
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
    99
  # __SCALABLE_IMAGE(emulator directory, file rom dir, dataz_, resource rom dir,
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   100
  #                  filename, resource filename)
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   101
    {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   102
      
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   103
    my $sourcepath="$1\\$2";
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   104
    my $targetpath=$3;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   105
    my $filename=$4;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   106
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   107
    if( -e "$sourcepath\\$filename.mbm" )
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   108
      {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   109
      push @newobydata, "AUTO-BITMAP=$sourcepath\\$filename.mbm $targetpath\\$filename.mbm\n";
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   110
      }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   111
    if( -e "$sourcepath\\$filename.mif" )
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   112
      {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   113
      push @newobydata, "data=$sourcepath\\$filename.mif $targetpath\\$filename.mif\n";
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   114
      }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   115
    elsif( ! -e "$sourcepath\\$filename.mbm ")
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   116
      {
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   117
      print STDERR "* Invalid image file name: $sourcepath\\$filename.mbm or .mif\n";
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   118
      }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   119
    return 1;
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   120
    }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   121
  }
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   122
997c19261166 -Added s60ibymacros.pm as buildrom plugin.
terytkon
parents:
diff changeset
   123
1;  # Return a true value from the file