[Git][ghc/ghc][master] 4 commits: hadrian/bindist: Ensure that phony rules are marked as such
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Feb 21 09:59:53 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
d04f384f by Ben Gamari at 2024-02-21T04:59:23-05:00
hadrian/bindist: Ensure that phony rules are marked as such
Otherwise make may not run the rule if file with the same name as the
rule happens to exist.
- - - - -
efcbad2d by Ben Gamari at 2024-02-21T04:59:23-05:00
hadrian: Generate HSC2HS_EXTRAS variable in bindist installation
We must generate the hsc2hs wrapper at bindist installation time since
it must contain `--lflag` and `--cflag` arguments which depend upon the
installation path.
The solution here is to substitute these variables in the configure
script (see mk/hsc2hs.in). This is then copied over a dummy wrapper in
the install rules.
Fixes #24050.
- - - - -
c540559c by Matthew Pickering at 2024-02-21T04:59:23-05:00
ci: Show --info for installed compiler
- - - - -
ab9281a2 by Matthew Pickering at 2024-02-21T04:59:23-05:00
configure: Correctly set --target flag for linker opts
Previously we were trying to use the FP_CC_SUPPORTS_TARGET with 4
arguments, when it only takes 3 arguments. Instead we need to use the
`FP_PROG_CC_LINKER_TARGET` function in order to set the linker flags.
Actually fixes #24414
- - - - -
5 changed files:
- .gitlab/ci.sh
- distrib/configure.ac.in
- hadrian/bindist/Makefile
- hadrian/src/Rules/BinaryDist.hs
- + mk/hsc2hs.in
Changes:
=====================================
.gitlab/ci.sh
=====================================
@@ -556,6 +556,8 @@ function install_bindist() {
--prefix="$instdir" \
"${args[@]+"${args[@]}"}"
make_install_destdir "$TOP"/destdir "$instdir"
+ # And check the `--info` of the installed compiler, sometimes useful in CI log.
+ "$instdir"/bin/ghc --info
;;
esac
popd
=====================================
distrib/configure.ac.in
=====================================
@@ -254,8 +254,11 @@ AC_SUBST(TargetHasGnuNonexecStack)
dnl ** See whether cc supports --target=<triple> and set
dnl CONF_CC_OPTS_STAGE[12] accordingly.
-FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE1], [CONF_CXX_OPTS_STAGE1], [CONF_GCC_LINKER_OPTS_STAGE1])
-FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE2], [CONF_CXX_OPTS_STAGE2], [CONF_GCC_LINKER_OPTS_STAGE2])
+FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE1], [CONF_CXX_OPTS_STAGE1])
+FP_CC_SUPPORTS_TARGET([$CC], [CONF_CC_OPTS_STAGE2], [CONF_CXX_OPTS_STAGE2])
+
+FP_PROG_CC_LINKER_TARGET([$CC], [CONF_CC_OPTS_STAGE1], [CONF_GCC_LINKER_OPTS_STAGE1])
+FP_PROG_CC_LINKER_TARGET([$CC], [CONF_CC_OPTS_STAGE2], [CONF_GCC_LINKER_OPTS_STAGE2])
dnl Pass -Qunused-arguments or otherwise GHC will have very noisy invocations of Clang
FP_CC_IGNORE_UNUSED_ARGS([$CC], [CONF_CC_OPTS_STAGE1])
@@ -325,6 +328,7 @@ FP_SETTINGS
AC_CONFIG_FILES([config.mk])
AC_CONFIG_FILES([default.host.target])
AC_CONFIG_FILES([default.target])
+AC_CONFIG_FILES([mk/hsc2hs])
AC_OUTPUT
# We get caught by
=====================================
hadrian/bindist/Makefile
=====================================
@@ -55,27 +55,26 @@ endef
# QUESTION : should we use shell commands?
-
+.PHONY: show
show:
@echo '$(VALUE)="$($(VALUE))"'
-.PHONY: install
-
+.PHONY: install_extra
ifeq "$(EnableDistroToolchain)" "NO"
install_extra: install_mingw
else
install_extra:
endif
+.PHONY: install_bin
ifeq "$(RelocatableBuild)" "YES"
install_bin: install_bin_direct
else
install_bin: install_bin_libdir install_wrappers
endif
-
-
+.PHONY: install
install: install_bin install_lib install_extra
install: install_man install_docs update_package_db
install: install_data
@@ -146,6 +145,7 @@ lib/settings : config.mk
# We need to install binaries relative to libraries.
BINARIES = $(wildcard ./bin/*)
+.PHONY: install_bin_libdir
install_bin_libdir:
@echo "Copying binaries to $(DESTDIR)$(ActualBinsDir)"
$(INSTALL_DIR) "$(DESTDIR)$(ActualBinsDir)"
@@ -161,11 +161,13 @@ install_bin_libdir:
"${XATTR}" -c -r "$(DESTDIR)$(ActualBinsDir)"; \
fi
+.PHONY: install_bin_direct
install_bin_direct:
@echo "Copying binaries to $(DESTDIR)$(WrapperBinsDir)"
$(INSTALL_DIR) "$(DESTDIR)$(WrapperBinsDir)"
$(INSTALL_PROGRAM) ./bin/* "$(DESTDIR)$(WrapperBinsDir)/"
+.PHONY: install_lib
install_lib: lib/settings
@echo "Copying libraries to $(DESTDIR)$(ActualLibsDir)"
$(INSTALL_DIR) "$(DESTDIR)$(ActualLibsDir)"
@@ -196,6 +198,7 @@ install_lib: lib/settings
"${XATTR}" -c -r "$(DESTDIR)$(ActualLibsDir)"; \
fi
+.PHONY: install_docs
install_docs:
@echo "Copying docs to $(DESTDIR)$(docdir)"
$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
@@ -233,14 +236,21 @@ install_man:
fi
export SHELL
-install_wrappers: install_bin_libdir
+.PHONY: install_wrappers
+install_wrappers: install_bin_libdir install_hsc2hs_wrapper
@echo "Installing wrapper scripts"
$(INSTALL_DIR) "$(DESTDIR)$(WrapperBinsDir)"
for p in `cd wrappers; $(FIND) . ! -type d`; do \
mk/install_script.sh "$$p" "$(DESTDIR)/$(WrapperBinsDir)/$$p" "$(WrapperBinsDir)" "$(ActualBinsDir)" "$(ActualBinsDir)/$$p" "$(ActualLibsDir)" "$(docdir)" "$(includedir)"; \
done
+.PHONY: install_hsc2hs_wrapper
+install_hsc2hs_wrapper:
+ @echo Copying hsc2hs wrapper
+ cp mk/hsc2hs wrappers/hsc2hs-ghc-$(ProjectVersion)
+
PKG_CONFS = $(shell find "$(DESTDIR)$(ActualLibsDir)/package.conf.d" -name '*.conf' | sed "s: :\0xxx\0:g")
+.PHONY: update_package_db
update_package_db: install_bin install_lib
@echo "Installing C++ standard library virtual package"
$(INSTALL_DATA) mk/system-cxx-std-lib-1.0.conf "$(DESTDIR)$(ActualLibsDir)/package.conf.d"
@@ -249,6 +259,7 @@ update_package_db: install_bin install_lib
$(call patchpackageconf,$(shell echo $(notdir $p) | sed 's/-[0-9.]*-[0-9a-zA-Z]*\.conf//g'),$(shell echo "$p" | sed 's:\0xxx\0: :g'),$(docdir),$(shell mk/relpath.sh "$(ActualLibsDir)" "$(docdir)"),$(shell echo $(notdir $p) | sed 's/.conf//g')))
'$(DESTDIR)$(ActualBinsDir)/$(CrossCompilePrefix)ghc-pkg' --global-package-db "$(DESTDIR)$(ActualLibsDir)/package.conf.d" recache
+.PHONY: install_mingw
install_mingw:
@echo "Installing MingGW"
$(INSTALL_DIR) "$(DESTDIR)$(prefix)/mingw"
=====================================
hadrian/src/Rules/BinaryDist.hs
=====================================
@@ -15,8 +15,6 @@ import Target
import Utilities
import qualified System.Directory.Extra as IO
import Data.Either
-import GHC.Toolchain (ccProgram, tgtCCompiler, ccLinkProgram, tgtCCompilerLink)
-import GHC.Toolchain.Program (prgFlags)
import qualified Data.Set as Set
import Oracles.Flavour
@@ -400,6 +398,7 @@ bindistInstallFiles =
, "mk" -/- "project.mk"
, "mk" -/- "relpath.sh"
, "mk" -/- "system-cxx-std-lib-1.0.conf.in"
+ , "mk" -/- "hsc2hs.in"
, "mk" -/- "install_script.sh"
, "README", "INSTALL" ]
@@ -464,17 +463,8 @@ haddockWrapper = pure $ "exec \"$executablename\" -B\"$libdir\" -l\"$libdir\" ${
commonWrapper :: Action String
commonWrapper = pure $ "exec \"$executablename\" ${1+\"$@\"}\n"
--- echo 'HSC2HS_EXTRA="$(addprefix --cflag=,$(CONF_CC_OPTS_STAGE1)) $(addprefix --lflag=,$(CONF_GCC_LINKER_OPTS_STAGE1))"' >> "$(WRAPPER)"
hsc2hsWrapper :: Action String
-hsc2hsWrapper = do
- ccArgs <- map ("--cflag=" <>) . prgFlags . ccProgram . tgtCCompiler <$> targetStage Stage1
- linkFlags <- map ("--lflag=" <>) . prgFlags . ccLinkProgram . tgtCCompilerLink <$> targetStage Stage1
- wrapper <- drop 4 . lines <$> liftIO (readFile "utils/hsc2hs/hsc2hs.wrapper")
- return $ unlines
- ( "HSC2HS_EXTRA=\"" <> unwords (ccArgs ++ linkFlags) <> "\""
- : "tflag=\"--template=$libdir/template-hsc.h\""
- : "Iflag=\"-I$includedir/\""
- : wrapper )
+hsc2hsWrapper = return "Copied from mk/hsc2hs"
runGhcWrapper :: Action String
runGhcWrapper = pure $ "exec \"$executablename\" -f \"$exedir/ghc\" ${1+\"$@\"}\n"
=====================================
mk/hsc2hs.in
=====================================
@@ -0,0 +1,41 @@
+HSC2HS_C="@SettingsCCompilerFlags@"
+
+HSC2HS_L="@SettingsCCompilerLinkFlags@"
+
+tflag="--template=$libdir/template-hsc.h"
+Iflag="-I$includedir/include/"
+
+for f in ${HSC2HS_C}; do
+ cflags="${cflags} --cflag=$f"
+done
+
+for f in ${HSC2HS_L}; do
+ lflags="${lflags} --lflag=$f"
+done
+
+HSC2HS_EXTRA="$cflags $lflags"
+
+read_response() {
+ response_file=$1
+ if [ -f "$response_file" ]; then
+ while read -r arg; do
+ case "$arg" in
+ -t*) tflag=;;
+ --template=*) tflag=;;
+ @*) read_response "${arg#"@"}" ;;
+ --) break;;
+ esac
+ done < "$response_file"
+ fi
+}
+
+for arg do
+ case "$arg" in
+ -t*) tflag=;;
+ --template=*) tflag=;;
+ @*) read_response "${arg#"@"}" ;;
+ --) break;;
+ esac
+done
+
+exec "$executablename" ${tflag:+"$tflag"} $HSC2HS_EXTRA ${1+"$@"} "$Iflag"
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cdd939e77f2bb20f80310280400b3426598b4eca...ab9281a28f260b8f015fe43984ea6690a0669294
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/cdd939e77f2bb20f80310280400b3426598b4eca...ab9281a28f260b8f015fe43984ea6690a0669294
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240221/e9509050/attachment-0001.html>
More information about the ghc-commits
mailing list