Avoid potential negative array index access to cached text.
[LibreOffice.git] / instsetoo_native / CustomTarget_install.mk
blob276e2154d539e39b3f32b3c27d496a867ba5b3e5
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 instsetoo_ULFLIST := ActionTe \
11 Control \
12 CustomAc \
13 Error \
14 LaunchCo \
15 Property \
16 RadioBut \
17 UIText
19 $(eval $(call gb_CustomTarget_CustomTarget,instsetoo_native/install))
21 $(eval $(call gb_CustomTarget_register_targets,instsetoo_native/install,\
22 install.phony \
23 $(if $(filter TRUE,$(WINDOWS_BUILD_SIGNING)),msi_signing.done) \
24 $(if $(filter-out WNT,$(OS)),\
25 bin/find-requires-gnome.sh \
26 bin/find-requires-x11.sh) \
27 $(foreach ulf,$(instsetoo_ULFLIST),win_ulffiles/$(ulf).ulf) \
30 .PHONY: $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/install.phony
32 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/bin/find-requires-%.sh: $(SRCDIR)/instsetoo_native/inc_openoffice/unix/find-requires-%.sh
33 cat $< | tr -d "\015" > $@
34 chmod a+x $@
36 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/win_ulffiles/%.ulf: \
37 | $(call gb_Postprocess_get_target,AllModulesButInstsetNative)
39 $(eval $(call gb_CustomTarget_ulfex_rule,\
40 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/win_ulffiles/%.ulf,\
41 $(SRCDIR)/instsetoo_native/inc_openoffice/windows/msi_languages/%.ulf,\
42 $(foreach lang,$(gb_TRANS_LANGS),\
43 $(gb_POLOCATION)/$(lang)/instsetoo_native/inc_openoffice/windows/msi_languages.po)))
45 export ENABLE_DOWNLOADSETS ?= TRUE
46 ifeq ($(OS),LINUX)
47 export DONT_REMOVE_PACKAGE := TRUE
48 endif
49 export instsetoo_OUT := $(WORKDIR)/installation
50 export LOCAL_OUT := $(instsetoo_OUT)
51 export LOCAL_COMMON_OUT := $(instsetoo_OUT)
53 ifeq ($(filter $(OS),MACOSX WNT),$(OS))
54 instsetoo_installer_langs := $(subst $(WHITESPACE),$(COMMA),$(strip en-US $(filter-out en-US,$(gb_WITH_LANG))))
55 else
56 instsetoo_installer_langs := en-US
57 endif
59 # delimiter is U+2027 Hyphenation point - files with colon in their name confuse the heck out of
60 # make and cannot be used as targets or prerequisites. For passing to call_installer.sh it is
61 # substituted by the : so that cut doesn't stumble over the delimiter
62 ifeq (TRUE,$(filter TRUE,$(LIBO_TEST_INSTALL) $(ENABLE_WIX)))
63 instsetoo_installer_targets = openoffice‧en-US‧‧‧archive‧nostrip
64 ifeq (ODK,$(filter ODK,$(BUILD_TYPE)))
65 instsetoo_installer_targets += sdkoo‧en-US‧_SDK‧‧archive‧nostrip
66 endif
67 else
68 instsetoo_installer_targets := $(foreach pkgformat,$(PKGFORMAT),\
69 openoffice‧$(instsetoo_installer_langs)‧‧‧$(pkgformat)$(if $(filter-out archive,$(pkgformat)),strip,nostrip) \
70 $(if $(filter ODK,$(BUILD_TYPE)),sdkoo‧en-US‧_SDK‧‧$(pkgformat)‧nostrip) \
71 $(if $(and $(filter HELP,$(BUILD_TYPE)),$(filter-out MACOSX,$(OS))), \
72 $(foreach lang,$(gb_HELP_LANGS),ooohelppack‧$(lang)‧‧-helppack‧$(pkgformat)‧nostrip)) \
73 $(if $(and $(filter-out WNT,$(OS)),$(filter-out MACOSX,$(OS))), \
74 $(foreach lang,$(filter-out en-US,$(gb_WITH_LANG)),ooolangpack‧$(lang)‧‧-languagepack‧$(pkgformat)‧nostrip)))
75 endif
77 LIBO_VERSION = $(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)
79 instsetoo_wipe:
80 $(call gb_Output_announce,wiping installation output dir,$(true),WPE,6)
81 rm -rf $(instsetoo_OUT)
83 # list both as prerequisites so that make won't treat the $(template) one as intermediate /
84 # won't attempt to delete it after the $(template)/Binary and the rest of the chain was made
85 instsetoo_msi_templates: $(foreach template,openoffice ooohelppack sdkoo,$(addprefix \
86 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_templates/,$(template) $(template)/Binary))
88 # use awk instead of grep to not have to deal with grep exiting with error on files with no comments
89 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_templates/%: $(SRCDIR)/instsetoo_native/inc_%/windows/msi_templates/*.*
90 $(call gb_Output_announce,setting up msi templates for type $(@F),$(true),AWK,4)
91 rm -rf $@ && mkdir -p $@ && cd $@ $(foreach file,$(^F),&& awk '!/^#/{print}' $(<D)/$(file) > $(file))
93 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_templates/%/Binary: $(SRCDIR)/instsetoo_native/inc_common/windows/msi_templates/Binary/*.* \
94 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_templates/%
95 $(call gb_Output_announce,setting up msi templates for type $* - copying binary assets,$(true),CPY,4)
96 rm -rf $@ && mkdir -p $@ && cd $@ && cp $(SRCDIR)/instsetoo_native/inc_common/windows/msi_templates/Binary/*.* ./
98 gb_Make_JobLimiter := $(WORKDIR)/job-limiter.exe
100 $(gb_Make_JobLimiter): $(SRCDIR)/solenv/bin/job-limiter.cpp
101 cd $(WORKDIR) && \
102 $(CXX_FOR_BUILD) $(SOLARINC) -EHsc $^ -link -LIBPATH:$(subst ;, -LIBPATH:,$(ILIB_FOR_BUILD)) || rm -f $@
104 # with all languages the logfile name would be too long when building the windows installation set,
105 # that's the reason for the substitution to multilang below in case more than just en-US is packaged
106 # also for windows msi packaging parallel execution is reduced by the job-limiter. This only has any
107 # effect when building with help and multiple languages, and it also won't affect the real time for
108 # packaging (since packaging the main installer takes longer than packaging sdk and all helppacks
109 # even with the reduced parallelism (the higher the parallelism, the higher the chance for random
110 # failures during the cscript call to WiLangId.vbs)
111 $(instsetoo_installer_targets): $(SRCDIR)/solenv/bin/make_installer.pl \
112 $(foreach ulf,$(instsetoo_ULFLIST),$(call gb_CustomTarget_get_workdir,instsetoo_native/install)/win_ulffiles/$(ulf).ulf) \
113 $(if $(filter-out WNT,$(OS)),\
114 $(addprefix $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/,\
115 bin/find-requires-gnome.sh \
116 bin/find-requires-x11.sh) \
117 ,instsetoo_msi_templates) \
118 $(call gb_Postprocess_get_target,AllModulesButInstsetNative) \
119 | instsetoo_wipe $(if $(filter msi,$(PKGFORMAT)),$(gb_Make_JobLimiter))
120 $(call gb_Output_announce,$(if $(filter en-US$(COMMA)%,$(instsetoo_installer_langs)),$(subst $(instsetoo_installer_langs),multilang,$@),$@),$(true),INS,1)
121 $(if $(filter %msi‧nostrip,$@),$(gb_Make_JobLimiter) grab)
122 $(call gb_Trace_StartRange,$@,INSTALLER)
123 $(call gb_Helper_print_on_error, \
124 $(SRCDIR)/solenv/bin/call_installer.sh $(if $(verbose),-verbose,-quiet) $(subst,:,$@),\
125 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/$(if $(filter en-US$(COMMA)%,$(instsetoo_installer_langs)),$(subst $(instsetoo_installer_langs),multilang,$@),$@).log)
126 $(if $(filter %msi‧nostrip,$@),$(gb_Make_JobLimiter) release)
127 $(call gb_Trace_EndRange,$@,INSTALLER)
129 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/install.phony: $(instsetoo_installer_targets)
130 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,2)
131 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
132 $(if $(ENABLE_WIX),$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/msicreator/create_installer.py $(BUILDDIR) $(SRCDIR) $(LIBO_VERSION) $(PRODUCTNAME_WITHOUT_SPACES))
133 ifeq (TRUE,$(LIBO_TEST_INSTALL))
134 unzip -q -d $(TESTINSTALLDIR) $(instsetoo_OUT)/$(PRODUCTNAME_WITHOUT_SPACES)/archive/install/en-US/LibreOffice*_archive.zip
135 mv $(TESTINSTALLDIR)/LibreOffice*_archive/LibreOffice*/* $(TESTINSTALLDIR)/
136 rmdir $(TESTINSTALLDIR)/LibreOffice*_archive/LibreOffice*
137 rmdir $(TESTINSTALLDIR)/LibreOffice*_archive
138 ifeq (ODK,$(filter ODK,$(BUILD_TYPE)))
139 unzip -q -d $(TESTINSTALLDIR) $(instsetoo_OUT)/$(PRODUCTNAME_WITHOUT_SPACES)_SDK/archive/install/en-US/LibreOffice*_archive_sdk.zip
140 mv $(TESTINSTALLDIR)/LibreOffice*_archive_sdk/LibreOffice*_SDK/sdk \
141 $(TESTINSTALLDIR)/
142 rmdir $(TESTINSTALLDIR)/LibreOffice*_archive_sdk/LibreOffice*_SDK
143 rmdir $(TESTINSTALLDIR)/LibreOffice*_archive_sdk
144 endif
145 endif # LIBO_TEST_INSTALL
146 touch $@
147 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
149 TIMESTAMPURL ?= "http://timestamp.digicert.com/"
150 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_signing.done: \
151 $(if $(filter HELP,$(BUILD_TYPE)),$(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_helppack_signing.done) \
152 $(if $(filter ODK,$(BUILD_TYPE)),$(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_sdk_signing.done) \
153 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_main_signing.done
154 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,2)
155 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
156 touch $@
157 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
159 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_helppack_signing.done \
160 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_sdk_signing.done \
161 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_main_signing.done \
162 : $(SRCDIR)/postprocess/signing/signing.pl $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/install.phony
164 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_main_signing.done:
165 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,2)
166 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
167 $(PERL) $(SRCDIR)/postprocess/signing/signing.pl \
168 -l $(subst .done,_log.txt,$@) \
169 $(if $(verbose),-v) \
170 $(if $(PFXFILE),-f $(PFXFILE)) \
171 $(if $(PFXPASSWORD),-p $(PFXPASSWORD)) \
172 $(if $(TIMESTAMPURL),-t $(TIMESTAMPURL)) \
173 -d $(PRODUCTNAME_WITHOUT_SPACES)\ $(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH) \
174 $(WORKDIR)/installation/$(PRODUCTNAME_WITHOUT_SPACES)/msi/install/*/*.msi \
175 && touch $@
176 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
178 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_helppack_signing.done:
179 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,2)
180 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
181 $(PERL) $(SRCDIR)/postprocess/signing/signing.pl \
182 -l $(subst .done,_log.txt,$@) \
183 $(if $(verbose),-v) \
184 $(if $(PFXFILE),-f $(PFXFILE)) \
185 $(if $(PFXPASSWORD),-p $(PFXPASSWORD)) \
186 $(if $(TIMESTAMPURL),-t $(TIMESTAMPURL)) \
187 -d $(PRODUCTNAME_WITHOUT_SPACES)\ $(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)\ Helppack \
188 $(WORKDIR)/installation/$(PRODUCTNAME_WITHOUT_SPACES)_helppack/msi/install/*/*.msi \
189 && touch $@
190 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
192 $(call gb_CustomTarget_get_workdir,instsetoo_native/install)/msi_sdk_signing.done:
193 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,2)
194 $(call gb_Trace_StartRange,$(subst $(WORKDIR)/,,$@),PRL)
195 $(PERL) $(SRCDIR)/postprocess/signing/signing.pl \
196 -l $(subst .done,_log.txt,$@) \
197 $(if $(verbose),-v) \
198 $(if $(PFXFILE),-f $(PFXFILE)) \
199 $(if $(PFXPASSWORD),-p $(PFXPASSWORD)) \
200 $(if $(TIMESTAMPURL),-t $(TIMESTAMPURL)) \
201 -d $(PRODUCTNAME_WITHOUT_SPACES)\ $(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)\ SDK \
202 $(WORKDIR)/installation/$(PRODUCTNAME_WITHOUT_SPACES)_SDK/msi/install/*/*.msi \
203 && touch $@
204 $(call gb_Trace_EndRange,$(subst $(WORKDIR)/,,$@),PRL)
206 # vim: set noet sw=4 ts=4: