From a7a79ee92d5663248abdc3f6d1476e28c1abda6a Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 25 Nov 2014 13:29:44 +0200 Subject: Move clew into a library of its own Change-Id: Ifb7e86b078bd549506a9cc1b9ce9fc22fffc5eec --- external/Module_external.mk | 1 + external/clcc/Library_clew.mk | 35 +++++++++++++++++++++++ external/clcc/Makefile | 7 +++++ external/clcc/Module_clcc.mk | 17 ++++++++++++ external/clcc/UnpackedTarball_clcc.mk | 25 +++++++++++++++++ external/clcc/clew-non-static.patch | 52 +++++++++++++++++++++++++++++++++++ 6 files changed, 137 insertions(+) create mode 100644 external/clcc/Library_clew.mk create mode 100644 external/clcc/Makefile create mode 100644 external/clcc/Module_clcc.mk create mode 100644 external/clcc/UnpackedTarball_clcc.mk create mode 100644 external/clcc/clew-non-static.patch (limited to 'external') diff --git a/external/Module_external.mk b/external/Module_external.mk index 6d38fd583939..e7c99d16351e 100644 --- a/external/Module_external.mk +++ b/external/Module_external.mk @@ -27,6 +27,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\ $(call gb_Helper_optional,BSH,beanshell) \ $(call gb_Helper_optional,CAIRO,cairo) \ $(call gb_Helper_optional,CDR,libcdr) \ + $(call gb_Helper_optional,CLCC,clcc) \ $(call gb_Helper_optional,CLUCENE,clucene) \ $(call gb_Helper_optional,CMIS,libcmis) \ $(call gb_Helper_optional,COINMP,coinmp) \ diff --git a/external/clcc/Library_clew.mk b/external/clcc/Library_clew.mk new file mode 100644 index 000000000000..8841ab9cf30f --- /dev/null +++ b/external/clcc/Library_clew.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_Library_Library,clew)) + +$(eval $(call gb_Library_use_unpacked,clew,clcc)) + +$(eval $(call gb_Library_add_defs,clew,\ + -DCLEW_BUILD \ +)) + +ifeq ($(OS),LINUX) +$(eval $(call gb_Library_add_libs,clew,\ + -ldl \ + -lrt \ +)) +endif + +ifeq ($(OS),MACOSX) +$(eval $(call gb_Library_add_libs,clew,\ + -framework OpenCL \ +)) +endif + +$(eval $(call gb_Library_add_generated_cobjects,clew,\ + UnpackedTarball/clcc/src/clew \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/clcc/Makefile b/external/clcc/Makefile new file mode 100644 index 000000000000..e4968cf85fb6 --- /dev/null +++ b/external/clcc/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/clcc/Module_clcc.mk b/external/clcc/Module_clcc.mk new file mode 100644 index 000000000000..245617fd21ac --- /dev/null +++ b/external/clcc/Module_clcc.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,clcc)) + +$(eval $(call gb_Module_add_targets,clcc,\ + Library_clew \ + UnpackedTarball_clcc \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/clcc/UnpackedTarball_clcc.mk b/external/clcc/UnpackedTarball_clcc.mk new file mode 100644 index 000000000000..011d0a52af4b --- /dev/null +++ b/external/clcc/UnpackedTarball_clcc.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_UnpackedTarball_UnpackedTarball,clcc)) + +$(eval $(call gb_UnpackedTarball_set_tarball,clcc,$(CLCC_TARBALL),0)) + +$(eval $(call gb_UnpackedTarball_set_patchlevel,clcc,0)) + +$(eval $(call gb_UnpackedTarball_fix_end_of_line,clcc,\ + src/clew.c \ + src/clew.h \ +)) + +$(eval $(call gb_UnpackedTarball_add_patches,clcc,\ + external/clcc/clew-non-static.patch \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/clcc/clew-non-static.patch b/external/clcc/clew-non-static.patch new file mode 100644 index 000000000000..f111930f3928 --- /dev/null +++ b/external/clcc/clew-non-static.patch @@ -0,0 +1,52 @@ +--- src/clew.h ++++ src/clew.h +@@ -1141,25 +1141,28 @@ + // calling the returned function address. + // + typedef CL_API_ENTRY void * (CL_API_CALL * PFNCLGETEXTENSIONFUNCTIONADDRESS)(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0; +- +- +-#define CLEW_STATIC + + #ifdef CLEW_STATIC + # define CLEWAPI extern + #else + # ifdef CLEW_BUILD +-# define CLEWAPI extern __declspec(dllexport) ++# if defined(_WIN32) ++# define CLEWAPI extern __declspec(dllexport) ++# elif defined(HAVE_GCC_VISIBILITY_FEATURE) ++# define CLEWAPI extern __attribute__ ((visibility("default"))) ++# else ++# define CLEWAPI extern ++# endif + # else +-# define CLEWAPI extern __declspec(dllimport) ++# if defined(_WIN32) ++# define CLEWAPI extern __declspec(dllimport) ++# else ++# define CLEWAPI extern ++# endif + # endif + #endif + +-#if defined(_WIN32) +-#define CLEW_FUN_EXPORT extern +-#else + #define CLEW_FUN_EXPORT CLEWAPI +-#endif + + #define CLEW_GET_FUN(x) x + +@@ -1305,9 +1305,9 @@ + #define CLEW_ERROR_IMPORT_FAILED -3 //!< Error code for failing to import a named function from the dll + + //! \brief Load OpenCL dynamic library and set function entry points +-int clewInit (const char*); ++CLEW_FUN_EXPORT int clewInit (const char*); + //! \brief Convert an OpenCL error code to its string equivalent +-const char* clewErrorString (cl_int error); ++CLEW_FUN_EXPORT const char* clewErrorString (cl_int error); + + #ifdef __cplusplus + } -- cgit