beep: Upgrade to 1.4.12

Fix build with clang while here, need to disable Werror as newer
compilers find more warnings.

Do not save intermediate objects and disable ubsan, we do not build
runtime for it by defaults

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2023-11-13 17:40:37 -08:00
parent 612d853087
commit 95e5244055
No known key found for this signature in database
GPG Key ID: BB053355919D3314
3 changed files with 81 additions and 79 deletions

View File

@ -8,24 +8,11 @@ LICENSE = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "git://github.com/spkr-beep/beep.git;protocol=https;branch=master \
file://0001-Do-not-use-Werror-as-it-fails-with-newer-clang-11.patch \
"
SRCREV = "8b85ddd09f73b9fd7caa5679298781a57af194ac"
file://0001-beep-library-Make-it-compatible-with-c99.patch"
SRCREV = "11453a79f2cea81832329b06ca3a284aa7a0a52e"
S = "${WORKDIR}/git"
EXTRA_OEMAKE = " \
COMPILER_gcc='${CC}' \
LINKER_gcc='${CC}' \
COMPILER_clang=no \
LINKER_clang=no \
"
EXTRA_OEMAKE:toolchain-clang = " \
COMPILER_clang='${CC}' \
LINKER_clang='${CC}' \
COMPILER_gcc=no \
LINKER_gcc=no \
"
EXTRA_OEMAKE = "prefix='${prefix}' CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
do_install() {
oe_runmake install DESTDIR='${D}'

View File

@ -1,63 +0,0 @@
From 6b33adfa438e35b6a37cfb0364274370ef4f9fc1 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 23 Dec 2020 18:00:59 +0000
Subject: [PATCH] Do not use -Werror as it fails with newer clang 11+
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
GNUmakefile | 1 -
1 file changed, 1 deletion(-)
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -91,12 +91,13 @@ comma := ,
# If supported by COMPILER_gcc, add given flags to CFLAGS_gcc.
# Example usage:
# $(eval $(call CHECK_CFLAGS_gcc,-fasynchronous-unwind-tables))
-define CHECK_CFLAGS_gcc
-CFLAGS_gcc += $$(if $$(shell if $$(COMPILER_gcc) $(1) -x c -o compile-check.gcc-o -c - < /dev/null > /dev/null 2>&1; then echo yes; else :; fi; rm -f compile-check.gcc-o > /dev/null 2>&1),$(1))
-endef
COMPILER_gcc = gcc
LINKER_gcc = gcc
+ifneq ($(COMPILER_gcc),no)
+define CHECK_CFLAGS_gcc
+CFLAGS_gcc += $$(if $$(shell if $$(COMPILER_gcc) $(1) -x c -o compile-check.gcc-o -c - < /dev/null > /dev/null 2>&1; then echo yes; else :; fi; rm -f compile-check.gcc-o > /dev/null 2>&1),$(1))
+endef
CPPFLAGS_gcc =
CFLAGS_gcc =
CFLAGS_gcc += -std=gnu99 -pedantic
@@ -113,30 +114,24 @@ CFLAGS_gcc += -save-temps=obj
LDFLAGS_gcc =
LIBS_gcc =
-ifneq ($(call pathsearch,$(COMPILER_gcc)),)
-ifneq ($(COMPILER_gcc)),no)
COMPILERS += gcc
endif
-endif
COMPILER_clang = clang
LINKER_clang = clang
+
+ifneq ($(COMPILER_clang),no)
CPPFLAGS_clang =
CFLAGS_clang += -Wall -Wextra
CFLAGS_clang += -Weverything
CFLAGS_clang += -Wno-padded
CFLAGS_clang += -std=gnu99 -pedantic
-CFLAGS_clang += -Werror
-CFLAGS_clang += -fsanitize=undefined
CFLAGS_clang += -O -g
LDFLAGS_clang =
LIBS_clang =
-ifneq ($(call pathsearch,$(COMPILER_clang)),)
-ifneq ($(COMPILER_clang),no)
COMPILERS += clang
endif
-endif
########################################################################

View File

@ -0,0 +1,78 @@
From 66b06e03fc25a168e06c7af5ccccc3162ddbf92a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 13 Nov 2023 17:18:55 -0800
Subject: [PATCH] beep-library: Make it compatible with < c99
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
beep-library.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--- a/beep-library.c
+++ b/beep-library.c
@@ -44,7 +44,7 @@
int open_checked_char_device(const char *const device_name)
{
struct stat sb;
-
+ int fd = -1;
if (-1 == stat(device_name, &sb)) {
LOG_VERBOSE("could not stat(2) %s: %s",
device_name, strerror(errno));
@@ -57,7 +57,7 @@ int open_checked_char_device(const char
return -1;
}
- const int fd = open(device_name, O_WRONLY);
+ fd = open(device_name, O_WRONLY);
if (fd == -1) {
LOG_VERBOSE("could not open(2) %s: %s",
device_name, strerror(errno));
@@ -90,6 +90,7 @@ void safe_error_exit(const char *const m
{
const int saved_errno = errno;
char strerr_buf[128];
+ size_t errlen, msglen;
const int ret = strerror_r(saved_errno, strerr_buf, sizeof(strerr_buf));
if (ret != 0) {
if (write(STDERR_FILENO, "strerror_r error\n",
@@ -98,14 +99,14 @@ void safe_error_exit(const char *const m
}
_exit(EXIT_FAILURE);
}
- const size_t msglen = strlen(msg);
+ msglen = strlen(msg);
if (write(STDERR_FILENO, msg, msglen)) {
/* ignore all write errors */
}
if (write(STDERR_FILENO, ": ", 2)) {
/* ignore all write errors */
}
- const size_t errlen = strlen(strerr_buf);
+ errlen = strlen(strerr_buf);
if (write(STDERR_FILENO, strerr_buf, errlen)) {
/* ignore all write errors */
}
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -155,7 +155,6 @@ $(eval $(call CHECK_CFLAGS,common_CFLAGS
$(eval $(call CHECK_CFLAGS,common_CFLAGS,-Wall))
$(eval $(call CHECK_CFLAGS,common_CFLAGS,-Wextra))
$(eval $(call CHECK_CFLAGS,common_CFLAGS,-Weverything))
-$(eval $(call CHECK_CFLAGS,common_CFLAGS,-Werror))
$(eval $(call CHECK_CFLAGS,common_CFLAGS,-Wno-padded))
$(eval $(call CHECK_CFLAGS,common_CFLAGS,-Werror=format-security))
$(eval $(call CHECK_CFLAGS,common_CFLAGS,-Wno-disabled-macro-expansion))
@@ -169,11 +168,6 @@ $(eval $(call CHECK_CFLAGS,CFLAGS,-fanal
$(eval $(call CHECK_CFLAGS,CFLAGS,-fstack-protector-strong))
$(eval $(call CHECK_CFLAGS,CFLAGS,-fstack-clash-protection))
$(eval $(call CHECK_CFLAGS,CFLAGS,-fcf-protection))
-$(eval $(call CHECK_CFLAGS,CFLAGS,-fsanitize=undefined))
-
-
-CFLAGS += -save-temps=obj
-
$(info # common_CFLAGS=$(common_CFLAGS))
$(info # CFLAGS=$(CFLAGS))