summaryrefslogtreecommitdiffstats
path: root/external/cppunit
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-10-17 01:32:29 +0200
committerBjörn Michaelsen <bjoern.michaelsen@canonical.com>2013-10-17 17:17:22 +0000
commit7223027a3a7e6599e387559d85f1eaebf3bbbd6c (patch)
tree10017f4f62c300eef573e6ac73dba9271c824855 /external/cppunit
parentfdo#70393: move clucene to a subdir of external (diff)
downloadcore-7223027a3a7e6599e387559d85f1eaebf3bbbd6c.tar.gz
core-7223027a3a7e6599e387559d85f1eaebf3bbbd6c.zip
fdo#70393: move cppunit to a subdir of external
Change-Id: I96ab796757af0c6c6741059b35fcaeefc2bf4507 Reviewed-on: https://gerrit.libreoffice.org/6286 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'external/cppunit')
-rw-r--r--external/cppunit/ExternalPackage_cppunit.mk50
-rw-r--r--external/cppunit/ExternalProject_cppunit.mk63
-rw-r--r--external/cppunit/Makefile7
-rw-r--r--external/cppunit/Module_cppunit.mk18
-rw-r--r--external/cppunit/README3
-rw-r--r--external/cppunit/UnpackedTarball_cppunit.mk34
-rw-r--r--external/cppunit/android.patch33
-rw-r--r--external/cppunit/disable-dynloading.patch25
-rw-r--r--external/cppunit/ios.patch18
-rw-r--r--external/cppunit/unix.patch15
-rw-r--r--external/cppunit/windows.patch48
-rw-r--r--external/cppunit/wundef.patch12
12 files changed, 326 insertions, 0 deletions
diff --git a/external/cppunit/ExternalPackage_cppunit.mk b/external/cppunit/ExternalPackage_cppunit.mk
new file mode 100644
index 000000000000..d900e22a1fd2
--- /dev/null
+++ b/external/cppunit/ExternalPackage_cppunit.mk
@@ -0,0 +1,50 @@
+# -*- 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_ExternalPackage_ExternalPackage,cppunit,cppunit))
+$(eval $(call gb_ExternalPackage_use_external_project,cppunit,cppunit))
+
+ifeq ($(OS),WNT)
+ifeq ($(COM),MSC)
+$(eval $(call gb_ExternalPackage_add_file,cppunit,bin/$(if $(MSVC_USE_DEBUG_RUNTIME),cppunitd_dll.dll,cppunit_dll.dll),src/cppunit/$(if $(MSVC_USE_DEBUG_RUNTIME),DebugDll/cppunitd_dll.dll,ReleaseDll/cppunit_dll.dll)))
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/icppunit_dll.lib,src/cppunit/$(if $(MSVC_USE_DEBUG_RUNTIME),DebugDll/cppunitd_dll.lib,ReleaseDll/cppunit_dll.lib)))
+$(eval $(call gb_ExternalPackage_add_file,cppunit,bin/DllPlugInTester_dll.exe,src/DllPlugInTester/$(if $(MSVC_USE_DEBUG_RUNTIME),DebugDll/DllPlugInTesterd_dll.exe,ReleaseDll/DllPlugInTester_dll.exe)))
+else
+$(eval $(call gb_ExternalPackage_add_file,cppunit,bin/libcppunit-1-13-0.dll,src/cppunit/.libs/libcppunit-1-13-0.dll))
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit.dll.a,src/cppunit/.libs/libcppunit.dll.a))
+$(eval $(call gb_ExternalPackage_add_file,cppunit,bin/DllPlugInTester.exe,src/DllPlugInTester/.libs/DllPlugInTester.exe))
+endif
+else
+ifneq ($(DISABLE_DYNLOADING),TRUE)
+$(eval $(call gb_ExternalPackage_add_file,cppunit,bin/DllPlugInTester,src/DllPlugInTester/.libs/DllPlugInTester))
+else
+ifneq ($(filter DESKTOP,$(BUILD_TYPE)),)
+$(eval $(call gb_ExternalPackage_add_file,cppunit,bin/DllPlugInTester,src/DllPlugInTester/DllPlugInTester))
+endif
+endif
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit-1.13.0.dylib,src/cppunit/.libs/libcppunit-1.13.0.dylib))
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit.dylib,src/cppunit/.libs/libcppunit.dylib))
+else ifeq ($(OS),AIX)
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit-1.13.a,src/cppunit/.libs/libcppunit-1.13.a))
+else ifeq ($(OS),OPENBSD)
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit-1.13.so.0.0,src/cppunit/.libs/libcppunit-1.13.so.0.0))
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit.so,src/cppunit/.libs/libcppunit-1.13.so.0.0))
+else ifeq ($(DISABLE_DYNLOADING),TRUE)
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit.a,src/cppunit/.libs/libcppunit.a))
+else ifeq ($(OS),ANDROID)
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit-1.13.so,src/cppunit/.libs/libcppunit-1.13.so))
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit.so,src/cppunit/.libs/libcppunit-1.13.so))
+else
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit-1.13.so.0,src/cppunit/.libs/libcppunit-1.13.so.0.0.1))
+$(eval $(call gb_ExternalPackage_add_file,cppunit,lib/libcppunit.so,src/cppunit/.libs/libcppunit-1.13.so.0.0.1))
+endif
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cppunit/ExternalProject_cppunit.mk b/external/cppunit/ExternalProject_cppunit.mk
new file mode 100644
index 000000000000..649bae1dcc01
--- /dev/null
+++ b/external/cppunit/ExternalProject_cppunit.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_ExternalProject_ExternalProject,cppunit))
+
+$(eval $(call gb_ExternalProject_register_targets,cppunit,\
+ build \
+))
+
+
+ifeq ($(OS)$(COM),WNTMSC)
+$(call gb_ExternalProject_get_state_target,cppunit,build) :
+ $(call gb_ExternalProject_run,build,\
+ msbuild.exe cppunit_dll.vcxproj /p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
+ $(if $(filter 110,$(VCVER)),/p:PlatformToolset=v110 /p:VisualStudioVersion=11.0) \
+ && cd ../DllPlugInTester \
+ && msbuild.exe DllPlugInTester.vcxproj /p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
+ $(if $(filter 110,$(VCVER)),/p:PlatformToolset=v110 /p:VisualStudioVersion=11.0) \
+ ,src/cppunit)
+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
+
+ifeq ($(OS)-$(COM),WNT-GCC)
+cppunit_CXXFLAGS+=-mthreads
+endif
+
+ifneq (,$(debug))
+cppunit_CXXFLAGS+=-g
+endif
+
+$(call gb_ExternalProject_get_state_target,cppunit,build) :
+ $(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 \
+ $(if $(filter YES,$(CROSS_COMPILING)),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
+ $(if $(filter WNT,$(OS)),LDFLAGS="-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2") \
+ $(if $(filter SOLARIS,$(OS)),LIBS="-lm") \
+ $(if $(filter ANDROID,$(OS)),LIBS="-lgnustl_shared -lm") \
+ CXXFLAGS="$(cppunit_CXXFLAGS)" \
+ && cd src \
+ && $(MAKE) \
+ )
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cppunit/Makefile b/external/cppunit/Makefile
new file mode 100644
index 000000000000..ccb1c85a04da
--- /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 000000000000..f0af9e8ce004
--- /dev/null
+++ b/external/cppunit/Module_cppunit.mk
@@ -0,0 +1,18 @@
+# -*- 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 \
+ ExternalPackage_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 000000000000..f71c260e6839
--- /dev/null
+++ b/external/cppunit/README
@@ -0,0 +1,3 @@
+C++ port of the JUnit framework for unit testing.
+
+From [http://sourceforge.net/projects/cppunit/]
diff --git a/external/cppunit/UnpackedTarball_cppunit.mk b/external/cppunit/UnpackedTarball_cppunit.mk
new file mode 100644
index 000000000000..e1a77a5ea327
--- /dev/null
+++ b/external/cppunit/UnpackedTarball_cppunit.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,cppunit))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,cppunit,$(CPPUNIT_TARBALL),,cppunit))
+
+$(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
+ external/cppunit/windows.patch \
+ external/cppunit/unix.patch \
+ external/cppunit/wundef.patch \
+))
+ifeq ($(OS),ANDROID)
+$(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
+ external/cppunit/android.patch \
+))
+else ifeq ($(OS),IOS)
+$(eval $(call gb_UnpackedTarball_add_patches,cppunit,\
+ external/cppunit/ios.patch \
+))
+endif
+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/android.patch b/external/cppunit/android.patch
new file mode 100644
index 000000000000..59ae4517abf1
--- /dev/null
+++ b/external/cppunit/android.patch
@@ -0,0 +1,33 @@
+--- misc/cppunit-1.13.1/config/ltmain.sh
++++ misc/build/cppunit-1.13.1/config/ltmain.sh
+@@ -3228,6 +3228,12 @@
+ fi
+ else
+
++ # Force no versioning suffix for Android thanks to silly
++ # apkbuilder which doesn't add extra native libs unless their
++ # name ends with .so
++
++ version_type=none
++
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+--- misc/cppunit-1.13.1/src/cppunit/UnixDynamicLibraryManager.cpp
++++ misc/build/cppunit-1.13.1/src/cppunit/UnixDynamicLibraryManager.cpp
+@@ -13,7 +13,15 @@
+ DynamicLibraryManager::LibraryHandle
+ DynamicLibraryManager::doLoadLibrary( const std::string &libraryName )
+ {
++#ifdef __ANDROID__
++ // Use our enhanced dlopen() wrapper, see sal/osl/android/jni/lo-wrapper.c
++ void *(*lo_dlopen)(const char *) = (void *(*)(const char *)) dlsym( RTLD_DEFAULT, "lo_dlopen" );
++ if (lo_dlopen == NULL)
++ return NULL;
++ return (*lo_dlopen)( libraryName.c_str() );
++#else
+ return ::dlopen( libraryName.c_str(), RTLD_NOW | RTLD_GLOBAL );
++#endif
+ }
+
+
diff --git a/external/cppunit/disable-dynloading.patch b/external/cppunit/disable-dynloading.patch
new file mode 100644
index 000000000000..a9aa37f6f45d
--- /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/ios.patch b/external/cppunit/ios.patch
new file mode 100644
index 000000000000..d7e355cddf44
--- /dev/null
+++ b/external/cppunit/ios.patch
@@ -0,0 +1,18 @@
+--- misc/cppunit-1.13.1/configure
++++ misc/cppunit-1.13.1/configure
+@@ -23273,7 +23273,7 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&5
+ $as_echo "creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&6; }
+ if test -f $ac_prefix_conf_INP ; then
+- $as_dirname -- /* automatically generated */ ||
++ $as_dirname -- '/* automatically generated */' ||
+ $as_expr X/* automatically generated */ : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X/* automatically generated */ : 'X\(//\)[^/]' \| \
+ X/* automatically generated */ : 'X\(//\)$' \| \
+@@ -23318,5 +23318,5 @@
+ else
+ as_fn_error $? "input file $ac_prefix_conf_IN does not exist, skip generating $ac_prefix_conf_OUT" "$LINENO" 5
+ fi
+- rm -f conftest.*
++ rm -f -r conftest.*
+ fi
diff --git a/external/cppunit/unix.patch b/external/cppunit/unix.patch
new file mode 100644
index 000000000000..0a153ad05deb
--- /dev/null
+++ b/external/cppunit/unix.patch
@@ -0,0 +1,15 @@
+--- misc/cppunit-1.13.1/src/cppunit/UnixDynamicLibraryManager.cpp
++++ misc/build/cppunit-1.13.1/src/cppunit/UnixDynamicLibraryManager.cpp
+@@ -34,7 +34,11 @@
+ std::string
+ DynamicLibraryManager::getLastErrorDetail() const
+ {
+- return "";
++ const char *last_dlerror = ::dlerror();
++ if (last_dlerror != NULL)
++ return last_dlerror;
++ else
++ return "";
+ }
+
+
diff --git a/external/cppunit/windows.patch b/external/cppunit/windows.patch
new file mode 100644
index 000000000000..c8ea6d7565dc
--- /dev/null
+++ b/external/cppunit/windows.patch
@@ -0,0 +1,48 @@
+--- misc/cppunit-1.13.1/include/cppunit/plugin/TestPlugIn.h 2010-01-11 14:42:25.084658287 +0100
++++ misc/build/cppunit-1.13.1/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,21 +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
+-#define NOMINMAX
+-#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.13.1/include/cppunit/TestAssert.h
++++ misc/build/cppunit-1.13.1/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);
+
diff --git a/external/cppunit/wundef.patch b/external/cppunit/wundef.patch
new file mode 100644
index 000000000000..5f701cd702d1
--- /dev/null
+++ b/external/cppunit/wundef.patch
@@ -0,0 +1,12 @@
+--- misc/cppunit-1.13.1/include/cppunit/Portability.h 2012-09-24 19:10:36.000000000 +0200
++++ misc/build/cppunit-1.13.1/include/cppunit/Portability.h 2013-03-18 14:23:48.880718714 +0100
+@@ -68,6 +68,9 @@
+ * std::allocator. On some compilers, you may need to change this to
+ * std::allocator<T>.
+ */
++#ifndef CPPUNIT_STD_NEED_ALLOCATOR /* avoid -Wundef warning */
++#define CPPUNIT_STD_NEED_ALLOCATOR 0
++#endif
+ #if CPPUNIT_STD_NEED_ALLOCATOR
+ # if !defined(CPPUNIT_STD_ALLOCATOR)
+ # define CPPUNIT_STD_ALLOCATOR std::allocator