summaryrefslogtreecommitdiff
path: root/automation
diff options
context:
space:
mode:
authorMartin Thomson <martin.thomson@gmail.com>2018-10-12 16:22:34 +1100
committerMartin Thomson <martin.thomson@gmail.com>2018-10-12 16:22:34 +1100
commit395db9dd0d6eb8d7982db4d8f1845f80c4af8c17 (patch)
tree5c50ee7e4a35803835ac4c1fbe384569fafdb842 /automation
parent90e6c8c4fdde4bc1524d9e821856542aeebcabd0 (diff)
downloadnss-hg-395db9dd0d6eb8d7982db4d8f1845f80c4af8c17.tar.gz
Bug 1434943 - Support for MSVC in build.sh, r=jcj
Summary: This adds basic support for MSVC to build.sh. It uses the registry and vswhere (which is part of the standard mozilla-build setup now) to work out paths and set them properly. It's probably a little fragile, but it's better than the shoestring and tape we have in builds right now. I took the liberty of sanitizing the command-line options a little here. Mostly that is sorting them, but I also deprecated the -m32 option in favour of specifying target architecture with -t. That turned out to be a lot cleaner. Reviewers: jcj Reviewed By: jcj Bug #: 1434943 Differential Revision: https://phabricator.services.mozilla.com/D5125
Diffstat (limited to 'automation')
-rw-r--r--automation/taskcluster/graph/src/extend.js14
-rw-r--r--automation/taskcluster/windows/build.sh8
-rw-r--r--automation/taskcluster/windows/build_gyp.sh32
-rw-r--r--automation/taskcluster/windows/setup.sh48
-rw-r--r--automation/taskcluster/windows/setup32.sh10
-rw-r--r--automation/taskcluster/windows/setup64.sh10
6 files changed, 68 insertions, 54 deletions
diff --git a/automation/taskcluster/graph/src/extend.js b/automation/taskcluster/graph/src/extend.js
index 352bdad21..1302602bc 100644
--- a/automation/taskcluster/graph/src/extend.js
+++ b/automation/taskcluster/graph/src/extend.js
@@ -152,13 +152,13 @@ export default async function main() {
await scheduleLinux("Linux 32 (opt)", {
platform: "linux32",
image: LINUX_IMAGE
- }, "-m32 --opt");
+ }, "-t ia32 --opt");
await scheduleLinux("Linux 32 (debug)", {
platform: "linux32",
collection: "debug",
image: LINUX_IMAGE
- }, "-m32");
+ }, "-t ia32");
await scheduleLinux("Linux 64 (opt)", {
platform: "linux64",
@@ -248,12 +248,12 @@ export default async function main() {
await scheduleWindows("Windows 2012 32 (opt)", {
platform: "windows2012-32",
- }, "build_gyp.sh --opt -m32");
+ }, "build_gyp.sh --opt -t ia32");
await scheduleWindows("Windows 2012 32 (debug)", {
platform: "windows2012-32",
collection: "debug"
- }, "build_gyp.sh -m32");
+ }, "build_gyp.sh -t ia32");
await scheduleFuzzing();
await scheduleFuzzing32();
@@ -679,7 +679,7 @@ async function scheduleFuzzing32() {
"/bin/bash",
"-c",
"bin/checkout.sh && " +
- "nss/automation/taskcluster/scripts/build_gyp.sh -g -v --fuzz -m32"
+ "nss/automation/taskcluster/scripts/build_gyp.sh -g -v --fuzz -t ia32"
],
artifacts: {
public: {
@@ -706,7 +706,7 @@ async function scheduleFuzzing32() {
"/bin/bash",
"-c",
"bin/checkout.sh && " +
- "nss/automation/taskcluster/scripts/build_gyp.sh -g -v --fuzz=tls -m32"
+ "nss/automation/taskcluster/scripts/build_gyp.sh -g -v --fuzz=tls -t ia32"
],
}));
@@ -1105,7 +1105,7 @@ async function scheduleTools() {
command: [
"/bin/bash",
"-c",
- "bin/checkout.sh && nss/automation/taskcluster/scripts/build_gyp.sh --disable-tests --emit-llvm -m32"
+ "bin/checkout.sh && nss/automation/taskcluster/scripts/build_gyp.sh --disable-tests --emit-llvm -t ia32"
]
}));
diff --git a/automation/taskcluster/windows/build.sh b/automation/taskcluster/windows/build.sh
index 46136153d..eebb41535 100644
--- a/automation/taskcluster/windows/build.sh
+++ b/automation/taskcluster/windows/build.sh
@@ -2,12 +2,12 @@
set -v -e -x
-# Set up the toolchain.
-if [ "$USE_64" = 1 ]; then
- source $(dirname $0)/setup64.sh
+if [[ "$USE_64" == 1 ]]; then
+ m=x64
else
- source $(dirname $0)/setup32.sh
+ m=x86
fi
+source "$(dirname "$0")/setup.sh"
# Clone NSPR.
hg_clone https://hg.mozilla.org/projects/nspr nspr default
diff --git a/automation/taskcluster/windows/build_gyp.sh b/automation/taskcluster/windows/build_gyp.sh
index cc829ca99..c0f38f948 100644
--- a/automation/taskcluster/windows/build_gyp.sh
+++ b/automation/taskcluster/windows/build_gyp.sh
@@ -2,33 +2,37 @@
set -v -e -x
-# Set up the toolchain.
-if [[ "$@" == *"-m32"* ]]; then
- source $(dirname $0)/setup32.sh
-else
- source $(dirname $0)/setup64.sh
-fi
+# Parse for the -t option.
+m=x64
+for i in "$@"; do
+ case "$i" in
+ -t|--target) m= ;;
+ --target=*) m="${i#*=}" ;;
+ *) [[ -z "$m" ]] && m="$i" ;;
+ esac
+done
+[[ "$m" == "ia32" ]] && m=x86
+source "$(dirname "$0")/setup.sh"
# Install GYP.
-cd gyp
+pushd gyp
python -m virtualenv test-env
test-env/Scripts/python setup.py install
test-env/Scripts/python -m pip install --upgrade pip
test-env/Scripts/pip install --upgrade setuptools
-cd ..
-
-export GYP_MSVS_OVERRIDE_PATH="${VSPATH}"
-export GYP_MSVS_VERSION="2015"
-export GYP="${PWD}/gyp/test-env/Scripts/gyp"
-
# Fool GYP.
touch "${VSPATH}/VC/vcvarsall.bat"
+export GYP_MSVS_OVERRIDE_PATH="${VSPATH}"
+export GYP_MSVS_VERSION=2015
+popd
+
+export PATH="${PATH}:${PWD}/ninja/bin:${PWD}/gyp/test-env/Scripts"
# Clone NSPR.
hg_clone https://hg.mozilla.org/projects/nspr nspr default
# Build with gyp.
-GYP=${GYP} ./nss/build.sh -g -v "$@"
+./nss/build.sh -g -v "$@"
# Package.
7z a public/build/dist.7z dist
diff --git a/automation/taskcluster/windows/setup.sh b/automation/taskcluster/windows/setup.sh
index 36a040ba1..93c0cdbd5 100644
--- a/automation/taskcluster/windows/setup.sh
+++ b/automation/taskcluster/windows/setup.sh
@@ -2,13 +2,6 @@
set -v -e -x
-export VSPATH="$(pwd)/vs2017_15.4.2"
-export NINJA_PATH="$(pwd)/ninja/bin"
-
-export WINDOWSSDKDIR="${VSPATH}/SDK"
-export VS90COMNTOOLS="${VSPATH}/VC"
-export INCLUDE="${VSPATH}/VC/include:${VSPATH}/SDK/Include/10.0.15063.0/ucrt:${VSPATH}/SDK/Include/10.0.15063.0/shared:${VSPATH}/SDK/Include/10.0.15063.0/um"
-
# Usage: hg_clone repo dir [revision=@]
hg_clone() {
repo=$1
@@ -22,5 +15,42 @@ hg_clone() {
exit 1
}
-hg_clone https://hg.mozilla.org/build/tools tools default
-tools/scripts/tooltool/tooltool_wrapper.sh $(dirname $0)/releng.manifest https://tooltool.mozilla-releng.net/ non-existant-file.sh /c/mozilla-build/python/python.exe /c/builds/tooltool.py --authentication-file /c/builds/relengapi.tok -c /c/builds/tooltool_cache
+hg_clone https://hg.mozilla.org/build/tools tools b8d7c263dfc3
+tools/scripts/tooltool/tooltool_wrapper.sh \
+ $(dirname $0)/releng.manifest https://tooltool.mozilla-releng.net/ \
+ non-existant-file.sh /c/mozilla-build/python/python.exe \
+ /c/builds/tooltool.py --authentication-file /c/builds/relengapi.tok \
+ -c /c/builds/tooltool_cache
+
+# This needs $m to be set.
+[[ -n "$m" ]]
+
+# Setup MSVC paths.
+export VSPATH="${PWD}/vs2017_15.4.2"
+UCRTVersion="10.0.15063.0"
+
+export WINDOWSSDKDIR="${VSPATH}/SDK"
+export VS90COMNTOOLS="${VSPATH}/VC"
+export WIN32_REDIST_DIR="${VSPATH}/VC/redist/${m}/Microsoft.VC141.CRT"
+export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/${m}"
+
+if [ "$m" == "x86" ]; then
+ PATH="${PATH}:${VSPATH}/VC/bin/Hostx64/x86"
+ PATH="${PATH}:${VSPATH}/VC/bin/Hostx64/x64"
+fi
+PATH="${PATH}:${VSPATH}/VC/bin/Host${m}/${m}"
+PATH="${PATH}:${WIN32_REDIST_DIR}"
+PATH="${PATH}:${WIN_UCRT_REDIST_DIR}"
+PATH="${PATH}:${VSPATH}/SDK/bin/${UCRTVersion}/x64"
+export PATH
+
+LIB="${LIB}:${VSPATH}/VC/lib/${m}"
+LIB="${LIB}:${VSPATH}/SDK/lib/${UCRTVersion}/ucrt/${m}"
+LIB="${LIB}:${VSPATH}/SDK/lib/${UCRTVersion}/um/${m}"
+export LIB
+
+INCLUDE="${INCLUDE}:${VSPATH}/VC/include"
+INCLUDE="${INCLUDE}:${VSPATH}/SDK/Include/${UCRTVersion}/ucrt"
+INCLUDE="${INCLUDE}:${VSPATH}/SDK/Include/${UCRTVersion}/shared"
+INCLUDE="${INCLUDE}:${VSPATH}/SDK/Include/${UCRTVersion}/um"
+export INCLUDE
diff --git a/automation/taskcluster/windows/setup32.sh b/automation/taskcluster/windows/setup32.sh
deleted file mode 100644
index 19bed284d..000000000
--- a/automation/taskcluster/windows/setup32.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-
-set -v -e -x
-
-source $(dirname $0)/setup.sh
-
-export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT"
-export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x86"
-export PATH="${NINJA_PATH}:${VSPATH}/VC/bin/Hostx64/x86:${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/VC/Hostx86/x86:${VSPATH}/SDK/bin/10.0.15063.0/x64:${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x86:${PATH}"
-export LIB="${VSPATH}/VC/lib/x86:${VSPATH}/SDK/lib/10.0.15063.0/ucrt/x86:${VSPATH}/SDK/lib/10.0.15063.0/um/x86"
diff --git a/automation/taskcluster/windows/setup64.sh b/automation/taskcluster/windows/setup64.sh
deleted file mode 100644
index d16cb0ec9..000000000
--- a/automation/taskcluster/windows/setup64.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-
-set -v -e -x
-
-source $(dirname $0)/setup.sh
-
-export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT"
-export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x64"
-export PATH="${NINJA_PATH}:${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/VC/bin/Hostx86/x86:${VSPATH}/SDK/bin/10.0.15063.0/x64:${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x64:${PATH}"
-export LIB="${VSPATH}/VC/lib/x64:${VSPATH}/SDK/lib/10.0.15063.0/ucrt/x64:${VSPATH}/SDK/lib/10.0.15063.0/um/x64"