#!/usr/bin/perl -w
#
# Creates common environment 
#
# $Id$
#
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(set_env);

use strict;
use File::Basename;
use ExtUtils::Command;
use File::Temp qw /tempdir/;

sub set_env {

my $tmp = dirname($PROGRAM_NAME);
#print "$tmp\n";
if ($tmp =~ /^\//) {
        $ENV{'TOOLHOME'} = $tmp;
        }
else {
        $ENV{'TOOLHOME'} = "$ENV{PWD}/$tmp";
        }

die "TOOLHOME doesn't exist" if (not (defined $ENV{'TOOLHOME'}));

# Adapt to your needs
$ENV{'TOPDIR'}=$ENV{'TOOLHOME'}."/../delivery";
mkpath $ENV{'TOPDIR'};

if (undef $ENV{'TMPDIR'}) {
	$ENV{'TMPDIR'}="/tmp";
}
$ENV{'PROJTMP'} = tempdir( "projbuild.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 );

umask 0022
}
1;
