symport/flm/export.pl
changeset 1 0a7b44b10206
child 2 806186ab5e14
equal deleted inserted replaced
0:c55016431358 1:0a7b44b10206
       
     1 #!/usr/bin/perl
       
     2 
       
     3 # Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 # All rights reserved.
       
     5 # This component and the accompanying materials are made available
       
     6 # under the terms of the License "Symbian Foundation License v1.0"
       
     7 # which accompanies this distribution, and is available
       
     8 # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     9 #
       
    10 # Initial Contributors:
       
    11 # Nokia Corporation - initial contribution.
       
    12 #
       
    13 # Contributors:
       
    14 #
       
    15 # Description:
       
    16 #
       
    17 
       
    18 use strict;
       
    19 use warnings;
       
    20 use Getopt::Long;
       
    21 use File::Spec::Functions;
       
    22 use Pod::Usage;
       
    23 use File::Copy;
       
    24 
       
    25 # Version of the script - just use the date
       
    26 $main::VERSION = '13-Oct-08';
       
    27 
       
    28 # Get command line arguments
       
    29 my ( $version, $help, $verbose );
       
    30 GetOptions("verbose|v" => \$verbose, "version|ver" => \$version, "help|h" => \$help) or pod2usage(2);
       
    31 
       
    32 # Handle help and version
       
    33 pod2usage({ verbose => 1, exitval => 0}) if $help;
       
    34 version() if $version;
       
    35 
       
    36 # Check we can find the build system
       
    37 die "SBS_HOME environment variable not defined" if !$ENV{SBS_HOME};
       
    38 die "Can't find SBS in $ENV{SBS_HOME}" if !-d $ENV{SBS_HOME};
       
    39 
       
    40 # Now do the work
       
    41 doCopy('x86tool.flm', catfile($ENV{SBS_HOME}, 'lib', 'flm', 'tools', 'x86tool.flm'));
       
    42 doCopy('x86tool.xml', catfile($ENV{SBS_HOME}, 'lib', 'flm', 'x86tool.xml'));
       
    43 
       
    44 # Copy files
       
    45 sub doCopy
       
    46 	{
       
    47 	my ( $src, $dst ) = @_;
       
    48 	print "Copying $src to $dst\n" if $verbose;
       
    49 	unlink $dst;
       
    50 	copy($src, $dst) or die "Failed to copy $src to $dst: $!";
       
    51 	}
       
    52 
       
    53 # New getopt::long provides this - but old version doesn't?
       
    54 sub version
       
    55 	{
       
    56 	print sprintf("$0: $main::VERSION\n$^X: %vd\nos: $^O", $^V);
       
    57 	exit;
       
    58 	}
       
    59 
       
    60 =head1 NAME
       
    61 
       
    62 export.pl - Copies FLM files to the right place
       
    63 
       
    64 =head1 SYNOPSIS
       
    65 
       
    66 export.pl [-help] [-version] [-verbose]
       
    67 
       
    68  Options:
       
    69    -help      brief help message
       
    70    -version   version of the script
       
    71    -verbose   print what the scripts does
       
    72 
       
    73 =cut