Install Pulsar softwares

We are going to keep the following directory structure:

inpta/source is where all the source codes will be kept. This is where compilations will take place.

inpta/stable is where bin, lib and include will reside.

Setting environment

Please put this in either your shell rc file (bashrc or zshrc) or put in a file and remember to source it

Please note that inpta should be expressed as the full path.

	export INPTA=inpta/stable
	export BIN=$INPTA/bin
	export INC=$INPTA/include
	export LIB=$INPTA/lib
	export SRC=inpta/source
	# 
	export OSTYPE=linux
	# PSRCAT
	export PSRCAT_DIR=$SRC/psrcat_tar
	export PSRCAT_FILE=$PSRCAT_DIR/psrcat.db
	# BOOST
	export BOOST_ROOT=$SRC/boost_1_68_0
	export BOOST_LIB=$BOOST_ROOT/stage/lib
	# PGPLOT
	export PGPLOT_DIR=$SRC/pgplot
	# TEMPO2
	export TEMPO2=$SRC/tempo2/T2runtime
	#
	export PATH=$PATH:$BIN

Running now

Curl those packages

	curl -L "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio3450.tar.gz" -o cfitsio3450.tar.gz 
	curl -L "http://www.atnf.csiro.au/research/pulsar/psrcat/downloads/psrcat_pkg.tar.gz" -o psrcat_pkg.tar.gz
	curl -L "http://www.fftw.org/fftw-3.3.8.tar.gz" -o fftw-3.3.8.tar.gz
	curl -L "https://zlib.net/zlib-1.2.11.tar.gz" -o zlib-1.2.11..tar.gz
	curl -L "https://curl.haxx.se/download/curl-7.61.1.tar.gz" -o curl-7.61.1.tar.gz
	curl -L "https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.gz" -o boost_1_68_0.tar.gz
	curl -L "ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz" -o pgplot5.2.tar.gz
	curl -L "https://www.imcce.fr/content/medias/recherche/equipes/asd/calceph/calceph-3.1.0.tar.gz" -o calceph-3.1.0.tar.gz
	curl -L "https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.4.tar.gz" -o git-2.9.4.tar.gz

Install now

You are at $SRC

CFITSIO

	cd cfitsio/
	configure --prefix=$INPTA CFLAGS=-fPIC FFLAGS=-fPIC
	make
	make shared
	make install
	make clean
	cd $SRC

PSRCAT

	cd psrcat_tar/
	bash makeit
	cp psrcat $BIN
	cd $SRC

FFTW

	cd fftw-3.3.8/
	configure --prefix=$INPTA --enable-float --enable-threads --enable-shared --enable-single CFLAGS=-fPIC FFLAGS=-fPIC 
	make check
	make install
	make clean
	cd $SRC

ZLIB

	cd zlib-1.2.11/
	configure --prefix=$INPTA 
	make
	make install
	cd $SRC

CURL

	cd curl-7.61.1/
	configure --prefix=$INPTA --with-ssh --with-zlib
	make
	make install
	cd $SRC

GIT

	cd git-2.19.0/
	configure --prefix=$INPTA CFLAGS=-I$INC LDFLAGS=-L$LIB
	make
	make install
	cd $SRC

GITER

	git clone https://github.com/Reference-LAPACK/lapack-release.git
	git clone https://github.com/shiningsurya/prf2fits.git
	git clone https://bitbucket.org/psrsoft/tempo2.git
	git clone git://git.code.sf.net/p/psrchive/code psrchive

LAPACK

	cd lapack-release/
	make PREFIX=$INPTA
	cd $SRC

BOOST

	cd boost_1_68_0/
	bootstrap.sh --prefix=$INPTA
	b2
	cd $SRC

PRF2FITS

	cd prf2fits/
	make cfgen prf2fits
	cp {prf2fits,cfgen} $BIN
	cd $SRC

PGPLOT

tricky, have to edit files

	mkdir pgplot
	mkdir pgplot/pgplotsrc
	tar xf pgplot.tar.gz -C pgplot/pgplotsrc --strip-components=1
	cd pgplot

You will have to do the following edits here: 0. You are at pgplot/pgplotsrc 1. Comment lines 107 & 108 of file pgdispd/proccom.c. 2. Copy f77_gcc.conf to gfortran_gcc.conf and edit the following lines

>  change line 9 from 
   XINCL="-I/usr/X11R6/include" to
   XINCL="-I/usr/include"

>  change line 38 from
   FCOMPL="f77" to
   FCOMPL="gfortran"

>  change line 44 from
   FFLAGC="-u" to
   FFLAGC="-u -Wall -fPIC -O"

>  change line 51 from
   FFLAGD="" to
   FFLAGD="-fno-backslash"

>  change line 61 from
   CFLAGC="-DPG_PPU -O2" to
   CFLAGC="-Wall -fPIC -DPG_PPU -O"

>  change line 66 from
   CFLAGD="-O2"
   CFLAGD="-Wall -O"

>  change line 78 from 
   LIBS="-lf2c -L/usr/X11R6/lib -lX11 \`\$(SRC)/cpg/libgcc_path.sh\` -lgcc -lm -lc"
   LIBS="-L/usr/lib64 -lX11"

>  change line 107 from
   SHARED_LIB="" to
   SHARED_LIB="libpgplot.so"

>  change line 112 from
   SHARED_LD=""
   SHARED_LD="gcc -shared -o $SHARED_LIB"

>  change line 144 from
   SYSDIR="$SYSDIR/f77_src" to
   SYSDIR="$SYSDIR"
  1. Now, go to pgplot.
  2. Copy pgplotsrc/drivers.list here
  3. Open the file and uncomment the following lines:
    1. PSDRIV 1
    2. PSDRIV 2
    3. PSDRIV 3
    4. PSDRIV 4
    5. X2DRIV
    6. XWDRIV
    7. XWDRIV there are two instances of XWDRIV
	cd $SRC/pgplot
	pgplotsrc/makemake pgplotsrc/ linux gfortran_gcc
	make
	make cpg
	cd $SRC

GSL

	cd gsl-2.5/
	configure --prefix=$INPTA 
	make
	make install
	cd $SRC

CALCEPH

	cd calceph-3.1.0/
	configure --prefix=$INPTA 
	make
	make install
	cd $SRC

TEMPO2

	cd tempo2
	bootstrap 
	configure F77=gfortran --prefix=$INPTA --with-cfitsio-dir=$INPTA --with-fftw3-dir=$INPTA CFLAGS=-fPIC FFLAGS=-fPIC CXXFLAGS="-I$INC -I$PGPLOT_DIR" LDFLAGS=-L$PGPLOT_DIR
	make 
	make install
	make plugins 
	make plugins-install 
	make unsupported
	cd $SRC

PSRCHIVE

	cd psrchive 
	bootstrap
	configure F77=gfortran --prefix=$INPTA --with-cfitsio-dir=$INPTA --with-fftw3-dir=$INPTA CFLAGS=-fPIC FFLAGS=-fPIC CXXFLAGS="-I$INC -I$PGPLOT_DIR" LDFLAGS=-L$PGPLOT_DIR
	make
	make install
	cd $SRC