Azure CI: Avoid deprecated compiler/src/win{32,64}.mak Makefiles (#15835)

* Azure CI: Avoid deprecated compiler/src/win{32,64}.mak Makefiles

Using build.d directly instead.

* Azure CI: Fix MODEL=32omf job
This commit is contained in:
Martin Kinkelin 2023-11-21 09:16:02 +01:00 committed by GitHub
parent 67a4603500
commit b5fb3b1eb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 29 deletions

View file

@ -8,7 +8,7 @@ steps:
fetchDepth: 1
- script: |
bash --version
sh --login .azure-pipelines/windows-visual-studio.sh
bash --login .azure-pipelines/windows-visual-studio.sh
displayName: Download required binaries
- script: |
call .azure-pipelines/windows-msbuild.bat

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -eux -o pipefail
@ -62,11 +62,10 @@ clone_repos
if [ "$MODEL" == "64" ] ; then
MAKE_FILE="win64.mak"
LIBNAME=phobos64.lib
elif [ "$MODEL" == "32mscoff" ] ; then
elif [ "$MODEL" == "32" ] ; then
MAKE_FILE="win64.mak"
LIBNAME=phobos32mscoff.lib
else
export LIB="$PWD/dmd2/windows/lib"
else # 32omf
MAKE_FILE="win32.mak"
LIBNAME=phobos.lib
fi
@ -74,15 +73,25 @@ fi
################################################################################
# Build DMD (incl. building and running the unittests)
################################################################################
if [ "$MODEL" == "32omf" ] ; then
DMD_BIN_PATH="$DMD_DIR/generated/windows/release/32/dmd"
else
DMD_BIN_PATH="$DMD_DIR/generated/windows/release/$MODEL/dmd"
# no `-debug` for unittests build with old host compilers (to avoid compile errors)
disable_debug_for_unittests=()
if [[ "$HOST_DMD_VERSION" == "2.079.0" ]]; then
disable_debug_for_unittests=(ENABLE_DEBUG=0)
fi
cd "$DMD_DIR/compiler/src"
"$DM_MAKE" -f "$MAKE_FILE" MAKE="$DM_MAKE" BUILD=debug unittest
DFLAGS="-L-LARGEADDRESSAWARE" "$DM_MAKE" -f "$MAKE_FILE" MAKE="$DM_MAKE" GEN="$DMD_DIR\generated" reldmd-asserts
# avoid the DMC runtime and its limitations for the compiler and {build,run}.d tools themselves
TOOL_MODEL="$MODEL"
if [[ "$MODEL" == "32omf" ]]; then
TOOL_MODEL=32
fi
cd "$DMD_DIR"
"$HOST_DC" -m$TOOL_MODEL compiler/src/build.d -ofgenerated/build.exe
generated/build.exe -j$N MODEL=$TOOL_MODEL HOST_DMD=$HOST_DC BUILD=debug "${disable_debug_for_unittests[@]}" unittest
generated/build.exe -j$N MODEL=$TOOL_MODEL HOST_DMD=$HOST_DC DFLAGS="-L-LARGEADDRESSAWARE" ENABLE_RELEASE=1 ENABLE_ASSERTS=1 dmd
DMD_BIN_PATH="$DMD_DIR/generated/windows/release/$TOOL_MODEL/dmd"
################################################################################
# Build Druntime and Phobos
@ -102,31 +111,34 @@ cd "$DMD_DIR/../phobos"
cd "$DMD_DIR/compiler/test"
# build run.d testrunner and its tools while host compiler is untampered
if [ "$MODEL" == "32omf" ] ; then
TOOL_MODEL=32;
else
TOOL_MODEL="$MODEL"
fi
"$HOST_DC" -m$TOOL_MODEL -g -i run.d
./run tools
# Rebuild dmd with ENABLE_COVERAGE for coverage tests
if [ "${DMD_TEST_COVERAGE:-0}" = "1" ] ; then
# Recompile debug dmd + unittests
rm -rf "$DMD_DIR/generated/windows"
DFLAGS="-L-LARGEADDRESSAWARE" ../../generated/build.exe --jobs=$N ENABLE_DEBUG=1 ENABLE_COVERAGE=1 dmd
DFLAGS="-L-LARGEADDRESSAWARE" ../../generated/build.exe --jobs=$N ENABLE_DEBUG=1 ENABLE_COVERAGE=1 unittest
../../generated/build.exe -j$N MODEL=$TOOL_MODEL DFLAGS="-L-LARGEADDRESSAWARE" ENABLE_DEBUG=1 ENABLE_COVERAGE=1 dmd
../../generated/build.exe -j$N MODEL=$TOOL_MODEL DFLAGS="-L-LARGEADDRESSAWARE" ENABLE_DEBUG=1 ENABLE_COVERAGE=1 unittest
fi
"$HOST_DC" -m$TOOL_MODEL -g -i run.d
if [ "$MODEL" == "32omf" ] ; then
# Pre-build the tools while the host compiler's sc.ini is untampered (see below).
./run tools
# WORKAROUND: Make Optlink use freshly built Phobos, not the host compiler's.
# Optlink apparently prefers LIB in sc.ini over the LIB env variable (and
# `-conf=` for DMD apparently doesn't prevent that, and there's apparently
# no sane way to specify a libdir for Optlink in the DMD cmdline).
# Optlink apparently prefers LIB in sc.ini (in the same dir as optlink.exe)
# over the LIB env variable (and `-conf=` for DMD apparently doesn't prevent
# that, and there's apparently no sane way to specify a libdir for Optlink
# in the DMD cmdline either).
rm "$DMD_DIR/tools/dmd2/windows/bin/sc.ini"
# We also need to remove LIB from the freshly built compiler's sc.ini -
# not all test invocations use `-conf=`.
sed -i 's|^LIB=.*$||g' "$DMD_DIR/generated/windows/release/$TOOL_MODEL/sc.ini"
# Okay, now the lib directories are controlled by the LIB env variable.
# run.d prepends the dir containing freshly built phobos.lib; we still need
# the DMC and Windows libs from the host compiler.
export LIB="$DMD_DIR/tools/dmd2/windows/lib"
fi
targets=("all")

View file

@ -10,7 +10,7 @@ steps:
@echo on
call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
bash --version
sh --login .azure-pipelines/windows.sh
bash --login .azure-pipelines/windows.sh
displayName: Build and test
# Try to upload the coverage files from the previous step to CodeCov

View file

@ -76,7 +76,7 @@ int binary(const(char)* p, const(char)* *table,int high)
version (X86asm)
{
alias len = high; // reuse parameter storage
asm nothrow
asm nothrow @nogc
{
// First find the length of the identifier.