diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-24 11:38:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-24 11:38:44 +0200 |
commit | 3209a9fa6e87ad4d2f9d1087a1206347df4c6214 (patch) | |
tree | 84646641225fba708abb5733ce175ceb904a0de0 | |
parent | d929add3baa3fac5720cf4053c42bb846d83c66b (diff) |
Reorganize the script structure
-rw-r--r-- | INSTALL | 6 | ||||
-rwxr-xr-x | cl-11 | 6 | ||||
-rwxr-xr-x | cl-11-32 | 10 | ||||
-rwxr-xr-x | cl-12 | 6 | ||||
-rwxr-xr-x | cl-12-32 | 10 | ||||
-rwxr-xr-x | cl-14 | 6 | ||||
-rwxr-xr-x | cl-14u0-32 | 10 | ||||
-rwxr-xr-x | cl-14u2 | 6 | ||||
-rwxr-xr-x | cl-14u2-32 | 10 | ||||
-rwxr-xr-x | cl-14u2-64 | 10 | ||||
-rwxr-xr-x | lib-11 | 6 | ||||
-rwxr-xr-x | lib-11-32 | 10 | ||||
-rwxr-xr-x | lib-12 | 6 | ||||
-rwxr-xr-x | lib-12-32 | 10 | ||||
-rwxr-xr-x | lib-14 | 6 | ||||
-rwxr-xr-x | lib-14u0-32 | 10 | ||||
-rwxr-xr-x | lib-14u2 | 6 | ||||
-rwxr-xr-x | lib-14u2-32 | 10 | ||||
-rwxr-xr-x | lib-14u2-64 | 10 | ||||
-rwxr-xr-x | link-11 | 6 | ||||
-rwxr-xr-x | link-11-32 | 10 | ||||
-rwxr-xr-x | link-12 | 6 | ||||
-rwxr-xr-x | link-12-32 | 10 | ||||
-rwxr-xr-x | link-14 | 6 | ||||
-rwxr-xr-x | link-14u0-32 | 10 | ||||
-rwxr-xr-x | link-14u2 | 6 | ||||
-rwxr-xr-x | link-14u2-32 | 10 | ||||
-rwxr-xr-x | link-14u2-64 | 10 | ||||
-rwxr-xr-x | msvc-11/msvc-11-32 (renamed from msvc-11) | 5 | ||||
-rwxr-xr-x | msvc-12/msvc-12-32 (renamed from msvc-12) | 5 | ||||
-rwxr-xr-x | msvc-14/msvc-14u0-32 (renamed from msvc-14) | 5 | ||||
-rwxr-xr-x | msvc-14/msvc-14u2-32 (renamed from msvc-14u2) | 5 | ||||
-rwxr-xr-x | msvc-14/msvc-14u2-64 (renamed from msvc-14u2-64) | 5 | ||||
-rwxr-xr-x | msvc-common/msvc-cl-common (renamed from msvc-cl-common) | 8 | ||||
-rwxr-xr-x | msvc-common/msvc-common (renamed from msvc-common) | 10 | ||||
-rwxr-xr-x | msvc-common/msvc-lib-common (renamed from msvc-lib-common) | 5 | ||||
-rwxr-xr-x | msvc-common/msvc-link-common (renamed from msvc-link-common) | 4 | ||||
-rwxr-xr-x | msvc-common/msvc-mt-common (renamed from msvc-mt-common) | 4 | ||||
-rwxr-xr-x | msvc-common/msvc-rc-common (renamed from msvc-rc-common) | 4 | ||||
-rwxr-xr-x | msvc-dispatch | 71 | ||||
-rwxr-xr-x | mt-11 | 6 | ||||
-rwxr-xr-x | mt-11-32 | 10 | ||||
-rwxr-xr-x | mt-12 | 6 | ||||
-rwxr-xr-x | mt-12-32 | 10 | ||||
-rwxr-xr-x | mt-14 | 6 | ||||
-rwxr-xr-x | mt-14u0-32 | 10 | ||||
-rwxr-xr-x | mt-14u2 | 6 | ||||
-rwxr-xr-x | mt-14u2-32 | 10 | ||||
-rwxr-xr-x | mt-14u2-64 | 10 | ||||
-rwxr-xr-x | rc-11 | 6 | ||||
-rwxr-xr-x | rc-11-32 | 10 | ||||
-rwxr-xr-x | rc-12 | 6 | ||||
-rwxr-xr-x | rc-12-32 | 10 | ||||
-rwxr-xr-x | rc-14 | 6 | ||||
-rwxr-xr-x | rc-14u0-32 | 10 | ||||
-rwxr-xr-x | rc-14u2 | 6 | ||||
-rwxr-xr-x | rc-14u2-32 | 10 | ||||
-rwxr-xr-x | rc-14u2-64 | 10 |
58 files changed, 371 insertions, 136 deletions
@@ -31,7 +31,11 @@ example: export PATH=$HOME/msvc-linux:$PATH Alternatively, if you have something like ~/bin/ that is already in PATH, then -you can simply add symlinks to the scripts. +you can simply add symlinks to the scripts. This way you can also choose +shorter tool names, for example: + +for t in cl link lib mt rc; do \ + ln -s .../msvc-linux/$t-14u2-64 ~/bin/$t-14; done Install Wine @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-11" -source "$src/msvc-cl-common" diff --git a/cl-11-32 b/cl-11-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/cl-11-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-12" -source "$src/msvc-cl-common" diff --git a/cl-12-32 b/cl-12-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/cl-12-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14" -source "$src/msvc-cl-common" diff --git a/cl-14u0-32 b/cl-14u0-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/cl-14u0-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/cl-14u2 b/cl-14u2 deleted file mode 100755 index 5896edc..0000000 --- a/cl-14u2 +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14u2" -source "$src/msvc-cl-common" diff --git a/cl-14u2-32 b/cl-14u2-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/cl-14u2-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/cl-14u2-64 b/cl-14u2-64 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/cl-14u2-64 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-11" -source "$src/msvc-lib-common" diff --git a/lib-11-32 b/lib-11-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/lib-11-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-12" -source "$src/msvc-lib-common" diff --git a/lib-12-32 b/lib-12-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/lib-12-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14" -source "$src/msvc-lib-common" diff --git a/lib-14u0-32 b/lib-14u0-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/lib-14u0-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/lib-14u2 b/lib-14u2 deleted file mode 100755 index 2d1c5c3..0000000 --- a/lib-14u2 +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14u2" -source "$src/msvc-lib-common" diff --git a/lib-14u2-32 b/lib-14u2-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/lib-14u2-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/lib-14u2-64 b/lib-14u2-64 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/lib-14u2-64 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/link-11 b/link-11 deleted file mode 100755 index 14267fc..0000000 --- a/link-11 +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-11" -source "$src/msvc-link-common" diff --git a/link-11-32 b/link-11-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/link-11-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/link-12 b/link-12 deleted file mode 100755 index d901cd3..0000000 --- a/link-12 +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-12" -source "$src/msvc-link-common" diff --git a/link-12-32 b/link-12-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/link-12-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/link-14 b/link-14 deleted file mode 100755 index 07e24db..0000000 --- a/link-14 +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14" -source "$src/msvc-link-common" diff --git a/link-14u0-32 b/link-14u0-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/link-14u0-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/link-14u2 b/link-14u2 deleted file mode 100755 index 38f8cde..0000000 --- a/link-14u2 +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14u2" -source "$src/msvc-link-common" diff --git a/link-14u2-32 b/link-14u2-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/link-14u2-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/link-14u2-64 b/link-14u2-64 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/link-14u2-64 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/msvc-11 b/msvc-11/msvc-11-32 index e226f5c..6db77cc 100755 --- a/msvc-11 +++ b/msvc-11/msvc-11-32 @@ -4,6 +4,9 @@ # # Should set the SDKBIN, VCBIN, VCDLL, INCLUDE, and LIB variables. # +if [ -z "$MSVC_INSTALLDIR" ]; then + MSVC_INSTALLDIR="Microsoft Visual Studio 11.0" +fi # SDK # @@ -15,7 +18,7 @@ LIB="$SDK\\lib\\win8\\um\\x86" # VC # -VC="C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC" +VC="C:\\Program Files (x86)\\$MSVC_INSTALLDIR\\VC" VCBIN="$VC\\bin" VCDLL="$VC\\bin" diff --git a/msvc-12 b/msvc-12/msvc-12-32 index e4d9500..6d77ff6 100755 --- a/msvc-12 +++ b/msvc-12/msvc-12-32 @@ -4,6 +4,9 @@ # # Should set the SDKBIN, VCBIN, VCDLL, INCLUDE, and LIB variables. # +if [ -z "$MSVC_INSTALLDIR" ]; then + MSVC_INSTALLDIR="Microsoft Visual Studio 12.0" +fi # SDK # @@ -15,7 +18,7 @@ LIB="$SDK\\lib\\winv6.3\\um\\x86" # VC # -VC="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC" +VC="C:\\Program Files (x86)\\$MSVC_INSTALLDIR\\VC" VCBIN="$VC\\bin\\amd64_x86" VCDLL="$VC\\bin\\amd64" diff --git a/msvc-14 b/msvc-14/msvc-14u0-32 index 77e2259..ec7b82b 100755 --- a/msvc-14 +++ b/msvc-14/msvc-14u0-32 @@ -4,6 +4,9 @@ # # Should set the SDKBIN, VCBIN, VCDLL, INCLUDE, and LIB variables. # +if [ -z "$MSVC_INSTALLDIR" ]; then + MSVC_INSTALLDIR="Microsoft Visual Studio 14.0" +fi # SDK # @@ -23,7 +26,7 @@ LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB" # VC # -VC="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC" +VC="C:\\Program Files (x86)\\$MSVC_INSTALLDIR\\VC" VCBIN="$VC\\bin\\amd64_x86" VCDLL="$VC\\bin\\amd64" diff --git a/msvc-14u2 b/msvc-14/msvc-14u2-32 index 8792e5d..0d54bb7 100755 --- a/msvc-14u2 +++ b/msvc-14/msvc-14u2-32 @@ -4,6 +4,9 @@ # # Should set the SDKBIN, VCBIN, VCDLL, INCLUDE, and LIB variables. # +if [ -z "$MSVC_INSTALLDIR" ]; then + MSVC_INSTALLDIR="Microsoft Visual Studio 14.0" +fi # SDK # @@ -24,7 +27,7 @@ LIB="$CRT\\lib\\$CRTVER\\ucrt\\x86;$LIB" # VC # -VC="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC" +VC="C:\\Program Files (x86)\\$MSVC_INSTALLDIR\\VC" VCBIN="$VC\\bin\\amd64_x86" VCDLL="$VC\\bin\\amd64" diff --git a/msvc-14u2-64 b/msvc-14/msvc-14u2-64 index 20b3405..5ac895b 100755 --- a/msvc-14u2-64 +++ b/msvc-14/msvc-14u2-64 @@ -4,6 +4,9 @@ # # Should set the SDKBIN, VCBIN, VCDLL, INCLUDE, and LIB variables. # +if [ -z "$MSVC_INSTALLDIR" ]; then + MSVC_INSTALLDIR="Microsoft Visual Studio 14.0" +fi # SDK # @@ -24,7 +27,7 @@ LIB="$CRT\\lib\\$CRTVER\\ucrt\\x64;$LIB" # VC # -VC="C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC" +VC="C:\\Program Files (x86)\\$MSVC_INSTALLDIR\\VC" VCBIN="$VC\\bin\\amd64" VCDLL="$VC\\bin\\amd64" diff --git a/msvc-cl-common b/msvc-common/msvc-cl-common index 597b0e5..57d389e 100755 --- a/msvc-cl-common +++ b/msvc-common/msvc-cl-common @@ -1,5 +1,7 @@ #! /usr/bin/env bash +# Note: shouldn't be executed directly, src_dir must be set. + # Common cl.exe driver that expects the VCBIN, INCLUDE, and, if running as a # linker, SDKBIN, LIB variables to be set for the specific MSVC # version/configuration. @@ -10,7 +12,7 @@ set -o errtrace # Trap in functions. function info () { echo "$*" 1>&2; } function error () { info "$*"; exit 1; } -source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common +source "$src_dir/msvc-common/msvc-common" # File descriptor where the diagnostics will be sent. Unless STDOUT is used # for something else (e.g., /E), cl.exe sends the diagnostics there. @@ -133,9 +135,9 @@ while [ $# -gt 0 ]; do # If contains at least two slashes, treat it as a path. # if [[ "$1" == /*/* ]]; then - args=("${args[@]}" "$(translate $1)") + args=("${args[@]}" "$(translate $1)") else - args=("${args[@]}" "$1") + args=("${args[@]}" "$1") fi shift ;; diff --git a/msvc-common b/msvc-common/msvc-common index 479ec3f..d571f87 100755 --- a/msvc-common +++ b/msvc-common/msvc-common @@ -1,6 +1,6 @@ #! /usr/bin/env bash -# Note: shouldn't be executed directly. +# Note: shouldn't be executed directly, src_dir must be set. # Translate absolute POSIX path to a Windows path with winepath. # @@ -42,9 +42,15 @@ function msvc_exec () # <diag> <exe> <arg>... # export WINEDEBUG=fixme-all + # Set an alternative .wine directory if requested. + # + if [ -n "$MSVC_WINEPREFIX" ]; then + export WINEPREFIX="$MSVC_WINEPREFIX" + fi + # Filter diagnostics output replacing absolute Windows paths with their # POSIX mapping. If <diag> is 1 then both stdout and stderr output are read # and filtered. # - "$(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-filter" "$diag" wine "$@" + "$src_dir/msvc-filter" "$diag" wine "$@" } diff --git a/msvc-lib-common b/msvc-common/msvc-lib-common index e533829..a38bcd3 100755 --- a/msvc-lib-common +++ b/msvc-common/msvc-lib-common @@ -1,11 +1,12 @@ #! /usr/bin/env bash +# Note: shouldn't be executed directly, src_dir must be set. + # Common lib.exe driver that expects the VCBIN 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. @@ -13,7 +14,7 @@ set -o errtrace # Trap in functions. function info () { echo "$*" 1>&2; } function error () { info "$*"; exit 1; } -source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common +source "$src_dir/msvc-common/msvc-common" # Translate absolute paths from POSIX to Windows. Use bash array to store # arguments in case they contain spaces. diff --git a/msvc-link-common b/msvc-common/msvc-link-common index 7cd121b..931a251 100755 --- a/msvc-link-common +++ b/msvc-common/msvc-link-common @@ -1,5 +1,7 @@ #! /usr/bin/env bash +# Note: shouldn't be executed directly, src_exe and src_dir must be set. + # Common link.exe driver that expects the VCBIN, SDKBIN, and LIB variables to # be set for the specific MSVC version/configuration. @@ -9,7 +11,7 @@ set -o errtrace # Trap in functions. function info () { echo "$*" 1>&2; } function error () { info "$*"; exit 1; } -source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common +source "$src_dir/msvc-common/msvc-common" # Translate absolute paths from POSIX to Windows. Use bash array to store # arguments in case they contain spaces. diff --git a/msvc-mt-common b/msvc-common/msvc-mt-common index 25c9c8e..305d98e 100755 --- a/msvc-mt-common +++ b/msvc-common/msvc-mt-common @@ -1,5 +1,7 @@ #! /usr/bin/env bash +# Note: shouldn't be executed directly, src_dir must be set. + # Common mt.exe driver that expects the SDKBIN variable to be set for the # specific MSVC version/configuration. @@ -9,7 +11,7 @@ set -o errtrace # Trap in functions. function info () { echo "$*" 1>&2; } function error () { info "$*"; exit 1; } -source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common +source "$src_dir/msvc-common/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 diff --git a/msvc-rc-common b/msvc-common/msvc-rc-common index 17c9333..ca986b4 100755 --- a/msvc-rc-common +++ b/msvc-common/msvc-rc-common @@ -1,5 +1,7 @@ #! /usr/bin/env bash +# Note: shouldn't be executed directly, src_dir must be set. + # Common rc.exe driver that expects the SDKBIN and INCLUDE variables to be set # for the specific MSVC version/configuration. @@ -9,7 +11,7 @@ set -o errtrace # Trap in functions. function info () { echo "$*" 1>&2; } function error () { info "$*"; exit 1; } -source $(dirname $(realpath ${BASH_SOURCE[0]}))/msvc-common +source "$src_dir/msvc-common/msvc-common" # Translate absolute paths from POSIX to Windows. Use bash array to store # arguments in case they contain spaces. diff --git a/msvc-dispatch b/msvc-dispatch new file mode 100755 index 0000000..945710b --- /dev/null +++ b/msvc-dispatch @@ -0,0 +1,71 @@ +#! /usr/bin/env bash + +# Note: shouldn't be executed directly, src_exe and src_dir must be set. + +# The filename in src_exe should be in the <tool>-<version>-<target> form. +# Based on that set some defaults, load the corresponding config file, and +# then continue with one of the msvc-<tool>-common scripts. + +trap "{ exit 1; }" ERR +set -o errtrace # Trap in functions. + +function info () { echo "$*" 1>&2; } +function error () { info "$*"; exit 1; } + +# Split the argument. The <version> itself should be <major>[minor] where +# <major> is digit-dot-only and minor should start with a non-digit-dot (e.g., +# u1, rc1, etc). +# +arg=($(echo "$(basename "$src_exe")" | \ + sed -n -e 's/^\([^-]*\)-\([0-9.]*\)\([^-]*\)-\([^-]*\)$/\1 \4 \2 \3/p')) +tool="${arg[0]}" +target="${arg[1]}" + +major="${arg[2]}" +minor="${arg[3]}" + +MAJOR="${arg[2]^^}" +MINOR="${arg[3]^^}" + +if [ -z "$tool" -o -z "$major" -o -z "$target" ]; then + error "invalid top-level script name" +fi + +# Calculate MSVC_WINEPREFIX and MSVC_INSTALLDIR. +# +# We have the following environment variable name hierarchy: +# +# MSVC_<MAJOR><MINOR>_* +# MSVC_<MAJOR>_* +# MSVC_* +# +# And we always reduce these to just MSVC_* which are used further down. +# +function lookup_value() # <name> +{ + local n="MSVC_${MAJOR}${MINOR}_$1" + local v="${!n}" + + if [ -z "$v" ]; then + n="MSVC_${MAJOR}_$1" + v="${!n}" + + if [ -z "$v" ]; then + n="MSVC_$1" + v="${!n}" + fi + fi + + echo "$v" +} + +MSVC_WINEPREFIX="$(lookup_value "WINEPREFIX")" +MSVC_INSTALLDIR="$(lookup_value "INSTALLDIR")" + +# Load the configuration. +# +source "$src_dir/msvc-$major/msvc-$major$minor-$target" + +# Dispatch to the tool. +# +source "$src_dir/msvc-common/msvc-$tool-common" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-11" -source "$src/msvc-mt-common" diff --git a/mt-11-32 b/mt-11-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/mt-11-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-12" -source "$src/msvc-mt-common" diff --git a/mt-12-32 b/mt-12-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/mt-12-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14" -source "$src/msvc-mt-common" diff --git a/mt-14u0-32 b/mt-14u0-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/mt-14u0-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/mt-14u2 b/mt-14u2 deleted file mode 100755 index c8c6499..0000000 --- a/mt-14u2 +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14u2" -source "$src/msvc-mt-common" diff --git a/mt-14u2-32 b/mt-14u2-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/mt-14u2-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/mt-14u2-64 b/mt-14u2-64 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/mt-14u2-64 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-11" -source "$src/msvc-rc-common" diff --git a/rc-11-32 b/rc-11-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/rc-11-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-12" -source "$src/msvc-rc-common" diff --git a/rc-12-32 b/rc-12-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/rc-12-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14" -source "$src/msvc-rc-common" diff --git a/rc-14u0-32 b/rc-14u0-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/rc-14u0-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/rc-14u2 b/rc-14u2 deleted file mode 100755 index ce9a5ea..0000000 --- a/rc-14u2 +++ /dev/null @@ -1,6 +0,0 @@ -#! /usr/bin/env bash - -src="$(dirname $(realpath ${BASH_SOURCE[0]}))" - -source "$src/msvc-14u2" -source "$src/msvc-rc-common" diff --git a/rc-14u2-32 b/rc-14u2-32 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/rc-14u2-32 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" diff --git a/rc-14u2-64 b/rc-14u2-64 new file mode 100755 index 0000000..0d34aea --- /dev/null +++ b/rc-14u2-64 @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# The contents of these files are all identical; the information is carries by +# the file name which should be in the form <tool>-<version>-<target>. See +# msvc-dispatch for details. +# +src_exe="$(realpath ${BASH_SOURCE[0]})" +src_dir="$(dirname "$src_exe")" + +source "$src_dir/msvc-dispatch" |