GNU bug report logs - #62705
[PATCH] gnu: Add clog.

Previous Next

Package: guix-patches;

Reported by: Antero Mejr <antero <at> mailbox.org>

Date: Fri, 7 Apr 2023 01:07:01 UTC

Severity: normal

Tags: patch

Done: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62705 in the body.
You can then email your comments to 62705 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#62705; Package guix-patches. (Fri, 07 Apr 2023 01:07:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Antero Mejr <antero <at> mailbox.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 07 Apr 2023 01:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Antero Mejr <antero <at> mailbox.org>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add clog.
Date: Fri,  7 Apr 2023 01:06:20 +0000
* gnu/packages/parallel.scm (clog): New variable.
* gnu/packages/patches/clog-fix-shared-build.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
Putting clog in parallel.scm (next to cpuinfo) because putting it in
logging.scm causes a circular dependency. Plus it's part of cpuinfo.

 gnu/local.mk                                  |  1 +
 gnu/packages/parallel.scm                     | 29 +++++++
 .../patches/clog-fix-shared-build.patch       | 85 +++++++++++++++++++
 3 files changed, 115 insertions(+)
 create mode 100644 gnu/packages/patches/clog-fix-shared-build.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index b7e19b6bc2..10778d6585 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1001,6 +1001,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/classpath-aarch64-support.patch		\
   %D%/packages/patches/classpath-miscompilation.patch		\
   %D%/packages/patches/cling-use-shared-library.patch		\
+  %D%/packages/patches/clog-fix-shared-build.patch		\
   %D%/packages/patches/clucene-pkgconfig.patch			\
   %D%/packages/patches/cmake-curl-certificates.patch		\
   %D%/packages/patches/cmake-curl-certificates-3.24.patch	\
diff --git a/gnu/packages/parallel.scm b/gnu/packages/parallel.scm
index 3c638e4ff9..9a22774789 100644
--- a/gnu/packages/parallel.scm
+++ b/gnu/packages/parallel.scm
@@ -490,6 +490,35 @@ (define-public cpuinfo
 processor name, cache information, and topology information.")
       (license license:bsd-2))))
 
+(define-public clog
+  (package
+    (inherit cpuinfo) ;distributed with cpuinfo but not built by it
+    (name "clog")
+    (source (origin
+              (inherit (package-source cpuinfo))
+              (patches (search-patches "clog-fix-shared-build.patch"))))
+    (arguments
+     (list #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON")
+           #:phases #~(modify-phases %standard-phases
+                        (add-after 'unpack 'chdir
+                          (lambda _
+                            (chdir "deps/clog"))))))
+    (native-inputs (list googletest))
+    (inputs '())
+    (synopsis "C-style logging library based on printf")
+    (description
+     "This package provides a C-style library for logging errors,
+warnings, information notes, and debug information.  Its features are:
+@itemize
+@item printf-style interface for formatting variadic parameters.
+@item Separate functions for logging errors, warnings, information notes, and
+debug information.
+@item Independent logging settings for different modules.
+@item Logging to logcat on Android and stderr/stdout on other platforms.
+@item Compatible with C99 and C++.
+@item Covered with unit tests.
+@end itemize")))
+
 (define-public psimd
   ;; There is currently no tag in this repo.
   (let ((commit "072586a71b55b7f8c584153d223e95687148a900")
diff --git a/gnu/packages/patches/clog-fix-shared-build.patch b/gnu/packages/patches/clog-fix-shared-build.patch
new file mode 100644
index 0000000000..bf80544b90
--- /dev/null
+++ b/gnu/packages/patches/clog-fix-shared-build.patch
@@ -0,0 +1,85 @@
+Author: Antero Mejr <antero <at> mailbox.org>
+Notes: Disabled function visibility hacks and googletest download. Enabled
+non-static builds.
+
+diff --git a/deps/clog/CMakeLists.txt b/deps/clog/CMakeLists.txt
+index 083f519..b7b225a 100644
+--- a/deps/clog/CMakeLists.txt
++++ b/deps/clog/CMakeLists.txt
+@@ -38,20 +38,8 @@ SET(CONFU_DEPENDENCIES_SOURCE_DIR ${CMAKE_SOURCE_DIR}/deps
+ SET(CONFU_DEPENDENCIES_BINARY_DIR ${CMAKE_BINARY_DIR}/deps
+   CACHE PATH "Confu-style dependencies binary directory")
+ 
+-IF(CLOG_BUILD_TESTS)
+-  IF(NOT DEFINED GOOGLETEST_SOURCE_DIR)
+-    MESSAGE(STATUS "Downloading Google Test to ${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest (define GOOGLETEST_SOURCE_DIR to avoid it)")
+-    CONFIGURE_FILE(cmake/DownloadGoogleTest.cmake "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download/CMakeLists.txt")
+-    EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
+-      WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download")
+-    EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" --build .
+-      WORKING_DIRECTORY "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest-download")
+-    SET(GOOGLETEST_SOURCE_DIR "${CONFU_DEPENDENCIES_SOURCE_DIR}/googletest" CACHE STRING "Google Test source directory")
+-  ENDIF()
+-ENDIF()
+-
+ # ---[ clog library
+-ADD_LIBRARY(clog STATIC src/clog.c)
++ADD_LIBRARY(clog src/clog.c)
+ SET_TARGET_PROPERTIES(clog PROPERTIES
+   C_STANDARD 99
+   C_EXTENSIONS NO)
+@@ -74,16 +62,6 @@ INSTALL(TARGETS clog
+ 
+ # ---[ clog tests
+ IF(CLOG_BUILD_TESTS)
+-  # ---[ Build google test
+-  IF(NOT TARGET gtest)
+-    IF(MSVC AND NOT CLOG_RUNTIME_TYPE STREQUAL "static")
+-      SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+-    ENDIF()
+-    ADD_SUBDIRECTORY(
+-      "${GOOGLETEST_SOURCE_DIR}"
+-      "${CONFU_DEPENDENCIES_BINARY_DIR}/googletest")
+-  ENDIF()
+-
+   ADD_EXECUTABLE(clog-test test/clog.cc)
+   SET_TARGET_PROPERTIES(clog-test PROPERTIES
+     CXX_STANDARD 11
+diff --git a/deps/clog/include/clog.h b/deps/clog/include/clog.h
+index 4143761..aa9000f 100644
+--- a/deps/clog/include/clog.h
++++ b/deps/clog/include/clog.h
+@@ -11,16 +11,6 @@
+ #define CLOG_INFO 4
+ #define CLOG_DEBUG 5
+ 
+-#ifndef CLOG_VISIBILITY
+-	#if defined(__ELF__)
+-		#define CLOG_VISIBILITY __attribute__((__visibility__("internal")))
+-	#elif defined(__MACH__)
+-		#define CLOG_VISIBILITY __attribute__((__visibility__("hidden")))
+-	#else
+-		#define CLOG_VISIBILITY
+-	#endif
+-#endif
+-
+ #ifndef CLOG_ARGUMENTS_FORMAT
+ 	#if defined(__GNUC__)
+ 		#define CLOG_ARGUMENTS_FORMAT __attribute__((__format__(__printf__, 1, 2)))
+@@ -33,11 +23,11 @@
+ extern "C" {
+ #endif
+ 
+-CLOG_VISIBILITY void clog_vlog_debug(const char* module, const char* format, va_list args);
+-CLOG_VISIBILITY void clog_vlog_info(const char* module, const char* format, va_list args);
+-CLOG_VISIBILITY void clog_vlog_warning(const char* module, const char* format, va_list args);
+-CLOG_VISIBILITY void clog_vlog_error(const char* module, const char* format, va_list args);
+-CLOG_VISIBILITY void clog_vlog_fatal(const char* module, const char* format, va_list args);
++void clog_vlog_debug(const char* module, const char* format, va_list args);
++void clog_vlog_info(const char* module, const char* format, va_list args);
++void clog_vlog_warning(const char* module, const char* format, va_list args);
++void clog_vlog_error(const char* module, const char* format, va_list args);
++void clog_vlog_fatal(const char* module, const char* format, va_list args);
+ 
+ #define CLOG_DEFINE_LOG_DEBUG(log_debug_function_name, module, level) \
+ 	CLOG_ARGUMENTS_FORMAT \
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#62705; Package guix-patches. (Fri, 21 Apr 2023 09:00:03 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
To: Antero Mejr via Guix-patches via <guix-patches <at> gnu.org>
Cc: Antero Mejr <antero <at> mailbox.org>, 62705-done <at> debbugs.gnu.org
Subject: Re: [bug#62705] [PATCH] gnu: Add clog.
Date: Fri, 21 Apr 2023 10:59:51 +0200
Hello,

Antero Mejr via Guix-patches via <guix-patches <at> gnu.org> writes:

> * gnu/packages/parallel.scm (clog): New variable.
> * gnu/packages/patches/clog-fix-shared-build.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.

Applied. Thank you.

Regards,
-- 
Nicolas Goaziou




Reply sent to Nicolas Goaziou <mail <at> nicolasgoaziou.fr>:
You have taken responsibility. (Fri, 21 Apr 2023 09:01:01 GMT) Full text and rfc822 format available.

Notification sent to Antero Mejr <antero <at> mailbox.org>:
bug acknowledged by developer. (Fri, 21 Apr 2023 09:01:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 19 May 2023 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.