~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to install/unix/switch_filter

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
while read input
 
3
do
 
4
        command=`echo $input | sed 's/^\([^     ]*\).*/\1/g'`
 
5
#       echo $command
 
6
        case $command in
 
7
        cp)
 
8
        # Filter, copying files:
 
9
        #       cp      -->     $copy
 
10
        #       *       -->     *;*
 
11
        #       ./      -->     (null)
 
12
        #       ..      -->     -
 
13
        #       -.-.dir/ -->    [-.-.dir]
 
14
        #       .o      -->     .obj
 
15
                echo $input | sed \
 
16
                -e 's/[         ][      ]*/ /g' \
 
17
                -e 's/^cp/\$ COPY/' \
 
18
                -e 's/ \.\// /g' \
 
19
                -e 's/\.\./-/g' \
 
20
                -e 's/-\//-\./g' \
 
21
                -e 's/\.-/-/g' \
 
22
                -e 's/ \([-\.][-\.]*[^\/]*\)\// \[\1\]/g' \
 
23
                -e 's/\.o/.obj/g'
 
24
                ;;
 
25
 
 
26
        # rm) entry remove because it is not needed any more. CG 301089
 
27
        #rm)
 
28
        ## Filter removing files in directories:
 
29
        ##
 
30
        ##      tabs    -->     single blank
 
31
        ##      rm      -->     $ DELETE
 
32
        ##      -f      -->     (null)
 
33
        ##      *.f     -->     (null)
 
34
        ##      file.o  -->     file.obj;*
 
35
        ##      file.exe-->     file.exe;*
 
36
        ##      file.a  -->     file.obl;*
 
37
        #       echo $input | sed \
 
38
        #       -e 's/[         ][      ]*/ /g' \
 
39
        #       -e 's/ -f//g' \
 
40
        #       -e 's/\.f$/& /' \
 
41
        #       -e 's/[^ ]*\.f //g' \
 
42
        #       -e 's/rm *$//' \
 
43
        #       -e 's/^rm/\$ DELETE/' \
 
44
        #       -e 's/\.o[      ]*/.obj;*,/g' \
 
45
        #       -e 's/\.exe[    ]*/.exe;*,/g' \
 
46
        #       -e 's/\.a[      ]*/.olb;*,/g' \
 
47
        #       -e 's/\.c[      ]*/.c;*,/g' \
 
48
        #       -e 's/\.for[    ]*/.for;*,/g' \
 
49
        #       -e 's/\.h[      ]*/.h;*,/g' \
 
50
        #       -e 's/,$//'
 
51
        #       ;;
 
52
 
 
53
        cc)
 
54
        # Filter compiling "C" files in directories:
 
55
        #
 
56
        #       tabs            -->     single blank
 
57
        #       cc              -->     $ CC
 
58
        #       -I/*            -->     -I*
 
59
        #       -I./*           -->     -I.*
 
60
        #       ..              -->     -
 
61
        #       pl*.*           -->     pl*_* (eg. pl2.1 in pl2_1)
 
62
        #       /               -->     .
 
63
        #       -Ddef           -->     /DEFINE=(def
 
64
        #       -Ddef           -->     ,def
 
65
        #       /DEFINE*        -->     /DEFINE=(*)
 
66
        #       -Iinclude_R4    -->     (null)
 
67
        #       -I.             -->     (null)
 
68
        #       -Idir           -->     /INCLUDE=([dir]
 
69
        #       -Idir           -->     ,[dir]
 
70
        #       /DEFINE*        -->     /DEFINE=(*)
 
71
        #       -g              -->     (null)
 
72
        #       -O              -->     (null)
 
73
        #       .-              -->     -
 
74
        #       -c              -->     (null)
 
75
        #       # .c            -->     (null) 
 
76
        #       [*midas.<rels>   -->    ['MIDASHOME'.'MIDVERS'
 
77
        #       -e 's/\.c$//g'
 
78
        #       -e 's/\.c[      ]*/ /g' 
 
79
                echo $input | sed \
 
80
                -e 's/[         ][      ]*/ /g' \
 
81
                -e 's/^cc/\$ CC/' \
 
82
                -e 's/ -I\// -I/g' \
 
83
                -e 's/ -I\.\// -I\./g' \
 
84
                -e 's/\.\./-/g' \
 
85
                -e 's/pl\(.\)\./pl\1_/' \
 
86
                -e 's/\//\./g' \
 
87
                -e 's/-D/\/DEFINE=\(/' \
 
88
                -e 's/ -D/,/g' \
 
89
                -e 's/DEFINE[^ ]*/&\)/' \
 
90
                -e 's/ -I[^ ]*include_R4 / /g' \
 
91
                -e 's/ -I\. / /g' \
 
92
                -e 's/ -I\([^ ]*\)/ \/INCLUDE=\(\[\1\]/' \
 
93
                -e 's/ -I\([^ ]*\)/,\[\1\]/g' \
 
94
                -e 's/INCLUDE[^ ]*/&\)/' \
 
95
                -e 's/ -g/ /g' \
 
96
                -e 's/ -O/ /g' \
 
97
                -e 's/ -c/ /g' \
 
98
                -e 's/\.-/-/g' \
 
99
                -e 's/ -[^ ]*/ /g' \
 
100
                -e 's/\[[^,]*midas\.[^\.]*/\['\''MIDASHOME'\''.'\''MIDVERS'\''/g' 
 
101
                ;;
 
102
 
 
103
        f77)    
 
104
        # Filter compiling fortran files in directories:
 
105
        #
 
106
        #       f77     -->     $ FORTRAN
 
107
        #       -O      -->     (null)
 
108
        #       -u      -->     (null)
 
109
        #       -d*     -->     (null)
 
110
        #       -g      -->     (null)
 
111
        #       -c      -->     (null)
 
112
        #       #.f     -->     (null)
 
113
        #       .f      -->     .for
 
114
                echo $input | sed -e 's/^f77/\$ FORTRAN/' \
 
115
                        -e 's/-[cgOu]//g' \
 
116
                        -e 's/-d.* //g' \
 
117
                        -e 's/ -[^ ]*/ /g' \
 
118
                        -e 's/\.f/\.for/g'
 
119
                ;;
 
120
        ar)
 
121
        # Filter generating libraries files in directories:
 
122
        #
 
123
        #       ar              -->     $ LIB/REPLACE
 
124
        #       [./]*           -->     [null]
 
125
        #       dirs/lib.a      -->     lib.a
 
126
        #       lib.a           -->     lib
 
127
        #       file1.o file2.o -->     file1,file2
 
128
                echo $input | sed -e 's/^ar[    ]*ruv/\$ LIB\/REPLACE/' \
 
129
                        -e 's/[         ][\.\/]*/ /g' \
 
130
                        -e 's/REPLACE .*\/\(.*\)/REPLACE \1/' \
 
131
                        -e 's/\.a//' \
 
132
                        -e 's/\.o[      ]*/\.obj,/g' \
 
133
                        -e 's/,$//'
 
134
                ;;
 
135
        ldvms)  
 
136
        # Filter linking files in directories:
 
137
        # 
 
138
        #       tabs                    -->     single blank
 
139
        #       ..                      -->     -
 
140
        #       /                       -->     .
 
141
        #       file.opt                -->     file/OPT,
 
142
        #       file.o                  -->     file.obj,
 
143
        #       lib1.a lib2.a           -->     lib1/L, lib2/L
 
144
        #       ldvms * -o dir.file.exe -->     $ LINK/NOMAP/EXE=[dir]
 
145
        #       -o *exec/file.exe       -->     (null)
 
146
        #       -l*                     -->     lib*/L
 
147
        #       libm/L                  -->     (null) 
 
148
        #       libtermcap/L            -->     (null) 
 
149
        #       libreadline/L           -->     (null) 
 
150
        #       libsocket/L             -->     (null) 
 
151
        #       libnsl/L                -->     (null) 
 
152
        #       -L*                     -->     (null)
 
153
        #       -.dir.file.obj          -->     [-.dir.]file.obj
 
154
        #       -R*                     -->     (null)
 
155
                echo $input | sed  -e 's/[      ][       ]*/ /g' \
 
156
                        -e 's/\.\./-/g' \
 
157
                        -e 's/\//./g' \
 
158
                        -e 's/\.opt /\/OPT, /g' \
 
159
                        -e 's/\.o /\.obj, /g' \
 
160
                        -e 's/\.a /\/L, /g' \
 
161
                        -e 's/^ldvms \(.*\) -o [^\.-]*\.exe/$ LINK\/NOMAP \1/' \
 
162
-e 's/^ldvms \(.*\) -o \(.*\)\.[^\.]*\.exe/$ LINK\/NOMAP\/EXE=\[\2\] \1/' \
 
163
                        -e 's/\(.*\)NOMAP\(.*OPT.*\)/\1NOTRACE\2/' \
 
164
                        -e 's/[-\.][-\.]*lib\.//g' \
 
165
                        -e 's/\.-/-/g' \
 
166
                        -e 's/ -l\([^   ]*\)/ lib\1\/L,/g' \
 
167
                        -e 's/libm\/L,//g' \
 
168
                        -e 's/libtermcap\/L,//g' \
 
169
                        -e 's/libreadline\/L,//g' \
 
170
                        -e 's/libsocket\/L,//g' \
 
171
                        -e 's/libnsl\/L,//g' \
 
172
                        -e 's/ -L[^     ]*//g' \
 
173
                        -e 's/ -R[^     ]*//g' \
 
174
                        -e 's/ \(-.*\)\.\([^\.-]*\.obj\)/ \[\1\]\2/g' \
 
175
                        -e 's/ *$//' \
 
176
                        -e 's/,$//'
 
177
                ;;
 
178
        macro)
 
179
        # Filter compiling macros files in directories:
 
180
        #
 
181
        #       macro           -->     $ MACRO
 
182
                echo $input | sed -e 's/^macro/\$ MACRO/'
 
183
                ;;
 
184
        *esoext.exe)
 
185
        # Filter for UNIX filter esoext.exe
 
186
                ;;
 
187
        *.exe)
 
188
        # Filter for other executables:
 
189
        # It removes ftoc_names.exe` argument for FORIF command
 
190
        # It removes ftoc_vmr.exe` argument for FORIF command
 
191
        #
 
192
        #       tabs                    -->     single blank
 
193
        #       `*ftoc_names.exe`       -->     blank
 
194
        #       `*ftoc_vmr`             -->     blank
 
195
        #       (blank)/                -->     blank
 
196
        #       (blank)./               -->     blank/
 
197
        #       ..                      -->     -
 
198
        #       /                       -->     .
 
199
        #       .-                      -->     -
 
200
        #       rel_dir/file.exe        -->     [.rel_dir]file
 
201
        #       abs_dir/file.exe        -->     [abs_dir]file
 
202
        #       file.exe                -->     file
 
203
        #       [.*]file                -->     $ file
 
204
        #       >                       -->     /OUTPUT=
 
205
                echo $input | sed \
 
206
                -e 's/[         ][      ]*/ /g' \
 
207
                -e 's/ `[^ ]*ftoc_names.exe` / /'g \
 
208
                -e 's/ `[^ ]*ftoc_vmr` / /'g \
 
209
                -e 's/ \// /g' \
 
210
                -e 's/ \.\// \//g' \
 
211
                -e 's/\.\./-/g' \
 
212
                -e 's/\//\./g' \
 
213
                -e 's/\.-/-/g' \
 
214
                -e 's/\([^ ]*\)\.\([^ ]*\).exe/[\1]\2/g' \
 
215
                -e 's/.exe / /' \
 
216
                -e 's/.exe//' \
 
217
                -e 's/^\[[^ ]*\]//' \
 
218
                -e 's/^/\$ /' \
 
219
                -e 's/>/\/OUTPUT=/g' 
 
220
                ;;
 
221
 
 
222
        *)      
 
223
        # Filter "ranlib" and "esoext" files in directories:
 
224
        #
 
225
        #       *       -->      (null)
 
226
        #       echo $input | sed  -e 's/^.*$//'
 
227
                ;;
 
228
        esac
 
229
done
 
230
exit 0