use Cwd qw(abs_path getcwd);
use File::Path qw(make_path remove_tree);
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
$File::Fetch::BLACKLIST = [qw|lwp httptiny httplite|];
$path = abs_path(dirname($exe));
$jarfile_name = "create-app-assembly-1.6.jar";
open(JAVAVER, "$java -version 2>&1 |");
if ( m|version "?(\d+)\.(\d+)|i ) {
print "found java version ", join('.',@java_version), "\n";
die "cannot run $java" unless scalar(@java_version) > 0;
die "java version 1.8 or greater is required\n" unless $java_version[0] == 1 && $java_version[1] >= 8;
$distro_jarfile = $jarfile = "$path/java/$jarfile_name";
$jarfile = "$path/../target/scala-2.12/$jarfile_name";
$jarfile = $distro_jarfile;
### pull from download url
my $jardir = dirname($jarfile);
my $ff = File::Fetch->new(uri => "http://casa.nrao.edu/download/devel/xml-casa/java/$jarfile_name");
my $where = $ff->fetch( to => $jardir );
die "configuration error, cannot find jar file ($jarfile_name)" unless -e $jarfile;
if ( $Config{osname} eq "darwin" && ! -e "casaviewer.icns" ) {
my $ff = File::Fetch->new(uri => "http://casa.nrao.edu/download/devel/xml-casa/viewer/casaviewer.icns");
open(VER,"cd casa-source/casa5 && code/install/resolvegitrevision.sh --pretty-print 2>&1 |");
if ( m|^(\d+)\.(\d+)\.(\d+)[^0-9]+(\d+)\+?$| ) {
unless ( $major_ver ne '' && $minor_ver ne '' && $patch_ver ne '' && $build_ver ne '' ) {
print "unable to determine version number from resolvegitrevision.sh output:\n";
foreach ( @lines ) { print " $_"; }
die "cannot continue...";
#unless ( -e ".casacore-measures-patch-applied" ) {
# my $patchfile = "scripts/waiting-on-casacore-acceptance.diff";
# my $now_string = strftime("%a %b %e %H:%M:%S %Y",localtime);
# open( TURD, "> .casacore-measures-patch-applied" );
# print TURD "$now_string\n";
# open( PATCH, "patch -p0 < $patchfile |" );
# while ( my $line = <PATCH> ) { print $line; }
%include_changes = ( 'display/region/QtRegionState.ui.h' => 'ui/ui_QtRegionState.h',