File: install.csh

package info (click to toggle)
clig 1.1.3-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 328 kB
  • ctags: 72
  • sloc: tcl: 1,459; ansic: 253; makefile: 109; sh: 60; csh: 52
file content (82 lines) | stat: -rwxr-xr-x 1,845 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/csh -fe

#set echo

if ( ! $?CTMPLDIR ) then
  echo "Do not run $0 by hand. Run 'make install' instead."
  exit 1
endif

##### try to guess, where the tclsh executable is located
unset tclsh
foreach x ($path)
  if ( -x $x/tclsh ) then
    set tclsh = $x/tclsh
    break
  endif
end
#echo ${0}: using '`'$tclsh\'

if ( ! $?tclsh ) then
  echo "${0}: cannot locate tclsh-executable. Please make sure it can"
  echo "    be found via the PATH environment variable and try again."
  exit 1
endif
  

## make all the directories we need
foreach x ($BINDIR $TCLSRCDIR $CTMPLDIR $MAN1DIR $DOCDIR)
  set y = ""
  while ( ! -d $x ) 
    set y = $y/$x:t
    set x = $x:h
  end
  while ( $y != "" )
    set x = $x/$y:t
    set y = $y:h
    mkdir $x
  end
end


## first the easy copying stuff
echo "copying scripts, template files, release notes and an example"
cp tcl/*.tcl            $TCLSRCDIR
cp c/*.c c/template.man $CTMPLDIR
cp example/{main.c,cmdline.cli,makefile} $DOCDIR
if (-e .Versions) cp .Versions $DOCDIR
if (-e CHANGES) cp CHANGES $DOCDIR

## the manual pages get their version inserted, as well as a pointer
## to an example file. 
echo "sedding manual pages"
set docdir = `echo $DOCDIR`
foreach x (*.man)
  sed -e "1,30s/|Version|/$VERSION/" \
      -e "s,|Example|,$docdir," \
  $x > $MAN1DIR/$x:r.1
end

##
## special handling of the main file
##
set TCLSRCDIR = $TCLSRCDIR
set CTMPLDIR = $CTMPLDIR
echo "sedding main file"
sed -e '1s%^.*$%#\!'$tclsh'%' \
    -e "1,30s%set *tclbase *|tclbase|%set tclbase $TCLSRCDIR%" \
    -e "1,30s%set *cbase *|cbase|%set cbase $CTMPLDIR%" \
    -e "1,30s%|Version|%$VERSION%" \
        tcl/clig >$BINDIR/clig
chmod +x $BINDIR/clig


##
## try to install convenience links, if LROOT is usable
##
./clink.sh $LROOT/bin $BINDIR/clig
./clink.sh $LROOT/man/man1 $MAN1DIR/clig.1



##### end #####