use File::Path 2.07 qw( make_path remove_tree );
use Cwd qw(abs_path getcwd);
use URI::Split qw(uri_split);
$osname = lc((uname( ))[0]);
$osrel=os_release($osname);
$library_destination = '';
$data_url = 'https://open-bitbucket.nrao.edu/scm/casa/casa-data.git';
$template_branch = 'master';
m|^version=(.+)| && ( $version = $1, next );
m|^ws=(\S+)|i && -d "$1" && ( $workspace = $1, next );
m|^arch=(\S+)|i && ( $arch = $1, next );
m|^match=(.+)| && ( $match = $1, next );
m|^out=(.+)| && ( $output_dir = $1, next );
m|^template=(.+)| && ( $local_template_path = $1, next );
m|^data=(.+)| && ( $local_data_path = $1, next );
m|^url=(.+)| && ( $template_url = $1, next );
m|^templatebranch=(.+)| && ( $template_branch = $1, next );
m|^branch=(.+)| && ( $branch = $1, next );
m|^-ignore-missing-dep|i && ( $ignore_missing_dep = 'yes', next );
m|^-q$|i && ( $quiet = 'yes', $verbose = '', next );
m|^-v$|i && ( $verbose = 'yes', $quiet = '', next );
m|^-ni$|i && ( $non_interactive = 'yes', next );
m|^-es$|i && ( $extract_symbols = 'yes', next );
m|^-help$| && ( usage( ), exit );
die "unrecognized option '$_'";
if ( $ENV{'CASAPATH'} =~ m|^(\S+)\s+\S+| ) {
$workspace = $1 if -d $1;
$ENV{'CASAPATH'} =~ m|\S+\s+(\S+)| && ( $arch = $1 );
my $uname = getpwuid( $< );
if ( $uname ne "casaci" and $uname ne "rpmbuild" and $uname ne "casauser" and $uname ne "root" ) { $bldtype = $uname }