summaryrefslogtreecommitdiffstats
path: root/external/cppunit
diff options
context:
space:
mode:
Diffstat (limited to 'external/cppunit')
-rw-r--r--external/cppunit/CPPUNIT_PLUGIN_EXPORT.patch.011
-rw-r--r--external/cppunit/ExternalProject_cppunit.mk65
-rw-r--r--external/cppunit/Makefile7
-rw-r--r--external/cppunit/Module_cppunit.mk17
-rw-r--r--external/cppunit/README3
-rw-r--r--external/cppunit/UnpackedTarball_cppunit.mk29
-rw-r--r--external/cppunit/disable-dynloading.patch25
-rw-r--r--external/cppunit/enable-win32-debug.patch34
-rw-r--r--external/cppunit/rtti.patch.015
-rw-r--r--external/cppunit/unix.patch10
-rw-r--r--external/cppunit/windows.patch50
11 files changed, 266 insertions, 0 deletions
diff --git a/external/cppunit/CPPUNIT_PLUGIN_EXPORT.patch.0 b/external/cppunit/CPPUNIT_PLUGIN_EXPORT.patch.0
new file mode 100644
index 000000000..a764be95a
--- /dev/null
+++ b/external/cppunit/CPPUNIT_PLUGIN_EXPORT.patch.0
@@ -0,0 +1,11 @@
+--- include/cppunit/plugin/TestPlugIn.h
++++ include/cppunit/plugin/TestPlugIn.h
+@@ -111,7 +111,7 @@
+ /*! \brief Type of the function exported by a plug-in.
+ * \ingroup WritingTestPlugIn
+ */
+-typedef CppUnitTestPlugIn *(*TestPlugInSignature)();
++extern "C" { typedef CppUnitTestPlugIn *(*TestPlugInSignature)(); }
+
+
+ /*! \brief Implements the function exported by the test plug-in
diff --git a/external/cppunit/ExternalProject_cppunit.mk b/external/cppunit/ExternalProject_cppunit.mk
new file mode 100644
index 000000000..c0d138064
--- /dev/null
+++ b/external/cppunit/ExternalProject_cppunit.mk
@@ -0,0 +1,65 @@
+# -*- 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,cppunit))
+
+$(eval $(call gb_ExternalProject_register_targets,cppunit,\
+ build \
+))
+
+ifeq ($(OS),WNT)
+$(call gb_ExternalProject_get_state_target,cppunit,build) :
+ $(call gb_Trace_StartRange,cppunit,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ PROFILEFLAGS="$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
+ /p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
+ $(if $(filter 160,$(VCVER)),/p:PlatformToolset=v142 /p:VisualStudioVersion=16.0 /ToolsVersion:Current) \
+ $(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION))" \
+ && msbuild.exe cppunit_dll.vcxproj /p:Configuration=$${PROFILEFLAGS} \
+ && cd ../DllPlugInTester \
+ && msbuild.exe DllPlugInTester.vcxproj /p:Configuration=$${PROFILEFLAGS} \
+ ,src/cppunit)
+ $(call gb_Trace_EndRange,cppunit,EXTERNAL)
+else
+
+cppunit_CXXFLAGS=$(CXXFLAGS)
+
+ifneq (,$(filter ANDROID DRAGONFLY FREEBSD iOS LINUX NETBSD OPENBSD,$(OS)))
+ifneq (,$(gb_ENABLE_DBGUTIL))
+cppunit_CXXFLAGS+=-D_GLIBCXX_DEBUG
+endif
+endif
+
+ifneq (,$(debug))
+cppunit_CXXFLAGS+=-g
+endif
+
+$(call gb_ExternalProject_get_state_target,cppunit,build) :
+ $(call gb_Trace_StartRange,cppunit,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ ./configure \
+ --disable-dependency-tracking \
+ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \
+ --disable-doxygen \
+ --disable-html-docs \
+ --disable-latex-docs \
+ --disable-werror \
+ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________NONE) \
+ $(if $(filter WNT,$(OS)),LDFLAGS="-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2") \
+ $(if $(filter SOLARIS,$(OS)),LIBS="-lm") \
+ $(if $(filter ANDROID,$(OS)),LIBS="$(gb_STDLIBS)") \
+ CXXFLAGS="$(cppunit_CXXFLAGS)" \
+ && cd src \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,cppunit,EXTERNAL)
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cppunit/Makefile b/external/cppunit/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/cppunit/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/cppunit/Module_cppunit.mk b/external/cppunit/Module_cppunit.mk
new file mode 100644
index 000000000..296feeb74
--- /dev/null
+++ b/external/cppunit/Module_cppunit.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,cppunit))
+
+$(eval $(call gb_Module_add_targets,cppunit,\
+ UnpackedTarball_cppunit \
+ ExternalProject_cppunit \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cppunit/README b/external/cppunit/README
new file mode 100644
index 000000000..e1d4e82a5
--- /dev/null
+++ b/external/cppunit/README
@@ -0,0 +1,3 @@
+C++ port of the JUnit framework for unit testing.
+
+From [http://www.freedesktop.org/wiki/Software/cppunit/]
diff --git a/external/cppunit/UnpackedTarball_cppunit.mk b/external/cppunit/UnpackedTarball_cppunit.mk
new file mode 100644
index 000000000..24f75b434
--- /dev/null
+++ b/external/cppunit/UnpackedTarball_cppunit.mk
@@ -0,0 +1,29 @@
+# -*- 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,cppunit))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,cppunit,$(CPPUNIT_TARBALL),,cppunit))
+
+$(eval $(call gb_UnpackedTarball_update_autoconf_configs,cppunit))
+
+$(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
+ external/cppunit/windows.patch \
+ external/cppunit/unix.patch \
+ external/cppunit/CPPUNIT_PLUGIN_EXPORT.patch.0 \
+ external/cppunit/enable-win32-debug.patch \
+ external/cppunit/rtti.patch.0 \
+))
+ifeq ($(DISABLE_DYNLOADING),TRUE)
+$(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
+ external/cppunit/disable-dynloading.patch \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cppunit/disable-dynloading.patch b/external/cppunit/disable-dynloading.patch
new file mode 100644
index 000000000..a9aa37f6f
--- /dev/null
+++ b/external/cppunit/disable-dynloading.patch
@@ -0,0 +1,25 @@
+--- build/cppunit-1.13.1/include/cppunit/plugin/TestPlugIn.h
++++ misc/build/cppunit-1.13.1/include/cppunit/plugin/TestPlugIn.h
+@@ -106,7 +106,9 @@
+ * CppUnitTestPlugIn *CPPUNIT_PLUGIN_EXPORTED_NAME(void);
+ * \endcode
+ */
++#ifndef CPPUNIT_PLUGIN_EXPORTED_NAME
+ #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn
++#endif
+
+ /*! \brief Type of the function exported by a plug-in.
+ * \ingroup WritingTestPlugIn
+@@ -143,6 +143,12 @@
+ #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
+ typedef char __CppUnitPlugInImplementMainDummyTypeDef
+
++// Actually this is for iOS and Android where we build the cppunit tests libraries
++// as plain archives and just link them statically into test fixture programs,
++// and don't want any stinking duplicate main(), but shouldn't hurt for MacOSX either.
++#elif defined(__APPLE__) || defined(__ANDROID__)
++#define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
++ typedef char __CppUnitPlugInImplementMainDummyTypeDef
+ // Unix
+ #elif defined(CPPUNIT_HAVE_UNIX_DLL_LOADER) || defined(CPPUNIT_HAVE_UNIX_SHL_LOADER)
+ #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
diff --git a/external/cppunit/enable-win32-debug.patch b/external/cppunit/enable-win32-debug.patch
new file mode 100644
index 000000000..dc159ecc5
--- /dev/null
+++ b/external/cppunit/enable-win32-debug.patch
@@ -0,0 +1,34 @@
+--- misc/cppunit-1.14.0/src/cppunit/cppunit_dll.vcxproj
++++ misc/build/cppunit-1.14.0/src/cppunit/cppunit_dll.vcxproj
+@@ -107,7 +107,6 @@
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+- <DebugInformationFormat>OldStyle</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CPPUNIT_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AssemblerListingLocation>.\ReleaseDll\</AssemblerListingLocation>
+@@ -138,6 +137,7 @@
+ <Link>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <LinkDLL>true</LinkDLL>
++ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OutputFile>.\ReleaseDll\cppunit_dll.dll</OutputFile>
+ <ImportLibrary>.\ReleaseDll\cppunit_dll.lib</ImportLibrary>
+@@ -237,7 +237,6 @@
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <WarningLevel>Level3</WarningLevel>
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
+- <DebugInformationFormat>OldStyle</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CPPUNIT_BUILD_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AssemblerListingLocation>.\ReleaseDll\</AssemblerListingLocation>
+@@ -266,6 +266,7 @@
+ <Link>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <LinkDLL>true</LinkDLL>
++ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Console</SubSystem>
+ <OutputFile>.\ReleaseDll\cppunit_dll.dll</OutputFile>
+ <ImportLibrary>.\ReleaseDll\cppunit_dll.lib</ImportLibrary>
diff --git a/external/cppunit/rtti.patch.0 b/external/cppunit/rtti.patch.0
new file mode 100644
index 000000000..38d2e6a90
--- /dev/null
+++ b/external/cppunit/rtti.patch.0
@@ -0,0 +1,15 @@
+--- include/cppunit/config/CppUnitApi.h
++++ include/cppunit/config/CppUnitApi.h
+@@ -20,6 +20,12 @@
+ #define CPPUNIT_NEED_DLL_DECL 1
+ #endif
+
++#elif defined __GNUC__ //TODO: actually only works for modern enough GCC
++
++#define CPPUNIT_API __attribute__ ((visibility("default")))
++#undef CPPUNIT_NEED_DLL_DECL
++#define CPPUNIT_NEED_DLL_DECL 0
++
+ #endif
+
+
diff --git a/external/cppunit/unix.patch b/external/cppunit/unix.patch
new file mode 100644
index 000000000..e75e72c6f
--- /dev/null
+++ b/external/cppunit/unix.patch
@@ -0,0 +1,10 @@
+--- misc/cppunit-1.13.1/src/cppunit/UnixDynamicLibraryManager.cpp
++++ misc/build/cppunit-1.13.1/src/cppunit/UnixDynamicLibraryManager.cpp
+@@ -20,7 +20,6 @@
+ void
+ DynamicLibraryManager::doReleaseLibrary()
+ {
+- ::dlclose( m_libraryHandle);
+ }
+
+
diff --git a/external/cppunit/windows.patch b/external/cppunit/windows.patch
new file mode 100644
index 000000000..e6ca26cbb
--- /dev/null
+++ b/external/cppunit/windows.patch
@@ -0,0 +1,50 @@
+--- misc/cppunit-1.15.0/include/cppunit/plugin/TestPlugIn.h 2010-01-11 14:42:25.084658287 +0100
++++ misc/build/cppunit-1.15.0/include/cppunit/plugin/TestPlugIn.h 2010-01-11 14:42:18.660706180 +0100
+@@ -133,9 +133,8 @@
+ /*! \def CPPUNIT_PLUGIN_IMPLEMENT_MAIN()
+ * \brief Implements the 'main' function for the plug-in.
+ *
+- * This macros implements the main() function for dynamic library.
+- * For example, WIN32 requires a DllMain function, while some Unix
+- * requires a main() function. This macros takes care of the implementation.
++ * This macro implements the main() function for dynamic library
++ * on Unix for some weird reason.
+ */
+
+ // Win32
+@@ -149,23 +149,7 @@
+
+ // Win32
+ #if defined(CPPUNIT_HAVE_WIN32_DLL_LOADER)
+-#if !defined(APIENTRY)
+-#define WIN32_LEAN_AND_MEAN
+-#define NOGDI
+-#define NOUSER
+-#define NOKERNEL
+-#define NOSOUND
+-#ifndef NOMINMAX
+-#define NOMINMAX
+-#endif
+-#define BLENDFUNCTION void // for mingw & gcc
+-#include <windows.h>
+-#endif
+ #define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() \
+- BOOL APIENTRY DllMain( HANDLE, DWORD, LPVOID ) \
+- { \
+- return TRUE; \
+- } \
+ typedef char __CppUnitPlugInImplementMainDummyTypeDef
+
+ // Unix
+--- misc/cppunit-1.15.0/include/cppunit/TestAssert.h
++++ misc/build/cppunit-1.15.0/include/cppunit/TestAssert.h
+@@ -76,7 +76,7 @@
+ const int precision = 15;
+ #endif // #ifdef DBL_DIG
+ char buffer[128];
+-#ifdef __STDC_SECURE_LIB__ // Use secure version with visual studio 2005 to avoid warning.
++#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning.
+ sprintf_s(buffer, sizeof(buffer), "%.*g", precision, x);
+ #else
+ sprintf(buffer, "%.*g", precision, x);
+