diff ibmscripts/shldcc @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children a4899cdfc2d6
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ibmscripts/shldcc	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,89 @@
+#!/bin/sh
+# shldcc - wrap the IBM compiler to look sort of like a unix compiler
+# (for linking shared libraries)
+# usage: shldcc [opts] objectfiles -o output
+# options:
+#     -v	verbose
+#
+
+QUIET=1
+
+while [ x"$1" != x ]; do
+    case "$1" in
+	-o) OUTPUT="$2"; shift;;
+	-o*) OUTPUT=`echo "$1" | sed 's/^-o//'`;;
+	-v) QUIET=0;;
+	-*)
+	    echo "$0: unknown option $1" 1>&2
+	    exit 1
+	;;
+	*) FILES="$FILES $1";;
+    esac
+shift
+done
+
+LIB='I:\\ibmcppw\\lib;I:\\ibmcppw\\sdk\\lib'
+export LIB
+
+case x"$OUTPUT" in
+    x*.dll) ;;
+    x) echo "$0: Usage: $0 [options] files -o output" 1>&2; exit 1;;
+    *) echo "$0: output file must be a DLL" 1>&2; exti 1;;
+esac
+
+MAPFILE=`echo "$OUTPUT" | sed 's/\.dll$/.map/'`
+LOGFILE=`echo "$OUTPUT" | sed 's/\.dll$/.log/'`
+
+WINEPATH='I:\\ibmcppw\\bin'
+export WINEPATH
+
+# note: you must have ilink354 as ilink.exe, not the latest
+# patchlevel, as the latest one apparently doesn't work right in wine.
+
+
+# /Q+ suppresses the copyright notice
+
+echo '/B"/dll /optf /noe"' > .tmp
+
+if [ $QUIET = 0 ]; then
+    echo wine 'I:\\ibmcppw\\bin\\icc.exe' /Ge- @.tmp /Q+ \
+	/Fm$MAPFILE /Fe$OUTPUT $FILES '|' tee "$LOGFILE"
+fi
+
+(
+    wine 'I:\\ibmcppw\\bin\\icc.exe' /Ge- @.tmp /Q+ \
+	/Fm$MAPFILE /Fe$OUTPUT $FILES
+    echo "@@@Exit $?"
+) 2>&1 | tr -d '\r' | tee "$LOGFILE" | (
+    if [ $QUIET = 1 ]; then
+      sed '
+	/^IBM Librarian for Windows (TM) Version 0.00.04 cc_WTC357f $/d
+	/^(C) Copyright IBM Corporation, 1991, 1996\.$/d
+	/^(C) Copyright Microsoft Corp\., 1988, 1989\.$/d
+	/^Licensed Materials - Property of IBM - All Rights Reserved\.$/d
+
+	/^IBM(R) VisualAge(TM) for C++ for Windows(R), Version 3\.5$/d
+	/^- Licensed Materials - Program-Property of IBM$/d
+	/^(C) Copyright IBM Corp. 1991, 1996 - All Rights Reserved.$/d
+
+	/^BM(R) Linker for Windows(R), %0$/d
+	/^ersion 02.01.r2a_WTC354e *$/d
+	/^opyright (C) IBM Corporation 1988, 1998\.$/d
+	/^Copyright (C) Microsoft Corp\. 1988, 1989\.$/d
+	/^All rights reserved\.$/d
+      '
+    else
+      cat
+    fi
+) | awk '
+    /^@@@Exit [0-9][0-9]*$/ { exit($2); }
+
+    /^%0$/ { next; }
+    /^$/ { next; }
+    /%0$/ { sub("%0$", "", $0); printf "%s", $0; needeol=1; next; }
+    { print; needeol=0; }
+    END { if (needeol) printf "\n"; }
+
+' "q=$QUIET"
+
+