summaryrefslogtreecommitdiffstats
path: root/external/libtommath
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /external/libtommath
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/libtommath')
-rw-r--r--external/libtommath/ExternalProject_libtommath.mk38
-rw-r--r--external/libtommath/Makefile7
-rw-r--r--external/libtommath/Module_libtommath.mk17
-rw-r--r--external/libtommath/README6
-rw-r--r--external/libtommath/UnpackedTarball_libtommath.mk21
-rw-r--r--external/libtommath/clang-cl.patch16
-rw-r--r--external/libtommath/libtommath-msvc.patch12
7 files changed, 117 insertions, 0 deletions
diff --git a/external/libtommath/ExternalProject_libtommath.mk b/external/libtommath/ExternalProject_libtommath.mk
new file mode 100644
index 000000000..2b4fb9fbd
--- /dev/null
+++ b/external/libtommath/ExternalProject_libtommath.mk
@@ -0,0 +1,38 @@
+# -*- 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,libtommath))
+
+$(eval $(call gb_ExternalProject_register_targets,libtommath,\
+ build \
+))
+
+$(eval $(call gb_ExternalProject_use_nmake,libtommath,build))
+
+ifeq ($(COM),MSC)
+$(call gb_ExternalProject_get_state_target,libtommath,build):
+ $(call gb_Trace_StartRange,libtommath,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ nmake -nologo -f makefile.msvc \
+ )
+ $(call gb_Trace_EndRange,libtommath,EXTERNAL)
+else
+$(call gb_ExternalProject_get_state_target,libtommath,build) :
+ $(call gb_Trace_StartRange,libtommath,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ unset MAKEFLAGS \
+ && export CFLAGS=" \
+ -fPIC \
+ " \
+ && $(MAKE) $(if $(verbose),V=1) NO_ADDTL_WARNINGS=1 \
+ )
+ $(call gb_Trace_EndRange,libtommath,EXTERNAL)
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtommath/Makefile b/external/libtommath/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/libtommath/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/libtommath/Module_libtommath.mk b/external/libtommath/Module_libtommath.mk
new file mode 100644
index 000000000..def67f839
--- /dev/null
+++ b/external/libtommath/Module_libtommath.mk
@@ -0,0 +1,17 @@
+# -*- 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,libtommath))
+
+$(eval $(call gb_Module_add_targets,libtommath,\
+ ExternalProject_libtommath \
+ UnpackedTarball_libtommath \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtommath/README b/external/libtommath/README
new file mode 100644
index 000000000..0da3128c5
--- /dev/null
+++ b/external/libtommath/README
@@ -0,0 +1,6 @@
+LibTomMath is a free open source portable number theoretic multiple-precision
+integer library written entirely in C.
+
+Used by embedded firebird (external/firebird).
+
+http://www.libtom.org/LibTomMath/
diff --git a/external/libtommath/UnpackedTarball_libtommath.mk b/external/libtommath/UnpackedTarball_libtommath.mk
new file mode 100644
index 000000000..bb0b9e352
--- /dev/null
+++ b/external/libtommath/UnpackedTarball_libtommath.mk
@@ -0,0 +1,21 @@
+# -*- 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,libtommath))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,libtommath,$(LIBTOMMATH_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libtommath,0))
+
+$(eval $(call gb_UnpackedTarball_add_patches,libtommath,\
+ external/libtommath/libtommath-msvc.patch \
+ external/libtommath/clang-cl.patch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtommath/clang-cl.patch b/external/libtommath/clang-cl.patch
new file mode 100644
index 000000000..1cc92d380
--- /dev/null
+++ b/external/libtommath/clang-cl.patch
@@ -0,0 +1,16 @@
+--- tommath.h
++++ tommath.h
+@@ -15,6 +15,13 @@
+ #ifndef BN_H_
+ #define BN_H_
+
++// Work around clang-cl issue when mp_word is a typedef for unsigned __int128, see
++// <https://bugs.llvm.org/show_bug.cgi?id=25305> "Clang-cl generates a call to an undefined symbol
++// _udivti3":
++#if defined _WIN32 && defined __clang__
++#define MP_8BIT
++#endif
++
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <stdint.h>
diff --git a/external/libtommath/libtommath-msvc.patch b/external/libtommath/libtommath-msvc.patch
new file mode 100644
index 000000000..07884871a
--- /dev/null
+++ b/external/libtommath/libtommath-msvc.patch
@@ -0,0 +1,12 @@
+--- makefile.msvc 2016-02-05 23:25:32.000000000 +0100
++++ makefile.msvc 2016-07-21 11:34:20.618390100 +0200
+@@ -38,3 +38,9 @@
+
+ library: $(OBJECTS)
+ lib /out:tommath.lib $(OBJECTS)
++
++.cc.obj:
++ $(CC) /nologo $(CFLAGS) /c $<
++
++.c.obj:
++ $(CC) /nologo $(CFLAGS) /c $<