diff options
-rw-r--r-- | Makefile.in | 16 | ||||
-rw-r--r-- | config_host.mk.in | 2 | ||||
-rw-r--r-- | configure.ac | 41 |
3 files changed, 51 insertions, 8 deletions
diff --git a/Makefile.in b/Makefile.in index f55e92c94405..ac3e8aafb529 100644 --- a/Makefile.in +++ b/Makefile.in @@ -91,19 +91,19 @@ define gb_Top_GbuildModuleRules .PHONY: $(1).allbuild $(1).buildall $(1).allcheck $(1).checkall $(1): bootstrap fetch - cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) + $(KEEP_AWAKE_CMD) cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $(1).build $(1).check $(1).coverage $(foreach target,$(gb_Top_MODULE_CHECK_TARGETS),$(1).$(target)): bootstrap fetch - cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@) + $(KEEP_AWAKE_CMD) cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@) $(1).clean $(1).showdeliverables: cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@) $(1).allbuild $(1).buildall: bootstrap fetch - $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(WORKDIR)/Module/$(1) + $(KEEP_AWAKE_CMD) $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(WORKDIR)/Module/$(1) $(1).allcheck $(1).checkall: bootstrap fetch - $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(WORKDIR)/Module/$(1) $(WORKDIR)/Module/check/$(1) $(WORKDIR)/Module/slowcheck/$(1) + $(KEEP_AWAKE_CMD) $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(WORKDIR)/Module/$(1) $(WORKDIR)/Module/check/$(1) $(WORKDIR)/Module/slowcheck/$(1) $(1).all: @echo "'make $(1).all' was renamed to 'make $(1).allcheck' (or use 'make $(1).allbuild' to build without unit tests)" @@ -170,10 +170,10 @@ gbuild_TARGETS := AllLangHelp \ # build a generic gbuild target $(foreach target,$(gbuild_TARGETS),$(target)_% $(foreach module,$(gbuild_modules),$(target)_$(module)/%)) UIConfig_modules/% %.genpatch: bootstrap fetch - $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@ + $(KEEP_AWAKE_CMD) $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@ $(gbuild_TARGETS): - $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@ + $(KEEP_AWAKE_CMD) $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $@ # # Clean @@ -291,9 +291,9 @@ bootstrap: check-if-root compilerplugins # build: bootstrap fetch $(if $(CROSS_COMPILING),cross-toolset,install-gdb-printers) \ $(if $(filter check,$(MAKECMDGOALS)),$(if $(COMPILER_PLUGINS),$(if $(LODE_HOME),clang-format-check))) - $(MAKE) $(PARALLELISM_OPTION) $(IWYU_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal) + $(KEEP_AWAKE_CMD) $(MAKE) $(PARALLELISM_OPTION) $(IWYU_OPTION) $(GMAKE_OPTIONS) -f $(SRCDIR)/Makefile.gbuild $(build_goal) ifeq ($(OS),iOS) - $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) ios + $(KEEP_AWAKE_CMD) $(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) ios endif build-non-l10n-only build-l10n-only check debugrun translations packageinfo coverage $(gb_Top_MODULE_CHECK_TARGETS): build diff --git a/config_host.mk.in b/config_host.mk.in index 1d5480bacf61..70d73f0a32f5 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -790,6 +790,8 @@ include $(BUILDDIR)/config_$(gb_Side)_lang.mk # does use some of the variables defined above include @SRC_ROOT@/download.lst +KEEP_AWAKE_CMD=@KEEP_AWAKE_CMD@ + # prep for WSL-as-helper-builds where build runs from within git-bash/MSYS that would otherwise # messes with anything that looks like a path (starts with /) but it cannot resolve export MSYS_NO_PATHCONV=1 diff --git a/configure.ac b/configure.ac index 4263116f894b..1650686382ef 100644 --- a/configure.ac +++ b/configure.ac @@ -2810,6 +2810,13 @@ AC_ARG_WITH(gtk3-build, [(Windows-only) In order to build GtkTiledViewer on Windows, pass the path to a GTK3 build, like '--with-gtk3-build=C:/gtk-build/gtk/x64/release'.])) +AC_ARG_WITH(keep-awake, + AS_HELP_STRING([--with-keep-awake], + [command to prefix make with in order to prevent the system from going to sleep/suspend + while building. + If no command is specified, defaults to using Awake (from Microsoft PowerToys) on Windows + and caffeinate on macOS])) + dnl =================================================================== dnl Branding dnl =================================================================== @@ -15244,6 +15251,40 @@ AC_SUBST(SYSTEMD_RUN) AC_SUBST(WITH_COREDUMPCTL) dnl =================================================================== +dnl Checking whether to use a keep-awake helper +dnl =================================================================== +#" +AC_MSG_CHECKING([whether to keep the system awake/prevent it from going into sleep/standby]) +if test -z "$with_keep_awake" -o "$with_keep_awake" = "no"; then + AC_MSG_RESULT([no]) +elif test "$with_keep_awake" = "yes"; then + AC_MSG_RESULT([yes (autodetect)]) + AC_MSG_CHECKING([for a suitable keep-awake command]) + if test "$_os" = "WINNT"; then + PathFormat "$(perl.exe -e 'print $ENV{"PROGRAMFILES"}')" + if test -f "$formatted_path_unix/PowerToys/PowerToys.Awake.exe"; then + AC_MSG_RESULT([using "Awake"]) + # need to pass the windows-PID to awake, so get the PGID of the shell first to get + # make's PID and then use that to get the windows-PID. + # lots of quoting for both make ($$) as well as configure ('"'"') make that command + # much scarier looking than it actually is. Using make's shell instead of subshells in + # the recipe to keep the command that's echoed by make short. + KEEP_AWAKE_CMD=$formatted_path/PowerToys/PowerToys.Awake.exe' --display-on False --pid $(shell ps | awk '"'"'/^\s+'"'"'$$(ps | awk '"'"'/^\s+'"'"'$$$$'"'"'\s+/{print $$3}'"'"')'"'"'\s+/{print $$4}'"'"') &' + else + AC_MSG_ERROR(["Awake" not found - install Microsoft PowerToys or specify a custom command]) + fi + elif test "$_os" = "Darwin"; then + AC_MSG_RESULT([using "caffeinate"]) + KEEP_AWAKE_CMD="caffeinate" + else + AC_MSG_ERROR([no default available for $_os, please specify manually]) + fi +else + AC_MSG_RESULT([yes (custom command: $with_keep_awake)]) +fi +AC_SUBST(KEEP_AWAKE_CMD) + +dnl =================================================================== dnl Setting up the environment. dnl =================================================================== AC_MSG_NOTICE([setting up the build environment variables...]) |