From c3302ca3e31d8140210bc978277ac71fc2a89c6b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 2 Aug 2016 08:45:03 +0200 Subject: Add mt.exe driver --- msvc-mt-common | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mt-11 | 6 ++++ mt-12 | 6 ++++ mt-14 | 6 ++++ mt-14u2 | 6 ++++ 5 files changed, 133 insertions(+) create mode 100755 msvc-mt-common create mode 100755 mt-11 create mode 100755 mt-12 create mode 100755 mt-14 create mode 100755 mt-14u2 diff --git a/msvc-mt-common b/msvc-mt-common new file mode 100755 index 0000000..25c9c8e --- /dev/null +++ b/msvc-mt-common @@ -0,0 +1,109 @@ +#! /usr/bin/env bash + +# Common mt.exe driver that expects the SDKBIN variable 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. +# +# Note that we assume mt.exe options start with '-' and are case-sensitive. +# +args=() + +while [ $# -gt 0 ]; do + case $1 in + + # @@ TODO: handle for [;[#]] + # + # -rgs: + # -tlb: + # -dll: + # -replacements: + # -managedassemblyname: + # -out: + # -inputresource:[;[#]] + # -outputresource:[;[#]] + # -updateresource:[;[#]] + # -hashupdate[:] + # -validate_file_hashes: + + -rgs:* | \ + -tlb:* | \ + -dll:* | \ + -out:*) + args=("${args[@]}" "$(split_translate 5 $1)") + shift + ;; + + -hashupdate:*) + args=("${args[@]}" "$(split_translate 12 $1)") + shift + ;; + + -replacements:*) + args=("${args[@]}" "$(split_translate 14 $1)") + shift + ;; + + -inputresource:*) + args=("${args[@]}" "$(split_translate 15 $1)") + shift + ;; + + -outputresource:* | \ + -updateresource:*) + args=("${args[@]}" "$(split_translate 16 $1)") + shift + ;; + + -managedassemblyname:*) + args=("${args[@]}" "$(split_translate 21 $1)") + shift + ;; + + -validate_file_hashes:*) + args=("${args[@]}" "$(split_translate 22 $1)") + shift + ;; + + # Handle other options with separate values. This makes sure we don't try + # to path-translate them. + # + + # None. + + # Handle other options with combined values that could possibly be + # interpreted as paths. + # + -identity:*) + args=("${args[@]}" "$1") + shift + ;; + + # Option or argument. + # + *) + # If starts with a slash, treat it as a path (options start with dash). + # + if [[ "$1" == /* ]]; then + args=("${args[@]}" "$(translate $1)") + else + args=("${args[@]}" "$1") + fi + shift + ;; + esac +done + +# mt.exe always sends diagnostics to stdout. +# +msvc_exec 1 "$SDKBIN\\mt.exe" "${args[@]}" diff --git a/mt-11 b/mt-11 new file mode 100755 index 0000000..9a0456a --- /dev/null +++ b/mt-11 @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +src="$(dirname $(realpath ${BASH_SOURCE[0]}))" + +source "$src/msvc-11" +source "$src/msvc-mt-common" diff --git a/mt-12 b/mt-12 new file mode 100755 index 0000000..6a912dd --- /dev/null +++ b/mt-12 @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +src="$(dirname $(realpath ${BASH_SOURCE[0]}))" + +source "$src/msvc-12" +source "$src/msvc-mt-common" diff --git a/mt-14 b/mt-14 new file mode 100755 index 0000000..6b5fb29 --- /dev/null +++ b/mt-14 @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +src="$(dirname $(realpath ${BASH_SOURCE[0]}))" + +source "$src/msvc-14" +source "$src/msvc-mt-common" diff --git a/mt-14u2 b/mt-14u2 new file mode 100755 index 0000000..c8c6499 --- /dev/null +++ b/mt-14u2 @@ -0,0 +1,6 @@ +#! /usr/bin/env bash + +src="$(dirname $(realpath ${BASH_SOURCE[0]}))" + +source "$src/msvc-14u2" +source "$src/msvc-mt-common" -- cgit v1.1