source: SH_SHM/trunk/setup/SHM-install.csh @ 375

Revision 375, 8.4 KB checked in by marcus, 13 years ago (diff)

r206 | walther | 2011-04-13 18:26:47 +0200 (Mi, 13 Apr 2011) | 1 line

Fixed checking for gccmakedep instead of makedepend.

  • Property svn:executable set to *
Line 
1#! /bin/csh
2#
3# file install.csh
4#      ===========
5#
6# version 5, 17-Feb-2011
7#
8# Installation script for SH/SHM package
9
10set ext="undefined"
11if  ("`uname`" == "Linux")  then
12        set ext="linux"
13else if  ("`uname`" == "SunOS")  then
14        set ext="sol2.5.1"
15endif
16
17if  ("$1" == "")  then
18        echo "To be only used from self-extracting setup process!"
19else
20        # get parameters
21        set dstpath=$1
22endif
23
24# check parameters
25if  (! -w $dstpath)  then
26        echo "$0 : cannot write to installation path $dstpath.  Abort."
27        exit 1
28endif
29
30# find input files
31set pack_fk=""
32set pack_locsat=""
33
34if  ("`uname`" == "Linux")  then
35        if  (-e $dstpath/fk-linux.tar.gz)  set pack_fk=$dstpath/fk-linux.tar.gz
36        if  (-e $dstpath/locsat-linux.tar.gz)  set pack_locsat=$dstpath/locsat-linux.tar.gz
37else if  ("`uname`" == "SunOS")  then
38        if  (-e $dstpath/fk-sol2.5.1.tar.gz)  set pack_fk=$dstpath/fk-sol2.5.1.tar.gz
39        if  (-e $dstpath/locsat-sol2.5.1.tar.gz)  set pack_locsat=$dstpath/locsat-sol2.5.1.tar.gz
40else
41endif
42
43if  (-e $dstpath/libahio.a.$ext)  then
44        set use_ah=1
45else
46        set use_ah=0
47endif
48
49
50# default values
51set displ_res="undef"
52set userroot='$HOME/shfiles'
53if  ("`uname`" == "Linux")  then
54        set linux_colors="yes"
55else
56        set linux_colors="no"
57endif
58
59# find text editor
60set editor=""
61foreach  ed  (kwrite gedit textedit nedit vuepad xedit leafpad mousepad)
62        set res=`which $ed`
63        if  (-e "$res")  then
64                set editor=$ed
65                break
66        endif
67end
68
69# check for some programs in search path
70set plist = ( gzip make gccmakedep gcc uil ar ranlib xterm )
71foreach p ($plist)
72        set res=`which $p`
73        if  (! -e "$res")  then
74                echo "Program $p not found in search path.  Please add."
75                exit 2
76        endif
77end
78
79# enter setup menu
80
81set cmd=""
82while  ("$cmd" != "i")
83
84        echo "======================================================================"
85        echo ""
86        echo "(u)  user root path:           $userroot"
87        echo "(e)  window based texteditor:  $editor"
88        echo "(c)  linux colors:             $linux_colors"
89        echo "(i)  Start Installation"
90        echo "(q)  Quit Installation"
91        echo ""
92        echo "If all settings are ok, enter 'i'"
93        echo ""
94        echo -n "Your command: "
95        set cmd="$<"
96
97        if  ("$cmd" == "q")  exit 99
98        if  ("$cmd" == "r")  then
99                if  ("$displ_res" == "xga")  then
100                        set displ_res="wxga"
101                else if  ("$displ_res" == "wxga")  then
102                        set displ_res="sxga"
103                else
104                        set displ_res="xga"
105                endif
106        endif
107        if  ("$cmd" == "c")  then
108                if  ("$linux_colors" == "yes")  then
109                        set linux_colors="no"
110                else
111                        set linux_colors="yes"
112                endif
113        endif
114        if  ("$cmd" == "e")  then
115                echo -n "window based texteditor: "
116                set editor="$<"
117                if  (! -e $editor)  then
118                        echo "$editor does not exist."
119                        echo -n "Enter <Return> ..."
120                        set x="$<"
121                        set editor=""
122                endif
123        endif
124        if  ("$cmd" == "u")  then
125                echo -n "user root path: "
126                set userroot="$<"
127                if  (! -e $userroot)  then
128                        mkdir $userroot
129                        if  (! -e $userroot)  then
130                                echo "cannot create $userroot. Reset to default."
131                                echo -n "Enter <Return> ..."
132                                set x="$<"
133                                set userroot=$HOME/shfiles
134                        endif
135                endif
136        endif
137        if  ("$cmd" == "i")  then
138                if  ("$editor" == "")   then
139                        echo "Please specify window based texteditor executable."
140                        echo -n "Enter <Return> ..."
141                        set x="$<"
142                        set cmd="."
143                endif
144        endif
145end
146
147cd $dstpath
148
149# create setup file from template
150echo "prepare setup file"
151cd sh/setup
152if  ("`uname`" == "Linux")  then
153        set remstr="#OS-linux "
154else if  ("`uname`" == "SunOS")  then
155        set remstr="#OS-sol2 "
156else
157        echo "$0 : sorry, this operating system is not supported"
158        exit 3
159endif
160set locsatpath=$dstpath/sh/util/locsat
161set plth=`echo $locsatpath | wc -c`
162
163# check for write access in /usr/bin -> create link for LocSAT installation path
164if (-w /usr/local) then
165    if  (-e /usr/local/LocSAT) \rm /usr/bin/LocSAT
166    ln -s $locsatpath /usr/local/LocSAT
167    set locsatpath=/usr/local/LocSAT
168# otherwise create link directly from user dir
169else if ($plth > 25)  then
170        if  (-e $HOME/lcs) \rm $HOME/lcs
171        ln -s $locsatpath $HOME/lcs
172        set locsatpath=$HOME/lcs
173        set plth=`echo $locsatpath | wc -c`
174        if  ($plth > 25)  then
175                echo "$0 : cannot find short locsat path.  Abort."
176                exit 4
177        endif
178endif
179if  (-e shsetup)  \rm shsetup
180sed "s/$remstr//" shsetup.template | sed "s@##ROOTPATH##@$dstpath/sh@" | \
181        sed "s@##LOCSATPATH##@$locsatpath@" | sed "s@##EDITOR##@$editor@" | \
182        sed 's/-DSH_SETUP_SZGRF//' | sed "s@##USERROOT##@$userroot@" >shsetup
183sed "s/$remstr//" shsetup.sh.template | sed "s@##ROOTPATH##@$dstpath/sh@" | \
184        sed "s@##LOCSATPATH##@$locsatpath@" | sed "s@##EDITOR##@$editor@" | \
185        sed 's/-DSH_SETUP_SZGRF//' | sed "s@##USERROOT##@$userroot@" >shsetup.sh
186
187if  ($use_ah == 0)  then
188        sed --in-place 's/-DSH_SETUP_AH//' shsetup
189        sed --in-place 's/-lahio//' shsetup
190endif
191if  ($?MACHTYPE == 1)  then
192        if  ("`echo $MACHTYPE | grep 64`" != "")  then
193                if  (-d /usr/X11R6/lib64)  then
194                        sed --in-place 's/\/usr\/X11R6\/lib/\/usr\/X11R6\/lib64/' shsetup
195                        sed --in-place 's/\/usr\/X11R6\/lib/\/usr\/X11R6\/lib64/' shsetup.sh
196                endif
197        endif
198endif
199source shsetup
200
201# create directories for evt files
202if (! -e $SH_USERROOT/evt/evid ) mkdir -p $SH_USERROOT/evt/evid
203if (! -e $SH_USERROOT/evt/evtout ) mkdir -p $SH_USERROOT/evt/evtout
204
205# find screen resolution
206set displ_res=`$dstpath/sh/util/get_screen_resolution.csh`
207if  ($#displ_res != 3)  then
208        echo "cannot find screen resolution, please set manually"
209        set displ_res="sxga"
210else
211        echo "found screen resolution $displ_res"
212        set displ_res=$displ_res[3]
213endif
214
215set origsetup=$dstpath/sh/inputs/shm-config-default.txt
216if  (! -e $origsetup)  then
217        echo "Installation program error.  Sorry."
218        exit  5
219endif
220set thissetup=$dstpath/sh/inputs/shm-config.txt
221if  (-e $thissetup)  then
222    \mv $thissetup $dstpath/sh/inputs/shm-config.txt.yours
223    echo "A backup of your shm-config.txt has been saved under:"
224    echo $dstpath/sh/inputs/shm-config.txt.yours
225endif
226sed "s@##EDITOR##@$editor@" $origsetup > $thissetup
227
228# settings for small displays (laptops)
229if  ("$displ_res" != "" && "$displ_res" != "sxga")  then
230        sed --in-place "s/shm-cof-sxga-geometry/shm-conf-$displ_res-geometry/" $thissetup
231endif
232
233# linux colors
234if  ("$linux_colors" == "yes")  then
235        # do nothing, this is default
236else
237        sed --in-place 's/reverse_xors                 true/reverse_xors                 false/' $thissetup
238endif
239
240echo "compiling SHM"
241cd $SH_ROOT
242# remove all o's and a's
243find . -name '*.o' -print0 | xargs -0 rm
244cd $SH_LIB
245if  (-e libahio.a)  mv libahio.a libahio.ax
246\rm *.a > /dev/null
247if  (-e libahio.ax)  mv libahio.ax libahio.a
248cd $SH_ROOT
249make depend_shm
250make shm
251make world
252
253# install FK
254echo "extract FK package"
255cd $SH_UTIL
256if  (-e fk_src)  \rm -rf fk_src
257cp $pack_fk .
258set pack_fk=$pack_fk:t
259gzip -d $pack_fk
260set pack_fk=$pack_fk:r
261chmod +w $pack_fk
262tar xf $pack_fk
263\rm $pack_fk
264if  (-e fk)  \rm fk
265ln -s fk_src/fk fk
266
267# install LocSAT
268echo "extract LocSAT package"
269cd $SH_UTIL
270if  (-e locsat)  \rm -rf locsat
271mkdir locsat
272cp $pack_locsat .
273set pack_locsat=$pack_locsat:t
274gzip -d $pack_locsat
275set pack_locsat=$pack_locsat:r
276chmod +w $pack_locsat
277tar xf $pack_locsat
278\rm $pack_locsat
279if  (-e LocSAT)  \rm LocSAT
280ln -s locsat/bin/LocSAT LocSAT
281
282# add SHM resources to .Xdefaults
283set resrc=""
284if  (-e ~/.Xdefaults)  set resrc=~/.Xdefaults
285if  ("$resrc" == "")  then
286        if  (-e ~/.Xresources)  set resrc=~/.Xresources
287endif
288if  ("$resrc" == "")  then
289        set resrc="~/.Xdefaults"
290        touch $resrc
291endif
292set res=`grep "SHM.locsat_prefix_text" $resrc`
293if  ("$res" == "")  then
294        echo "SHM*locsat_prefix_text.value:       tab"  >>$resrc
295        echo "SHM*fk_frqlo_text.value:            0.4"  >>$resrc
296        echo "SHM*fk_frqhi_text.value:            3.0"  >>$resrc
297        echo "SHM*fk_slowness_text.value:         15"   >>$resrc
298        echo "SHM*fk_resol_text.value:            51"   >>$resrc
299        echo "SHM*fk_colnum_text.value:           10"   >>$resrc
300        echo "SHM*filter_butpar_hi_text.value:    1Hz"  >>$resrc
301        echo "SHM*filter_butpar_lo_text.value:    100s" >>$resrc
302        echo "SHM*filter_butpar_order_text.value: 4"    >>$resrc
303        echo "SHM*opick_thresh_text.value:        10.0" >>$resrc
304        echo "SHM*opick_duration_text.value:      1.0"  >>$resrc
305        echo "SHM*opick_break_text.value:         0.00" >>$resrc
306endif
307xrdb $resrc
308
309echo "========================================================================"
310echo ""
311echo "Please update your environment before using SH or SHM!"
312echo ""
313echo "If you prefer csh or tcsh put this line into your ~/.cshrc file:"
314echo "source $dstpath/sh/setup/shsetup"
315echo ""
316echo "If you prefer bash put this line into your ~/.bashrc file:"
317echo "source $dstpath/sh/setup/shsetup.sh"
318echo ""
319echo "========================================================================"
Note: See TracBrowser for help on using the repository browser.