aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL12
-rw-r--r--TODO10
-rwxr-xr-xmsvc-cl-common2
-rwxr-xr-xmsvc-lib-common10
-rwxr-xr-xmsvc-link-common126
-rwxr-xr-xmsvc-rc-common22
6 files changed, 141 insertions, 41 deletions
diff --git a/INSTALL b/INSTALL
index 38b51b4..f91e2d9 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,12 +4,12 @@ Setup
Setting Scripts
---------------
-The "driver" scripts that you will be invoking are cl-NN, lib-NN, and link-NN,
-where NN is the Visual Studio version (e.g., 11, 12, 14, etc). There are also
-the "configuration" scripts, msvc-NN, which provide the Visual Studio/SDK
-location and configuration (in a way similar to vcvars32.bat). There is also a
-bunch of other helper scripts that you will not need to modify or invoke
-directly.
+The "driver" scripts that you will be invoking are cl-NN, link-NN, lib-NN,
+etc., where NN is the Visual Studio version (e.g., 11, 12, 14, etc). There
+are also the "configuration" scripts, msvc-NN, which provide the Visual
+Studio/SDK location and configuration (in a way similar to vcvars32.bat).
+There is also a bunch of other helper scripts that you will not need to
+modify or invoke directly.
All of these scripts should reside in the same directory. In particular, you
cannot copy, say, cl-NN to /usr/local/bin/ while leaving the rest in some
diff --git a/TODO b/TODO
index b2f76ab..d451bc7 100644
--- a/TODO
+++ b/TODO
@@ -1,16 +1,10 @@
-@@ link.exe option translation.
-
@@ Had to rename Windows.h to windows.h; /showIncludes seem to retain naming
from #include directive. Also WinBase.h, WinUser.h, WinNls.h, ... nsed?
-@@ Requires GNU sed 4.2.2 or later (-z), realpath dirpath
+@@ Requires bash 4, GNU sed 4.2.2 or later (-z), realpath dirpath
@@ Still need wineserver for /EP, etc. otherwise long pause.
-@@ Redirection of /EP to /dev/null is slow, to file is much faster.
-
@@ What about 64-bit? cl-64 or some such?
-@@ I think options are not case-sensitive.
-
-@@ There is link command. link.exe? cl-14.exe?
+@@ There is link POSIX command. link.exe? cl-14.exe?
diff --git a/msvc-cl-common b/msvc-cl-common
index 7601d77..33a68ef 100755
--- a/msvc-cl-common
+++ b/msvc-cl-common
@@ -31,6 +31,8 @@ diag=1
# Note that the order of the cases is important. Specifically, we want, e.g.,
# /D before /D*.
#
+# Note also that cl.exe options are case-sensitive.
+#
args=()
while [ $# -gt 0 ]; do
diff --git a/msvc-lib-common b/msvc-lib-common
index 8b23f4f..7f10223 100755
--- a/msvc-lib-common
+++ b/msvc-lib-common
@@ -1,9 +1,11 @@
#! /usr/bin/env bash
-# @@ Do we really need LIB? What's /LIBPATH for?
-#
# Common lib.exe driver that expects the VC and LIB variables to be set for
# the specific MSVC version/configuration.
+#
+# It's not clear/documented why we need LIB or what the /LIBPATH option is
+# for. Perhaps for link-time code generation (/LTCG).
+#
trap "{ exit 1; }" ERR
set -o errtrace # Trap in functions.
@@ -27,7 +29,7 @@ source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common
args=()
while [ $# -gt 0 ]; do
- case $1 in
+ case ${1^^} in # Uppercase for case-insensitive comparison.
# /DEF[:filename]
# /OUT:filename
@@ -86,8 +88,6 @@ while [ $# -gt 0 ]; do
esac
done
-# @@ Do we need this?
-#
export LIB
# lib.exe always sends diagnostics to stdout.
diff --git a/msvc-link-common b/msvc-link-common
index bec14dc..7b3481a 100755
--- a/msvc-link-common
+++ b/msvc-link-common
@@ -22,41 +22,143 @@ source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common
# an options. We will also explicitly recognize certain options which may
# not fit this scheme well.
#
+# Note that link.exe /? is missing some options that are documented in MSDN.
+#
args=()
while [ $# -gt 0 ]; do
- case $1 in
+ case ${1^^} in # Uppercase for case-insensitive comparison.
- # /DEF[:filename]
- # /OUT:filename
+ # @@ TODO: handle the rest/obscure options.
#
+ # @file
+ # /ASSEMBLYLINKRESOURCE:filename
+ # /ASSEMBLYMODULE:filename
+ # /ASSEMBLYRESOURCE:filename[,[name][,PRIVATE]]
+ # /BASE:{address[,size]|@filename,key}
+ #+ /DEF:filename
+ #+ /DEFAULTLIB:library
+ #+ /DELAYLOAD:dll
+ # /FASTGENPROFILE:PGD=filename|...
+ # /GENPROFILE:PGD=filename|...
+ #+ /IDLOUT:filename
+ #+ /IMPLIB:filename
+ #+ /KEYFILE:filename
+ #+ /LIBPATH:dir
+ #+ /MANIFESTFILE:filename
+ #+ /MANIFESTINPUT:filename
+ #+ /MAP:filename
+ #+ /MIDL:@commandfile
+ #+ /NODEFAULTLIB:library
+ #+ /ORDER:@filename
+ #+ /OUT:filename
+ #+ /PDB:filename
+ #+ /PDBALTPATH:filename
+ #+ /PDBSTRIPPED:filename
+ #+ /PGD:filename
+ #+ /STUB:filename
+ #+ /TLBOUT:filename
+ # /USEPROFILE:PGD=filename
+ #+ /WHOLEARCHIVE:library
+ #+ /WINMDFILE:filename
+ # /WINMDKEYCONTAINER:name
+ #+ /WINMDKEYFILE:filename
+
[/-]DEF:* | \
- [/-]OUT:*)
+ [/-]MAP:* | \
+ [/-]OUT:* | \
+ [/-]PDB:* | \
+ [/-]PGD:*)
args=("${args[@]}" "$(split_translate 5 $1)")
shift
;;
- # @@ TODO
- #
+ [/-]STUB:*)
+ args=("${args[@]}" "$(split_translate 6 $1)")
+ shift
+ ;;
- # /LIBPATH:dir
- #
+ [/-]MIDL:@*)
+ args=("${args[@]}" "$(split_translate 7 $1)")
+ shift
+ ;;
+
+ [/-]IMPLIB:* | \
+ [/-]IDLOUT:* | \
+ [/-]TLBOUT:* | \
+ [/-]ORDER:@*)
+ args=("${args[@]}" "$(split_translate 8 $1)")
+ shift
+ ;;
+
+ [/-]KEYFILE:* | \
[/-]LIBPATH:*)
args=("${args[@]}" "$(split_translate 9 $1)")
shift
;;
+ [/-]DELAYLOAD:* | \
+ [/-]WINMDFILE:*)
+ args=("${args[@]}" "$(split_translate 11 $1)")
+ shift
+ ;;
+
+ [/-]DEFAULTLIB:* | \
+ [/-]PDBALTPATH:*)
+ args=("${args[@]}" "$(split_translate 12 $1)")
+ shift
+ ;;
+
+ [/-]PDBSTRIPPED:*)
+ args=("${args[@]}" "$(split_translate 13 $1)")
+ shift
+ ;;
+
+ [/-]NODEFAULTLIB:* | \
+ [/-]MANIFESTFILE:* | \
+ [/-]WHOLEARCHIVE:* | \
+ [/-]WINMDKEYFILE:*)
+ args=("${args[@]}" "$(split_translate 14 $1)")
+ shift
+ ;;
+
+ [/-]MANIFESTINPUT:*)
+ args=("${args[@]}" "$(split_translate 15 $1)")
+ shift
+ ;;
+
# Handle other options with separate values. This makes sure we don't try
# to path-translate them.
#
- # @@ TODO
+ # Aren't any.
# Handle other options with combined values that could possibly be
- # interpreted as paths, for example /EXTRACT:foo/bar.obj.
+ # interpreted as paths.
#
-
- # @@ TODO
+ # /ENTRY:symbol
+ # /EXPORT:symbol
+ # /INCLUDE:symbol
+ # /KEYCONTAINER:name
+ # /MANIFESTDEPENDENCY:manifest dependency
+ # /MANIFESTUAC[:{NO|UAC fragment}]
+ # /MAPINFO:{EXPORTS}
+ # /MERGE:from=to
+ # /SECTION:name,[[!]{DEKPRSW}][,ALIGN=#]
+ #
+ [/-]ENTRY:* | \
+ [/-]EXPORT:* | \
+ [/-]INCLUDE:* | \
+ [/-]KEYCONTAINER:* | \
+ [/-]MANIFESTDEPENDENCY:* | \
+ [/-]MANIFESTUAC:* | \
+ [/-]MAPINFO:* | \
+ [/-]MERGE:* | \
+ [/-]SECTION:* | \
+ [/-]REMOVE:*)
+ args=("${args[@]}" "$1")
+ shift
+ ;;
# Option or argument.
#
diff --git a/msvc-rc-common b/msvc-rc-common
index 7e55aec..421d232 100755
--- a/msvc-rc-common
+++ b/msvc-rc-common
@@ -25,14 +25,16 @@ source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common
# Note that the order of the cases is important. Specifically, we want, e.g.,
# /D before /D*.
#
+# Note that rc.exe /? is missing some options that are documented in MSDN.
+#
args=()
while [ $# -gt 0 ]; do
- case $1 in
+ case ${1^^} in # Uppercase for case-insensitive comparison.
# /I <dir>
#
- [/-][Ii])
+ [/-]I)
args=("${args[@]}" "$1")
shift
args=("${args[@]}" "$(translate $1)")
@@ -41,14 +43,14 @@ while [ $# -gt 0 ]; do
# /I<dir>
#
- [/-][Ii]*)
+ [/-]I*)
args=("${args[@]}" "$(split_translate 2 $1)")
shift
;;
# /f[om] <file>
#
- [/-][fF][oOmM])
+ [/-]F[OM])
args=("${args[@]}" "$1")
shift
args=("${args[@]}" "$(translate $1)")
@@ -57,14 +59,14 @@ while [ $# -gt 0 ]; do
# /f[om]<file>
#
- [/-][fF][oOmM]*)
+ [/-]F[OM]*)
args=("${args[@]}" "$(split_translate 3 $1)")
shift
;;
# /q <file>
#
- [/-][qQ])
+ [/-]Q)
args=("${args[@]}" "$1")
shift
args=("${args[@]}" "$(translate $1)")
@@ -73,7 +75,7 @@ while [ $# -gt 0 ]; do
# /q<file>
#
- [/-][qQ]*)
+ [/-]Q*)
args=("${args[@]}" "$(split_translate 2 $1)")
shift
;;
@@ -81,8 +83,8 @@ while [ $# -gt 0 ]; do
# Handle other options with separate values. This makes sure we don't try
# to path-translate them.
#
- [/-][Dd] | \
- [/-][Uu])
+ [/-]D | \
+ [/-]U)
args=("${args[@]}" "$1")
shift
args=("${args[@]}" "$1")
@@ -92,7 +94,7 @@ while [ $# -gt 0 ]; do
# Handle other options with combined values that could possibly be
# interpreted as paths, for example /DFOO=foo/bar.
#
- [/-][Dd]*)
+ [/-]D*)
args=("${args[@]}" "$1")
shift
;;