diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /external/onlineupdate | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/onlineupdate')
39 files changed, 1762 insertions, 0 deletions
diff --git a/external/onlineupdate/CustomTarget_generated.mk b/external/onlineupdate/CustomTarget_generated.mk new file mode 100644 index 0000000000..ffdfffd431 --- /dev/null +++ b/external/onlineupdate/CustomTarget_generated.mk @@ -0,0 +1,25 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_CustomTarget_CustomTarget,external/onlineupdate/generated)) + +onlineupdate_INC := $(call gb_CustomTarget_get_workdir,external/onlineupdate/generated) + +$(onlineupdate_INC)/primaryCert.h $(onlineupdate_INC)/secondaryCert.h : \ + $(call gb_ExternalExecutable_get_dependencies,python) \ + | $(call gb_UnpackedTarball_get_target,onlineupdate) + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,,1) + mkdir -p $(dir $@) + PYPATH=$${PYPATH:+$$PYPATH$(gb_CLASSPATHSEP)}'$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/updater' $(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/external/onlineupdate/generate.py $@ '$(ONLINEUPDATE_MAR_CERTIFICATEDER)' + +$(call gb_CustomTarget_get_target,external/onlineupdate/generated) : \ + $(onlineupdate_INC)/primaryCert.h \ + $(onlineupdate_INC)/secondaryCert.h \ + +# vim: set noet sw=4 ts=4: diff --git a/external/onlineupdate/Executable_mar.mk b/external/onlineupdate/Executable_mar.mk new file mode 100644 index 0000000000..bcfd2f4a7f --- /dev/null +++ b/external/onlineupdate/Executable_mar.mk @@ -0,0 +1,63 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Executable_Executable,mar)) + +$(eval $(call gb_Executable_use_unpacked,mar,onlineupdate)) + +$(eval $(call gb_Executable_set_include,mar,\ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/libmar/src/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/libmar/verify/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/libmar/sign/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include/onlineupdate \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Executable_use_static_libraries,mar,\ + libmar \ + libmarverify \ +)) + +ifeq ($(OS),WNT) + +$(eval $(call gb_Executable_add_defs,mar,\ + -DXP_WIN \ +)) + +$(eval $(call gb_Executable_add_libs,mar,\ + ws2_32.lib \ + Crypt32.lib \ +)) + +endif + +$(eval $(call gb_Executable_use_externals,mar,\ + nss3 \ +)) + +$(eval $(call gb_Executable_add_defs,mar,\ + -DMAR_NSS \ +)) + +$(eval $(call gb_Executable_add_defs,mar,\ + -DMOZ_APP_VERSION=\"$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)\" \ + -DMAR_CHANNEL_ID=\"LOOnlineUpdater\" \ +)) + +$(eval $(call gb_Executable_add_generated_cobjects,mar,\ + UnpackedTarball/onlineupdate/nsprpub/lib/libc/src/strdup \ + UnpackedTarball/onlineupdate/nsprpub/lib/libc/src/strlen \ + UnpackedTarball/onlineupdate/onlineupdate/source/libmar/sign/nss_secutil \ + UnpackedTarball/onlineupdate/onlineupdate/source/libmar/sign/mar_sign \ + UnpackedTarball/onlineupdate/onlineupdate/source/libmar/tool/mar \ +)) + +$(eval $(call gb_Executable_set_warnings_disabled,mar)) + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/external/onlineupdate/Executable_mbsdiff.mk b/external/onlineupdate/Executable_mbsdiff.mk new file mode 100644 index 0000000000..a417299095 --- /dev/null +++ b/external/onlineupdate/Executable_mbsdiff.mk @@ -0,0 +1,43 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Executable_Executable,mbsdiff)) + +$(eval $(call gb_Executable_use_unpacked,mbsdiff,onlineupdate)) + +$(eval $(call gb_Executable_set_include,mbsdiff,\ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/inc \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/toolkit/mozapps/update/updater \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Executable_use_externals,mbsdiff,\ + bzip2 \ +)) + + +ifeq ($(OS),WNT) + +$(eval $(call gb_Executable_add_defs,mbsdiff, \ + -DXP_WIN \ +)) + +$(eval $(call gb_Executable_add_libs,mbsdiff,\ + ws2_32.lib \ +)) + +endif + +$(eval $(call gb_Executable_add_generated_cobjects,mbsdiff,\ + UnpackedTarball/onlineupdate/onlineupdate/source/mbsdiff/bsdiff \ +)) + +$(eval $(call gb_Executable_set_warnings_disabled,mbsdiff)) + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/external/onlineupdate/Executable_test_updater_dialog.mk b/external/onlineupdate/Executable_test_updater_dialog.mk new file mode 100644 index 0000000000..4d31c7f24f --- /dev/null +++ b/external/onlineupdate/Executable_test_updater_dialog.mk @@ -0,0 +1,80 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Executable_Executable,test_updater_dialog)) + +$(eval $(call gb_Executable_use_unpacked,test_updater_dialog,onlineupdate)) + +$(eval $(call gb_Executable_set_include,test_updater_dialog,\ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/inc \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/common \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/updater/xpcom/glue \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/updater \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include/onlineupdate \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/toolkit/mozapps/update/common \ + $$(INCLUDE) \ + $(if $(filter-out WNT,$(OS)),$$(GTK3_CFLAGS) ) \ +)) + +$(eval $(call gb_Executable_use_static_libraries,test_updater_dialog,\ + updatehelper \ +)) + +ifeq ($(OS),WNT) + +$(eval $(call gb_Executable_add_defs,test_updater_dialog, \ + -DXP_WIN \ +)) + +$(eval $(call gb_Executable_add_libs,test_updater_dialog,\ + Ws2_32.lib \ + Gdi32.lib \ + Comctl32.lib \ + Shell32.lib \ + Shlwapi.lib \ + Crypt32.lib \ +)) + +$(eval $(call gb_Executable_set_targettype_gui,test_updater_dialog,YES)) + +$(eval $(call gb_Executable_add_nativeres,test_updater_dialog,updaterres)) + +$(eval $(call gb_Executable_add_ldflags,test_updater_dialog,\ + /ENTRY:wmainCRTStartup \ +)) + +else + +$(eval $(call gb_Executable_add_defs,test_updater_dialog,\ + -DMOZ_VERIFY_MAR_SIGNATURE \ + -DNSS3 \ +)) + +$(eval $(call gb_Executable_use_externals,test_updater_dialog,\ + nss3 \ +)) + +$(eval $(call gb_Executable_add_libs,test_updater_dialog,\ + $(GTK3_LIBS) \ +)) +endif + +$(eval $(call gb_Executable_add_exception_objects,test_updater_dialog,\ + external/onlineupdate/workben/test_dialog \ +)) + +# external/onlineupdate/workben/test_dialog.cxx #include's lots of external .cpp code: +$(eval $(call gb_Executable_set_warnings_not_errors,test_updater_dialog)) + +ifeq ($(OS),WNT) +$(eval $(call gb_Executable_add_defs,test_updater_dialog,-DUNICODE)) +endif + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/external/onlineupdate/Executable_update_service.mk b/external/onlineupdate/Executable_update_service.mk new file mode 100644 index 0000000000..2d301c5ace --- /dev/null +++ b/external/onlineupdate/Executable_update_service.mk @@ -0,0 +1,83 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Executable_Executable,update_service)) + +$(eval $(call gb_Executable_use_unpacked,update_service,onlineupdate)) + +$(eval $(call gb_Executable_set_targettype_gui,update_service,YES)) + +$(eval $(call gb_Executable_set_include,update_service,\ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/inc \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/libmar/src/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/libmar/verify/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/libmar/sign/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/common/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include/onlineupdate \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/toolkit/mozapps/update/common \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/toolkit/xre \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/xpcom/base \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/xpcom/string \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Executable_use_static_libraries,update_service,\ + updatehelper \ + windows_process \ +)) + +$(eval $(call gb_Executable_add_libs,update_service,\ + ws2_32.lib \ + Crypt32.lib \ + shell32.lib \ + wintrust.lib \ + version.lib \ + wtsapi32.lib \ + userenv.lib \ + shlwapi.lib \ + ole32.lib \ + rpcrt4.lib \ + comctl32.lib \ + shlwapi.lib \ + kernel32.lib \ + advapi32.lib \ +)) + +$(eval $(call gb_Executable_add_ldflags,update_service,\ + /ENTRY:wmainCRTStartup \ +)) + +$(eval $(call gb_Executable_set_generated_cxx_suffix,update_service,cpp)) + +$(eval $(call gb_Executable_add_generated_exception_objects,update_service,\ + UnpackedTarball/onlineupdate/onlineupdate/source/service/maintenanceservice \ + UnpackedTarball/onlineupdate/onlineupdate/source/service/servicebase \ + UnpackedTarball/onlineupdate/onlineupdate/source/service/serviceinstall \ + UnpackedTarball/onlineupdate/onlineupdate/source/service/workmonitor \ +)) + +$(eval $(call gb_Executable_add_cxxflags,update_service,-Zc:strictStrings-)) + +$(eval $(call gb_Executable_add_defs,update_service, \ + -DMOZ_MAINTENANCE_SERVICE \ + -DNS_NO_XPCOM \ + -DUNICODE \ + -DXP_WIN \ + $(if $(filter AARCH64 INTEL X86_64,$(CPUNAME)),-D__BYTE_ORDER__=1234) \ + -D__ORDER_BIG_ENDIAN__=4321 \ + -D__ORDER_LITTLE_ENDIAN__=1234 \ + -U_WIN32_WINNT \ +)) + +$(eval $(call gb_Executable_set_warnings_disabled,update_service)) + +$(eval $(call gb_Executable_add_default_nativeres,update_service)) + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/external/onlineupdate/Executable_updater.mk b/external/onlineupdate/Executable_updater.mk new file mode 100644 index 0000000000..2196ff5df5 --- /dev/null +++ b/external/onlineupdate/Executable_updater.mk @@ -0,0 +1,142 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Executable_Executable,updater)) + +$(eval $(call gb_Executable_use_unpacked,updater,onlineupdate)) + +$(eval $(call gb_Executable_set_include,updater,\ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/inc \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/common \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/updater/xpcom/glue \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/service \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include/onlineupdate \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/modules/xz-embedded/src \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/toolkit/mozapps/update/common \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/toolkit/mozapps/update/updater \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/toolkit/xre \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/xpcom/base \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/xpcom/string \ + $$(INCLUDE) \ + $(if $(filter-out WNT,$(OS)),$$(GTK3_CFLAGS) ) \ +)) + +$(eval $(call gb_Executable_use_custom_headers,updater,external/onlineupdate/generated)) + +$(eval $(call gb_Executable_use_static_libraries,updater,\ + libmar \ + libmarverify \ + updatehelper \ + $(if $(filter WNT,$(OS)), \ + windows_process )\ +)) + +$(eval $(call gb_Executable_use_externals,updater,\ + bzip2 \ +)) + +ifeq ($(OS),WNT) +$(eval $(call gb_Executable_add_libs,updater,\ + Ws2_32.lib \ + Gdi32.lib \ + Comctl32.lib \ + Shell32.lib \ + Shlwapi.lib \ + Crypt32.lib \ + Ole32.lib \ + Rpcrt4.lib \ + wintrust.lib \ +)) + +$(eval $(call gb_Executable_set_targettype_gui,updater,YES)) + +$(eval $(call gb_Executable_add_nativeres,updater,updaterres)) + +$(eval $(call gb_Executable_add_ldflags,updater,\ + /ENTRY:wmainCRTStartup \ +)) + +$(eval $(call gb_Executable_add_defs,updater,\ + -DMOZ_APP_VERSION=\"$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)\" \ + -DMOZ_VERIFY_MAR_SIGNATURE \ + -DNS_NO_XPCOM \ + -DMOZ_MAINTENANCE_SERVICE \ + -DXP_WIN \ + -DXZ_USE_CRC64 \ + -DXZ_DEC_X86 \ + -DXZ_DEC_POWERPC \ + -DXZ_DEC_IA64 \ + -DXZ_DEC_ARM \ + -DXZ_DEC_ARMTHUMB \ + -DXZ_DEC_SPARC \ + $(if $(filter AARCH64 INTEL X86_64,$(CPUNAME)),-D__BYTE_ORDER__=1234) \ + -D__ORDER_BIG_ENDIAN__=4321 \ + -D__ORDER_LITTLE_ENDIAN__=1234 \ + -U_WIN32_WINNT \ +)) + +else + +$(eval $(call gb_Executable_add_defs,updater,\ + -DMOZ_APP_VERSION=\"$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)\" \ + -DMOZ_VERIFY_MAR_SIGNATURE \ + -DNSS3 \ + -DNS_NO_XPCOM \ + -DXP_UNIX \ + -DXZ_USE_CRC64 \ + -DXZ_DEC_X86 \ + -DXZ_DEC_POWERPC \ + -DXZ_DEC_IA64 \ + -DXZ_DEC_ARM \ + -DXZ_DEC_ARMTHUMB \ + -DXZ_DEC_SPARC \ +)) + +$(eval $(call gb_Executable_use_externals,updater,\ + nss3 \ +)) + +$(eval $(call gb_Executable_add_libs,updater,\ + $(GTK3_LIBS) \ +)) + +endif + +$(eval $(call gb_Executable_set_generated_cxx_suffix,updater,cpp)) + +$(eval $(call gb_Executable_add_generated_exception_objects,updater,\ + UnpackedTarball/onlineupdate/onlineupdate/source/update/updater/archivereader \ + UnpackedTarball/onlineupdate/onlineupdate/source/update/updater/bspatch \ + $(if $(filter-out WNT,$(OS)),UnpackedTarball/onlineupdate/onlineupdate/source/update/updater/progressui_gtk) \ + UnpackedTarball/onlineupdate/onlineupdate/source/update/updater/updater \ + $(if $(filter WNT,$(OS)),\ + UnpackedTarball/onlineupdate/onlineupdate/source/update/updater/loaddlls \ + UnpackedTarball/onlineupdate/onlineupdate/source/update/updater/progressui_win )\ +)) + +$(eval $(call gb_Executable_add_generated_cobjects,updater, \ + UnpackedTarball/onlineupdate/modules/xz-embedded/src/xz_crc32 \ + UnpackedTarball/onlineupdate/modules/xz-embedded/src/xz_crc64 \ + UnpackedTarball/onlineupdate/modules/xz-embedded/src/xz_dec_bcj \ + UnpackedTarball/onlineupdate/modules/xz-embedded/src/xz_dec_lzma2 \ + UnpackedTarball/onlineupdate/modules/xz-embedded/src/xz_dec_stream \ +)) + +$(eval $(call gb_Executable_set_warnings_disabled,updater)) + +ifeq ($(OS),WNT) + +$(eval $(call gb_Executable_add_cxxflags,updater,-Zc:strictStrings-)) + +$(eval $(call gb_Executable_add_defs,updater,-DUNICODE)) + +endif + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/external/onlineupdate/Library_install_updateservice.mk b/external/onlineupdate/Library_install_updateservice.mk new file mode 100644 index 0000000000..216b81a95a --- /dev/null +++ b/external/onlineupdate/Library_install_updateservice.mk @@ -0,0 +1,54 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,install_updateservice)) + +$(eval $(call gb_Library_use_unpacked,install_updateservice,onlineupdate)) + +$(eval $(call gb_Library_set_include,install_updateservice, \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/common \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_add_defs,install_updateservice, \ + -U_DLL \ +)) + +$(eval $(call gb_Library_add_cxxflags,install_updateservice, \ + $(if $(MSVC_USE_DEBUG_RUNTIME),/MTd,/MT) \ + $(if $(filter -fsanitize=%,$(CC)),,/fno-sanitize-address-vcasan-lib) \ +)) + +$(eval $(call gb_Library_add_ldflags,install_updateservice, \ + /DEF:$(SRCDIR)/external/onlineupdate/install_updateservice.def \ + /NODEFAULTLIB \ +)) + +$(eval $(call gb_Library_add_exception_objects,install_updateservice, \ + external/onlineupdate/install_updateservice \ +)) + +$(eval $(call gb_Library_use_static_libraries,install_updateservice, \ + updatehelper \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,install_updateservice, \ + libcmt \ + libcpmt \ + libucrt \ + libvcruntime \ + msi \ + kernel32 \ + user32 \ + advapi32 \ + shell32 \ + shlwapi \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/onlineupdate/Makefile b/external/onlineupdate/Makefile new file mode 100644 index 0000000000..569ad8a0ba --- /dev/null +++ b/external/onlineupdate/Makefile @@ -0,0 +1,14 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/onlineupdate/Module_onlineupdate.mk b/external/onlineupdate/Module_onlineupdate.mk new file mode 100644 index 0000000000..6b037bd971 --- /dev/null +++ b/external/onlineupdate/Module_onlineupdate.mk @@ -0,0 +1,33 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,onlineupdate)) + +ifneq ($(ENABLE_ONLINE_UPDATE_MAR),) +$(eval $(call gb_Module_add_targets,onlineupdate,\ + UnpackedTarball_onlineupdate \ + StaticLibrary_libmar \ + StaticLibrary_libmarverify \ + StaticLibrary_updatehelper \ + $(if $(filter WNT,$(OS)),\ + Executable_update_service \ + Library_install_updateservice \ + WinResTarget_updater )\ + Executable_test_updater_dialog \ + Executable_mar \ + Executable_updater \ + Executable_mbsdiff \ + CustomTarget_generated \ + Package_update-settings_ini \ + Package_updater_ini \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/onlineupdate/Package_update-settings_ini.mk b/external/onlineupdate/Package_update-settings_ini.mk new file mode 100644 index 0000000000..bbb438e40d --- /dev/null +++ b/external/onlineupdate/Package_update-settings_ini.mk @@ -0,0 +1,16 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Package_Package,update-settings_ini,$(SRCDIR)/external/onlineupdate)) + +$(eval $(call gb_Package_add_files,update-settings_ini,$(if $(filter MACOSX,$(OS)),Contents/Resources,.), \ + update-settings.ini \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/onlineupdate/Package_updater_ini.mk b/external/onlineupdate/Package_updater_ini.mk new file mode 100644 index 0000000000..5ae65db8b4 --- /dev/null +++ b/external/onlineupdate/Package_updater_ini.mk @@ -0,0 +1,16 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Package_Package,updater_ini,$(SRCDIR)/external/onlineupdate)) + +$(eval $(call gb_Package_add_files,updater_ini,$(LIBO_BIN_FOLDER), \ + updater.ini \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/onlineupdate/README.md b/external/onlineupdate/README.md new file mode 100644 index 0000000000..5b0d08146e --- /dev/null +++ b/external/onlineupdate/README.md @@ -0,0 +1,44 @@ +# Online Update + +Online update implementation based on Mozilla's MAR format + update mechanism + +The source code has been extracted from <https://github.com/mozilla/gecko-dev> with +external/onlineupdate/generate-sources.sh. + +The source/service directory contains the code for the silent windows updater that avoids the +repeated administrator check for an update. + +## Note + +The updater executable should not depend on any other dynamic library in the LibreOffice +installation as we would need to copy that one also to a temporary directory during update. We can't +update any library or executable that is currently in use. For the updater executable we solve this +problem by copying the updater before using it to a temporary directory. + +On Windows we use the system to provide us with a crypto library whereas on Linux we use NSS. + +## Update Procedure + +The updater executable is run two times. In a first run, the current installation is copied to an +`update` directory and the update is applied in this `update` directory. During the next run, a +replacement request is executed. The replacement request removes the old installation directory and +replaces it with the content of the `update` directory. + +### User Profile in the Installation Directory + +The archive based installations have the user profile by default inside of the installation +directory. During the update process this causes some problems that need special handling in the +updater. + +* The `update` directory is inside of the user profile resulting in recursive copying. +* During the replacement request the updater log is in the user profile, which changes location from +the actual location to a backup location. + +## Executable_test_updater_dialog + +To run that manual test, do +``` +$ cp instdir/program/updater.ini workdir/LinkTarget/Executable/test_updater_dialog.ini +$ workdir/LinkTarget/Executable/test_updater_dialog +$ rm workdir/LinkTarget/Executable/test_updater_dialog.ini +``` diff --git a/external/onlineupdate/StaticLibrary_libmar.mk b/external/onlineupdate/StaticLibrary_libmar.mk new file mode 100644 index 0000000000..836b500387 --- /dev/null +++ b/external/onlineupdate/StaticLibrary_libmar.mk @@ -0,0 +1,45 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,libmar)) + +$(eval $(call gb_StaticLibrary_use_unpacked,libmar,onlineupdate)) + +$(eval $(call gb_StaticLibrary_set_include,libmar,\ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/libmar/src/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include/onlineupdate \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/other-licenses/nsis/Contrib/CityHash/cityhash \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,libmar,cpp)) + +$(eval $(call gb_StaticLibrary_add_generated_cobjects,libmar,\ + UnpackedTarball/onlineupdate/onlineupdate/source/libmar/src/mar_create \ + UnpackedTarball/onlineupdate/onlineupdate/source/libmar/src/mar_extract \ + UnpackedTarball/onlineupdate/onlineupdate/source/libmar/src/mar_read \ +)) + +$(eval $(call gb_StaticLibrary_add_generated_exception_objects,libmar, \ + UnpackedTarball/onlineupdate/other-licenses/nsis/Contrib/CityHash/cityhash/city \ +)) + +$(eval $(call gb_StaticLibrary_use_static_libraries,\ + libmarverify \ +)) + +$(eval $(call gb_StaticLibrary_set_warnings_disabled,libmar)) + +ifeq ($(OS),WNT) +$(eval $(call gb_StaticLibrary_add_defs,libmar, \ + -DXP_WIN \ +)) +endif + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/external/onlineupdate/StaticLibrary_libmarverify.mk b/external/onlineupdate/StaticLibrary_libmarverify.mk new file mode 100644 index 0000000000..9915fcb662 --- /dev/null +++ b/external/onlineupdate/StaticLibrary_libmarverify.mk @@ -0,0 +1,45 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,libmarverify)) + +$(eval $(call gb_StaticLibrary_use_unpacked,libmarverify,onlineupdate)) + +$(eval $(call gb_StaticLibrary_set_include,libmarverify,\ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/libmar/src/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include/onlineupdate \ + $$(INCLUDE) \ +)) + +ifeq ($(OS),WNT) + +$(eval $(call gb_StaticLibrary_add_defs,libmarverify, \ + -DXP_WIN \ +)) + +else + +$(eval $(call gb_StaticLibrary_add_defs,libmarverify,\ + -DMAR_NSS \ +)) + +$(eval $(call gb_StaticLibrary_use_externals,libmarverify,\ + nss3 \ +)) + +endif + +$(eval $(call gb_StaticLibrary_add_generated_cobjects,libmarverify,\ + UnpackedTarball/onlineupdate/onlineupdate/source/libmar/verify/mar_verify \ + UnpackedTarball/onlineupdate/onlineupdate/source/libmar/verify/cryptox \ +)) + +$(eval $(call gb_StaticLibrary_set_warnings_disabled,libmarverify)) + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/external/onlineupdate/StaticLibrary_updatehelper.mk b/external/onlineupdate/StaticLibrary_updatehelper.mk new file mode 100644 index 0000000000..79da4f809c --- /dev/null +++ b/external/onlineupdate/StaticLibrary_updatehelper.mk @@ -0,0 +1,70 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_StaticLibrary_StaticLibrary,updatehelper)) + +$(eval $(call gb_StaticLibrary_use_unpacked,updatehelper,onlineupdate)) + +$(eval $(call gb_StaticLibrary_set_include,updatehelper,\ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/inc/ \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/service \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/common \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include/onlineupdate \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/include \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/mfbt/double-conversion \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/toolkit/mozapps/update/common \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/xpcom/base \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_StaticLibrary_add_defs,updatehelper,\ + -DMOZ_MAINTENANCE_SERVICE \ + -DNSS3 \ + -DMOZ_VERIFY_MAR_SIGNATURE \ + -DXP_$(if $(filter WNT,$(OS)),WIN,UNIX) \ + $(if $(filter WNT,$(OS)),-U_WIN32_WINNT) \ +)) + +$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,updatehelper,cpp)) + +$(eval $(call gb_StaticLibrary_add_generated_exception_objects,updatehelper,\ + UnpackedTarball/onlineupdate/mozglue/misc/Printf \ + UnpackedTarball/onlineupdate/onlineupdate/source/update/common/readstrings \ + UnpackedTarball/onlineupdate/toolkit/mozapps/update/common/updatecommon \ +)) + +ifeq ($(OS),WNT) +$(eval $(call gb_StaticLibrary_add_generated_exception_objects,updatehelper,\ + UnpackedTarball/onlineupdate/onlineupdate/source/update/common/pathhash \ + UnpackedTarball/onlineupdate/onlineupdate/source/update/common/uachelper \ + UnpackedTarball/onlineupdate/onlineupdate/source/update/common/updatehelper \ + UnpackedTarball/onlineupdate/onlineupdate/source/service/certificatecheck \ + UnpackedTarball/onlineupdate/onlineupdate/source/service/registrycertificates \ + UnpackedTarball/onlineupdate/toolkit/mozapps/update/common/updateutils_win \ +)) +endif + +$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,updatehelper,cc)) + +$(eval $(call gb_StaticLibrary_add_generated_exception_objects,updatehelper, \ + UnpackedTarball/onlineupdate/mfbt/double-conversion/double-conversion/bignum \ + UnpackedTarball/onlineupdate/mfbt/double-conversion/double-conversion/bignum-dtoa \ + UnpackedTarball/onlineupdate/mfbt/double-conversion/double-conversion/cached-powers \ + UnpackedTarball/onlineupdate/mfbt/double-conversion/double-conversion/double-to-string \ + UnpackedTarball/onlineupdate/mfbt/double-conversion/double-conversion/fast-dtoa \ + UnpackedTarball/onlineupdate/mfbt/double-conversion/double-conversion/fixed-dtoa \ +)) + +$(eval $(call gb_StaticLibrary_set_warnings_disabled,updatehelper)) + +ifeq ($(OS),WNT) +$(eval $(call gb_StaticLibrary_add_cxxflags,updatehelper,-Zc:strictStrings-)) +endif + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: */ diff --git a/external/onlineupdate/UnpackedTarball_onlineupdate.mk b/external/onlineupdate/UnpackedTarball_onlineupdate.mk new file mode 100644 index 0000000000..d27a191d50 --- /dev/null +++ b/external/onlineupdate/UnpackedTarball_onlineupdate.mk @@ -0,0 +1,30 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,onlineupdate)) + +$(eval $(call gb_UnpackedTarball_set_tarball,onlineupdate,$(ONLINEUPDATE_TARBALL))) + +$(eval $(call gb_UnpackedTarball_set_patchlevel,onlineupdate,0)) + +$(eval $(call gb_UnpackedTarball_add_patches,onlineupdate, \ + external/onlineupdate/gtk3deprecated.patch \ + external/onlineupdate/lo.patch \ +)) + +# The update maintenance service that is used on Windows has a couple of checks that files in the +# to-be-updated installation set are signed, which would fail for --disable-windows-build-signing; +# so, as a HACK for debugging purposes, silence those problematic checks for --enable-dbgutil: +ifeq ($(OS)-$(WINDOWS_BUILD_SIGNING)-$(ENABLE_DBGUTIL),WNT-FALSE-TRUE) +$(eval $(call gb_UnpackedTarball_add_patches,onlineupdate, \ + external/onlineupdate/unsigned-hack.patch \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/onlineupdate/WinResTarget_updater.mk b/external/onlineupdate/WinResTarget_updater.mk new file mode 100644 index 0000000000..edb2db7483 --- /dev/null +++ b/external/onlineupdate/WinResTarget_updater.mk @@ -0,0 +1,15 @@ +$(eval $(call gb_WinResTarget_WinResTarget,updaterres)) + +$(call gb_WinResTarget_get_target,updaterres,updaterres): | \ + $(call gb_UnpackedTarball_get_target,onlineupdate) + +$(eval $(call gb_WinResTarget_set_include,updaterres,\ + $$(INCLUDE) \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/common \ + -I$(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/updater \ +)) + +$(call gb_WinResTarget_get_clean_target,updaterres): \ + RCFILE := $(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/updater/updater.rc +$(call gb_WinResTarget_get_target,updaterres): \ + RCFILE := $(call gb_UnpackedTarball_get_dir,onlineupdate)/onlineupdate/source/update/updater/updater.rc diff --git a/external/onlineupdate/generate-sources.sh b/external/onlineupdate/generate-sources.sh new file mode 100755 index 0000000000..8b6ebeb6c3 --- /dev/null +++ b/external/onlineupdate/generate-sources.sh @@ -0,0 +1,209 @@ +#!/bin/sh +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +# Generate an external tarball from upstream git repo $1 (optionally using $2 in the tarball name): + +set -ex + +source=${1?} +tag=${2-$(git -C "${source?}" describe --abbrev=40 --always)} + +tmpdir=$(mktemp -d) + +copyto() { + (cd "${tmpdir?}" && mkdir -p $(dirname "${1?}")) + cp "${source?}"/"${2?}" "${tmpdir?}"/"${1?}" +} + +# Copy sources according to the old onlineupdate/ target layout: + +copyto include/onlineupdate/mar.h modules/libmar/src/mar.h +copyto include/onlineupdate/mar_cmdline.h modules/libmar/src/mar_cmdline.h +copyto include/onlineupdate/mar_private.h modules/libmar/src/mar_private.h +copyto include/onlineupdate/mozilla/Assertions.h mfbt/Assertions.h +copyto include/onlineupdate/mozilla/Attributes.h mfbt/Attributes.h +copyto include/onlineupdate/mozilla/Compiler.h mfbt/Compiler.h +copyto include/onlineupdate/mozilla/Likely.h mfbt/Likely.h +copyto include/onlineupdate/mozilla/MacroArgs.h mfbt/MacroArgs.h +copyto include/onlineupdate/mozilla/Types.h mfbt/Types.h +copyto include/onlineupdate/mozilla/nsTraceRefcnt.h xpcom/base/nsTraceRefcnt.h +copyto include/mozilla/Char16.h mfbt/Char16.h +copyto onlineupdate/inc/bspatch.h toolkit/mozapps/update/updater/bspatch/bspatch.h +copyto onlineupdate/source/libmar/README modules/libmar/README +copyto onlineupdate/source/libmar/sign/mar_sign.c modules/libmar/sign/mar_sign.c +copyto onlineupdate/source/libmar/sign/nss_secutil.c modules/libmar/sign/nss_secutil.c +copyto onlineupdate/source/libmar/sign/nss_secutil.h modules/libmar/sign/nss_secutil.h +copyto onlineupdate/source/libmar/src/mar_create.c modules/libmar/src/mar_create.c +copyto onlineupdate/source/libmar/src/mar_extract.c modules/libmar/src/mar_extract.c +copyto onlineupdate/source/libmar/src/mar_read.c modules/libmar/src/mar_read.c +copyto onlineupdate/source/libmar/tool/mar.c modules/libmar/tool/mar.c +copyto onlineupdate/source/libmar/verify/MacVerifyCrypto.cpp modules/libmar/verify/MacVerifyCrypto.cpp +copyto onlineupdate/source/libmar/verify/cryptox.c modules/libmar/verify/cryptox.c +copyto onlineupdate/source/libmar/verify/cryptox.h modules/libmar/verify/cryptox.h +copyto onlineupdate/source/libmar/verify/mar_verify.c modules/libmar/verify/mar_verify.c +copyto onlineupdate/source/mbsdiff/bsdiff.c other-licenses/bsdiff/bsdiff.c +copyto onlineupdate/source/service/certificatecheck.cpp toolkit/mozapps/update/common/certificatecheck.cpp +copyto onlineupdate/source/service/certificatecheck.h toolkit/mozapps/update/common/certificatecheck.h +copyto onlineupdate/source/service/maintenanceservice.cpp toolkit/components/maintenanceservice/maintenanceservice.cpp +copyto onlineupdate/source/service/maintenanceservice.h toolkit/components/maintenanceservice/maintenanceservice.h +copyto onlineupdate/source/service/registrycertificates.cpp toolkit/mozapps/update/common/registrycertificates.cpp +copyto onlineupdate/source/service/registrycertificates.h toolkit/mozapps/update/common/registrycertificates.h +copyto onlineupdate/source/service/resource.h toolkit/components/maintenanceservice/resource.h +copyto onlineupdate/source/service/servicebase.cpp toolkit/components/maintenanceservice/servicebase.cpp +copyto onlineupdate/source/service/servicebase.h toolkit/components/maintenanceservice/servicebase.h +copyto onlineupdate/source/service/serviceinstall.cpp toolkit/components/maintenanceservice/serviceinstall.cpp +copyto onlineupdate/source/service/serviceinstall.h toolkit/components/maintenanceservice/serviceinstall.h +copyto onlineupdate/source/service/workmonitor.cpp toolkit/components/maintenanceservice/workmonitor.cpp +copyto onlineupdate/source/service/workmonitor.h toolkit/components/maintenanceservice/workmonitor.h +# Renamed target from onlineupdate/source/update/common/errors.h: +copyto onlineupdate/source/update/common/updatererrors.h toolkit/mozapps/update/common/updatererrors.h +copyto onlineupdate/source/update/common/pathhash.cpp toolkit/mozapps/update/common/pathhash.cpp +copyto onlineupdate/source/update/common/pathhash.h toolkit/mozapps/update/common/pathhash.h +copyto onlineupdate/source/update/common/readstrings.cpp toolkit/mozapps/update/common/readstrings.cpp +copyto onlineupdate/source/update/common/readstrings.h toolkit/mozapps/update/common/readstrings.h +copyto onlineupdate/source/update/common/uachelper.cpp toolkit/mozapps/update/common/uachelper.cpp +copyto onlineupdate/source/update/common/uachelper.h toolkit/mozapps/update/common/uachelper.h +copyto onlineupdate/source/update/common/updatedefines.h toolkit/mozapps/update/common/updatedefines.h +copyto onlineupdate/source/update/common/updatehelper.cpp toolkit/mozapps/update/common/updatehelper.cpp +copyto onlineupdate/source/update/common/updatehelper.h toolkit/mozapps/update/common/updatehelper.h +copyto onlineupdate/source/update/updater/Makefile.in toolkit/mozapps/update/updater/Makefile.in +copyto onlineupdate/source/update/updater/archivereader.cpp toolkit/mozapps/update/updater/archivereader.cpp +copyto onlineupdate/source/update/updater/archivereader.h toolkit/mozapps/update/updater/archivereader.h +copyto onlineupdate/source/update/updater/bspatch.cpp toolkit/mozapps/update/updater/bspatch/bspatch.cpp +copyto onlineupdate/source/update/updater/gen_cert_header.py toolkit/mozapps/update/updater/gen_cert_header.py +copyto onlineupdate/source/update/updater/launchchild_osx.mm toolkit/mozapps/update/updater/launchchild_osx.mm +copyto onlineupdate/source/update/updater/loaddlls.cpp toolkit/mozapps/update/updater/loaddlls.cpp +# Renamed target from onlineupdate/source/update/updater/macbuild/Contents/Info.plist: +copyto onlineupdate/source/update/updater/macbuild/Contents/Info.plist.in toolkit/mozapps/update/updater/macbuild/Contents/Info.plist.in +copyto onlineupdate/source/update/updater/macbuild/Contents/PkgInfo toolkit/mozapps/update/updater/macbuild/Contents/PkgInfo +copyto onlineupdate/source/update/updater/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in toolkit/mozapps/update/updater/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in +copyto onlineupdate/source/update/updater/macbuild/Contents/Resources/English.lproj/MainMenu.nib/classes.nib toolkit/mozapps/update/updater/macbuild/Contents/Resources/English.lproj/MainMenu.nib/classes.nib +copyto onlineupdate/source/update/updater/macbuild/Contents/Resources/English.lproj/MainMenu.nib/info.nib toolkit/mozapps/update/updater/macbuild/Contents/Resources/English.lproj/MainMenu.nib/info.nib +copyto onlineupdate/source/update/updater/macbuild/Contents/Resources/English.lproj/MainMenu.nib/keyedobjects.nib toolkit/mozapps/update/updater/macbuild/Contents/Resources/English.lproj/MainMenu.nib/keyedobjects.nib +copyto onlineupdate/source/update/updater/macbuild/Contents/Resources/updater.icns toolkit/mozapps/update/updater/macbuild/Contents/Resources/updater.icns +copyto onlineupdate/source/update/updater/progressui-unused/progressui_osx.mm toolkit/mozapps/update/updater/progressui_osx.mm +copyto onlineupdate/source/update/updater/progressui.h toolkit/mozapps/update/updater/progressui.h +copyto onlineupdate/source/update/updater/progressui_gtk.cpp toolkit/mozapps/update/updater/progressui_gtk.cpp +copyto onlineupdate/source/update/updater/progressui_null.cpp toolkit/mozapps/update/updater/progressui_null.cpp +copyto onlineupdate/source/update/updater/progressui_win.cpp toolkit/mozapps/update/updater/progressui_win.cpp +copyto onlineupdate/source/update/updater/resource.h toolkit/mozapps/update/updater/resource.h +copyto onlineupdate/source/update/updater/updater-common.build toolkit/mozapps/update/updater/updater-common.build +copyto onlineupdate/source/update/updater/updater-xpcshell/Makefile.in toolkit/mozapps/update/updater/updater-xpcshell/Makefile.in +copyto onlineupdate/source/update/updater/updater-xpcshell/moz.build toolkit/mozapps/update/updater/updater-xpcshell/moz.build +copyto onlineupdate/source/update/updater/updater.cpp toolkit/mozapps/update/updater/updater.cpp +copyto onlineupdate/source/update/updater/updater.exe.comctl32.manifest toolkit/mozapps/update/updater/updater.exe.comctl32.manifest +copyto onlineupdate/source/update/updater/updater.exe.manifest toolkit/mozapps/update/updater/updater.exe.manifest +copyto onlineupdate/source/update/updater/updater.ico toolkit/mozapps/update/updater/updater.ico +copyto onlineupdate/source/update/updater/updater.png toolkit/mozapps/update/updater/updater.png +copyto onlineupdate/source/update/updater/updater.rc toolkit/mozapps/update/updater/updater.rc +copyto onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.cpp xpcom/base/nsVersionComparator.cpp +copyto onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.h xpcom/base/nsVersionComparator.h + +# Missing source for include/onlineupdate/mozilla/TypeTraits.h +# Missing source for onlineupdate/source/libmar/sign/Makefile.in +# Missing source for onlineupdate/source/libmar/src/Makefile.in +# Missing source for onlineupdate/source/libmar/tool/Makefile.in +# Missing source for onlineupdate/source/service/windowsHelper.hxx +# Missing source for onlineupdate/source/update/common/sources.mozbuild +# Missing source for onlineupdate/source/update/common/updatelogging.cxx +# Missing source for onlineupdate/source/update/common/updatelogging.h +# Missing source for onlineupdate/source/update/updater/progressui-unused/progressui_gonk.cxx +# Missing source for onlineupdate/source/update/updater/progressui_gtk_icon.h +# Missing source for onlineupdate/source/update/updater/updater.svg + +# Copy additional sources according to the actual source layout: + +copyto include/mozilla/Alignment.h mfbt/Alignment.h +copyto include/mozilla/AllocPolicy.h mfbt/AllocPolicy.h +copyto include/mozilla/ArrayUtils.h mfbt/ArrayUtils.h +copyto include/mozilla/Atomics.h mfbt/Atomics.h +copyto include/mozilla/Casting.h mfbt/Casting.h +copyto include/mozilla/CheckedInt.h mfbt/CheckedInt.h +copyto include/mozilla/CmdLineAndEnvUtils.h toolkit/xre/CmdLineAndEnvUtils.h +copyto include/mozilla/CompactPair.h mfbt/CompactPair.h +copyto include/mozilla/DebugOnly.h mfbt/DebugOnly.h +copyto include/mozilla/DynamicallyLinkedFunctionPtr.h mozglue/misc/DynamicallyLinkedFunctionPtr.h +copyto include/mozilla/EndianUtils.h mfbt/EndianUtils.h +copyto include/mozilla/Fuzzing.h mfbt/Fuzzing.h +copyto include/mozilla/HashFunctions.h mfbt/HashFunctions.h +copyto include/mozilla/IntegerPrintfMacros.h mozglue/misc/IntegerPrintfMacros.h +copyto include/mozilla/IntegerTypeTraits.h mfbt/IntegerTypeTraits.h +copyto include/mozilla/MathAlgorithms.h mfbt/MathAlgorithms.h +copyto include/mozilla/Maybe.h mfbt/Maybe.h +copyto include/mozilla/MaybeStorageBase.h mfbt/MaybeStorageBase.h +copyto include/mozilla/MemoryChecking.h mfbt/MemoryChecking.h +copyto include/mozilla/MemoryReporting.h mfbt/MemoryReporting.h +copyto include/mozilla/OperatorNewExtensions.h mfbt/OperatorNewExtensions.h +copyto include/mozilla/Poison.h mfbt/Poison.h +copyto include/mozilla/Printf.h mozglue/misc/Printf.h +copyto include/mozilla/ReentrancyGuard.h mfbt/ReentrancyGuard.h +copyto include/mozilla/Result.h mfbt/Result.h +copyto include/mozilla/ResultVariant.h mfbt/ResultVariant.h +copyto include/mozilla/Span.h mfbt/Span.h +copyto include/mozilla/Sprintf.h mozglue/misc/Sprintf.h +copyto include/mozilla/StaticAnalysisFunctions.h mfbt/StaticAnalysisFunctions.h +copyto include/mozilla/TemplateLib.h mfbt/TemplateLib.h +copyto include/mozilla/ThreadSafety.h mfbt/ThreadSafety.h +copyto include/mozilla/TypedEnumBits.h mfbt/TypedEnumBits.h +copyto include/mozilla/UniquePtr.h mfbt/UniquePtr.h +copyto include/mozilla/UniquePtrExtensions.h mfbt/UniquePtrExtensions.h +copyto include/mozilla/Variant.h mfbt/Variant.h +copyto include/mozilla/Vector.h mfbt/Vector.h +copyto include/mozilla/WinHeaderOnlyUtils.h widget/windows/WinHeaderOnlyUtils.h +copyto include/mozilla/WrappingOperations.h mfbt/WrappingOperations.h +copyto include/mozilla/fallible.h mfbt/fallible.h +copyto mfbt/double-conversion/double-conversion/bignum-dtoa.cc mfbt/double-conversion/double-conversion/bignum-dtoa.cc +copyto mfbt/double-conversion/double-conversion/bignum-dtoa.h mfbt/double-conversion/double-conversion/bignum-dtoa.h +copyto mfbt/double-conversion/double-conversion/bignum.cc mfbt/double-conversion/double-conversion/bignum.cc +copyto mfbt/double-conversion/double-conversion/bignum.h mfbt/double-conversion/double-conversion/bignum.h +copyto mfbt/double-conversion/double-conversion/cached-powers.cc mfbt/double-conversion/double-conversion/cached-powers.cc +copyto mfbt/double-conversion/double-conversion/cached-powers.h mfbt/double-conversion/double-conversion/cached-powers.h +copyto mfbt/double-conversion/double-conversion/diy-fp.h mfbt/double-conversion/double-conversion/diy-fp.h +copyto mfbt/double-conversion/double-conversion/double-to-string.cc mfbt/double-conversion/double-conversion/double-to-string.cc +copyto mfbt/double-conversion/double-conversion/double-to-string.h mfbt/double-conversion/double-conversion/double-to-string.h +copyto mfbt/double-conversion/double-conversion/fast-dtoa.cc mfbt/double-conversion/double-conversion/fast-dtoa.cc +copyto mfbt/double-conversion/double-conversion/fast-dtoa.h mfbt/double-conversion/double-conversion/fast-dtoa.h +copyto mfbt/double-conversion/double-conversion/fixed-dtoa.cc mfbt/double-conversion/double-conversion/fixed-dtoa.cc +copyto mfbt/double-conversion/double-conversion/fixed-dtoa.h mfbt/double-conversion/double-conversion/fixed-dtoa.h +copyto mfbt/double-conversion/double-conversion/ieee.h mfbt/double-conversion/double-conversion/ieee.h +copyto mfbt/double-conversion/double-conversion/utils.h mfbt/double-conversion/double-conversion/utils.h +copyto modules/xz-embedded/src/xz.h modules/xz-embedded/src/xz.h +copyto modules/xz-embedded/src/xz_config.h modules/xz-embedded/src/xz_config.h +copyto modules/xz-embedded/src/xz_crc32.c modules/xz-embedded/src/xz_crc32.c +copyto modules/xz-embedded/src/xz_crc64.c modules/xz-embedded/src/xz_crc64.c +copyto modules/xz-embedded/src/xz_dec_bcj.c modules/xz-embedded/src/xz_dec_bcj.c +copyto modules/xz-embedded/src/xz_dec_lzma2.c modules/xz-embedded/src/xz_dec_lzma2.c +copyto modules/xz-embedded/src/xz_dec_stream.c modules/xz-embedded/src/xz_dec_stream.c +copyto modules/xz-embedded/src/xz_lzma2.h modules/xz-embedded/src/xz_lzma2.h +copyto modules/xz-embedded/src/xz_private.h modules/xz-embedded/src/xz_private.h +copyto modules/xz-embedded/src/xz_stream.h modules/xz-embedded/src/xz_stream.h +copyto mozglue/misc/Printf.cpp mozglue/misc/Printf.cpp +copyto nsprpub/lib/libc/src/strdup.c nsprpub/lib/libc/src/strdup.c +copyto nsprpub/lib/libc/src/strlen.c nsprpub/lib/libc/src/strlen.c +copyto other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp +copyto other-licenses/nsis/Contrib/CityHash/cityhash/city.h other-licenses/nsis/Contrib/CityHash/cityhash/city.h +copyto toolkit/mozapps/update/common/commonupdatedir.h toolkit/mozapps/update/common/commonupdatedir.h +copyto toolkit/mozapps/update/common/updatecommon.cpp toolkit/mozapps/update/common/updatecommon.cpp +copyto toolkit/mozapps/update/common/updatecommon.h toolkit/mozapps/update/common/updatecommon.h +copyto toolkit/mozapps/update/common/updateutils_win.cpp toolkit/mozapps/update/common/updateutils_win.cpp +copyto toolkit/mozapps/update/common/updateutils_win.h toolkit/mozapps/update/common/updateutils_win.h +copyto toolkit/mozapps/update/updater/crctable.h toolkit/mozapps/update/updater/crctable.h +copyto toolkit/xre/nsWindowsRestart.cpp toolkit/xre/nsWindowsRestart.cpp +copyto tools/update-packaging/common.sh tools/update-packaging/common.sh +copyto tools/update-packaging/make_full_update.sh tools/update-packaging/make_full_update.sh +copyto tools/update-packaging/make_incremental_update.sh tools/update-packaging/make_incremental_update.sh +copyto xpcom/base/nsAlgorithm.h xpcom/base/nsAlgorithm.h +copyto xpcom/base/nsAutoRef.h xpcom/base/nsAutoRef.h +copyto xpcom/base/nsWindowsHelpers.h xpcom/base/nsWindowsHelpers.h +copyto xpcom/string/nsCharTraits.h xpcom/string/nsCharTraits.h +copyto xpcom/string/nsUTF8Utils.h xpcom/string/nsUTF8Utils.h + +LC_ALL=C tar -c --format=gnu --sort=name --owner=0 --group=0 --mode=go=rX,u=rwX \ + --mtime '2023-12-11 00:00:00+0' --xz -f onlineupdate-"${tag?}".tar.xz -C "${tmpdir?}" . +rm -r "${tmpdir?}" diff --git a/external/onlineupdate/generate.py b/external/onlineupdate/generate.py new file mode 100644 index 0000000000..8454d7efd9 --- /dev/null +++ b/external/onlineupdate/generate.py @@ -0,0 +1,21 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +import sys + +from gen_cert_header import create_header + +with open(sys.argv[1], mode='w') as f: + # For debug purposes, ONLINEUPDATE_MAR_CERTIFICATEDER (passed in as sys.argv[2]) can be empty, + # but create_header always expects an existing file argument, so as a hack fall back to this + # script itself (i.e., sys.argv[0]) as the pathname of the certificate DER file (though that + # will cause create_header to generate nonsense data, of course): + create_header(f, sys.argv[2] or sys.argv[0]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/external/onlineupdate/gtk3deprecated.patch b/external/onlineupdate/gtk3deprecated.patch new file mode 100644 index 0000000000..fb73634d50 --- /dev/null +++ b/external/onlineupdate/gtk3deprecated.patch @@ -0,0 +1,11 @@ +--- onlineupdate/source/update/updater/progressui_gtk.cpp ++++ onlineupdate/source/update/updater/progressui_gtk.cpp +@@ -94,7 +94,7 @@ + gtk_window_set_icon(GTK_WINDOW(sWin), sPixbuf); + g_object_unref(sPixbuf); + +- GtkWidget* vbox = gtk_vbox_new(TRUE, 6); ++ GtkWidget* vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); + sLabel = gtk_label_new(sStrings.info.get()); + gtk_misc_set_alignment(GTK_MISC(sLabel), 0.0f, 0.0f); + sProgressBar = gtk_progress_bar_new(); diff --git a/external/onlineupdate/install_updateservice.cxx b/external/onlineupdate/install_updateservice.cxx new file mode 100644 index 0000000000..c1d5471560 --- /dev/null +++ b/external/onlineupdate/install_updateservice.cxx @@ -0,0 +1,225 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <algorithm> +#include <cstddef> +#include <limits> +#include <memory> +#include <string> + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <msiquery.h> + +#include <pathhash.h> + +// Replacements for functions used in +// workdir/UnpackedTarball/onlineupdate/onlineupdate/source/update/common/pathhash.cpp but not +// available here: + +extern "C" wchar_t* _wcslwr(wchar_t* str) +{ + for (auto p = str; *p != L'\0'; ++p) + { + if (*p >= L'A' && *p <= L'Z') + { + *p += L'a' - L'A'; + } + } + return str; +}; + +extern "C" wchar_t* wcsncpy(wchar_t* strDest, wchar_t const* strSource, std::size_t count) +{ + for (std::size_t i = 0; i != count; ++i) + { + strDest[i] = *strSource; + if (*strSource != L'\0') + { + ++strSource; + } + } + return strDest; +} + +namespace +{ +bool getProperty(MSIHANDLE handle, wchar_t const* name, std::wstring* value) +{ + DWORD n = 0; + if (MsiGetPropertyW(handle, name, const_cast<wchar_t*>(L""), &n) != ERROR_MORE_DATA + || n == std::numeric_limits<DWORD>::max()) + { + return false; + } + ++n; + auto buf = std::make_unique<wchar_t[]>(n); + if (MsiGetPropertyW(handle, name, buf.get(), &n) != ERROR_SUCCESS) + { + return false; + } + if (n != 0 && buf[n - 1] == L'\\') + { + --n; + } + value->assign(buf.get(), n); + return true; +} + +typedef std::unique_ptr<void, decltype(&CloseHandle)> CloseHandleGuard; + +CloseHandleGuard guard(HANDLE handle) { return CloseHandleGuard(handle, CloseHandle); } + +bool runExecutable(std::wstring const& installLocation, wchar_t const* argument) +{ + std::wstring cmdline(L"\""); + cmdline += installLocation; + cmdline += L"\\program\\update_service.exe\" "; + cmdline += argument; + auto const n = cmdline.size() + 1; + auto const buf = std::make_unique<wchar_t[]>(n); + std::copy_n(cmdline.data(), n, buf.get()); + STARTUPINFOW si{}; + si.cb = sizeof(si); + PROCESS_INFORMATION pi{}; + if (!CreateProcessW(nullptr, buf.get(), nullptr, nullptr, FALSE, CREATE_NO_WINDOW, nullptr, + nullptr, &si, &pi)) + { + return false; + } + auto const g(guard(pi.hProcess)); + DWORD res = WaitForSingleObject(pi.hProcess, INFINITE); + if (res != WAIT_OBJECT_0) + { + return false; + } + DWORD ec = 0; + if (!GetExitCodeProcess(pi.hProcess, &ec)) + { + return false; + } + if (ec != 0) + { + return false; + } + return true; +} + +bool writeRegistry(std::wstring const& installLocation) +{ + WCHAR path[MAX_PATH + 1]; + if (!CalculateRegistryPathFromFilePath(installLocation.c_str(), path)) + { + return false; + } + HKEY key; + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, (std::wstring(path) + L"\\0").c_str(), 0, nullptr, + REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_WOW64_64KEY, nullptr, &key, + nullptr) + != ERROR_SUCCESS) + { + return false; + } + auto ok = true; + if (RegSetValueExW(key, L"issuer", 0, REG_SZ, + reinterpret_cast<BYTE const*>(L"Certum Code Signing 2021 CA"), + sizeof L"Certum Code Signing 2021 CA") + != ERROR_SUCCESS) + { + ok = false; + } + if (RegSetValueExW(key, L"name", 0, REG_SZ, + reinterpret_cast<BYTE const*>(L"The Document Foundation"), + sizeof L"The Document Foundation") + != ERROR_SUCCESS) + { + ok = false; + } + if (RegCloseKey(key) != ERROR_SUCCESS) + { + ok = false; + } + return ok; +} + +bool deleteRegistry(std::wstring const& installLocation) +{ + WCHAR path[MAX_PATH + 1]; + if (!CalculateRegistryPathFromFilePath(installLocation.c_str(), path)) + { + return false; + } + if (RegDeleteTreeW(HKEY_LOCAL_MACHINE, path) != ERROR_SUCCESS) + { + return false; + } + return true; +} +} + +extern "C" __declspec(dllexport) UINT __stdcall PrepareUpdateservice(MSIHANDLE handle) +{ + std::wstring loc; + if (!getProperty(handle, L"INSTALLLOCATION", &loc)) + { + return ERROR_INSTALL_FAILURE; + } + auto ok = true; + if (MsiSetPropertyW(handle, L"install_updateservice", loc.c_str()) != ERROR_SUCCESS) + { + ok = false; + } + if (MsiSetPropertyW(handle, L"uninstall_updateservice", loc.c_str()) != ERROR_SUCCESS) + { + ok = false; + } + return ok ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; +} + +extern "C" __declspec(dllexport) UINT __stdcall InstallUpdateservice(MSIHANDLE handle) +{ + std::wstring loc; + if (!getProperty(handle, L"CustomActionData", &loc)) + { + return ERROR_INSTALL_FAILURE; + } + auto ok = true; + if (!runExecutable(loc, L"install")) + { + ok = false; + } + if (!writeRegistry(loc)) + { + ok = false; + } + return ok ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; +} + +extern "C" __declspec(dllexport) UINT __stdcall UninstallUpdateservice(MSIHANDLE handle) +{ + std::wstring loc; + if (!getProperty(handle, L"CustomActionData", &loc)) + { + return ERROR_INSTALL_FAILURE; + } + auto ok = true; + if (!runExecutable(loc, L"uninstall")) + { + ok = false; + } + if (!deleteRegistry(loc)) + { + ok = false; + } + return ok ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/external/onlineupdate/install_updateservice.def b/external/onlineupdate/install_updateservice.def new file mode 100644 index 0000000000..d1c319a43f --- /dev/null +++ b/external/onlineupdate/install_updateservice.def @@ -0,0 +1,5 @@ +LIBRARY "install_updateservice.dll" +EXPORTS + InstallUpdateservice + PrepareUpdateservice + UninstallUpdateservice diff --git a/external/onlineupdate/lo.patch b/external/onlineupdate/lo.patch new file mode 100644 index 0000000000..14b2a9a2de --- /dev/null +++ b/external/onlineupdate/lo.patch @@ -0,0 +1,304 @@ +--- onlineupdate/source/libmar/tool/mar.c ++++ onlineupdate/source/libmar/tool/mar.c +@@ -14,7 +14,9 @@ + # include <windows.h> + # include <direct.h> + # define chdir _chdir ++# define PATH_MAX MAX_PATH + #else ++# include <limits.h> + # include <unistd.h> + #endif + +@@ -39,7 +41,7 @@ + printf("Create a MAR file:\n"); + printf( + " mar -H MARChannelID -V ProductVersion [-C workingDir] " +- "-c archive.mar [files...]\n"); ++ "-c archive.mar [files...|-f files]\n"); + + printf("Extract a MAR file:\n"); + printf(" mar [-C workingDir] -x archive.mar\n"); +@@ -244,6 +246,8 @@ + + switch (argv[1][1]) { + case 'c': { ++ int numfiles; ++ char** files; + struct ProductInformationBlock infoBlock; + if (!productVersion) { + fprintf(stderr, +@@ -256,9 +260,61 @@ + "<mar-channel-id>`).\n"); + return -1; + } ++ if (argc == 5 && !strcmp(argv[3], "-f")) { ++ FILE* in; ++ in = fopen(argv[4], "r"); ++ if (!in) { ++ fprintf(stderr, ++ "ERROR: Cannot open file `%s` for reading.\n", argv[4]); ++ return -1; ++ } ++ numfiles = 0; ++ files = malloc(sizeof(char*) * 10000); /*TODO*/ ++ if (!files) { ++ fprintf(stderr, ++ "ERROR: Cannot allocate memory"); ++ return -1; ++ } ++ for (;;) { ++ char buf[PATH_MAX + 1]; ++ size_t len; ++ if (!fgets(buf, PATH_MAX + 1, in)) { ++ if (feof(in)) { ++ break; ++ } ++ fprintf(stderr, ++ "ERROR: Cannot read from file `%s`.\n", argv[4]); ++ return -1; ++ } ++ len = strlen(buf); ++ if (len != 0 && buf[len - 1] == '\n') { ++ buf[len - 1] = '\0'; ++ } else if (!feof(in)) { ++ fprintf(stderr, ++ "ERROR: Too long line in file `%s`.\n", argv[4]); ++ return -1; ++ } ++ if (numfiles == 10000) { /*TODO*/ ++ fprintf(stderr, ++ "ERROR: Too many lines in file `%s`.\n", argv[4]); ++ return -1; ++ } ++ files[numfiles] = strdup(buf); ++ if (!files[numfiles]) { ++ fprintf(stderr, ++ "ERROR: Cannot allocate memory"); ++ return -1; ++ } ++ ++numfiles; ++ } ++ fclose(in); ++ } else { ++ numfiles = argc - 3; ++ files = argv + 3; ++ } + infoBlock.MARChannelID = MARChannelID; + infoBlock.productVersion = productVersion; +- return mar_create(argv[2], argc - 3, argv + 3, &infoBlock); ++ return mar_create(argv[2], numfiles, files, &infoBlock); + } + case 'i': { + if (!productVersion) { +--- onlineupdate/source/service/serviceinstall.cpp ++++ onlineupdate/source/service/serviceinstall.cpp +@@ -25,7 +25,7 @@ + + // This uninstall key is defined originally in maintenanceservice_installer.nsi + #define MAINT_UNINSTALL_KEY \ +- L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MozillaMaintenan" \ ++ L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\LibreOfficeMaintenan" \ + L"ceService" + + static BOOL UpdateUninstallerVersionString(LPWSTR versionString) { +@@ -201,7 +201,7 @@ + size_t currentServicePathLen = wcslen(currentServicePath); + bool doesServiceHaveCorrectPath = + currentServicePathLen > 2 && +- !wcsstr(currentServicePath, L"maintenanceservice_tmp.exe") && ++ !wcsstr(currentServicePath, L"update_service_tmp.exe") && + currentServicePath[0] == L'\"' && + currentServicePath[currentServicePathLen - 1] == L'\"'; + +@@ -222,7 +222,7 @@ + LOG_WARN(("Couldn't remove file spec. (%lu)", GetLastError())); + return FALSE; + } +- if (!PathAppendSafe(fixedPath, L"maintenanceservice.exe")) { ++ if (!PathAppendSafe(fixedPath, L"update_service.exe")) { + LOG_WARN(("Couldn't append file spec. (%lu)", GetLastError())); + return FALSE; + } +@@ -561,7 +561,7 @@ + + // The service can be in a stopped state but the exe still in use + // so make sure the process is really gone before proceeding +- WaitForProcessExit(L"maintenanceservice.exe", 30); ++ WaitForProcessExit(L"update_service.exe", 30); + LOG(("Done waiting for service stop, last service state: %lu", lastState)); + + return lastState == SERVICE_STOPPED; +--- onlineupdate/source/service/serviceinstall.h ++++ onlineupdate/source/service/serviceinstall.h +@@ -4,7 +4,7 @@ + + #include "readstrings.h" + +-#define SVC_DISPLAY_NAME L"Mozilla Maintenance Service" ++#define SVC_DISPLAY_NAME L"LibreOffice Maintenance Service" + + enum SvcInstallAction { UpgradeSvc, InstallSvc, ForceInstallSvc }; + BOOL SvcInstall(SvcInstallAction action); +--- onlineupdate/source/update/common/pathhash.cpp ++++ onlineupdate/source/update/common/pathhash.cpp +@@ -119,7 +119,7 @@ + delete[] lowercasePath; + + LPCWSTR baseRegPath = +- L"SOFTWARE\\Mozilla\\" ++ L"SOFTWARE\\LibreOffice\\" + L"MaintenanceService\\"; + wcsncpy(registryPath, baseRegPath, MAX_PATH); + BinaryDataToHexString(hash, hashSize, registryPath + wcslen(baseRegPath)); +--- onlineupdate/source/update/common/updatehelper.cpp ++++ onlineupdate/source/update/common/updatehelper.cpp +@@ -78,7 +78,7 @@ + wcsncpy(outBuf, progFilesX86, MAX_PATH + 1); + CoTaskMemFree(progFilesX86); + +- if (!PathAppendSafe(outBuf, L"Mozilla Maintenance Service")) { ++ if (!PathAppendSafe(outBuf, L"LibreOffice Maintenance Service")) { + return FALSE; + } + +@@ -311,7 +311,7 @@ + // Obtain the temp path of the maintenance service binary + WCHAR tmpService[MAX_PATH + 1] = {L'\0'}; + if (!PathGetSiblingFilePath(tmpService, serviceConfig.lpBinaryPathName, +- L"maintenanceservice_tmp.exe")) { ++ L"update_service_tmp.exe")) { + return FALSE; + } + +@@ -322,7 +322,7 @@ + // Get the new maintenance service path from the install dir + WCHAR newMaintServicePath[MAX_PATH + 1] = {L'\0'}; + wcsncpy(newMaintServicePath, installDir, MAX_PATH); +- PathAppendSafe(newMaintServicePath, L"maintenanceservice.exe"); ++ PathAppendSafe(newMaintServicePath, L"update_service.exe"); + + // Copy the temp file in alongside the maintenace service. + // This is a requirement for maintenance service upgrades. +@@ -429,7 +429,7 @@ + // 2) The command being executed, which is "software-update" + // 3) The path to updater.exe (from argv[0]) + LPCWSTR* updaterServiceArgv = new LPCWSTR[argc + 2]; +- updaterServiceArgv[0] = L"MozillaMaintenance"; ++ updaterServiceArgv[0] = L"LibreOfficeMaintenance"; + updaterServiceArgv[1] = L"software-update"; + + for (int i = 0; i < argc; ++i) { +--- onlineupdate/source/update/common/updatehelper.h ++++ onlineupdate/source/update/common/updatehelper.h +@@ -24,9 +24,9 @@ + #define PATCH_DIR_PATH L"\\updates\\0" + + #ifdef MOZ_MAINTENANCE_SERVICE +-# define SVC_NAME L"MozillaMaintenance" ++# define SVC_NAME L"LibreOfficeMaintenance" + +-# define BASE_SERVICE_REG_KEY L"SOFTWARE\\Mozilla\\MaintenanceService" ++# define BASE_SERVICE_REG_KEY L"SOFTWARE\\LibreOffice\\MaintenanceService" + + // The test only fallback key, as its name implies, is only present on machines + // that will use automated tests. Since automated tests always run from a +--- onlineupdate/source/service/workmonitor.cpp ++++ onlineupdate/source/service/workmonitor.cpp +@@ -328,7 +328,7 @@ + // The installation dir that we are installing to is installDir. + WCHAR installDirUpdater[MAX_PATH + 1] = {L'\0'}; + wcsncpy(installDirUpdater, installDir, MAX_PATH); +- if (!PathAppendSafe(installDirUpdater, L"updater.exe")) { ++ if (!PathAppendSafe(installDirUpdater, L"program\\updater.exe")) { + LOG_WARN(("Install directory updater could not be determined.")); + return false; + } +@@ -746,7 +746,7 @@ + + WCHAR installDirUpdater[MAX_PATH + 1] = {L'\0'}; + wcsncpy(installDirUpdater, installDir, MAX_PATH); +- if (!PathAppendSafe(installDirUpdater, L"updater.exe")) { ++ if (!PathAppendSafe(installDirUpdater, L"program\\updater.exe")) { + LOG_WARN(("Install directory updater could not be determined.")); + result = FALSE; + } +--- onlineupdate/source/update/updater/updater.cpp ++++ onlineupdate/source/update/updater/updater.cpp +@@ -4174,6 +4174,10 @@ + NS_tmkdir(gDeleteDirPath, 0755); + } + } ++ ++ if (_setmaxstdio(8192) == -1) { ++ LOG(("_setmaxstdio failed")); ++ } + #endif /* XP_WIN */ + + // Run update process on a background thread. ShowProgressUI may return +--- tools/update-packaging/common.sh ++++ tools/update-packaging/common.sh +@@ -76,6 +76,15 @@ + forced= + fi + ++ if [ -n "$IFSFILE" ]; then ++ ifsline=$(grep -F " \"$f\"" "$IFSFILE") ++ if [ -n "$ifsline" ]; then ++ testfile=$(printf '%s' "$ifsline" | cut -f 2 -d '"') ++ verbose_notice " add-if \"$testfile\" \"$f\"" ++ echo "add-if \"$testfile\" \"$f\"" >> "$filev3" ++ return ++ fi ++ fi + is_extension=$(echo "$f" | grep -c 'distribution/extensions/.*/') + if [ $is_extension = "1" ]; then + # Use the subdirectory of the extensions folder as the file to test +--- tools/update-packaging/make_full_update.sh ++++ tools/update-packaging/make_full_update.sh +@@ -45,6 +45,7 @@ + + archive="$1" + targetdir="$2" ++IFSFILE=$3 + # Prevent the workdir from being inside the targetdir so it isn't included in + # the update mar. + if [ $(echo "$targetdir" | grep -c '\/$') = 1 ]; then +@@ -53,9 +54,10 @@ + fi + workdir="$targetdir.work" + updatemanifestv3="$workdir/updatev3.manifest" +-targetfiles="updatev3.manifest" + + mkdir -p "$workdir" ++ ++printf 'updatev3.manifest\n' >"$workdir/files.txt" + + # Generate a list of all files in the target directory. + pushd "$targetdir" +@@ -66,7 +68,6 @@ + if [ ! -f "precomplete" ]; then + if [ ! -f "Contents/Resources/precomplete" ]; then + notice "precomplete file is missing!" +- exit 1 + fi + fi + +@@ -99,7 +100,7 @@ + $XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force --stdout "$targetdir/$f" > "$workdir/$f" + copy_perm "$targetdir/$f" "$workdir/$f" + +- targetfiles="$targetfiles \"$f\"" ++ printf '%s\n' "$f" >>"$workdir/files.txt" + done + + # Append remove instructions for any dead files. +@@ -110,7 +111,7 @@ + $XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force "$updatemanifestv3" && mv -f "$updatemanifestv3.xz" "$updatemanifestv3" + + mar_command="$mar_command -C \"$workdir\" -c output.mar" +-eval "$mar_command $targetfiles" ++eval "$mar_command -f $workdir/files.txt" + mv -f "$workdir/output.mar" "$archive" + + # cleanup diff --git a/external/onlineupdate/monitor-sources.sh b/external/onlineupdate/monitor-sources.sh new file mode 100755 index 0000000000..9e0a252a06 --- /dev/null +++ b/external/onlineupdate/monitor-sources.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +# Monitor any changes in upstream git repo $1 between revisions $2 and $3 that affect files that we +# copy with our external/onlineupdate/generate-sources.sh: + +set -ex -o pipefail + +source=${1?} +old=${2?} +new=${3?} + +files=$(grep -E '^copyto [^ ]+ [^ ]+$' external/onlineupdate/generate-sources.sh | cut -f 3 -d ' ') +git -C "${source?}" log --patch "${old?}".."${new?}" -- $files diff --git a/external/onlineupdate/qa/lang_packs/Makefile b/external/onlineupdate/qa/lang_packs/Makefile new file mode 100644 index 0000000000..d328472f53 --- /dev/null +++ b/external/onlineupdate/qa/lang_packs/Makefile @@ -0,0 +1,21 @@ +gb_Side := host +include ../../../config_host.mk + +UPDATER_DIR := $(WORKDIR)/updater/lang_pack + +all : call + +unpack: + @echo "Unpacking the updater test project" + @rm -r $(UPDATER_DIR) || true + @mkdir -p $(WORKDIR)/updater/ + @unzip updater_lang.zip -d $(WORKDIR)/updater > /dev/null + @cp update_signed.mar $(UPDATER_DIR)/user/patch/update.mar + @cp update_en_signed.mar $(UPDATER_DIR)/user/patch/update_en_signed.mar + +call: unpack + @echo "Update the test project" + @$(INSTDIR)/program/updater $(UPDATER_DIR)/user/patch $(UPDATER_DIR) $(UPDATER_DIR)/user/update -1 + +call-gdb: unpack + gdb --args $(INSTDIR)/program/updater $(UPDATER_DIR)/user/patch $(UPDATER_DIR) $(UPDATER_DIR)/user/update -1 diff --git a/external/onlineupdate/qa/lang_packs/update_en_signed.mar b/external/onlineupdate/qa/lang_packs/update_en_signed.mar Binary files differnew file mode 100644 index 0000000000..b72d1c5df6 --- /dev/null +++ b/external/onlineupdate/qa/lang_packs/update_en_signed.mar diff --git a/external/onlineupdate/qa/lang_packs/update_signed.mar b/external/onlineupdate/qa/lang_packs/update_signed.mar Binary files differnew file mode 100644 index 0000000000..a145d6325c --- /dev/null +++ b/external/onlineupdate/qa/lang_packs/update_signed.mar diff --git a/external/onlineupdate/qa/lang_packs/updater_lang.zip b/external/onlineupdate/qa/lang_packs/updater_lang.zip Binary files differnew file mode 100644 index 0000000000..05b206bc89 --- /dev/null +++ b/external/onlineupdate/qa/lang_packs/updater_lang.zip diff --git a/external/onlineupdate/qa/replace_request/Makefile b/external/onlineupdate/qa/replace_request/Makefile new file mode 100644 index 0000000000..476e93213c --- /dev/null +++ b/external/onlineupdate/qa/replace_request/Makefile @@ -0,0 +1,17 @@ +gb_Side := host +include ../../../config_host.mk + +UPDATER_DIR := $(WORKDIR)/updater/replace_request + +unpack: + @echo "Unpacking the updater test project" + @rm -r $(UPDATER_DIR) || true + @mkdir -p $(WORKDIR)/updater + @unzip updater.zip -d $(WORKDIR)/updater > /dev/null + +call: unpack + @echo "Update the test project" + @$(INSTDIR)/program/updater $(UPDATER_DIR)/user/patch $(UPDATER_DIR) $(UPDATER_DIR)/user/update /replace + +call-gdb: unpack + gdb --args $(INSTDIR)/program/updater $(UPDATER_DIR)/user/patch $(UPDATER_DIR) $(UPDATER_DIR)/user/update /replace diff --git a/external/onlineupdate/qa/replace_request/README b/external/onlineupdate/qa/replace_request/README new file mode 100644 index 0000000000..f50c692fd6 --- /dev/null +++ b/external/onlineupdate/qa/replace_request/README @@ -0,0 +1,3 @@ +Tests the replacement request done by the automatic updater + +After calling 'make call' the content in workdir/updater/program/datei.txt should say "new". diff --git a/external/onlineupdate/qa/replace_request/updater.zip b/external/onlineupdate/qa/replace_request/updater.zip Binary files differnew file mode 100644 index 0000000000..dc5e26b0f2 --- /dev/null +++ b/external/onlineupdate/qa/replace_request/updater.zip diff --git a/external/onlineupdate/qa/single_step/Makefile b/external/onlineupdate/qa/single_step/Makefile new file mode 100644 index 0000000000..f303992baa --- /dev/null +++ b/external/onlineupdate/qa/single_step/Makefile @@ -0,0 +1,27 @@ +gb_Side := host +include ../../../config_host.mk + +UPDATER_DIR := $(WORKDIR)/updater/single_step + +all : call + +unpack: + @echo "Unpacking the updater test project" + @rm -r $(UPDATER_DIR) || true + @mkdir -p $(UPDATER_DIR) + @unzip single_step.zip -d $(WORKDIR)/updater > /dev/null + @mkdir -p $(UPDATER_DIR)/patch + +call-complete: unpack + @echo "Update the test project" + @cp complete_signed.mar $(UPDATER_DIR)/patch/update.mar + @$(INSTDIR)/program/updater $(UPDATER_DIR)/patch $(UPDATER_DIR) $(UPDATER_DIR) 0 + +call-incremental: unpack + @echo "Update the test project" + @cp incremental_signed.mar $(UPDATER_DIR)/patch/update.mar + @$(INSTDIR)/program/updater $(UPDATER_DIR)/patch $(UPDATER_DIR) $(UPDATER_DIR) 0 + +call-gdb: unpack + @cp incremental_signed.mar $(UPDATER_DIR)/patch/update.mar + gdb --args $(INSTDIR)/program/updater $(UPDATER_DIR)/patch $(UPDATER_DIR) $(UPDATER_DIR) 0 diff --git a/external/onlineupdate/qa/single_step/complete_signed.mar b/external/onlineupdate/qa/single_step/complete_signed.mar Binary files differnew file mode 100644 index 0000000000..7b0631dd33 --- /dev/null +++ b/external/onlineupdate/qa/single_step/complete_signed.mar diff --git a/external/onlineupdate/qa/single_step/incremental_signed.mar b/external/onlineupdate/qa/single_step/incremental_signed.mar Binary files differnew file mode 100644 index 0000000000..6ec6e7a1a9 --- /dev/null +++ b/external/onlineupdate/qa/single_step/incremental_signed.mar diff --git a/external/onlineupdate/qa/single_step/single_step.zip b/external/onlineupdate/qa/single_step/single_step.zip Binary files differnew file mode 100644 index 0000000000..823a590e08 --- /dev/null +++ b/external/onlineupdate/qa/single_step/single_step.zip diff --git a/external/onlineupdate/unsigned-hack.patch b/external/onlineupdate/unsigned-hack.patch new file mode 100644 index 0000000000..7ef3b76d73 --- /dev/null +++ b/external/onlineupdate/unsigned-hack.patch @@ -0,0 +1,20 @@ +--- onlineupdate/source/service/workmonitor.cpp ++++ onlineupdate/source/service/workmonitor.cpp +@@ -395,7 +395,7 @@ + } + + #ifndef DISABLE_UPDATER_AUTHENTICODE_CHECK +- return DoesBinaryMatchAllowedCertificates(installDir, updater); ++ return DoesBinaryMatchAllowedCertificates(installDir, updater)||true; + #else + return true; + #endif +@@ -732,7 +732,7 @@ + if (!WriteStatusFailure(argv[4], SERVICE_INSTALL_DIR_REG_ERROR)) { + LOG_WARN(("Could not write update.status for previous failure.")); + } +- return FALSE; ++ //return FALSE; + } + RegCloseKey(baseKey); + } else { diff --git a/external/onlineupdate/update-settings.ini b/external/onlineupdate/update-settings.ini new file mode 100644 index 0000000000..60a657f904 --- /dev/null +++ b/external/onlineupdate/update-settings.ini @@ -0,0 +1,10 @@ +; +; This file is part of the LibreOffice project. +; +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, You can obtain one at http://mozilla.org/MPL/2.0/. +; + +[Settings] +ACCEPTED_MAR_CHANNEL_IDS=LOOnlineUpdater diff --git a/external/onlineupdate/updater.ini b/external/onlineupdate/updater.ini new file mode 100644 index 0000000000..8ee6ad9cc2 --- /dev/null +++ b/external/onlineupdate/updater.ini @@ -0,0 +1,12 @@ +; +; This file is part of the LibreOffice project. +; +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, You can obtain one at http://mozilla.org/MPL/2.0/. +; + +[Strings] +Title=LibreOffice Update +Info=Please wait while we update your installation. +MozillaMaintenanceDescription=The LibreOffice Maintenace Service helps ensure that you have the latest and most secure version of LibreOffice on your computer. diff --git a/external/onlineupdate/workben/test_dialog.cxx b/external/onlineupdate/workben/test_dialog.cxx new file mode 100644 index 0000000000..4c956410d8 --- /dev/null +++ b/external/onlineupdate/workben/test_dialog.cxx @@ -0,0 +1,39 @@ +#include "progressui.h" + +#if defined(_WIN32) +#include "progressui_win.cpp" +#else +#include "progressui_gtk.cpp" +#endif + +#include <thread> +#include <chrono> +#include <iostream> + +void func() +{ + for (int i = 0; i <= 100; ++i) + { + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + UpdateProgressUI(i); + } + QuitProgressUI(); +} + +int NS_main(int argc, NS_tchar** argv) +{ + InitProgressUI(&argc, &argv); + std::thread a(func); + /* + volatile bool b = false; + do + { + std::this_thread::sleep_for(std::chrono::seconds(1)); + } + while (!b); + */ + int result = ShowProgressUI(); + std::cout << result << std::endl; + a.join(); + return 0; +} |