Commit 3ae83da1 authored by Alp Mestanogullari's avatar Alp Mestanogullari Committed by Marge Bot

hadrian: Windows fixes (bindists, CI)

This commit implements a few Windows-specific fixes which get us from a CI
job that can't even get as far as starting the testsuite driver, to a state
where we can run the entire testssuite (but have test failures to fix).

- Don't forget about a potential extension for the haddock program, when
  preparing the bindist.
- Build the timeout program, used by the testsuite driver on Windows in place
  of the Python script used elsewhere, using the boot compiler. We could
  alternatively build it with the compiler that we're going to test but this
  would be a lot more tedious to write.
- Implement a wrapper-script less installation procedure for Windows, in
  `hadrian/bindist/Makefile.
- Make dependencies a bit more accurate in the aforementioned Makefile.
- Update Windows/Hadrian CI job accordingly.

This patch fixes #17486.
parent a906595f
Pipeline #15580 failed with stages
in 454 minutes and 7 seconds
...@@ -816,12 +816,10 @@ validate-x86_64-linux-fedora27: ...@@ -816,12 +816,10 @@ validate-x86_64-linux-fedora27:
- | - |
python boot python boot
bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex' bash -c './configure --enable-tarballs-autodownload GHC=`pwd`/toolchain/bin/ghc HAPPY=`pwd`/toolchain/bin/happy ALEX=`pwd`/toolchain/bin/alex'
- bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh --flavour=$FLAVOUR -j`mk/detect-cpu-count.sh` --flavour=Quick --docs=no-sphinx binary-dist" - bash -c "PATH=`pwd`/toolchain/bin:$PATH hadrian/build.cabal.sh --flavour=$FLAVOUR -j`mk/detect-cpu-count.sh` --docs=no-sphinx binary-dist"
- mv _build/bindist/ghc*.tar.xz ghc.tar.xz - mv _build/bindist/ghc*.tar.xz ghc.tar.xz
- bash -c "export TOP=$(pwd); cd _build/bindist/ghc-*/ && PATH=$TOP/toolchain/bin:$PATH ./configure --prefix=$TOP/_build/install && make install && cd ../../../" - bash -c "export TOP=$(pwd); cd _build/bindist/ghc-*/ && PATH=$TOP/toolchain/bin:$PATH ./configure --prefix=$TOP/_build/install && make install && cd ../../../"
- bash -c "export TOP=$(pwd); PATH=$TOP/toolchain/bin:$PATH hadrian/build.cabal.sh --flavour=$FLAVOUR -j`mk/detect-cpu-count.sh` --flavour=quick test --summary-junit=./junit.xml --skip-perf --test-compiler=$TOP/_build/install/bin/ghc" - bash -c "export TOP=$(pwd); PATH=$TOP/toolchain/bin:$PATH hadrian/build.cabal.sh --flavour=$FLAVOUR -j`mk/detect-cpu-count.sh` test --summary-junit=./junit.xml --test-compiler=$TOP/_build/install/bin/ghc"
# skipping perf tests for now since we build a quick-flavoured GHC,
# which might result in some broken perf tests?
tags: tags:
- x86_64-windows - x86_64-windows
artifacts: artifacts:
...@@ -835,6 +833,7 @@ validate-x86_64-linux-fedora27: ...@@ -835,6 +833,7 @@ validate-x86_64-linux-fedora27:
validate-x86_64-windows-hadrian: validate-x86_64-windows-hadrian:
extends: .build-windows-hadrian extends: .build-windows-hadrian
stage: full-build
variables: variables:
MSYSTEM: MINGW64 MSYSTEM: MINGW64
TEST_ENV: "x86_64-windows-hadrian" TEST_ENV: "x86_64-windows-hadrian"
......
...@@ -71,23 +71,38 @@ endef ...@@ -71,23 +71,38 @@ endef
.PHONY: install .PHONY: install
install: install_lib install_bin install_includes
install: install_docs install_wrappers install_ghci ifeq "$(TargetOS_CPP)" "mingw32"
install: install_mingw update_package_db install_bin: install_mingw install_bin_direct
else
install_bin: install_bin_libdir install_wrappers
endif
install: install_bin install_lib install_includes
install: install_docs install_ghci update_package_db
ActualBinsDir=${ghclibdir}/bin ActualBinsDir=${ghclibdir}/bin
ifeq "$(TargetOS_CPP)" "mingw32"
ActualLibsDir=${ghclibdir}
else
ActualLibsDir=${ghclibdir}/lib ActualLibsDir=${ghclibdir}/lib
endif
WrapperBinsDir=${bindir} WrapperBinsDir=${bindir}
# We need to install binaries relative to libraries. # We need to install binaries relative to libraries.
BINARIES = $(wildcard ./bin/*) BINARIES = $(wildcard ./bin/*)
install_bin: install_bin_libdir:
@echo "Copying binaries to $(ActualBinsDir)" @echo "Copying binaries to $(ActualBinsDir)"
$(INSTALL_DIR) "$(ActualBinsDir)" $(INSTALL_DIR) "$(ActualBinsDir)"
for i in $(BINARIES); do \ for i in $(BINARIES); do \
cp -R $$i "$(ActualBinsDir)"; \ cp -R $$i "$(ActualBinsDir)"; \
done done
install_bin_direct:
@echo "Copying binaries to $(WrapperBinsDir)"
$(INSTALL_DIR) "$(WrapperBinsDir)"
cp ./bin/* "$(WrapperBinsDir)/"
install_ghci: install_ghci:
@echo "Copying and installing ghci" @echo "Copying and installing ghci"
$(CREATE_SCRIPT) '$(WrapperBinsDir)/ghci' $(CREATE_SCRIPT) '$(WrapperBinsDir)/ghci'
...@@ -105,7 +120,7 @@ install_lib: ...@@ -105,7 +120,7 @@ install_lib:
INCLUDES = $(wildcard ./include/*) INCLUDES = $(wildcard ./include/*)
install_includes: install_includes:
@echo "Copying libraries to $(includedir)" @echo "Copying include files to $(includedir)"
$(INSTALL_DIR) "$(includedir)" $(INSTALL_DIR) "$(includedir)"
for i in $(INCLUDES); do \ for i in $(INCLUDES); do \
cp -R $$i "$(includedir)/"; \ cp -R $$i "$(includedir)/"; \
...@@ -113,34 +128,30 @@ install_includes: ...@@ -113,34 +128,30 @@ install_includes:
DOCS = $(wildcard ./docs/*) DOCS = $(wildcard ./docs/*)
install_docs: install_docs:
@echo "Copying libraries to $(docdir)" @echo "Copying docs to $(docdir)"
$(INSTALL_DIR) "$(docdir)" $(INSTALL_DIR) "$(docdir)"
for i in $(DOCS); do \ for i in $(DOCS); do \
cp -R $$i "$(docdir)/"; \ cp -R $$i "$(docdir)/"; \
done done
BINARY_NAMES=$(shell ls ./wrappers/) BINARY_NAMES=$(shell ls ./wrappers/)
install_wrappers: install_wrappers: install_bin_libdir
@echo "Installing Wrapper scripts" @echo "Installing wrapper scripts"
$(INSTALL_DIR) "$(WrapperBinsDir)" $(INSTALL_DIR) "$(WrapperBinsDir)"
$(foreach p, $(BINARY_NAMES),\ $(foreach p, $(BINARY_NAMES),\
$(call installscript,$p,$(WrapperBinsDir)/$p,$(WrapperBinsDir),$(ActualBinsDir),$(ActualBinsDir)/$p,$(ActualLibsDir),$(docdir),$(includedir))) $(call installscript,$p,$(WrapperBinsDir)/$p,$(WrapperBinsDir),$(ActualBinsDir),$(ActualBinsDir)/$p,$(ActualLibsDir),$(docdir),$(includedir)))
PKG_CONFS = $(shell find "$(ActualLibsDir)/package.conf.d" -name '*.conf' | sed 's: :xxx:g') PKG_CONFS = $(shell find "$(ActualLibsDir)/package.conf.d" -name '*.conf' | sed 's: :xxx:g')
update_package_db: update_package_db: install_bin install_lib
@echo "$(PKG_CONFS)" @echo "$(PKG_CONFS)"
@echo "Updating the package DB" @echo "Updating the package DB"
$(foreach p, $(PKG_CONFS),\ $(foreach p, $(PKG_CONFS),\
$(call patchpackageconf,$(shell echo $(notdir $p) | sed 's/-\([0-9]*[0-9]\.\)*conf//g'),$(shell echo "$p" | sed 's:xxx: :g'),$(docdir),$(shell realpath --relative-to="$(libdir)" "$(docdir)"))) $(call patchpackageconf,$(shell echo $(notdir $p) | sed 's/-\([0-9]*[0-9]\.\)*conf//g'),$(shell echo "$p" | sed 's:xxx: :g'),$(docdir),$(shell realpath --relative-to="$(libdir)" "$(docdir)")))
'$(WrapperBinsDir)/ghc-pkg' recache '$(WrapperBinsDir)/ghc-pkg' recache
# The 'foreach' that copies the mingw directory will only trigger a copy
# when the wildcard matches, therefore only on Windows.
MINGW = $(wildcard ./mingw)
install_mingw: install_mingw:
@echo "Installing MingGW" @echo "Installing MingGW"
$(INSTALL_DIR) "$(prefix)/mingw" $(INSTALL_DIR) "$(prefix)/mingw"
$(foreach d, $(MINGW),\ cp -R ./mingw "$(prefix)"
cp -R ./mingw "$(prefix)")
# END INSTALL # END INSTALL
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
...@@ -136,10 +136,11 @@ bindistRules = do ...@@ -136,10 +136,11 @@ bindistRules = do
-- shipping it -- shipping it
removeFile (bindistFilesDir -/- mingwStamp) removeFile (bindistFilesDir -/- mingwStamp)
-- We copy the binary (<build root>/stage1/bin/haddock) to -- We copy the binary (<build root>/stage1/bin/haddock[.exe]) to
-- the bindist's bindir (<build root>/bindist/ghc-.../bin/). -- the bindist's bindir (<build root>/bindist/ghc-.../bin/).
haddockPath <- programPath (vanillaContext Stage1 haddock) haddockPath <- programPath (vanillaContext Stage1 haddock)
copyFile haddockPath (bindistFilesDir -/- "bin" -/- "haddock") copyFile haddockPath
(bindistFilesDir -/- "bin" -/- takeFileName haddockPath)
-- We then 'need' all the files necessary to configure and install -- We then 'need' all the files necessary to configure and install
-- (as in, './configure [...] && make install') this build on some -- (as in, './configure [...] && make install') this build on some
......
...@@ -140,7 +140,7 @@ timeoutProgBuilder = do ...@@ -140,7 +140,7 @@ timeoutProgBuilder = do
root <- buildRoot root <- buildRoot
if windowsHost if windowsHost
then do then do
prog <- programPath =<< programContext Stage1 timeout prog <- programPath =<< programContext Stage0 timeout
copyFile prog (root -/- timeoutPath) copyFile prog (root -/- timeoutPath)
else do else do
python <- builderPath Python python <- builderPath Python
...@@ -154,12 +154,12 @@ timeoutProgBuilder = do ...@@ -154,12 +154,12 @@ timeoutProgBuilder = do
needTestBuilders :: Action () needTestBuilders :: Action ()
needTestBuilders = do needTestBuilders = do
testGhc <- testCompiler <$> userSetting defaultTestArgs testGhc <- testCompiler <$> userSetting defaultTestArgs
when (testGhc `elem` ["stage1", "stage2", "stage3"]) needTestsuitePackages when (testGhc `elem` ["stage1", "stage2", "stage3"])
(needTestsuitePackages testGhc)
-- | Build extra programs and libraries required by testsuite -- | Build extra programs and libraries required by testsuite
needTestsuitePackages :: Action () needTestsuitePackages :: String -> Action ()
needTestsuitePackages = do needTestsuitePackages testGhc = do
testGhc <- testCompiler <$> userSetting defaultTestArgs
when (testGhc `elem` ["stage1", "stage2", "stage3"]) $ do when (testGhc `elem` ["stage1", "stage2", "stage3"]) $ do
let stg = stageOf testGhc let stg = stageOf testGhc
allpkgs <- packages <$> flavour allpkgs <- packages <$> flavour
......
...@@ -76,6 +76,7 @@ stage0Packages = do ...@@ -76,6 +76,7 @@ stage0Packages = do
, transformers , transformers
, unlit ] , unlit ]
++ [ terminfo | not windowsHost, not cross ] ++ [ terminfo | not windowsHost, not cross ]
++ [ timeout | windowsHost ]
++ [ touchy | windowsHost ] ++ [ touchy | windowsHost ]
-- | Packages built in 'Stage1' by default. You can change this in "UserSettings". -- | Packages built in 'Stage1' by default. You can change this in "UserSettings".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment