1 | #!/bin/bash |
---|
2 | # build code for use at ATNF |
---|
3 | set -e |
---|
4 | [ $# -eq 0 ] && echo "please specify a version" && exit |
---|
5 | |
---|
6 | Fail () { while [ $# -gt 0 ] ; do echo $1; shift ; done; exit 1; } ; |
---|
7 | |
---|
8 | case `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" |
---|
47 | esac |
---|
48 | |
---|
49 | version=$1 |
---|
50 | InstallDir=/nfs/atapplic/duchamp-${version} |
---|
51 | PlatformDir=${InstallDir}/${PLATFORM} |
---|
52 | BuildDir=${PlatformDir}/Duchamp-${version} |
---|
53 | SymLink=/nfs/atapplic/duchamp |
---|
54 | |
---|
55 | ThisDir=`pwd` |
---|
56 | mkdir -p $BuildDir |
---|
57 | rm -rf $BuildDir/* |
---|
58 | mkdir -p $InstallDir |
---|
59 | mkdir -p ${PlatformDir} |
---|
60 | rm -f $SymLink |
---|
61 | ln -s $InstallDir $SymLink |
---|
62 | |
---|
63 | case `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" |
---|
84 | esac |
---|
85 | |
---|
86 | cd $BuildDir |
---|
87 | |
---|
88 | ./configure $ConfigOptions |
---|
89 | |
---|
90 | echo "=== Done Configuration. Now to compile the code. ===" |
---|
91 | |
---|
92 | ${MAKE_CMD} duchamp |
---|
93 | |
---|
94 | #verification |
---|
95 | |
---|
96 | case `uname` in |
---|
97 | Linux) |
---|
98 | ./VerifyDuchamp.sh |
---|
99 | ;; |
---|
100 | SunOS) |
---|
101 | bash VerifyDuchamp.sh |
---|
102 | ;; |
---|
103 | *) Fail "Unsupported on the `uname` platform" |
---|
104 | esac |
---|
105 | |
---|
106 | #library, for development purposes only (not necessary to run Duchamp) |
---|
107 | ${MAKE_CMD} lib |
---|
108 | |
---|
109 | #installation |
---|
110 | ${MAKE_CMD} install |
---|
111 | |
---|
112 | cp ./README $InstallDir |
---|
113 | |
---|
114 | #Docs |
---|
115 | mkdir -p $InstallDir/docs |
---|
116 | cd docs |
---|
117 | latex Guide > doc-log |
---|
118 | latex Guide >> doc-log |
---|
119 | latex Guide >> doc-log |
---|
120 | latex Guide >> doc-log |
---|
121 | dvips -o Guide.ps Guide.dvi |
---|
122 | cp ./Guide.ps $InstallDir/docs/ |
---|
123 | export TEXINPUTS= |
---|
124 | pdflatex Guide >> doc-log |
---|
125 | pdflatex Guide >> doc-log |
---|
126 | cp ./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" |
---|
130 | cd $InstallDir |
---|
131 | rm -f /usr/local/bin/Duchamp |
---|
132 | cp scripts/duchamp-wrapper.sh /usr/local/bin |
---|
133 | ln -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 |
---|
135 | cp ${PlatformDir}/lib/libduchamp.a /usr/local/lib |
---|
136 | cp -r ${PlatformDir}/include/duchamp /usr/local/include |
---|
137 | |
---|
138 | cd $ThisDir |
---|