aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-11 07:26:39 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-11 07:26:39 +0200
commit634991096d72e1a6ccfd25574d2a9e90fed120f9 (patch)
tree0f1b5e96d0711bc13fe9a3b320abbf11b1f25fe3
parent3775f6aa680849c1bb7a5f8760a8f84203b615c8 (diff)
Add support for rc.exe
-rwxr-xr-xmsvc-116
-rwxr-xr-xmsvc-126
-rwxr-xr-xmsvc-1412
-rwxr-xr-xmsvc-14u217
-rwxr-xr-xmsvc-cl-common4
-rwxr-xr-xmsvc-lib-common6
-rwxr-xr-xmsvc-link-common6
-rwxr-xr-xmsvc-rc-common119
-rwxr-xr-xrc-116
-rwxr-xr-xrc-126
-rwxr-xr-xrc-146
-rwxr-xr-xrc-14u26
12 files changed, 180 insertions, 20 deletions
diff --git a/msvc-11 b/msvc-11
index d1ccc99..4fcee37 100755
--- a/msvc-11
+++ b/msvc-11
@@ -1,11 +1,14 @@
#! /usr/bin/env bash
-# MSVC 11 setup/configuration. Should set VC, INCLUDE, and LIB variables.
+# MSVC 11 setup/configuration.
+#
+# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables.
#
# SDK
#
SDK="C:\\Program Files (x86)\\Windows Kits\\8.0"
+SDKBIN="$SDK\\bin\\x86"
INCLUDE="$SDK\\include\\shared;$SDK\\include\\um;$SDK\\include\\winrt"
LIB="$SDK\\lib\\win8\\um\\x86"
@@ -13,6 +16,7 @@ LIB="$SDK\\lib\\win8\\um\\x86"
# VC
#
VC="C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC"
+VCBIN="$VC\\bin"
INCLUDE="$VC\\include;$INCLUDE"
LIB="$VC\\lib;$LIB"
diff --git a/msvc-12 b/msvc-12
index 2674215..e124a1b 100755
--- a/msvc-12
+++ b/msvc-12
@@ -1,11 +1,14 @@
#! /usr/bin/env bash
-# MSVC 12 setup/configuration. Should set VC, INCLUDE, and LIB variables.
+# MSVC 12 setup/configuration.
+#
+# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables.
#
# SDK
#
SDK="C:\\Program Files (x86)\\Windows Kits\\8.1"
+SDKBIN="$SDK\\bin\\x86"
INCLUDE="$SDK\\include\\shared;$SDK\\include\\um;$SDK\\include\\winrt"
LIB="$SDK\\lib\\winv6.3\\um\\x86"
@@ -13,6 +16,7 @@ LIB="$SDK\\lib\\winv6.3\\um\\x86"
# VC
#
VC="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC"
+VCBIN="$VC\\bin"
INCLUDE="$VC\\include;$INCLUDE"
LIB="$VC\\lib;$LIB"
diff --git a/msvc-14 b/msvc-14
index 31242c6..2e0c53a 100755
--- a/msvc-14
+++ b/msvc-14
@@ -1,11 +1,14 @@
#! /usr/bin/env bash
-# MSVC 14 setup/configuration. Should set VC, INCLUDE, and LIB variables.
+# MSVC 14 setup/configuration.
+#
+# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables.
#
# SDK
#
SDK="C:\\Program Files (x86)\\Windows Kits\\8.1"
+SDKBIN="$SDK\\bin\\x86"
INCLUDE="$SDK\\include\\shared;$SDK\\include\\um;$SDK\\include\\winrt"
LIB="$SDK\\lib\\winv6.3\\um\\x86"
@@ -13,14 +16,15 @@ LIB="$SDK\\lib\\winv6.3\\um\\x86"
# CRT
#
CRT="C:\\Program Files (x86)\\Windows Kits\\10"
-VER="10.0.10150.0"
+CRTVER="10.0.10150.0"
-INCLUDE="$CRT\\include\\$VER\\ucrt;$INCLUDE"
-LIB="$CRT\\lib\\$VER\\ucrt\\x86;$LIB"
+INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE"
+LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB"
# VC
#
VC="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC"
+VCBIN="$VC\\bin"
INCLUDE="$VC\\include;$INCLUDE"
LIB="$VC\\lib;$LIB"
diff --git a/msvc-14u2 b/msvc-14u2
index 1a4524f..0f6d1f7 100755
--- a/msvc-14u2
+++ b/msvc-14u2
@@ -1,26 +1,31 @@
#! /usr/bin/env bash
-# MSVC 14U2 setup/configuration. Should set VC, INCLUDE, and LIB variables.
+# MSVC 14U2 setup/configuration.
+#
+# Should set the SDKBIN, VCBIN, INCLUDE, and LIB variables.
#
# SDK
#
SDK="C:\\Program Files (x86)\\Windows Kits\\10"
-VER="10.0.10586.0"
+SDKBIN="$SDK\\bin\\x86"
+SDKVER="10.0.10586.0"
-INCLUDE="$SDK\\include\\$VER\\shared;$SDK\\include\\$VER\\um;$SDK\\include\\$VER\\winrt"
-LIB="$SDK\\lib\\$VER\\um\\x86"
+INCLUDE="$SDK\\include\\$SDKVER\\shared;$SDK\\include\\$SDKVER\\um;$SDK\\include\\$SDKVER\\winrt"
+LIB="$SDK\\lib\\$SDKVER\\um\\x86"
# CRT
#
CRT="C:\\Program Files (x86)\\Windows Kits\\10"
+CRTVER="10.0.10586.0"
-INCLUDE="$CRT\\include\\$VER\\ucrt;$INCLUDE"
-LIB="$CRT\\lib\\$VER\\ucrt\\x86;$LIB"
+INCLUDE="$CRT\\include\\$CRTVER\\ucrt;$INCLUDE"
+LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB"
# VC
#
VC="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC"
+VCBIN="$VC\\bin"
INCLUDE="$VC\\include;$INCLUDE"
LIB="$VC\\lib;$LIB"
diff --git a/msvc-cl-common b/msvc-cl-common
index ce76fc8..7601d77 100755
--- a/msvc-cl-common
+++ b/msvc-cl-common
@@ -1,7 +1,7 @@
#! /usr/bin/env bash
# Common cl.exe driver that expects the VC, INCLUDE, and LIB variables to
-# be set for the specific MSVC version/configuration set.
+# be set for the specific MSVC version/configuration.
trap "{ exit 1; }" ERR
set -o errtrace # Trap in functions.
@@ -142,4 +142,4 @@ done
export INCLUDE
export LIB
-msvc_exec $diag "$VC\\bin\\cl.exe" "${args[@]}"
+msvc_exec $diag "$VCBIN\\cl.exe" "${args[@]}"
diff --git a/msvc-lib-common b/msvc-lib-common
index 5d11ba1..8b23f4f 100755
--- a/msvc-lib-common
+++ b/msvc-lib-common
@@ -3,7 +3,7 @@
# @@ 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 set.
+# the specific MSVC version/configuration.
trap "{ exit 1; }" ERR
set -o errtrace # Trap in functions.
@@ -90,6 +90,6 @@ done
#
export LIB
-# Lib.exe always sends diagnostics to stdout.
+# lib.exe always sends diagnostics to stdout.
#
-msvc_exec 1 "$VC\\bin\\lib.exe" "${args[@]}"
+msvc_exec 1 "$VCBIN\\lib.exe" "${args[@]}"
diff --git a/msvc-link-common b/msvc-link-common
index 64c8a0c..bec14dc 100755
--- a/msvc-link-common
+++ b/msvc-link-common
@@ -1,7 +1,7 @@
#! /usr/bin/env bash
# Common link.exe driver that expects the VC and LIB variables to be set for
-# the specific MSVC version/configuration set.
+# the specific MSVC version/configuration.
trap "{ exit 1; }" ERR
set -o errtrace # Trap in functions.
@@ -75,6 +75,6 @@ done
export LIB
-# Link.exe always sends diagnostics to stdout.
+# link.exe always sends diagnostics to stdout.
#
-msvc_exec 1 "$VC\\bin\\link.exe" "${args[@]}"
+msvc_exec 1 "$VCBIN\\link.exe" "${args[@]}"
diff --git a/msvc-rc-common b/msvc-rc-common
new file mode 100755
index 0000000..7e55aec
--- /dev/null
+++ b/msvc-rc-common
@@ -0,0 +1,119 @@
+#! /usr/bin/env bash
+
+# Common rc.exe driver that expects the VC and INCLUDE variables to be set for
+# the specific MSVC version/configuration.
+
+trap "{ exit 1; }" ERR
+set -o errtrace # Trap in functions.
+
+function info () { echo "$*" 1>&2; }
+function error () { info "$*"; exit 1; }
+
+source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common
+
+# Translate absolute paths from POSIX to Windows. Use bash array to store
+# arguments in case they contain spaces.
+#
+# This needs to be done for both certain option values and arguments.
+# Arguments are tricky in that unless we recognize every option, and option
+# may look a lot like an absolute POSIX path (e.g., /nologo). The heuristics
+# that we are going to use here is that if the argument starts with / and
+# contains at least one more /, then we consider it an argument. Otherwise --
+# an options. We will also explicitly recognize certain options which may not
+# fit this scheme well.
+#
+# Note that the order of the cases is important. Specifically, we want, e.g.,
+# /D before /D*.
+#
+args=()
+
+while [ $# -gt 0 ]; do
+ case $1 in
+
+ # /I <dir>
+ #
+ [/-][Ii])
+ args=("${args[@]}" "$1")
+ shift
+ args=("${args[@]}" "$(translate $1)")
+ shift
+ ;;
+
+ # /I<dir>
+ #
+ [/-][Ii]*)
+ args=("${args[@]}" "$(split_translate 2 $1)")
+ shift
+ ;;
+
+ # /f[om] <file>
+ #
+ [/-][fF][oOmM])
+ args=("${args[@]}" "$1")
+ shift
+ args=("${args[@]}" "$(translate $1)")
+ shift
+ ;;
+
+ # /f[om]<file>
+ #
+ [/-][fF][oOmM]*)
+ args=("${args[@]}" "$(split_translate 3 $1)")
+ shift
+ ;;
+
+ # /q <file>
+ #
+ [/-][qQ])
+ args=("${args[@]}" "$1")
+ shift
+ args=("${args[@]}" "$(translate $1)")
+ shift
+ ;;
+
+ # /q<file>
+ #
+ [/-][qQ]*)
+ args=("${args[@]}" "$(split_translate 2 $1)")
+ shift
+ ;;
+
+ # Handle other options with separate values. This makes sure we don't try
+ # to path-translate them.
+ #
+ [/-][Dd] | \
+ [/-][Uu])
+ args=("${args[@]}" "$1")
+ shift
+ args=("${args[@]}" "$1")
+ shift
+ ;;
+
+ # Handle other options with combined values that could possibly be
+ # interpreted as paths, for example /DFOO=foo/bar.
+ #
+ [/-][Dd]*)
+ args=("${args[@]}" "$1")
+ shift
+ ;;
+
+ # Option or argument.
+ #
+ *)
+ # If contains at least two slashes, treat it as a path.
+ #
+ if [[ "$1" == /*/* ]]; then
+ args=("${args[@]}" "$(translate $1)")
+ else
+ args=("${args[@]}" "$1")
+ fi
+ shift
+ ;;
+ esac
+done
+
+export INCLUDE
+
+# rc.exe always sends diagnostics to stdout.
+#
+msvc_exec 1 "$SDKBIN\\rc.exe" "${args[@]}"
diff --git a/rc-11 b/rc-11
new file mode 100755
index 0000000..64ba949
--- /dev/null
+++ b/rc-11
@@ -0,0 +1,6 @@
+#! /usr/bin/env bash
+
+src="$(dirname $(realpath ${BASH_SOURCE[0]}))"
+
+source "$src/msvc-11"
+source "$src/msvc-rc-common"
diff --git a/rc-12 b/rc-12
new file mode 100755
index 0000000..5215106
--- /dev/null
+++ b/rc-12
@@ -0,0 +1,6 @@
+#! /usr/bin/env bash
+
+src="$(dirname $(realpath ${BASH_SOURCE[0]}))"
+
+source "$src/msvc-12"
+source "$src/msvc-rc-common"
diff --git a/rc-14 b/rc-14
new file mode 100755
index 0000000..01cc0a3
--- /dev/null
+++ b/rc-14
@@ -0,0 +1,6 @@
+#! /usr/bin/env bash
+
+src="$(dirname $(realpath ${BASH_SOURCE[0]}))"
+
+source "$src/msvc-14"
+source "$src/msvc-rc-common"
diff --git a/rc-14u2 b/rc-14u2
new file mode 100755
index 0000000..ce9a5ea
--- /dev/null
+++ b/rc-14u2
@@ -0,0 +1,6 @@
+#! /usr/bin/env bash
+
+src="$(dirname $(realpath ${BASH_SOURCE[0]}))"
+
+source "$src/msvc-14u2"
+source "$src/msvc-rc-common"