Скрипт на перле по установке Калькуликса

http://feacluster.com/calculix/install/install

#!/usr/bin/perl

# USAGE: Install Calculix with Spooles solver
# perl install
# Install Calculix with Pardiso solver
# perl install pardiso
#
# Need help? Email info@feacluster.com

##################

sub remove_files {

`rm -f ccx_2.10.src.tar arpack96.tar patch.tar spooles.2.2.tar`;
`rm -rf ARPACK/ CalculiX/ SPOOLES.2.2/`;

} # end sub

########
# MAIN #
########

`wget http://www.feacluster.com/calculix/arpack96.tar.gz`;
`wget http://www.feacluster.com/calculix/patch.tar.gz`;
`wget http://www.feacluster.com/calculix/spooles.2.2.tar.gz`;
`wget http://www.feacluster.com/calculix/ccx_2.10.src.tar.gz`;

`gunzip *.gz`;

`tar -xvf arpack96.tar;tar -xvf patch.tar`;

$pwd = `pwd`;
chomp ($pwd);
$pwd =~ s/\//\\\//g;
$pwd = “$pwd\\/ARPACK”;

`perl -i -wpe ‘s/home \= .*/home \= $pwd/’ ARPACK/ARmake.inc`;
`perl -i -wpe ‘s/PLAT \= .*/PLAT \= INTEL/’ ARPACK/ARmake.inc`;

my $fortran_compiler = `which gfortran`;
$fortran_compiler =~ s/.*gfortran/gfortran/;

if ( $ARGV[0] =~ /pardiso/i ) {
$fortran_compiler = `which ifort`;
if ( $fortran_compiler !~ /ifort/ ) {
print “\n**** Intel fortran compiler not installed or configured. If you have already installed it, try doing:\n\nsource /opt/intel/compilers_and_libraries/linux/bin/compilervars.sh -arch intel64 -platform linux\n\nIf you have not installed, then you can download a free evaluation copy from:\n\nhttps://registrationcenter.intel.com/en/forms/?productid=2274\n\n”;
&remove_files;
exit 1;
}
else { $fortran_compiler = ‘ifort’; }
}

if ( $fortran_compiler =~ /gfortran|ifort/ ) {
`perl -i -wpe ‘s/FC \= .*/FC \= $fortran_compiler/’ ARPACK/ARmake.inc`;
`perl -i -wpe ‘s/^FFLAGS.*/FFLAGS \= -O/’ ARPACK/ARmake.inc`;
`perl -i -wpe ‘s/ EXTERNAL/\* EXTERNAL/’ ARPACK/UTIL/second.f`;
}
else { print “\n**** gfortran compiler not found! Install by doing as root: ‘yum install gcc-gfortran’\n\n”; exit 1; }

my $make = `which make`;
if ( $make =~ /usr/ ) {
`perl -i -wpe ‘s/MAKE \= .*/MAKE \= \\/usr\\/bin\\/make/’ ARPACK/ARmake.inc`;
}
print “\n** Building ARPACK – may take several minutes! **\n\n”;
`cd ARPACK;make lib`;

`mkdir SPOOLES.2.2;mv spooles.2.2.tar SPOOLES.2.2/;cd SPOOLES.2.2;tar -xvf spooles.2.2.tar`;

`perl -i -wpe ‘s/drawTree/draw/’ SPOOLES.2.2/Tree/src/makeGlobalLib`;

my $ccompiler = `which cc`;
if ( $ccompiler =~ /cc/ ) {
`perl -i -wpe ‘s/^ CC \=.*/ CC \= cc/’ SPOOLES.2.2/Make.inc`;
`perl -i -wpe ‘s/\#cd MT/\tcd MT/g’ SPOOLES.2.2/makefile`;
}
else { print “\n**** C compiler not found! Install by doing as root: ‘yum group install Development Tools’\n\n”; exit 1; }

print “\n** Building Spooles – may take several minutes! **\n\n”;
`cd SPOOLES.2.2;make lib`;

`tar -xvf ccx_2.10.src.tar`;

`perl -i -wpe ‘s/\-Wall/\-w/g’ CalculiX/ccx_2.10/src/Makefile_MT;`;

if ( $fortran_compiler =~ /ifort/ ) {

`perl -i -wpe ‘s/DSPOOLES/DSPOOLES \-DPARDISO/’ CalculiX/ccx_2.10/src/Makefile_MT;`;
`perl -i -wpe ‘s/FFLAGS \=.*/FFLAGS \= -w -O3 -fopenmp/’ CalculiX/ccx_2.10/src/Makefile_MT;`;
`perl -i -wpe ‘s/FC\=.*/FC\= $fortran_compiler/’ CalculiX/ccx_2.10/src/Makefile_MT;`;
`perl -i -wpe ‘s\/-fopenmp \-w \-O3/\-openmp \-parallel \-mkl \-nofor-main/’ CalculiX/ccx_2.10/src/Makefile_MT;`;
}
else { `perl -i -wpe ‘s/\=gfortran/\=gfortran -w/g’ CalculiX/ccx_2.10/src/Makefile_MT;`; }

print “\n** Building Calculix – may take several minutes! **\n\n”;

`cd CalculiX/ccx_2.10/src/;mv Makefile_MT Makefile;make`;
`cp CalculiX/ccx_2.10/src/ccx_2.10_MT ./;chmod 711 ccx_2.10_MT`;
$executable = ‘ccx_2.10_MT’;

if ( $fortran_compiler =~ /ifort/ ) { `mv ccx_2.10_MT ccx_2.10_MT_PARDISO`; $executable = ‘ccx_2.10_MT_PARDISO’; }

print “\n** Done! – To run, enter ./$executable . Set number of cpus to use by doing:\n\nexport OMP_NUM_THREADS=number_cpus_available\n\n”;

&remove_files;

1;