summaryrefslogtreecommitdiffstats
path: root/external/expat
diff options
context:
space:
mode:
Diffstat (limited to 'external/expat')
-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.mk34
-rw-r--r--external/expat/expat-winapi.patch25
8 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..1e9609a4a
--- /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,\
+ $(gb_RUN_CONFIGURE) ./configure --without-docbook \
+ $(gb_CONFIGURE_PLATFORMS) \
+ $(if $(CROSS_COMPILING),$(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..5d4f41f6d
--- /dev/null
+++ b/external/expat/UnpackedTarball_expat.mk
@@ -0,0 +1,34 @@
+# -*- 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 \
+))
+
+# 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..fed65644a
--- /dev/null
+++ b/external/expat/expat-winapi.patch
@@ -0,0 +1,25 @@
+--- misc/expat-2.5.0/lib/expat_external.h 2022-10-25 01:32:54.000000000 +0900
++++ misc/build/expat-2.5.0/lib/expat_external.h 2022-10-30 23:09:47.339459134 +0900
+@@ -88,10 +88,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 */
+
+--- misc/expat-2.5.0/lib/xmlparse.c 2022-10-26 00:09:08.000000000 +0900
++++ misc/build/expat-2.5.0/lib/xmlparse.c 2022-10-30 23:09:01.843006341 +0900
+@@ -67,6 +67,9 @@
+ #endif
+
+ #ifdef _WIN32
++# undef HAVE_ARC4RANDOM_BUF
++# undef HAVE_GETRANDOM
++# undef HAVE_SYSCALL_GETRANDOM
+ /* force stdlib to define rand_s() */
+ # if ! defined(_CRT_RAND_S)
+ # define _CRT_RAND_S