annotate ibmscripts/shldcc @ 24:a4899cdfc2d6 default tip

Obfuscate the regexps to strip off the IBM compiler's copyright banners. I don't want bots scanning github to think they're real copyright notices because that could cause real problems.
author David A. Holland
date Mon, 13 Jun 2022 00:40:23 -0400
parents 13d2b8934445
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
1 #!/bin/sh
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
2 # shldcc - wrap the IBM compiler to look sort of like a unix compiler
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
3 # (for linking shared libraries)
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
4 # usage: shldcc [opts] objectfiles -o output
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
5 # options:
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
6 # -v verbose
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
7 #
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
8
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
9 QUIET=1
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
10
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
11 while [ x"$1" != x ]; do
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
12 case "$1" in
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
13 -o) OUTPUT="$2"; shift;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
14 -o*) OUTPUT=`echo "$1" | sed 's/^-o//'`;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
15 -v) QUIET=0;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
16 -*)
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
17 echo "$0: unknown option $1" 1>&2
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
18 exit 1
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
19 ;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
20 *) FILES="$FILES $1";;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
21 esac
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
22 shift
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
23 done
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
24
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
25 LIB='I:\\ibmcppw\\lib;I:\\ibmcppw\\sdk\\lib'
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
26 export LIB
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
27
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
28 case x"$OUTPUT" in
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
29 x*.dll) ;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
30 x) echo "$0: Usage: $0 [options] files -o output" 1>&2; exit 1;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
31 *) echo "$0: output file must be a DLL" 1>&2; exti 1;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
32 esac
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
33
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
34 MAPFILE=`echo "$OUTPUT" | sed 's/\.dll$/.map/'`
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
35 LOGFILE=`echo "$OUTPUT" | sed 's/\.dll$/.log/'`
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
36
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
37 WINEPATH='I:\\ibmcppw\\bin'
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
38 export WINEPATH
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
39
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
40 # note: you must have ilink354 as ilink.exe, not the latest
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
41 # patchlevel, as the latest one apparently doesn't work right in wine.
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
42
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
43
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
44 # /Q+ suppresses the copyright notice
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
45
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
46 echo '/B"/dll /optf /noe"' > .tmp
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
47
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
48 if [ $QUIET = 0 ]; then
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
49 echo wine 'I:\\ibmcppw\\bin\\icc.exe' /Ge- @.tmp /Q+ \
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
50 /Fm$MAPFILE /Fe$OUTPUT $FILES '|' tee "$LOGFILE"
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
51 fi
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
52
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
53 (
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
54 wine 'I:\\ibmcppw\\bin\\icc.exe' /Ge- @.tmp /Q+ \
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
55 /Fm$MAPFILE /Fe$OUTPUT $FILES
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
56 echo "@@@Exit $?"
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
57 ) 2>&1 | tr -d '\r' | tee "$LOGFILE" | (
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
58 if [ $QUIET = 1 ]; then
24
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
59 #
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
60 # The compiler prints its copyright banner every time you run
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
61 # it, and there's apparently no way to fully suppress this.
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
62 # (That is, I think the /Q+ flag above silences some messages
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
63 # but not all of them.) So, since this is extremely annoying and
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
64 # interferes with development, delete the strings from the
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
65 # output. Obfuscate the regexps slightly, because I want them to
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
66 # be precise (no other messages should be suppressed) but I also
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
67 # don't want to be harassed by source-scanning bots or (perhaps)
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
68 # clueless lawyers that think they're actual IBM copyright
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
69 # notices. I wrote this script; it's not IBM's. (Or Microsoft's,
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
70 # either.)
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
71 #
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
72 # Note that the strings with the first character missing are not
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
73 # an accident. That actually happens.
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
74 #
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
75 sed '
24
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
76 /^[I][B][M] Librarian for Windows (..) Version 0.00.04 cc_WTC357f $/d
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
77 /^(.) [C]opyright [I][B][M] [C]orporation, 1991, 1996\.$/d
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
78 /^(.) [C]opyright [M]icrosoft [C]orp\., 1988, 1989\.$/d
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
79 /^[L]icensed [M]aterials - [P]roperty of [I][B][M] - [A]ll [R]ights [R]eserved\.$/d
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
80
24
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
81 /^[I][B][M](.) VisualAge(..) for C++ for Windows(.), Version 3\.5$/d
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
82 /^- [L]icensed [M]aterials - Program-[P]roperty of [I][B][M]$/d
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
83 /^(.) [C]opyright [I][B][M] [C]orp. 1991, 1996 - [A]ll [R]ights [R]eserved.$/d
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
84
24
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
85 /^[B][M](.) Linker for Windows(.), %0$/d
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
86 /^ersion 02.01.r2a_WTC354e *$/d
24
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
87 /^[o]pyright (.) [I][B][M] [C]orporation 1988, 1998\.$/d
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
88 /^[C]opyright (.) [M]icrosoft [C]orp\. 1988, 1989\.$/d
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
89 /^[A]ll [r]ights [r]eserved\.$/d
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
90 '
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
91 else
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
92 cat
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
93 fi
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
94 ) | awk '
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
95 /^@@@Exit [0-9][0-9]*$/ { exit($2); }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
96
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
97 /^%0$/ { next; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
98 /^$/ { next; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
99 /%0$/ { sub("%0$", "", $0); printf "%s", $0; needeol=1; next; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
100 { print; needeol=0; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
101 END { if (needeol) printf "\n"; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
102
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
103 ' "q=$QUIET"
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
104
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
105