azure: add OMF build with LATEST dmd, do not download some files if already existing, simplify space handling

This commit is contained in:
Rainer Schuetze 2019-07-31 19:04:45 +02:00
parent 43c4ce36cc
commit 9aee71b6a9
3 changed files with 76 additions and 39 deletions

View file

@ -8,16 +8,18 @@ clone() {
local url="$1"
local path="$2"
local branch="$3"
for i in {0..4}; do
if git clone --depth 1 --branch "$branch" "$url" "$path" "${@:4}" --quiet; then
break
elif [ $i -lt 4 ]; then
sleep $((1 << $i))
else
echo "Failed to clone: ${url}"
exit 1
fi
done
if [ ! -d $path ]; then
for i in {0..4}; do
if git clone --depth 1 --branch "$branch" "$url" "$path" "${@:4}" --quiet; then
break
elif [ $i -lt 4 ]; then
sleep $((1 << $i))
else
echo "Failed to clone: ${url}"
exit 1
fi
done
fi
}
download() {
@ -43,8 +45,10 @@ install_grep() {
local tools_dir="${DMD_DIR}/tools"
mkdir -p "$tools_dir"
cd "$tools_dir"
download "http://downloads.dlang.org/other/grep-3.1.zip" "grep-3.1.zip"
unzip "grep-3.1.zip" # contains grep.exe
if [ ! -f grep.exe ]; then
download "http://downloads.dlang.org/other/grep-3.1.zip" "grep-3.1.zip"
unzip "grep-3.1.zip" # contains grep.exe
fi
export PATH="${tools_dir}:$PATH"
}

View file

@ -9,14 +9,24 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
GNU_MAKE="$(which make)"
install_host_dmd() {
download "http://downloads.dlang.org/releases/2.x/${HOST_DMD_VERSION}/dmd.${HOST_DMD_VERSION}.windows.7z" dmd2.7z
7z x dmd2.7z > /dev/null
if [ ! -f dmd2/README.TXT ]; then
download "http://downloads.dlang.org/releases/2.x/${HOST_DMD_VERSION}/dmd.${HOST_DMD_VERSION}.windows.7z" dmd2.7z
7z x dmd2.7z > /dev/null
fi
export PATH="$PWD/dmd2/windows/bin/:$PATH"
export HOST_DC="$PWD/dmd2/windows/bin/dmd.exe"
export DM_MAKE="$PWD/dmd2/windows/bin/make.exe"
dmd --version
}
install_host_dmc() {
if [ ! -f dm/README.TXT ]; then
download "http://downloads.dlang.org/other/dm857c.zip" dmc.zip
7z x dmc.zip > /dev/null
fi
dm/bin/dmc | head -n 1 || true
}
################################################################################
# Setup required tools
################################################################################
@ -25,11 +35,29 @@ install_host_dmd() {
# REASON: the preinstalled version is buggy (see also: https://github.com/dlang/dmd/pull/9398#issuecomment-468773638)
install_grep
if [ "$HOST_DMD_VERSION" == "LATEST" ]; then
download "http://downloads.dlang.org/releases/LATEST" LATEST
HOST_DMD_VERSION="$(cat LATEST)"
fi
echo "D_VERSION: $HOST_DMD_VERSION"
echo "VSINSTALLDIR: $VSINSTALLDIR"
echo "GNU_MAKE: $("${GNU_MAKE}" --version)"
echo "GREP_VERSION: $(grep --version)"
################################################################################
# Prepare C compiler
################################################################################
if [ "$MODEL" == "32" ] ; then
install_host_dmc
export CC="$PWD/dm/bin/dmc.exe"
export AR="$PWD/dm/bin/lib.exe"
else
export CC="$(where cl.exe)"
export AR="$(where lib.exe)" # must be done before installing dmd
export MSVC_AR="$AR" # for msvc-lib
fi
################################################################################
# Install the host compiler
################################################################################
@ -51,15 +79,18 @@ clone_repos
# Prepare build flags
################################################################################
export CC="${MSVC_CC}"
export AR="${MSVC_AR}"
if [ "$MODEL" == "64" ] ; then
export MODEL_FLAG="-m64"
MAKE_FILE="win64.mak"
LIBNAME=phobos64.lib
elif [ "$MODEL" == "32mscoff" ] ; then
export MODEL_FLAG="-m32mscoff"
MAKE_FILE="win64.mak"
LIBNAME=phobos32mscoff.lib
else
export MODEL_FLAG="-m32"
MAKE_FILE="win32.mak"
LIBNAME=phobos.lib
fi
################################################################################
@ -71,22 +102,15 @@ DMD_BIN_PATH="$DMD_DIR/generated/windows/release/${MODEL}/dmd"
cd "${DMD_DIR}/src"
"${DM_MAKE}" -f "${MAKE_FILE}" reldmd DMD="$DMD_BIN_PATH"
################################################################################
# WORKAROUND: Make the paths to CC and AR whitespace free
# REASON: Druntime & Phobos Makefiles as the variables don't use quotation
################################################################################
ln -s "$(dirname "$CC")" "${DMD_DIR}/../ccdir"
export CC="$DMD_DIR/../ccdir/cl.exe"
export AR="$DMD_DIR/../ccdir/lib.exe"
################################################################################
# WORKAROUND: Build zlib separately with DigitalMars make
# REASON: whitespace path variables in DigitalMars make from indirect invocation from Phobos
################################################################################
cd "${DMD_DIR}/../phobos/etc/c/zlib"
${DM_MAKE} -f win64.mak "MODEL=${MODEL}" "zlib${MODEL}.lib" CC="${CC}" LIB="${AR}" VCDIR="${VCINSTALLDIR}"
if [ "$MODEL" != "32" ] ; then
cd "${DMD_DIR}/../phobos/etc/c/zlib"
${DM_MAKE} -f win64.mak MODEL=${MODEL} "zlib${MODEL}.lib" "CC=$CC" "LIB=$AR" VCDIR=.
fi
################################################################################
# Build Druntime and Phobos
@ -94,7 +118,7 @@ ${DM_MAKE} -f win64.mak "MODEL=${MODEL}" "zlib${MODEL}.lib" CC="${CC}" LIB="${AR
for proj in druntime phobos; do
cd "${DMD_DIR}/../${proj}"
"${DM_MAKE}" -f "${MAKE_FILE}" DMD="$DMD_BIN_PATH" CC="$CC" AR="$MSVC_AR" VCDIR="${VCINSTALLDIR}" CFLAGS="/C7"
"${DM_MAKE}" -f "${MAKE_FILE}" MODEL=$MODEL DMD="$DMD_BIN_PATH" "CC=$CC" "AR=$AR" VCDIR=.
done
################################################################################
@ -104,7 +128,7 @@ cd "${DMD_DIR}/test"
# WORKAROUND: Copy the built Phobos library in the path
# REASON: LIB argument doesn't seem to work
cp "${DMD_DIR}/../phobos/phobos64.lib" .
cp "${DMD_DIR}/../phobos/$LIBNAME" .
DMD_TESTSUITE_MAKE_ARGS="-j$N" "${GNU_MAKE}" -j1 start_all_tests ARGS="-O -inline -g" MODEL="$MODEL" MODEL_FLAG="$MODEL_FLAG"
@ -114,5 +138,5 @@ DMD_TESTSUITE_MAKE_ARGS="-j$N" "${GNU_MAKE}" -j1 start_all_tests ARGS="-O -inlin
mkdir -p "${DMD_DIR}/artifacts"
cd "${DMD_DIR}/artifacts"
cp "${DMD_DIR}/../phobos/phobos64.lib" .
cp "${DMD_DIR}/../phobos/$LIBNAME" .
cp "${DMD_BIN_PATH}" .

View file

@ -1,7 +1,4 @@
# Learn more: https://aka.ms/yaml
variables:
HOST_DMD_VERSION: 2.084.1
jobs:
- job: Windows
timeoutInMinutes: 120
@ -9,6 +6,7 @@ jobs:
vmImage: 'vs2017-win2016'
variables:
VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
HOST_DMD_VERSION: 2.084.1
strategy:
matrix:
x64:
@ -16,11 +14,22 @@ jobs:
MODEL: 64
ARCH: x64
D_COMPILER: dmd
#x86:
#OS: Win_32
#MODEL: 32
#ARCH: x86
#D_COMPILER: dmd
steps:
- template: .azure-pipelines/windows.yml
- job: Windows_OMF
timeoutInMinutes: 120
pool:
vmImage: 'vs2017-win2016'
variables:
VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
HOST_DMD_VERSION: LATEST
strategy:
matrix:
x64:
OS: Win_32
MODEL: 32
ARCH: x86
D_COMPILER: dmd
steps:
- template: .azure-pipelines/windows.yml
- job: Windows_VisualD