InstallAtATNF: make-atnf-install.sh

File make-atnf-install.sh, 3.4 KB (added by MatthewWhiting, 13 years ago)

Installation script

Line 
1#!/bin/bash
2# build code for use at ATNF
3set -e
4[ $# -eq 0 ] && echo "please specify a version" && exit
5
6Fail () { while [ $# -gt 0 ] ; do echo $1; shift ; done; exit 1; } ;
7
8case `uname` in
9    Linux)
10        case `uname -m` in
11            *86)
12                PLATFORM=linux
13                ;;
14            *86_64)
15                PLATFORM=linux64
16                ;;
17        esac
18        ;;
19    SunOS)
20        case `uname -r` in
21            4.)
22                PLATFORM=sun4
23                ;;
24            5.*)
25                PLATFORM=sun4sol
26                ;;
27            *)
28                case `uname -m` in
29                    *86)
30                        PLATFORM=i86sol
31                        ;;
32                    esac
33                esac
34        ;;
35    Darwin)
36        case `uname -m` in
37            i*86)
38                PLATFORM=darwin_x86
39                ;;
40            Power*)
41                PLATFORM=darwin_ppc
42                ;;
43        esac
44        ;;
45    *)
46        Fail "Unsupported on the `uname` platform"
47esac
48
49version=$1
50InstallDir=/nfs/atapplic/duchamp-${version}
51PlatformDir=${InstallDir}/${PLATFORM}
52BuildDir=${PlatformDir}/Duchamp-${version}
53SymLink=/nfs/atapplic/duchamp
54
55ThisDir=`pwd`
56mkdir -p $BuildDir
57rm -rf $BuildDir/*
58mkdir -p $InstallDir
59mkdir -p ${PlatformDir}
60rm -f $SymLink
61ln -s $InstallDir $SymLink
62
63case `uname` in
64  Linux)
65        SVNDir=http://svn.atnf.csiro.au/duchamp/tags/release-${version}
66        ConfigOptions="--prefix=${PlatformDir} --with-cfitsio=/usr/local --with-wcslib=/usr/local --with-pgplot=/usr/local --x-libraries=/usr/X11R6/lib"
67        MAKE_CMD=make
68        svn checkout $SVNDir $BuildDir
69        # The following removes a complier flag that isn't available on draco for gcc 3.3.5
70        echo perl -pi -e 's| -ftree-vectorize| |g' ${BuildDir}/Makefile.in
71        perl -pi -e 's| -ftree-vectorize| |g' ${BuildDir}/Makefile.in
72        ;;
73  SunOS)
74        DataLocation=/nfs/wwwatdocs/people/Matthew.Whiting/Duchamp/downloads
75        ConfigOptions="--prefix=${PlatformDir} --with-cfitsio=/usr/local --with-wcslib=/usr/local --with-pgplot=/usr/local CXX=g++-3.1.1 CC=gcc-3.1.1 F77=g77-3.1.1"
76        MAKE_CMD=gmake
77        cp ${DataLocation}/Duchamp-${version}.tar.gz ${PlatformDir}; cd ${PlatformDir}; gunzip Duchamp-${version}.tar.gz; tar xvf Duchamp-${version}.tar
78        # The following is a patch for a particular issue with the solaris compilers, especially for Duchamp-1.1.8
79        perl -pi -e 's|fabsf|fabs|g' Duchamp-${version}/src/PixelMap/Scan.cc
80        # The following removes a complier flag that isn't available on cetus for g++-3.1.1
81        perl -pi -e 's| -ftree-vectorize| |g' ${BuildDir}/Makefile.in
82        ;;
83  *) Fail "Unsupported on the `uname` platform"
84esac
85
86cd $BuildDir
87
88./configure $ConfigOptions
89
90echo "=== Done Configuration. Now to compile the code. ==="
91
92${MAKE_CMD} duchamp
93
94#verification
95
96case `uname` in
97    Linux)
98        ./VerifyDuchamp.sh
99        ;;
100    SunOS)
101        bash VerifyDuchamp.sh
102        ;;
103    *) Fail "Unsupported on the `uname` platform"
104esac
105
106#library, for development purposes only (not necessary to run Duchamp)
107${MAKE_CMD} lib
108
109#installation
110${MAKE_CMD} install
111
112cp ./README $InstallDir
113                   
114#Docs
115mkdir -p $InstallDir/docs
116cd docs
117latex Guide > doc-log
118latex Guide >> doc-log
119latex Guide >> doc-log
120latex Guide >> doc-log
121dvips -o Guide.ps Guide.dvi
122cp ./Guide.ps  $InstallDir/docs/
123export TEXINPUTS=
124pdflatex Guide >> doc-log
125pdflatex Guide >> doc-log
126cp ./Guide.pdf $InstallDir/docs/
127
128#
129# Copy the duchamp_wrapper script to /usr/local/bin and make a symlink pointing to it so people can run "Duchamp"
130cd $InstallDir
131rm -f /usr/local/bin/Duchamp
132cp scripts/duchamp-wrapper.sh /usr/local/bin
133ln -s /usr/local/bin/duchamp-wrapper.sh /usr/local/bin/Duchamp
134# Also copy the library and the include files to /usr/local/lib and /usr/local/include
135cp ${PlatformDir}/lib/libduchamp.a /usr/local/lib
136cp -r ${PlatformDir}/include/duchamp /usr/local/include
137
138cd $ThisDir