cross-plat-dev-utils/places.pm
author Mike Kinghan <mikek@symbian.org>
Sat, 27 Nov 2010 17:23:11 +0000
changeset 41 1600211976c3
parent 6 787612182dd0
permissions -rwxr-xr-x
1) Add imgtools/romtools to the targets for which exports are performed by fix_tools_exports.pl 2) Windows compatibility fix to list_targets.pl 3) Modify imgtools\romtools\group\BLD.INF so that Windows-only exports are not performed on Linux hosts or vice versa. 4) Windows compatibility fix for imgtools\romtools\rombuild\romnibus.pl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
     1
#!/usr/bin/perl
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
     2
# Copyright (c) 2010 Symbian Foundation Ltd
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
     3
# This component and the accompanying materials are made available
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
     4
# under the terms of the License "Eclipse Public License v1.0"
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
     5
# which accompanies this distribution, and is available
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
     7
#
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
     8
# Initial Contributors:
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
     9
# Mike Kinghan, mikek@symbian.org, for Symbian Foundation Ltd - initial contribution.
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    10
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    11
# Routines to get/set some essential paths.
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    12
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    13
use strict;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    14
use Cwd;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    15
use Cwd 'abs_path';
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    16
use File::Spec;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    17
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    18
# get the package directory
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    19
sub get_pkg_dir()
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    20
{
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    21
	return abs_path("..");	
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    22
}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    23
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    24
# get the epoc32 directory without insisting it exists
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    25
sub get_epoc32_path()
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    26
{
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    27
	my $epocroot = get_epocroot();
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    28
	my $epoc32 = File::Spec->catfile($epocroot,"epoc32");
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    29
	return $epoc32;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    30
}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    31
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    32
# get the epoc32 directory, insisting it exists
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    33
sub get_epoc32_dir()
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    34
{
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    35
	my $epoc32 = get_epoc32_path();
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    36
	die "*** Error: directory \"$epoc32\" does not exist ***",
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    37
		unless ( -d "$epoc32");	
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    38
	return $epoc32;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    39
}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    40
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    41
# Get the EPOCROOT directory, using the environment setting if it exists,
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    42
# otherwise assuming the parent of the package dir.
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    43
sub get_epocroot()
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    44
{
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    45
	my $epocroot = $ENV{'EPOCROOT'};
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    46
    unless ($epocroot) {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    47
		$epocroot = abs_path(File::Spec->catfile("..",".."));
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    48
		if (-d "$epocroot") {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    49
        	print ">>> EPOCROOT not defined. Assuming \"$epocroot\"\n";
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    50
		} else {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    51
			die "*** Error: EPOCROOT not defined and guess \"$epocroot\" " .
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    52
				"does not exist ***";
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    53
		}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    54
    	$ENV{'EPOCROOT'}=$epocroot;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    55
		print ">>> EPOCROOT=\"$epocroot\"\n";
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    56
    }
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    57
	if (! -d "$epocroot") {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    58
		die "*** Error: directory \"$epocroot\" does not exist ***";
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    59
	}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    60
	else {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    61
		my $epoc32 = File::Spec->catfile($epocroot,"epoc32");
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    62
		unless ( -d "$epoc32") {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    63
			print "!!! Warning: No epoc32 die under EPOCROOT !!!\n";
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    64
		}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    65
	}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    66
	return $epocroot;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    67
}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    68
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    69
sub get_sbs_home()
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    70
{
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    71
	my $sbs_home = $ENV{'SBS_HOME'};
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    72
	unless($sbs_home) {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    73
		$sbs_home = File::Spec->catfile(get_pkg_dir(),"sbsv2","raptor");
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    74
		if ( -d "$sbs_home") {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    75
        	print ">>> SBS_HOME not defined. Assuming \"$sbs_home\"\n";
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    76
		} else {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    77
			die "*** Error: SBS_HOME not defined and guess \"$sbs_home\" " .
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    78
				"does not exist ***";
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    79
		}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    80
		$ENV{'SBS_HOME'} = $sbs_home;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    81
	}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    82
	unless ( -d "$sbs_home") {
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    83
		die "*** Error: directory \"$sbs_home\" does not exist ***";
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    84
	}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    85
	return $sbs_home;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    86
}
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    87
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    88
1;
787612182dd0 1) Make cross-plat-dev-utils perl scripts independent of the package directory name
mikek
parents:
diff changeset
    89