summaryrefslogtreecommitdiffstats
path: root/external/expat
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /external/expat
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--external/expat/ExternalProject_expat.mk25
-rw-r--r--external/expat/Makefile7
-rw-r--r--external/expat/Module_expat.mk30
-rw-r--r--external/expat/README4
-rw-r--r--external/expat/StaticLibrary_expat.mk51
-rw-r--r--external/expat/StaticLibrary_expat_x64.mk33
-rw-r--r--external/expat/UnpackedTarball_expat.mk35
-rw-r--r--external/expat/expat-winapi.patch13
-rw-r--r--external/expat/ubsan.patch.011
9 files changed, 209 insertions, 0 deletions
diff --git a/external/expat/ExternalProject_expat.mk b/external/expat/ExternalProject_expat.mk
new file mode 100644
index 000000000..4f4f0301c
--- /dev/null
+++ b/external/expat/ExternalProject_expat.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_ExternalProject_ExternalProject,expat))
+
+$(eval $(call gb_ExternalProject_register_targets,expat,\
+ configure \
+))
+
+$(call gb_ExternalProject_get_state_target,expat,configure) :
+ $(call gb_Trace_StartRange,expat,EXTERNAL)
+ $(call gb_ExternalProject_run,configure,\
+ ./configure --without-docbook \
+ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+ $(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \
+ ,,expat_configure.log)
+ $(call gb_Trace_EndRange,expat,EXTERNAL)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/expat/Makefile b/external/expat/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/expat/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+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/expat/Module_expat.mk b/external/expat/Module_expat.mk
new file mode 100644
index 000000000..baac0b595
--- /dev/null
+++ b/external/expat/Module_expat.mk
@@ -0,0 +1,30 @@
+# -*- 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,expat))
+
+$(eval $(call gb_Module_add_targets,expat,\
+ UnpackedTarball_expat \
+ StaticLibrary_expat \
+))
+
+ifneq ($(OS),WNT)
+$(eval $(call gb_Module_add_targets,expat,\
+ ExternalProject_expat \
+))
+endif
+
+# ---------------- X64 stuff special ---------------------
+ifeq ($(BUILD_X64),TRUE)
+$(eval $(call gb_Module_add_targets,expat,\
+ StaticLibrary_expat_x64 \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/expat/README b/external/expat/README
new file mode 100644
index 000000000..e7c93c246
--- /dev/null
+++ b/external/expat/README
@@ -0,0 +1,4 @@
+Simple SAX parser library with added UTF-16 support.
+
+From:
+[https://github.com/libexpat/libexpat]
diff --git a/external/expat/StaticLibrary_expat.mk b/external/expat/StaticLibrary_expat.mk
new file mode 100644
index 000000000..025ab617a
--- /dev/null
+++ b/external/expat/StaticLibrary_expat.mk
@@ -0,0 +1,51 @@
+# -*- 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,expat))
+
+$(eval $(call gb_StaticLibrary_set_warnings_disabled,expat))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,expat,expat))
+
+# no configure step on windows, no dependency
+ifneq ($(OS),WNT)
+$(eval $(call gb_StaticLibrary_use_external_project,expat,expat,full))
+endif
+
+$(eval $(call gb_StaticLibrary_set_include,expat,\
+ -I$(call gb_UnpackedTarball_get_dir,expat) \
+ $$(INCLUDE) \
+))
+
+ifeq ($(OS),MACOSX)
+ifneq ($(strip $(SYSBASE)),)
+$(eval $(call gb_StaticLibrary_add_defs,expat,\
+ -DHAVE_MEMMOVE \
+ -DHAVE_BCOPY \
+))
+endif
+endif
+
+ifeq ($(OS),WNT)
+$(eval $(call gb_StaticLibrary_add_defs,expat,\
+ -DCOMPILED_FROM_DSP \
+))
+else
+$(eval $(call gb_StaticLibrary_add_defs,expat,\
+ -DHAVE_EXPAT_CONFIG_H \
+))
+endif
+
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,expat,\
+ UnpackedTarball/expat/lib/xmlparse \
+ UnpackedTarball/expat/lib/xmlrole \
+ UnpackedTarball/expat/lib/xmltok \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/expat/StaticLibrary_expat_x64.mk b/external/expat/StaticLibrary_expat_x64.mk
new file mode 100644
index 000000000..68bb7f86a
--- /dev/null
+++ b/external/expat/StaticLibrary_expat_x64.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_StaticLibrary_StaticLibrary,expat_x64))
+
+$(eval $(call gb_StaticLibrary_set_x64,expat_x64,YES))
+
+$(eval $(call gb_StaticLibrary_set_warnings_disabled,expat_x64))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,expat_x64,expat))
+
+$(eval $(call gb_StaticLibrary_set_include,expat_x64,\
+ -I$(call gb_UnpackedTarball_get_dir,expat) \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_StaticLibrary_add_defs,expat_x64,\
+ -DCOMPILED_FROM_DSP \
+))
+
+$(eval $(call gb_StaticLibrary_add_x64_generated_cobjects,expat_x64,\
+ UnpackedTarball/expat/lib/xmlparse_x64 \
+ UnpackedTarball/expat/lib/xmltok_x64 \
+ UnpackedTarball/expat/lib/xmlrole_x64 \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/expat/UnpackedTarball_expat.mk b/external/expat/UnpackedTarball_expat.mk
new file mode 100644
index 000000000..96f4e3ec8
--- /dev/null
+++ b/external/expat/UnpackedTarball_expat.mk
@@ -0,0 +1,35 @@
+# -*- 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_UnpackedTarball_UnpackedTarball,expat))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,expat,$(EXPAT_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_update_autoconf_configs,expat,conftools))
+
+$(eval $(call gb_UnpackedTarball_add_patches,expat,\
+ external/expat/expat-winapi.patch \
+ external/expat/ubsan.patch.0 \
+))
+
+# This is a bit hackish.
+
+# When building for Windows (as 32-bit) we need to build it twice: as
+# 32- and 64-bit code, to be able to produce a 64-bit Explorer
+# ("shell") extension that is used when the 32-bit LibreOffice is
+# installed on a 64-bit OS.
+
+$(eval $(call gb_UnpackedTarball_set_post_action,expat,\
+ $(if $(filter $(BUILD_X64),TRUE), \
+ cp lib/xmlparse.c lib/xmlparse_x64.c && \
+ cp lib/xmltok.c lib/xmltok_x64.c && \
+ cp lib/xmlrole.c lib/xmlrole_x64.c) \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/expat/expat-winapi.patch b/external/expat/expat-winapi.patch
new file mode 100644
index 000000000..b33c12b83
--- /dev/null
+++ b/external/expat/expat-winapi.patch
@@ -0,0 +1,13 @@
+--- misc/expat-2.1.0/lib/expat_external.h 2009-11-16 08:53:17.375000000 +0000
++++ misc/build/expat-2.1.0/lib/expat_external.h 2009-11-16 08:53:34.703125000 +0000
+@@ -81,10 +81,6 @@
+ # ifndef XML_BUILDING_EXPAT
+ /* using Expat from an application */
+
+-# if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
+-# define XMLIMPORT __declspec(dllimport)
+-# endif
+-
+ # endif
+ #endif /* not defined XML_STATIC */
+
diff --git a/external/expat/ubsan.patch.0 b/external/expat/ubsan.patch.0
new file mode 100644
index 000000000..8317f922d
--- /dev/null
+++ b/external/expat/ubsan.patch.0
@@ -0,0 +1,11 @@
+--- lib/xmlparse.c
++++ lib/xmlparse.c
+@@ -6485,7 +6485,7 @@
+ static void FASTCALL
+ hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) {
+ iter->p = table->v;
+- iter->end = iter->p + table->size;
++ iter->end = table->size == 0 ? iter->p : iter->p + table->size;
+ }
+
+ static NAMED *FASTCALL