cross-plat-dev-utils/places.pm
author Mike Kinghan <mikek@symbian.org>
Thu, 25 Nov 2010 13:59:07 +0000
changeset 40 68f68128601f
parent 6 787612182dd0
permissions -rwxr-xr-x
1) Add the sbsv1 components from sftools/dev/build to make the linux_build package independent of the obsolete buildtools package. 2) Enhance romnibus.pl so that it generate the symbol file for the built rom when invoked by Raptor 3) Make the maksym.pl tool portable for Linux as well as Windows. 4) Remove the of armasm2as.pl from the e32tools component in favour of the copy now exported from sbsv1/e32util.

#!/usr/bin/perl
# Copyright (c) 2010 Symbian Foundation Ltd
# This component and the accompanying materials are made available
# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Mike Kinghan, mikek@symbian.org, for Symbian Foundation Ltd - initial contribution.

# Routines to get/set some essential paths.

use strict;
use Cwd;
use Cwd 'abs_path';
use File::Spec;

# get the package directory
sub get_pkg_dir()
{
	return abs_path("..");	
}

# get the epoc32 directory without insisting it exists
sub get_epoc32_path()
{
	my $epocroot = get_epocroot();
	my $epoc32 = File::Spec->catfile($epocroot,"epoc32");
	return $epoc32;
}

# get the epoc32 directory, insisting it exists
sub get_epoc32_dir()
{
	my $epoc32 = get_epoc32_path();
	die "*** Error: directory \"$epoc32\" does not exist ***",
		unless ( -d "$epoc32");	
	return $epoc32;
}

# Get the EPOCROOT directory, using the environment setting if it exists,
# otherwise assuming the parent of the package dir.
sub get_epocroot()
{
	my $epocroot = $ENV{'EPOCROOT'};
    unless ($epocroot) {
		$epocroot = abs_path(File::Spec->catfile("..",".."));
		if (-d "$epocroot") {
        	print ">>> EPOCROOT not defined. Assuming \"$epocroot\"\n";
		} else {
			die "*** Error: EPOCROOT not defined and guess \"$epocroot\" " .
				"does not exist ***";
		}
    	$ENV{'EPOCROOT'}=$epocroot;
		print ">>> EPOCROOT=\"$epocroot\"\n";
    }
	if (! -d "$epocroot") {
		die "*** Error: directory \"$epocroot\" does not exist ***";
	}
	else {
		my $epoc32 = File::Spec->catfile($epocroot,"epoc32");
		unless ( -d "$epoc32") {
			print "!!! Warning: No epoc32 die under EPOCROOT !!!\n";
		}
	}
	return $epocroot;
}

sub get_sbs_home()
{
	my $sbs_home = $ENV{'SBS_HOME'};
	unless($sbs_home) {
		$sbs_home = File::Spec->catfile(get_pkg_dir(),"sbsv2","raptor");
		if ( -d "$sbs_home") {
        	print ">>> SBS_HOME not defined. Assuming \"$sbs_home\"\n";
		} else {
			die "*** Error: SBS_HOME not defined and guess \"$sbs_home\" " .
				"does not exist ***";
		}
		$ENV{'SBS_HOME'} = $sbs_home;
	}
	unless ( -d "$sbs_home") {
		die "*** Error: directory \"$sbs_home\" does not exist ***";
	}
	return $sbs_home;
}

1;