editeng/CustomTarget_generated.mk |    2 +-
 filter/CustomTarget_svg.mk        |    6 +++---
 sdext/CustomTarget_pdfimport.mk   |    2 +-
 solenv/gbuild/CustomTarget.mk     |    2 +-
 sw/CustomTarget_generated.mk      |   34 +++++++++++++++++++---------------
 5 files changed, 25 insertions(+), 21 deletions(-)

New commits:
commit 683e3fdb3c6b40789e8f90db51c0bf4805619a00
Author:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
AuthorDate: Wed Aug 2 17:10:59 2023 +0200
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Wed Oct 2 19:40:22 2024 +0200

    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+libreoff...@googlemail.com>
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174241
    Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de>
    Tested-by: Balazs Varga <balazs.varga.ext...@allotropia.de>

diff --git a/editeng/CustomTarget_generated.mk 
b/editeng/CustomTarget_generated.mk
index 542ffe2bc720..bbdc75fcf53a 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 8de54f419a8c..cdc48cc21219 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 0f9a75658e90..a32da2b94191 100644
--- a/sdext/CustomTarget_pdfimport.mk
+++ b/sdext/CustomTarget_pdfimport.mk
@@ -17,7 +17,7 @@ $(gb_CustomTarget_workdir)/sdext/pdfimport/hash.cxx : \
                | $(gb_CustomTarget_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 75c080b19a37..e698a895baea 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)) : $(gb_CustomTarget_workdir)/$(1)/$(2)
 $(gb_CustomTarget_workdir)/$(1)/$(2) : 
$(gb_CustomTarget_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 5784f16813cd..ca59842fd582 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 := $(gb_CustomTarget_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
 

Reply via email to