################################################################################
# Tasks to do as root
################################################################################

##############################
# Configure repositories
##############################

cd /etc/yum.repos.d/

################################################
# Add epel.repo with the following contents:
################################################

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

###############################################
# Add casa.repo with the following contents:
###############################################

[casa]
name=CASA RPMs for RedHat Enterprise Linux 7 (x86_64)
baseurl=http://svn.cv.nrao.edu/casa/repo/el7/x86_64
gpgkey=http://svn.cv.nrao.edu/casa/RPM-GPG-KEY-casa http://www.jpackage.org/jpackage.asc http://svn.cv.nrao.edu/casa/repo/el7/RPM-GPG-KEY-redhat-release http://svn.cv.nrao.edu/casa/repo/el7/RPM-GPG-KEY-EPEL

#################################################################
# In the redhat.repo, turn rhel-7-workstation-optional-rpms
# and rhel-7-workstation-optional-source-rpms on by changing
# "enabled = 0" to "enabled = 1"
#################################################################

##################################
# Install required RPM packages
##################################

yum install casa01-dbus-cpp casa01-dbus-cpp-devel casa01-mpi4py.x86_64 casa01-openmpi.x86_64 casa01-python.x86_64 casa01-python-devel.x86_64 casa01-python-tools.x86_64 cfitsio-devel libsakura wcslib wcslib-devel pgplot-devel pgplot-demos pgplot-motif devtoolset* lapack-devel xerces-c-devel Cython flex-devel bison-devel


################################################################################
# Configuring workspace
################################################################################

# Create a working directory
cd /export/home/cbt-el7-3/
mkdir carta-work
cd carta-work

# Download Qt
curl -O -L http://download.qt.io/official_releases/qt/5.3/5.3.2/qt-opensource-linux-x64-5.3.2.run

# Run the installer and install into /export/home/cbt-el7-3/carta-work/Qt5.3.2/
# Include new Qt in PATH
export PATH=/export/home/cbt-el7-3/carta-work/Qt5.3.2/5.3/gcc_64/bin/:$PATH

# Create directories and download source
mkdir cartabuild
cd cartabuild
export CARTABUILDHOME=`pwd`
git clone https://github.com/Astroua/CARTAvis  # Move this after the configuration
mkdir -p CARTAvis-externals/ThirdParty
cd CARTAvis-externals/ThirdParty

################################################################
# Download and configure Qwt
################################################################
curl -O -L http://downloads.sourceforge.net/project/qwt/qwt/6.1.2/qwt-6.1.2.tar.bz2
tar xvfj qwt-6.1.2.tar.bz2 && mv qwt-6.1.2 qwt-6.1.2-src
cd  qwt-6.1.2-src

# Change QWT_INSTALL_PREFIX in qwtconfig.pri to point to
$CARTABUILDHOME/CARTAvis-externals/ThirdParty/qwt-6.1.2

qmake qwt.pro
make
make install
cd ..
# On Linux, the qwt can probably be directly symlinked to the appropriate qwt directory
mkdir qwt
cd qwt
ln -s $CARTABUILDHOME/CARTAvis-externals/ThirdParty/qwt-6.1.2/include include
ln -s $CARTABUILDHOME/CARTAvis-externals/ThirdParty/qwt-6.1.2/lib lib
cd ..

###############################
# Download and install qooxdoo
###############################

Copy
https://sourceforge.net/projects/qooxdoo/files/qooxdoo-current/3.5/qooxdoo-3.5-sdk.zip/download
to:
$CARTABUILDHOME/CARTAvis-externals/ThirdParty/

unzip qooxdoo-3.5-sdk.zip

################################
# Download and install rapidjson
################################

curl -O -L https://github.com/miloyip/rapidjson/archive/v1.0.2.tar.gz
tar xvfz v1.0.2.tar.gz
ln -s rapidjson-1.0.2 rapidjson

##############################
# Download and install wcslib
##############################
ftp://ftp.atnf.csiro.au/pub/software/wcslib/wcslib.tar.bz2
cp wcslib.tar.bz2 $CARTABUILDHOME/CARTAvis-externals/ThirdParty/
cd $CARTABUILDHOME/CARTAvis-externals/ThirdParty/
tar xvfj wcslib.tar.bz2 && mv wcslib-5.15/ wcslib-5.15-src
cd wcslib-5.15-src
./configure --prefix=`pwd`/../wcslib/
make install

##############################
# Download and install cfitsio
##############################
cd $CARTABUILDHOME/CARTAvis-externals/ThirdParty/
curl -O -L http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio3380.tar.gz
tar xvfz cfitsio3380.tar.gz && mv cfitsio cfitsio-src
cd cfitsio-src
./configure --prefix=`pwd`/../cfitsio/
make install
cd ..
ln -s cfitsio cfitsio-shared

##############################
# Download and install ast
##############################
cd $CARTABUILDHOME/CARTAvis-externals/ThirdParty/
curl -O -L https://svn.cv.nrao.edu/casa/devel/carta/ast-8.0.2.tar.gz
tar xvfz ast-8.0.2.tar.gz && mv ast-8.0.2 ast-8.0.2-src
cd ast-8.0.2-src
./configure --prefix=`pwd`/../ast/
make install
cd ..

##############################
# Download and install gsl
##############################
cd $CARTABUILDHOME/CARTAvis-externals/ThirdParty/
curl -O -L http://ftp.gnu.org/gnu/gsl/gsl-2.1.tar.gz
tar xvfz gsl-2.1.tar.gz && mv gsl-2.1 gsl-2.1-src
cd gsl-2.1-src
./configure --prefix=`pwd`/../gsl/
make install
cd ..

################################
# Build and copy casacore and code
################################
Note: You can't use QT5 for this
Link or copy the following parts

mkdir $CARTABUILDHOME/../casa
cd $CARTABUILDHOME/../casa
svn co https://svn.cv.nrao.edu/svn/trunk
svn co https://svn.cv.nrao.edu/svn/casa/trunk
cd trunk/casacore
mkdir build && cd build

cmake -DUseCrashReporter=0 -DBoost_NO_BOOST_CMAKE=1 -DCASA_BUILD=1 -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=../../linux -DBUILD_PYTHON=1 -DPYTHON_INCLUDE_DIR=/opt/casa/01/include/python2.7/ -DPYTHON_LIBRARY=/opt/casa/01/lib/libpython2.7.so -DBOOST_ROOT=/usr/lib64/casa/01 -DCMAKE_BUILD_TYPE=Release -DCXX11=1 -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/gfortran ..

make
make install

cd ../../code
mkdir build && cd build
cmake -DUseCrashReporter=0  -DBoost_NO_BOOST_CMAKE=1 '-DEXTRA_C_FLAGS=-DPG_PPU -I/usr/include/wcslib' -Darch=linux -DBoost_NO_BOOST_CMAKE=1 -DCMAKE_BUILD_TYPE=Release -DCXX11=1 -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/g++ -DCMAKE_C_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/gcc -DCMAKE_Fortran_COMPILER=/opt/rh/devtoolset-3/root/usr/bin/gfortran ..
make

cd $CARTABUILDHOME/CARTAvis-externals/ThirdParty/
mkdir imageanalysis
cd imageanalysis
ln -s $CARTABUILDHOME/../casa/trunk/linux/include/casacode/ include
ln -s $CARTABUILDHOME/../casa/trunk/linux/lib lib
cd ..
mkdir casacore
cd casacore
ln -s $CARTABUILDHOME/../casa/trunk/linux/include/casacore/ include
ln -s $CARTABUILDHOME/../casa/trunk/linux/lib lib


################################################################################
# Build
################################################################################

# Make sure that carta/cpp/common_config.pri points to the following directories
CASACOREDIR=../../ThirdParty/casacore
#ASTLIBDIR = ../../ThirdParty/ast
WCSLIBDIR=../../ThirdParty/wcslib
CFITSIODIR=../../ThirdParty/cfitsio
IMAGEANALYSISDIR=../../ThirdParty/imageanalysis

# You may also need to modify CARTAvis/carta/cpp/common.pri to not try to use gcc4.8

export PATH=/export/home/cbt-el7-3/carta-work/Qt5.3.2/5.3/gcc_64/bin/:$PATH

# Run qooxdoo code generation
cd $CARTABUILDHOME/CARTAvis/carta/html5/common/skel
./generate.py source > /dev/null
./generate.py  > /dev/null


# Create a build directory
cd $CARTABUILDHOME
mkdir build
cd build

# Configure and make
qmake NOSERVER=1 CARTA_BUILD_TYPE=dev $CARTABUILDHOME/CARTAvis/carta -r
make -j 2

# Run
ulimit -n 2000
#Note: LD_LIBRARY_PATH should be used for the local tests only
export LD_LIBRARY_PATH=/export/home/cbt-el7-3/carta-work/casa/trunk/linux/lib/:/export/home/cbt-el7-3/carta-work/cartabuild/build/cpp/plugins/CasaImageLoader/
./cpp/desktop/desktop --html /export/home/cbt-el7-3/carta-work/cartabuild/CARTAvis/carta/html5/desktop/desktopIndex.html --scriptPort 9999

################################################################################
#Package
################################################################################

svn co https://svn.cv.nrao.edu/svn/casa/development_tools/packaging
cd packaging/scripts/

export cartaversion='1.0.0'

# Add Casa libraries to path
export LD_LIBRARY_PATH=/export/home/cbt-el7-3/carta-work/casa/trunk/linux/lib
./make-app-carta  -ni -v version=$cartaversion type=DEV out=/tmp ws=$CARTABUILDHOME/build/cpp/desktop

chrpath -c -r '$ORIGIN/../../lib:$ORIGIN/../../plugins/CasaImageLoader' /tmp/carta-DEV-$cartaversion/plugins/ImageStatistics/libplugin.so

########################
# Fix Resources
########################

# Copy html in place

cp -r /export/home/cbt-el7-3/carta-work/cartabuild/CARTAvis/carta/html5 /tmp/carta-DEV-$cartaversion/etc
# Remove qooxdoo symlink
rm /tmp/carta-DEV-$cartaversion/etc/html5/common/qooxdoo-3.5-sdk
cp -r /export/home/cbt-el7-3/carta-work/cartabuild/CARTAvis/Externals/ThirdParty/qooxdoo-3.5-sdk /tmp/carta-DEV-$cartaversion/etc/html5/common/qooxdoo-3.5-sdk

###################################################
#Copy the rest of the straggling dependencies
###################################################

cp -r /export/home/cbt-el7-3/carta-work/Qt5.3.2/5.3/gcc_64/plugins/platforms /tmp/carta-DEV-$cartaversion/bin/
cp /export/home/cbt-el7-3/carta-work/runscripts/* /tmp/carta-DEV-$cartaversion/bin/

cp /usr/lib64/libcfitsio.so.2 /tmp/carta-DEV-$cartaversion/lib/
cp /usr/lib64/libcpgplot.so.5  /tmp/carta-DEV-$cartaversion/lib/
cp /usr/lib64/libpgplot.so.5 /tmp/carta-DEV-$cartaversion/lib/
cp /usr/lib64/libpgsbox.so.5 /tmp/carta-DEV-$cartaversion/lib/
cp /export/home/cbt-el7-3/carta-work/Qt5.3.2/5.3/gcc_64/lib/libQt5DBus.so.5 /tmp/carta-DEV-$cartaversion/lib/

#################################
# Add sample images
#################################

curl -O -L https://svn.cv.nrao.edu/casa/devel/carta/cartaimages.tar.gz && tar xvfz cartaimages.tar.gz -C /tmp/carta-DEV-$cartaversion/etc && rm cartaimages.tar.gz

######################
# Run
######################

./desktop --config ../Resources/config/config.json --html `pwd`/../Resources/html/desktop/desktopIndex.html --scriptPort 9999 /opt/casa/01//Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyfits/tests/data/test0.fits

-- VilleSuoranta - 2016-05-27
Topic revision: r9 - 2016-11-08, VilleSuoranta
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback