CI: Adapt to generic Makefile for Phobos

This commit is contained in:
Martin Kinkelin 2023-12-13 23:08:56 +01:00 committed by Nicholas Wilson
parent f8ee42a18d
commit f3f89ca5b6
8 changed files with 20 additions and 81 deletions

View file

@ -18,15 +18,11 @@ set DMD=%DMD_DIR%\generated\Windows\%CONFIGURATION%\%PLATFORM%\dmd.exe
set VISUALD_INSTALLER=VisualD-%VISUALD_VER%.exe set VISUALD_INSTALLER=VisualD-%VISUALD_VER%.exe
set N=3 set N=3
set DM_MAKE=%DMD_DIR%\dm\path\make.exe
set LDC_DIR=%DMD_DIR%\ldc2-%LDC_VERSION%-windows-multilib set LDC_DIR=%DMD_DIR%\ldc2-%LDC_VERSION%-windows-multilib
if "%D_COMPILER%" == "ldc" set HOST_DMD=%LDC_DIR%\bin\ldmd2.exe if "%D_COMPILER%" == "ldc" set HOST_DMD=%LDC_DIR%\bin\ldmd2.exe
if "%D_COMPILER%" == "dmd" set HOST_DMD=%DMD_DIR%\dmd2\windows\bin\dmd.exe if "%D_COMPILER%" == "dmd" set HOST_DMD=%DMD_DIR%\dmd2\windows\bin\dmd.exe
set MSVC_CC=cl.exe
FOR /F "tokens=* USEBACKQ" %%F IN (`where lib.exe`) DO (SET MSVC_AR=%%~fsF)
REM add grep to PATH REM add grep to PATH
set PATH=%DMD_DIR%\tools;%PATH% set PATH=%DMD_DIR%\tools;%PATH%
echo %PATH% echo %PATH%
@ -48,10 +44,7 @@ echo [STEP]: Building druntime
make -j%N% -C "%DMD_DIR%\druntime" MODEL=%MODEL% "DMD=%DMD%" || exit /B 2 make -j%N% -C "%DMD_DIR%\druntime" MODEL=%MODEL% "DMD=%DMD%" || exit /B 2
echo [STEP]: Building phobos echo [STEP]: Building phobos
cd "%DMD_DIR%\..\phobos" make -j%N% -C "%DMD_DIR%\..\phobos" MODEL=%MODEL% "DMD=%DMD%" "DMD_DIR=%DMD_DIR%" || exit /B 3
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "AR=%MSVC_AR%" "MAKE=%DM_MAKE%" "DRUNTIME=%DMD_DIR%\druntime" "DRUNTIMELIB=%DMD_DIR%\generated\windows\release\%MODEL%\druntime.lib" || exit /B 3
:: The expected Phobos filename for 32-bit COFF is phobos32mscoff.lib, not phobos32.lib.
if "%MODEL%" == "32" ren phobos32.lib phobos32mscoff.lib || exit /B 3
echo [STEP]: Building run.d testrunner and its tools echo [STEP]: Building run.d testrunner and its tools
REM needs to be done before tampering with LIB and DFLAGS env variables (affecting the ldmd2 host compiler too) REM needs to be done before tampering with LIB and DFLAGS env variables (affecting the ldmd2 host compiler too)
@ -94,11 +87,11 @@ if not "%C_RUNTIME%" == "mingw" goto not_mingw
echo [STEP]: Building and running druntime tests echo [STEP]: Building and running druntime tests
cd "%DMD_DIR%\druntime" cd "%DMD_DIR%\druntime"
make -j%N% MODEL=%MODEL% "DMD=%DMD%" "CC=%MSVC_CC%" %DRUNTIME_TESTS_TARGET% || exit /B 5 make -j%N% MODEL=%MODEL% "DMD=%DMD%" %DRUNTIME_TESTS_TARGET% || exit /B 5
echo [STEP]: Running DMD testsuite echo [STEP]: Running DMD testsuite
cd "%DMD_DIR%\compiler\test" cd "%DMD_DIR%\compiler\test"
run.exe --environment --jobs=%N% %DMD_TESTS% "ARGS=-O -inline -g" "BUILD=%CONFIGURATION%" "DMD_MODEL=%PLATFORM%" "CC=%MSVC_CC%" || exit /B 6 run.exe --environment --jobs=%N% %DMD_TESTS% "ARGS=-O -inline -g" "BUILD=%CONFIGURATION%" "DMD_MODEL=%PLATFORM%" CC=cl.exe || exit /B 6
echo [STEP]: Building and running Phobos unittests echo [STEP]: Building and running Phobos unittests
rem FIXME: lld-link fails to link phobos unittests ("error: relocation against symbol in discarded section: __TMP2427") rem FIXME: lld-link fails to link phobos unittests ("error: relocation against symbol in discarded section: __TMP2427")
@ -108,4 +101,4 @@ if "%D_COMPILER%_%MODEL%" == "ldc_64" copy %LDC_DIR%\lib64\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "ldc_32" copy %LDC_DIR%\lib32\libcurl.dll . if "%D_COMPILER%_%MODEL%" == "ldc_32" copy %LDC_DIR%\lib32\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "dmd_64" copy %DMD_DIR%\dmd2\windows\bin64\libcurl.dll . if "%D_COMPILER%_%MODEL%" == "dmd_64" copy %DMD_DIR%\dmd2\windows\bin64\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "dmd_32" copy %DMD_DIR%\dmd2\windows\bin\libcurl.dll . if "%D_COMPILER%_%MODEL%" == "dmd_32" copy %DMD_DIR%\dmd2\windows\bin\libcurl.dll .
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "MAKE=%DM_MAKE%" "DRUNTIME=%DMD_DIR%\druntime" "DRUNTIMELIB=%DMD_DIR%\generated\windows\release\%MODEL%\druntime.lib" unittest || exit /B 7 make -j%N% MODEL=%MODEL% "DMD=%DMD%" "DMD_DIR=%DMD_DIR%" unittest || exit /B 7

View file

@ -40,19 +40,6 @@ visuald() {
fi fi
} }
################################################################################
# Download DigitalMars Make
################################################################################
dm_make() {
download "https://downloads.dlang.org/other/dm857c.zip" dmc.zip
unzip dmc.zip > /dev/null
export DMC="$PWD/dm/bin/dmc.exe"
export DM_MAKE="$PWD/dm/bin/make.exe"
mkdir -p dm/path
cp "$DMC" "$DM_MAKE" "dm/path"
}
if [ "$D_COMPILER" == "ldc" ]; then if [ "$D_COMPILER" == "ldc" ]; then
echo "[STEP]: Downloading LDC" echo "[STEP]: Downloading LDC"
ldc ldc
@ -64,9 +51,6 @@ fi
echo "[STEP]: Downloading VisualD" echo "[STEP]: Downloading VisualD"
visuald visuald
echo "[STEP]: Downloading DigitalMars make"
dm_make
echo "[STEP]: Downloading grep" echo "[STEP]: Downloading grep"
install_grep install_grep

View file

@ -26,17 +26,14 @@ echo "GREP_VERSION: $(grep --version)"
# Prepare DigitalMars make and C compiler # Prepare DigitalMars make and C compiler
################################################################################ ################################################################################
GNU_MAKE="$(which make)" # must be done before installing dmd (tampers with PATH) GNU_MAKE="$(which make)" # must be done before installing dmc (tampers with PATH)
install_host_dmc
DM_MAKE="$PWD/dm/bin/make.exe"
if [ "$MODEL" == "32omf" ] ; then if [ "$MODEL" == "32omf" ] ; then
install_host_dmc
CC="$PWD/dm/bin/dmc.exe" CC="$PWD/dm/bin/dmc.exe"
AR="$PWD/dm/bin/lib.exe"
export CPPCMD="$PWD/dm/bin/sppn.exe" export CPPCMD="$PWD/dm/bin/sppn.exe"
else else
CC="cl.exe" CC="cl.exe"
AR="$(where lib.exe)" # must be done before installing dmd
fi fi
################################################################################ ################################################################################
@ -98,16 +95,9 @@ DMD_BIN_PATH="$DMD_DIR/generated/windows/release/$TOOL_MODEL/dmd.exe"
# Build Druntime and Phobos # Build Druntime and Phobos
################################################################################ ################################################################################
LIBS_MAKE_ARGS=(-f "$MAKE_FILE" MODEL=$MODEL DMD="$DMD_BIN_PATH" VCDIR=. CC="$CC" AR="$AR" MAKE="$DM_MAKE")
"$GNU_MAKE" -j$N -C "$DMD_DIR/druntime" MODEL=$MODEL DMD="$DMD_BIN_PATH" "$GNU_MAKE" -j$N -C "$DMD_DIR/druntime" MODEL=$MODEL DMD="$DMD_BIN_PATH"
cd "$DMD_DIR/../phobos" "$GNU_MAKE" -j$N -C "$DMD_DIR/../phobos" MODEL=$MODEL DMD="$DMD_BIN_PATH" CC="$CC" DMD_DIR="$DMD_DIR"
"$DM_MAKE" "${LIBS_MAKE_ARGS[@]}" DRUNTIME="$DMD_DIR\druntime" DRUNTIMELIB="$DMD_DIR/generated/windows/release/$MODEL/druntime.lib"
if [[ "$MODEL" == "32" ]]; then
# the expected Phobos filename for 32-bit COFF is phobos32mscoff.lib, not phobos32.lib
mv phobos32.lib phobos32mscoff.lib
fi
################################################################################ ################################################################################
# Run DMD testsuite # Run DMD testsuite
@ -183,7 +173,7 @@ else
else else
cp "$DMD_DIR/tools/dmd2/windows/bin/libcurl.dll" . cp "$DMD_DIR/tools/dmd2/windows/bin/libcurl.dll" .
fi fi
"$DM_MAKE" "${LIBS_MAKE_ARGS[@]}" DRUNTIME="$DMD_DIR\druntime" DRUNTIMELIB="$DMD_DIR/generated/windows/release/$MODEL/druntime.lib" unittest "$GNU_MAKE" -j$N MODEL=$MODEL DMD="$DMD_BIN_PATH" CC="$CC" DMD_DIR="$DMD_DIR" unittest
fi fi
################################################################################ ################################################################################

View file

@ -118,7 +118,7 @@ coverage()
# build dmd, druntime, and phobos # build dmd, druntime, and phobos
$builder MODEL=$MODEL HOST_DMD=$DMD BUILD=$BUILD all $builder MODEL=$MODEL HOST_DMD=$DMD BUILD=$BUILD all
make -j$N -C druntime MODEL=$MODEL BUILD=$BUILD make -j$N -C druntime MODEL=$MODEL BUILD=$BUILD
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL BUILD=$BUILD make -j$N -C ../phobos MODEL=$MODEL BUILD=$BUILD
# save the built dmd as host compiler this time # save the built dmd as host compiler this time
# `generated` gets removed in 'clean', so we create another _generated # `generated` gets removed in 'clean', so we create another _generated
@ -190,7 +190,7 @@ test_cxx()
echo "Test CXX frontend.h header generation" echo "Test CXX frontend.h header generation"
./compiler/src/build.d ./compiler/src/build.d
make -j$N -C druntime MODEL=$MODEL BUILD=$BUILD make -j$N -C druntime MODEL=$MODEL BUILD=$BUILD
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL BUILD=$BUILD make -j$N -C ../phobos MODEL=$MODEL BUILD=$BUILD
./compiler/src/build.d cxx-headers-test ./compiler/src/build.d cxx-headers-test
deactivate deactivate
} }

View file

@ -277,31 +277,6 @@ jobs:
exit 1 exit 1
fi fi
# Restore or install dmc (and DM make)
- name: '[Windows] Restore dmc from cache'
id: cache-dmc
if: runner.os == 'Windows'
uses: actions/cache@v3
with:
path: ${{ github.workspace }}\tools\
key: ${{ matrix.os }}-dmc857
- name: '[Windows] Install dmc'
if: runner.os == 'Windows' && steps.cache-dmc.outputs.cache-hit != 'true'
shell: powershell
run: |
$url = "http://ftp.digitalmars.com/Digital_Mars_C++/Patch/dm857c.zip"
$sha256hash = "F51CDFEB45EAF4FFBF7ABF0FE9B3D548B202B4528401005C2C3192B00BC32367"
Write-Host ('Downloading {0} ...' -f $url)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$ProgressPreference = 'SilentlyContinue'
New-Item -ItemType directory -Path ${{ github.workspace }}\tools\
Invoke-WebRequest -Uri $url -OutFile '${{ github.workspace }}\tools\dmc.zip'
if ((Get-FileHash '${{ github.workspace }}\tools\dmc.zip' -Algorithm "SHA256").Hash -ne $sha256hash) {
exit 1
}
Expand-Archive '${{ github.workspace }}\tools\dmc.zip' -DestinationPath ${{ github.workspace }}\tools\
- name: '[Windows] Add VC toolset to PATH' - name: '[Windows] Add VC toolset to PATH'
if: runner.os == 'Windows' if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1
@ -310,10 +285,7 @@ jobs:
if: runner.os == 'Windows' if: runner.os == 'Windows'
shell: bash shell: bash
run: | run: |
echo "VISUAL_STUDIO_LIB_NOT_DM=$(which lib.exe)" >> $GITHUB_ENV
echo "HOST_DMD=${{ env.DC }}" >> $GITHUB_ENV echo "HOST_DMD=${{ env.DC }}" >> $GITHUB_ENV
echo "GNU_MAKE=$(which make.exe)" >> $GITHUB_ENV
echo "${{ github.workspace }}/tools/dm/bin/" >> $GITHUB_PATH
######################################## ########################################
# Building DMD, druntime, Phobos # # Building DMD, druntime, Phobos #
@ -326,13 +298,13 @@ jobs:
# All hosts are 64 bits but let's be explicit # All hosts are 64 bits but let's be explicit
./dmd/compiler/src/build.d -j2 MODEL=64 ./dmd/compiler/src/build.d -j2 MODEL=64
make -C dmd/druntime -j2 MODEL=64 make -C dmd/druntime -j2 MODEL=64
make -C phobos -f posix.mak -j2 MODEL=64 make -C phobos -j2 MODEL=64
# Both version can live side by side (they end up in a different directory) # Both version can live side by side (they end up in a different directory)
# However, since clang does not provide a multilib package, only test 32 bits with g++ # However, since clang does not provide a multilib package, only test 32 bits with g++
if [ ${{ matrix.compiler }} == "g++" ]; then if [ ${{ matrix.compiler }} == "g++" ]; then
./dmd/compiler/src/build.d install -j2 MODEL=32 ./dmd/compiler/src/build.d install -j2 MODEL=32
make -C dmd/druntime install -j2 MODEL=32 make -C dmd/druntime install -j2 MODEL=32
make -C phobos -f posix.mak install -j2 MODEL=32 make -C phobos install -j2 MODEL=32
fi fi
- name: '[Windows] Build compiler & standard library' - name: '[Windows] Build compiler & standard library'
@ -344,12 +316,10 @@ jobs:
# Note: Only CC for druntime and AR for Phobos are required ATM, # Note: Only CC for druntime and AR for Phobos are required ATM,
# but providing all three to avoid surprise for future contributors # but providing all three to avoid surprise for future contributors
# Those should really be in the path, though. # Those should really be in the path, though.
"$GNU_MAKE" -j2 -C dmd/druntime make -j2 -C dmd/druntime
if [ $? -ne 0 ]; then return 1; fi if [ $? -ne 0 ]; then return 1; fi
cd phobos/ make -j2 -C phobos
make -f win64.mak CC=cl.exe LD=link "AR=$VISUAL_STUDIO_LIB_NOT_DM" "DRUNTIMELIB=../dmd/generated/windows/release/64/druntime.lib"
if [ $? -ne 0 ]; then return 1; fi if [ $? -ne 0 ]; then return 1; fi
cd ../
######################################## ########################################
# Running the test suite # # Running the test suite #
@ -370,7 +340,7 @@ jobs:
if: runner.os == 'Windows' if: runner.os == 'Windows'
shell: bash shell: bash
run: | run: |
"$GNU_MAKE" -j2 -C dmd/druntime test/stdcpp/.run CC=cl.exe LD=link "AR=$VISUAL_STUDIO_LIB_NOT_DM" make -j2 -C dmd/druntime test/stdcpp/.run
if [ $? -ne 0 ]; then return 1; fi if [ $? -ne 0 ]; then return 1; fi
######################################## ########################################

View file

@ -63,7 +63,7 @@ build() {
generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" BUILD=debug unittest generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" BUILD=debug unittest
generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=1 dmd generated/build -j$N MODEL=$MODEL HOST_DMD=$DMD DFLAGS="$CI_DFLAGS" ENABLE_RELEASE=1 dmd
make -j$N -C druntime MODEL=$MODEL make -j$N -C druntime MODEL=$MODEL
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL make -j$N -C ../phobos MODEL=$MODEL
deactivate # deactivate host compiler deactivate # deactivate host compiler
} }
@ -119,7 +119,7 @@ test_druntime() {
# build and run Phobos unit tests # build and run Phobos unit tests
test_phobos() { test_phobos() {
make -j$N -C ../phobos -f posix.mak MODEL=$MODEL unittest make -j$N -C ../phobos MODEL=$MODEL unittest
} }
# test dub package # test dub package

View file

@ -576,7 +576,7 @@ alias dmdPGO = makeRule!((builder, rule) {
// Run phobos unittests // Run phobos unittests
//TODO makefiles //TODO makefiles
//generated/linux/release/64/unittest/test_runner builds the unittests without running them. //generated/linux/release/64/unittest/test_runner builds the unittests without running them.
const scope cmd = ["make", "-C", "../phobos", "-j" ~ jobs.to!string, "-fposix.mak", "generated/linux/release/64/unittest/test_runner", "DMD_DIR="~compilerDir]; const scope cmd = ["make", "-C", "../phobos", "-j" ~ jobs.to!string, "generated/linux/release/64/unittest/test_runner", "DMD_DIR="~compilerDir];
log("%-(%s %)", cmd); log("%-(%s %)", cmd);
if (spawnProcess(cmd, null, Config.init, compilerDir).wait()) if (spawnProcess(cmd, null, Config.init, compilerDir).wait())
stderr.writeln("Phobos Tests failed! This will not end the PGO build because some data may have been gathered"); stderr.writeln("Phobos Tests failed! This will not end the PGO build because some data may have been gathered");

View file

@ -375,6 +375,8 @@ void setDefaultLibrary(ref Param params, const ref Target target)
if (driverParams.debuglibname is null) if (driverParams.debuglibname is null)
driverParams.debuglibname = driverParams.defaultlibname; driverParams.debuglibname = driverParams.defaultlibname;
else if (!driverParams.debuglibname.length) // if `-debuglib=` (i.e. an empty debuglib)
driverParams.debuglibname = null;
} }
void printPredefinedVersions(FILE* stream) void printPredefinedVersions(FILE* stream)