Cheng Shao pushed to branch wip/ci-make-install-j at Glasgow Haskell Compiler / GHC
Commits:
-
1d0021cb
by Cheng Shao at 2026-07-16T15:45:19+00:00
-
b0ada958
by Cheng Shao at 2026-07-16T15:45:19+00:00
-
06850ecf
by Cheng Shao at 2026-07-16T15:45:19+00:00
4 changed files:
Changes:
| ... | ... | @@ -499,7 +499,7 @@ hadrian-multi: |
| 499 | 499 | || tar -xf ghc-x86_64-linux-deb13-release.tar.xz -C tmp
|
| 500 | 500 | pushd tmp/ghc-*/
|
| 501 | 501 | ./configure --prefix=$root
|
| 502 | - make install
|
|
| 502 | + make install -j$CPUS
|
|
| 503 | 503 | popd
|
| 504 | 504 | rm -Rf tmp
|
| 505 | 505 | - export HC=$root/bin/ghc
|
| ... | ... | @@ -1005,7 +1005,7 @@ perf-nofib: |
| 1005 | 1005 | tar -xf ../ghc-x86_64-linux-fedora43-release.tar.xz -C tmp
|
| 1006 | 1006 | pushd tmp/ghc-*/
|
| 1007 | 1007 | ./configure --prefix=$root
|
| 1008 | - make install
|
|
| 1008 | + make install -j$CPUS
|
|
| 1009 | 1009 | popd
|
| 1010 | 1010 | rm -Rf tmp
|
| 1011 | 1011 | - export PATH=$root/bin:$PATH
|
| ... | ... | @@ -1047,7 +1047,7 @@ perf: |
| 1047 | 1047 | || tar -xf ghc-x86_64-linux-deb13-release.tar.xz -C tmp
|
| 1048 | 1048 | pushd tmp/ghc-*/
|
| 1049 | 1049 | ./configure --prefix=$root
|
| 1050 | - make install
|
|
| 1050 | + make install -j$CPUS
|
|
| 1051 | 1051 | popd
|
| 1052 | 1052 | rm -Rf tmp
|
| 1053 | 1053 | - export BOOT_HC=$(which ghc)
|
| ... | ... | @@ -1068,7 +1068,7 @@ perf: |
| 1068 | 1068 | abi-test:
|
| 1069 | 1069 | stage: testing
|
| 1070 | 1070 | needs:
|
| 1071 | - - job: x86_64-linux-deb13-validate
|
|
| 1071 | + - job: x86_64-linux-deb13-numa-slow-validate
|
|
| 1072 | 1072 | optional: true
|
| 1073 | 1073 | - job: nightly-x86_64-linux-deb13-validate
|
| 1074 | 1074 | optional: true
|
| ... | ... | @@ -1083,11 +1083,12 @@ abi-test: |
| 1083 | 1083 | - root=$(pwd)/ghc
|
| 1084 | 1084 | - |
|
| 1085 | 1085 | mkdir tmp
|
| 1086 | - tar -xf ghc-x86_64-linux-deb13-validate.tar.xz -C tmp \
|
|
| 1086 | + tar -xf ghc-x86_64-linux-deb13-numa-slow-validate.tar.xz -C tmp \
|
|
| 1087 | + || tar -xf ghc-x86_64-linux-deb13-validate.tar.xz -C tmp \
|
|
| 1087 | 1088 | || tar -xf ghc-x86_64-linux-deb13-release.tar.xz -C tmp
|
| 1088 | 1089 | pushd tmp/ghc-*/
|
| 1089 | 1090 | ./configure --prefix=$root
|
| 1090 | - make install
|
|
| 1091 | + make install -j$CPUS
|
|
| 1091 | 1092 | popd
|
| 1092 | 1093 | rm -Rf tmp
|
| 1093 | 1094 | - export BOOT_HC=$(which ghc)
|
| ... | ... | @@ -605,7 +605,7 @@ function make_install_destdir() { |
| 605 | 605 | |
| 606 | 606 | mkdir -p "$destdir"
|
| 607 | 607 | mkdir -p "$instdir"
|
| 608 | - run "$MAKE" DESTDIR="$destdir" install || fail "make install failed"
|
|
| 608 | + run "$MAKE" DESTDIR="$destdir" install -j"$cores" || fail "make install failed"
|
|
| 609 | 609 | # check for empty dir portably
|
| 610 | 610 | # https://superuser.com/a/667100
|
| 611 | 611 | if find "$instdir" -mindepth 1 -maxdepth 1 | read; then
|
| ... | ... | @@ -899,8 +899,8 @@ function save_cache () { |
| 899 | 899 | if [[ "${CI_JOB_NAME}" == *"darwin"* ]]; then
|
| 900 | 900 | # -a makes APFS behave like a COW file system
|
| 901 | 901 | # From man CP(1)
|
| 902 | - # copy files using clonefile(2).
|
|
| 903 | - # Note that if clonefile(2) is not supported for the target filesystem,
|
|
| 902 | + # copy files using clonefile(2).
|
|
| 903 | + # Note that if clonefile(2) is not supported for the target filesystem,
|
|
| 904 | 904 | # then cp will fallback to using copyfile(2) instead to ensure the copy still succeeds.
|
| 905 | 905 | cp -Rcf "$CABAL_DIR" "$CABAL_CACHE"
|
| 906 | 906 | else
|
| 1 | +section: packaging
|
|
| 2 | +synopsis: Fix race condition in bindist make install -j on macos/freebsd
|
|
| 3 | +issues: #27499
|
|
| 4 | +mrs: !15707 |
| ... | ... | @@ -97,12 +97,26 @@ lib/targets/default.target : config.mk default.target |
| 97 | 97 | @echo "Copying the bindist-configured default.target to lib/targets/default.target"
|
| 98 | 98 | cp default.target $@
|
| 99 | 99 | |
| 100 | +# sequentially create one layer of subdirectories under DESTDIR, then
|
|
| 101 | +# subsequent install_* jobs can happen concurrently without bsd
|
|
| 102 | +# install race condition. required for make install -j to work on
|
|
| 103 | +# macos/freebsd, see #27499.
|
|
| 104 | +.PHONY: install_dirs
|
|
| 105 | +install_dirs:
|
|
| 106 | + $(INSTALL_DIR) "$(DESTDIR)$(prefix)"
|
|
| 107 | + $(INSTALL_DIR) "$(DESTDIR)$(ActualBinsDir)"
|
|
| 108 | + $(INSTALL_DIR) "$(DESTDIR)$(WrapperBinsDir)"
|
|
| 109 | + $(INSTALL_DIR) "$(DESTDIR)$(ActualLibsDir)"
|
|
| 110 | + $(INSTALL_DIR) "$(DESTDIR)$(mandir)"
|
|
| 111 | + $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
|
|
| 112 | + $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
|
|
| 113 | + |
|
| 100 | 114 | # We need to install binaries relative to libraries.
|
| 101 | 115 | BINARIES = $(wildcard ./bin/*)
|
| 102 | 116 | .PHONY: install_bin_libdir
|
| 103 | -install_bin_libdir:
|
|
| 117 | +install_bin_libdir: install_dirs
|
|
| 104 | 118 | @echo "Copying binaries to $(DESTDIR)$(ActualBinsDir)"
|
| 105 | - $(INSTALL_DIR) "$(DESTDIR)$(ActualBinsDir)"
|
|
| 119 | + |
|
| 106 | 120 | for i in $(BINARIES); do \
|
| 107 | 121 | if test -L "$$i"; then \
|
| 108 | 122 | cp -RP "$$i" "$(DESTDIR)$(ActualBinsDir)"; \
|
| ... | ... | @@ -112,15 +126,14 @@ install_bin_libdir: |
| 112 | 126 | done
|
| 113 | 127 | |
| 114 | 128 | .PHONY: install_bin_direct
|
| 115 | -install_bin_direct:
|
|
| 129 | +install_bin_direct: install_dirs
|
|
| 116 | 130 | @echo "Copying binaries to $(DESTDIR)$(WrapperBinsDir)"
|
| 117 | - $(INSTALL_DIR) "$(DESTDIR)$(WrapperBinsDir)"
|
|
| 131 | + |
|
| 118 | 132 | $(INSTALL_PROGRAM) ./bin/* "$(DESTDIR)$(WrapperBinsDir)/"
|
| 119 | 133 | |
| 120 | 134 | .PHONY: install_lib
|
| 121 | -install_lib: lib/settings lib/targets/default.target
|
|
| 135 | +install_lib: install_dirs lib/settings lib/targets/default.target
|
|
| 122 | 136 | @echo "Copying libraries to $(DESTDIR)$(ActualLibsDir)"
|
| 123 | - $(INSTALL_DIR) "$(DESTDIR)$(ActualLibsDir)"
|
|
| 124 | 137 | |
| 125 | 138 | @dest="$(DESTDIR)$(ActualLibsDir)"; \
|
| 126 | 139 | cd ./lib; \
|
| ... | ... | @@ -146,9 +159,8 @@ install_lib: lib/settings lib/targets/default.target |
| 146 | 159 | done; \
|
| 147 | 160 | |
| 148 | 161 | .PHONY: install_docs
|
| 149 | -install_docs:
|
|
| 162 | +install_docs: install_dirs
|
|
| 150 | 163 | @echo "Copying docs to $(DESTDIR)$(docdir)"
|
| 151 | - $(INSTALL_DIR) "$(DESTDIR)$(docdir)"
|
|
| 152 | 164 | |
| 153 | 165 | if [ -d doc ]; then \
|
| 154 | 166 | cd ./doc; $(FIND) . -type f -exec sh -c \
|
| ... | ... | @@ -163,9 +175,9 @@ install_docs: |
| 163 | 175 | fi
|
| 164 | 176 | |
| 165 | 177 | .PHONY: install_data
|
| 166 | -install_data:
|
|
| 178 | +install_data: install_dirs
|
|
| 167 | 179 | @echo "Copying data to $(DESTDIR)share"
|
| 168 | - $(INSTALL_DIR) "$(DESTDIR)$(datadir)"
|
|
| 180 | + |
|
| 169 | 181 | if [ -d share ]; then \
|
| 170 | 182 | cd ./share; $(FIND) . -type f -exec sh -c \
|
| 171 | 183 | '$(INSTALL_DIR) "$(DESTDIR)$(datadir)/`dirname $$1`" && \
|
| ... | ... | @@ -177,18 +189,17 @@ MAN_SECTION := 1 |
| 177 | 189 | MAN_PAGES := manpage/ghc.1
|
| 178 | 190 | |
| 179 | 191 | .PHONY: install_man
|
| 180 | -install_man:
|
|
| 192 | +install_man: install_dirs
|
|
| 181 | 193 | if [ -f $(MAN_PAGES) ]; then \
|
| 182 | - $(INSTALL_DIR) "$(DESTDIR)$(mandir)"; \
|
|
| 183 | 194 | $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)"; \
|
| 184 | 195 | $(INSTALL_MAN) $(INSTALL_OPTS) $(MAN_PAGES) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)"; \
|
| 185 | 196 | fi
|
| 186 | 197 | |
| 187 | 198 | export SHELL
|
| 188 | 199 | .PHONY: install_wrappers
|
| 189 | -install_wrappers: install_bin_libdir install_hsc2hs_wrapper
|
|
| 200 | +install_wrappers: install_dirs install_bin_libdir install_hsc2hs_wrapper
|
|
| 190 | 201 | @echo "Installing wrapper scripts"
|
| 191 | - $(INSTALL_DIR) "$(DESTDIR)$(WrapperBinsDir)"
|
|
| 202 | + |
|
| 192 | 203 | for p in `cd ./wrappers; $(FIND) . ! -type d`; do \
|
| 193 | 204 | mk/install_script.sh "$$p" "$(DESTDIR)/$(WrapperBinsDir)/$$p" "$(WrapperBinsDir)" "$(ActualBinsDir)" "$(ActualBinsDir)/$$p" "$(ActualLibsDir)" "$(docdir)" "$(includedir)"; \
|
| 194 | 205 | done
|