Skip to contentSkip to conversation

package/zlog: bump to version 1.2.20 and switch to the CMake build

PATCH Applied Yegor Yefremov via buildroot 1 participant 2 messages Oct 8 – Oct 22

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/zlog: bump to version 1.2.20 and switch to the CMake build

zlog ships two build systems: the hand written makefiles used so far and a CMake one, which 1.2.19 reworked. Switch to the latter and use the cmake-package infrastructure, because the CMake build not only installs zlog.pc like the makefiles do, but also the CMake package files (zlogConfig.cmake and friends), so that dependent packages can use find_package(zlog) and the zlog::zlog imported target.

Dropping the custom build and install commands also restores the ability to build zlog in parallel, as the makefile build had to be serialized with MAKE1.

An out of source build is needed, as zlog rejects an in source one since 1.2.19: CMake would generate its own makefiles over the hand written ones that are part of the source tree.

-DZLOG_WERROR=OFF disables the -Werror upstream turns on by default, following the usual Buildroot practice of not letting a new compiler warning break the build.

zlog uses C11 atomics since 1.2.19, and 1.2.20 adds 64-bit ones, which need libatomic on e.g. ARMv5:

libzlog.so.1.2.20: undefined reference to `__atomic_store_8'

So depend on BR2_TOOLCHAIN_HAS_ATOMIC and link the library against libatomic when the toolchain provides it.

The CMake build installs the same set of files as the makefile build did (zlog.h, zlog-chk-conf, libzlog.so.1.2.20 and libzlog.a) plus zlog.pc and the CMake package files. The soname is libzlog.so.1.2 with either build system.

Changelog: https://github.com/HardySimpson/zlog/blob/1.2.20/Changelog

Assisted-by Claude:claude-opus-5-5
---
 package/zlog/Config.in |  2 ++
 package/zlog/zlog.hash |  2 +-
 package/zlog/zlog.mk   | 22 +++++++++-------------
 3 files changed, 12 insertions(+), 14 deletions(-)
package/zlog/Config.in +2 -0
index cf86a26174..b764705362 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_ZLOG
 	bool "zlog"
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_STATIC_LIBS
 	help
@@ -9,4 +10,5 @@ config BR2_PACKAGE_ZLOG
 	  https://github.com/HardySimpson/zlog
 
 comment "zlog needs a toolchain w/ threads, dynamic library"
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
package/zlog/zlog.hash +1 -1
index f000b08f37..4f2d22dce2 100644
@@ -1,3 +1,3 @@
 # Locally computed
-sha256  3977dc8ea0069139816ec4025b320d9a7fc2035398775ea91429e83cb0d1ce4e  zlog-1.2.18.tar.gz
+sha256  432723ccd9a5b07ec1e4b8cc985d9011d768633b1e4c4facfc0e3e9a7ad5fcf7  zlog-1.2.20.tar.gz
 sha256  c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4  LICENSE
package/zlog/zlog.mk +9 -13
index 0d56471559..15a2951520 100644
@@ -4,25 +4,21 @@
 #
 ################################################################################
 
-ZLOG_VERSION = 1.2.18
+ZLOG_VERSION = 1.2.20
 ZLOG_SITE = $(call github,HardySimpson,zlog,$(ZLOG_VERSION))
 ZLOG_LICENSE = Apache-2.0
 ZLOG_LICENSE_FILES = LICENSE
 ZLOG_CPE_ID_VALID = YES
 ZLOG_INSTALL_STAGING = YES
 
-define ZLOG_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE1) \
-		CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)" \
-		WARNINGS="" -C $(@D) all
-endef
+# CMakeLists.txt refuses an in source build, as it would overwrite the hand
+# written makefiles that are part of the source tree
+ZLOG_SUPPORTS_IN_SOURCE_BUILD = NO
 
-define ZLOG_INSTALL_STAGING_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) PREFIX=$(STAGING_DIR)/usr -C $(@D) install
-endef
+ZLOG_CONF_OPTS = -DZLOG_WERROR=OFF
 
-define ZLOG_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) PREFIX=$(TARGET_DIR)/usr -C $(@D) install
-endef
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+ZLOG_CONF_OPTS += -DCMAKE_SHARED_LINKER_FLAGS=-latomic
+endif
 
-$(eval $(generic-package))
+$(eval $(cmake-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 32 lines · Yegor Yefremov via buildroot

zlog ships two build systems: the hand written makefiles used so far and a CMake one, which 1.2.19 reworked. Switch to the latter and use the cmake-package infrastructure, because the CMake build not only installs zlog.pc like the makefiles do, but also the CMake package files (zlogConfig.cmake and friends), so that dependent packages can use find_package(zlog) and the zlog::zlog imported target.

Dropping the custom build and install commands also restores the ability to build zlog in parallel, as the makefile build had to be serialized with MAKE1.

An out of source build is needed, as zlog rejects an in source one since 1.2.19: CMake would generate its own makefiles over the hand written ones that are part of the source tree.

-DZLOG_WERROR=OFF disables the -Werror upstream turns on by default, following the usual Buildroot practice of not letting a new compiler warning break the build.

zlog uses C11 atomics since 1.2.19, and 1.2.20 adds 64-bit ones, which need libatomic on e.g. ARMv5:

libzlog.so.1.2.20: undefined reference to `__atomic_store_8'

So depend on BR2_TOOLCHAIN_HAS_ATOMIC and link the library against libatomic when the toolchain provides it.

The CMake build installs the same set of files as the makefile build did (zlog.h, zlog-chk-conf, libzlog.so.1.2.20 and libzlog.a) plus zlog.pc and the CMake package files. The soname is libzlog.so.1.2 with either build system.

Quoted 4 lines

Changelog: https://github.com/HardySimpson/zlog/blob/1.2.20/Changelog

Assisted-by Claude:claude-opus-5-5

Applied to master, thanks!

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot