summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2023-08-02 17:10:59 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2024-04-26 14:01:51 +0200
commitb87da3e9402c8b56ce2a16213802224f9288de4d (patch)
tree3d774aeb4b9948db79400585dee3d62cbfd8503b
parentrun zip via wsl in wsl-as-helper case (diff)
downloadcore-b87da3e9402c8b56ce2a16213802224f9288de4d.tar.gz
core-b87da3e9402c8b56ce2a16213802224f9288de4d.zip
run gperf via wsl in wsl-as-helper case
also split up the gperf commands when generating sw/generated/tokens.cxx wsl has trouble appending using shell redirects, so use separate targets and use cat in the final processing step for tokens.cxx see also https://github.com/microsoft/WSL/issues/4400 Change-Id: Id7a24d060e9be71113ec2827a389d347456f6522 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166338 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Jenkins
-rw-r--r--editeng/CustomTarget_generated.mk2
-rw-r--r--filter/CustomTarget_svg.mk6
-rw-r--r--sdext/CustomTarget_pdfimport.mk2
-rw-r--r--solenv/gbuild/CustomTarget.mk2
-rw-r--r--sw/CustomTarget_generated.mk34
5 files changed, 25 insertions, 21 deletions
diff --git a/editeng/CustomTarget_generated.mk b/editeng/CustomTarget_generated.mk
index 8f05f6ccb23b..fe7aa10ae18a 100644
--- a/editeng/CustomTarget_generated.mk
+++ b/editeng/CustomTarget_generated.mk
@@ -19,7 +19,7 @@ $(editeng_INC)/tokens.hxx $(editeng_INC)/tokens.gperf : $(editeng_SRC)/tokens.tx
$(call gb_ExternalExecutable_get_command,python) $(editeng_PY) $(editeng_SRC)/tokens.txt $(editeng_INC)/tokens.gperf
$(editeng_INC)/tokens.cxx : $(editeng_INC)/tokens.gperf
- $(GPERF) --compare-strncmp --readonly-tables $(editeng_INC)/tokens.gperf \
+ $(call gb_Helper_wsl_path,$(GPERF) --compare-strncmp --readonly-tables $(editeng_INC)/tokens.gperf) \
| sed -e '/^#line/d' -e 's/(char\*)0/(char\*)0, XML_TOKEN_INVALID/g' > $@
$(call gb_CustomTarget_get_target,editeng/generated) : $(editeng_INC)/tokens.cxx
diff --git a/filter/CustomTarget_svg.mk b/filter/CustomTarget_svg.mk
index bc980eb48e82..7eb0d6178d52 100644
--- a/filter/CustomTarget_svg.mk
+++ b/filter/CustomTarget_svg.mk
@@ -39,9 +39,9 @@ $(filter_GEN_svg_Tokens_hxx) : $(filter_GEN_svg_Tokens_gperf)
$(filter_GEN_svg_Tokens_cxx) : $(filter_GEN_svg_Tokens_gperf)
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,GPF,1)
- $(call gb_Helper_abbreviate_dirs, \
- $(GPERF) --compare-strncmp -C -m 20 --switch=2 --readonly-tables $(filter_GEN_svg_Tokens_gperf) \
- | sed -e '/^#line/d' -e 's/(char\*)0/(char\*)0$(COMMA) 0/g' > $@)
+ $(call gb_Helper_wsl_path,\
+ $(GPERF) --compare-strncmp -C -m 20 --switch=2 --readonly-tables $(filter_GEN_svg_Tokens_gperf)) \
+ | sed -e '/^#line/d' -e 's/(char\*)0/(char\*)0, 0/g' > $@
$(filter_GEN_svg_Script_hxx) : \
$(call gb_ExternalExecutable_get_dependencies,python) \
diff --git a/sdext/CustomTarget_pdfimport.mk b/sdext/CustomTarget_pdfimport.mk
index 086daca5bc37..a337049c77ae 100644
--- a/sdext/CustomTarget_pdfimport.mk
+++ b/sdext/CustomTarget_pdfimport.mk
@@ -17,7 +17,7 @@ $(call gb_CustomTarget_get_workdir,sdext/pdfimport)/hash.cxx : \
| $(call gb_CustomTarget_get_workdir,sdext/pdfimport)/.dir
$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),GPF,1)
$(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),GPF)
- $(GPERF) -C -t -l -L C++ -m 20 --switch=2 --readonly-tables -Z PdfKeywordHash -k'4-5,$$' $< > $@
+ $(call gb_Helper_wsl_path,$(GPERF) -C -t -l -L C++ -m 20 --switch=2 --readonly-tables -Z PdfKeywordHash -k'4-5$(COMMA)$$' $<) > $@
$(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),GPF)
# vim:set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/solenv/gbuild/CustomTarget.mk b/solenv/gbuild/CustomTarget.mk
index 64272b9d450e..4b1ad8f02ddc 100644
--- a/solenv/gbuild/CustomTarget.mk
+++ b/solenv/gbuild/CustomTarget.mk
@@ -84,7 +84,7 @@ define gb_CustomTarget_token_hash
$(call gb_CustomTarget_get_target,$(1)) : $(call gb_CustomTarget_get_workdir,$(1))/$(2)
$(call gb_CustomTarget_get_workdir,$(1))/$(2) : $(call gb_CustomTarget_get_workdir,$(1))/misc/$(3)
$$(call gb_Output_announce,$$(subst $(WORKDIR)/,,$$@),build,GPF,1)
- $(GPERF) --compare-strncmp --switch=2 --readonly-tables $$< \
+ $$(call gb_Helper_wsl_path,$(GPERF) --compare-strncmp --switch=2 --readonly-tables $$<) \
| sed -e '/^#line/d' -e 's/(char\*)0/(char\*)0, 0/g' > $$@
endef
diff --git a/sw/CustomTarget_generated.mk b/sw/CustomTarget_generated.mk
index c3277ca418a7..e804e1590d49 100644
--- a/sw/CustomTarget_generated.mk
+++ b/sw/CustomTarget_generated.mk
@@ -13,22 +13,26 @@ sw_SRC := $(SRCDIR)/sw/source/core/swg
sw_PY := $(SRCDIR)/solenv/bin/gentoken.py
sw_INC := $(call gb_CustomTarget_get_workdir,sw/generated)
-$(sw_INC)/TextBlockTokens.gperf : $(sw_SRC)/TextBlockTokens.txt $(sw_PY) \
- $(call gb_ExternalExecutable_get_dependencies,python)
- mkdir -p $(sw_INC)
- $(call gb_ExternalExecutable_get_command,python) $(sw_PY) $(sw_SRC)/TextBlockTokens.txt $(sw_INC)/TextBlockTokens.gperf
-
-$(sw_INC)/BlockListTokens.gperf : $(sw_SRC)/BlockListTokens.txt $(sw_PY) \
- $(call gb_ExternalExecutable_get_dependencies,python)
- mkdir -p $(sw_INC)
- $(call gb_ExternalExecutable_get_command,python) $(sw_PY) $(sw_SRC)/BlockListTokens.txt $(sw_INC)/BlockListTokens.gperf
-
-$(sw_INC)/tokens.cxx : $(sw_INC)/TextBlockTokens.gperf $(sw_INC)/BlockListTokens.gperf
- $(GPERF) --compare-strncmp --readonly-tables --output-file=$(sw_INC)/tokens.cxx \
- --class-name=TextBlockTokens --word-array-name=textBlockList --enum $(sw_INC)/TextBlockTokens.gperf
+# static pattern rule
+$(sw_INC)/TextBlockTokens.gperf \
+$(sw_INC)/BlockListTokens.gperf : $(sw_INC)/%.gperf : $(sw_SRC)/%.txt $(sw_PY) \
+ | $(call gb_ExternalExecutable_get_dependencies,python)
+ mkdir -p $(@D)
+ $(call gb_ExternalExecutable_get_command,python) $(sw_PY) $< $@
+
+# appending when wrapping with wsl.exe is broken, will always replace from start instead of add
+# https://github.com/microsoft/WSL/issues/4400 so create them as separate intermediates
+$(sw_INC)/TextBlockTokens.processed : $(sw_INC)/TextBlockTokens.gperf
+ $(GPERF) --compare-strncmp --readonly-tables --class-name=TextBlockTokens \
+ --word-array-name=textBlockList --enum $(sw_INC)/TextBlockTokens.gperf > $@
+
+$(sw_INC)/BlockListTokens.processed : $(sw_INC)/BlockListTokens.gperf
$(GPERF) --compare-strncmp --readonly-tables -T $(sw_INC)/BlockListTokens.gperf \
- --class-name=BlockListTokens --word-array-name=blockListList >> $(sw_INC)/tokens.cxx
- sed -i $(if $(filter MACOSX,$(OS_FOR_BUILD)),'') -e '/^#line/d' -e 's/(char\*)0/(char\*)0, XML_TOKEN_INVALID/g' $(sw_INC)/tokens.cxx
+ --class-name=BlockListTokens --word-array-name=blockListList > $@
+
+$(sw_INC)/tokens.cxx : sw_INC:=$(call gb_Helper_wsl_path,$(sw_INC))
+$(sw_INC)/tokens.cxx : $(sw_INC)/TextBlockTokens.processed $(sw_INC)/BlockListTokens.processed
+ sed -e '/^#line/d' -e 's/(char\*)0/(char\*)0, XML_TOKEN_INVALID/g' $^ > $@
$(call gb_CustomTarget_get_target,sw/generated) : $(sw_INC)/tokens.cxx