annotate ibmscripts/ldcc @ 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 # ldcc - 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 programs)
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
4 # usage: ldcc [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 *.dll) FILES="$FILES `echo $1 | sed 's/\.dll$/.lib/'`";;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
21 *) FILES="$FILES $1";;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
22 esac
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
23 shift
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
24 done
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
25
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
26 LIB='I:\\ibmcppw\\lib;I:\\ibmcppw\\sdk\\lib'
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
27 export LIB
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
28
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
29 case x"$OUTPUT" in
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
30 x*.exe) ;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
31 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
32 *) echo "$0: output file must be an EXE" 1>&2; exti 1;;
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
33 esac
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
34
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
35 MAPFILE=`echo "$OUTPUT" | sed 's/\.exe$/.map/'`
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
36 LOGFILE=`echo "$OUTPUT" | sed 's/\.exe$/.log/'`
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
37
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
38 WINEPATH='I:\\ibmcppw\\bin'
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
39 export WINEPATH
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
40
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
41 # note: this must be ilink354, not the latest patchlevel, as the latest
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
42 # one apparently doesn't work right in wine.
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 # In the older makefiles, ag.exe is linked with /B"PM:PM", and agcl.exe
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
45 # isn't. According to documentation I just found on the web (1/1/06) this
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
46 # means "PMTYPE" and sets the type of application with respect to the OS/2
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
47 # Presentation Manager. Apparently PM means it *is* a Presentation Manager
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
48 # application. You can also set it to "VIO" or "NOVIO" for whether it's
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
49 # visually compatible (or something like that) with the Presentation Manager.
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
50 # I strongly suspect that under Windows this has no effect and it's a
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
51 # leftover from when we were using the OS/2 version of this compiler.
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
52 # So I'm leaving it out.
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 # 4/1/06 I'm putting /B"PM:PM" in, unconditionally, for now, just in case.
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
55
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
56 # /Gm is like -thread.
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
57 # /Q+ suppresses the copyright notice.
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
58
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
59 if [ $QUIET = 0 ]; then
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
60 echo wine 'I:\\ibmcppw\\bin\\icc.exe' /Gm '/B"PM:PM"' /Q+ \
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
61 /Fm$MAPFILE /Fe$OUTPUT $FILES '|' tee "$LOGFILE"
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
62 fi
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
63
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
64 (
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
65 wine 'I:\\ibmcppw\\bin\\icc.exe' /Gm '/B"PM:PM"' /Q+ \
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
66 /Fm$MAPFILE /Fe$OUTPUT $FILES
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
67 echo "@@@Exit $?"
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
68 ) 2>&1 | tr -d '\r' | tee "$LOGFILE" | (
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
69 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
70 #
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
71 # 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
72 # 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
73 # (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
74 # 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
75 # 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
76 # 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
77 # 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
78 # 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
79 # 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
80 # 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
81 # either.)
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
82 #
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
83 # 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
84 # 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
85 #
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
86 sed '
24
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
87 /^[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
88 /^- [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
89 /^(.) [C]opyright [I][B][M] [C]orp. 1991, 1996 - [A]ll [R]ights [R]eserved.$/d
a4899cdfc2d6 Obfuscate the regexps to strip off the IBM compiler's copyright banners.
David A. Holland
parents: 0
diff changeset
90 /^[B][M](.) Linker for Windows(.), %0$/d
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
91 /^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
92 /^[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
93 /^[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
94 /^[A]ll [r]ights [r]eserved\.$/d
0
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
95 '
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
96 else
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
97 cat
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
98 fi
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
99 ) | awk '
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
100 /^@@@Exit [0-9][0-9]*$/ { exit($2); }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
101
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
102 /^%0$/ { next; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
103 /^$/ { next; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
104 /%0$/ { sub("%0$", "", $0); printf "%s", $0; needeol=1; next; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
105 { print; needeol=0; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
106 END { if (needeol) printf "\n"; }
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
107
13d2b8934445 Import AnaGram (near-)release tree into Mercurial.
David A. Holland
parents:
diff changeset
108 ' "q=$QUIET"