Skip to contentSkip to conversation

ntpsec: Add -D_GNU_SOURCE and fix building with devtool

PATCH New Khem Raj 1 participant 4 messages Aug 23, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/4 ntpsec: Add -D_GNU_SOURCE and fix building with devtool

wscript detects .git directory and if its present them invokes git describe --dirty which does not work on the devtool created git repository, since its synthesized.

Add GNU_SOURCE define to get strptime() definition

---
 ...01-wscript-Widen-the-search-for-tags.patch | 29 +++++++++++++++++++
 .../recipes-support/ntpsec/ntpsec_1.2.1.bb    |  6 ++--
 2 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-support/ntpsec/ntpsec/0001-wscript-Widen-the-search-for-tags.patch
meta-networking/recipes-support/ntpsec/ntpsec/0001-wscript-Widen-the-search-for-tags.patch new file +29 -0
new file mode 100644
index 0000000000..98c62eed49
@@ -0,0 +1,29 @@
+From 9a7dead72f41e79979625c9bdef2fb638427d3d6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 22 Aug 2022 20:54:17 -0700
+Subject: [PATCH] wscript: Widen the search for tags
+
+Default is to look for annotated tags, howveer when using devtool we
+create our own git tree from release tarballs which will have tags but
+they are not annotated, therefore broaden the search to include all tags
+
+Upstream-Status: Inappropriate [OE-specific]
+
+Signed-off-by: Khem Raj <[email protected]>
+---
+ wscript | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/wscript b/wscript
+index 879ded1..dff835d 100644
+--- a/wscript
++++ b/wscript
+@@ -177,7 +177,7 @@ def configure(ctx):
+     if build_desc:
+         build_desc = ' ' + build_desc
+     if ctx.env.BIN_GIT:
+-        cmd = ctx.env.BIN_GIT + shlex.split("describe --dirty")
++        cmd = ctx.env.BIN_GIT + shlex.split("describe --tags --dirty")
+         git_short_hash = ctx.cmd_and_log(cmd).strip()
+         git_short_hash = '-'.join(git_short_hash.split('-')[1:])
+ 
meta-networking/recipes-support/ntpsec/ntpsec_1.2.1.bb +4 -2
index cd8b396f19..e975f903f9 100644
@@ -16,7 +16,9 @@ SRC_URI = "https://ftp.ntpsec.org/pub/releases/ntpsec-${PV}.tar.gz \
            file://0001-ntpd-ntp_sandbox.c-allow-clone3-for-glibc-2.34-in-se.patch \
            file://0001-ntpd-ntp_sandbox.c-allow-newfstatat-on-all-archs-for.patch \
            file://0002-ntpd-ntp_sandbox.c-match-riscv-to-aarch-in-seccomp-f.patch \
-           file://volatiles.ntpsec"
+           file://volatiles.ntpsec \
+           file://0001-wscript-Widen-the-search-for-tags.patch \
+           "
 
 SRC_URI[sha256sum] = "f2684835116c80b8f21782a5959a805ba3c44e3a681dd6c17c7cb00cc242c27a"
 
@@ -56,7 +58,7 @@ export PYTAG = "cpython${@ d.getVar('PYTHON_BASEVERSION').replace('.', '')}"
 export pyext_PATTERN = "%s.so"
 export PYTHON_LDFLAGS = "-lpthread -ldl"
 
-CFLAGS:append = " -I${PYTHON_INCLUDE_DIR}"
+CFLAGS:append = " -I${PYTHON_INCLUDE_DIR} -D_GNU_SOURCE"
 
 EXTRA_OECONF = "--cross-compiler='${CC}' \
                 --cross-cflags='${CFLAGS}' \
Signature · 1 line
2.37.2
author
#1 lore raw

PATCH 2/4 gd: Fix build with clang-15

---
 ...1-Fix-deprecared-function-prototypes.patch | 115 ++++++++++++++++++
 meta-oe/recipes-support/gd/gd_2.3.3.bb        |   1 +
 2 files changed, 116 insertions(+)
 create mode 100644 meta-oe/recipes-support/gd/gd/0001-Fix-deprecared-function-prototypes.patch
meta-oe/recipes-support/gd/gd/0001-Fix-deprecared-function-prototypes.patch new file +115 -0
new file mode 100644
index 0000000000..5ac5170721
@@ -0,0 +1,115 @@
+From 6379331cd0647fc6f149f55e4505a9a92e4f159f Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 22 Aug 2022 22:43:26 -0700
+Subject: [PATCH] Fix deprecared function prototypes
+
+Fixes following errors:
+error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
+
+Upstream-Status: Submitted [https://github.com/libgd/libgd/pull/835]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/gd_nnquant.c | 32 +++++++-------------------------
+ src/gd_tiff.c    |  4 +---
+ 2 files changed, 8 insertions(+), 28 deletions(-)
+
+diff --git a/src/gd_nnquant.c b/src/gd_nnquant.c
+index 8b9aa794..013f7160 100644
+--- a/src/gd_nnquant.c
++++ b/src/gd_nnquant.c
+@@ -112,12 +112,7 @@ typedef struct {
+ 
+ /* Initialise network in range (0,0,0,0) to (255,255,255,255) and set parameters
+    ----------------------------------------------------------------------- */
+-static void initnet(nnq, thepic, len, sample, colours)
+-nn_quant *nnq;
+-unsigned char *thepic;
+-int len;
+-int sample;
+-int colours;
++static void initnet(nn_quant *nnq, unsigned char *thepic, int len, int sample, int colours)
+ {
+ 	register int i;
+ 	register int *p;
+@@ -163,9 +158,7 @@ static void unbiasnet(nn_quant *nnq)
+ }
+ 
+ /* Output colormap to unsigned char ptr in RGBA format */
+-static void getcolormap(nnq, map)
+-nn_quant *nnq;
+-unsigned char *map;
++static void getcolormap(nn_quant *nnq, unsigned char *map)
+ {
+ 	int i,j;
+ 	for(j=0; j < nnq->netsize; j++) {
+@@ -232,9 +225,7 @@ static void inxbuild(nn_quant *nnq)
+ 
+ /* Search for ABGR values 0..255 (after net is unbiased) and return colour index
+ 	 ---------------------------------------------------------------------------- */
+-static unsigned int inxsearch(nnq, al,b,g,r)
+-nn_quant *nnq;
+-register int al, b, g, r;
++static unsigned int inxsearch(nn_quant *nnq, int al, int b, int g, int r)
+ {
+ 	register int i, j, dist, a, bestd;
+ 	register int *p;
+@@ -306,9 +297,7 @@ register int al, b, g, r;
+ 
+ /* Search for biased ABGR values
+    ---------------------------- */
+-static int contest(nnq, al,b,g,r)
+-nn_quant *nnq;
+-register int al,b,g,r;
++static int contest(nn_quant *nnq, int al, int b, int g, int r)
+ {
+ 	/* finds closest neuron (min dist) and updates freq */
+ 	/* finds best neuron (min dist-bias) and returns position */
+@@ -362,9 +351,7 @@ register int al,b,g,r;
+ /* Move neuron i towards biased (a,b,g,r) by factor alpha
+ 	 ---------------------------------------------------- */
+ 
+-static void altersingle(nnq, alpha,i,al,b,g,r)
+-nn_quant *nnq;
+-register int alpha,i,al,b,g,r;
++static void altersingle(nn_quant *nnq, int alpha, int i,int al, int b, int g, int r)
+ {
+ 	register int *n;
+ 
+@@ -382,10 +369,7 @@ register int alpha,i,al,b,g,r;
+ /* Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|]
+ 	 --------------------------------------------------------------------------------- */
+ 
+-static void alterneigh(nnq, rad,i,al,b,g,r)
+-nn_quant *nnq;
+-int rad,i;
+-register int al,b,g,r;
++static void alterneigh(nn_quant *nnq, int rad, int i, int al,int b,int g, int r)
+ {
+ 	register int j,k,lo,hi,a;
+ 	register int *p, *q;
+@@ -429,9 +413,7 @@ register int al,b,g,r;
+ /* Main Learning Loop
+    ------------------ */
+ 
+-static void learn(nnq, verbose) /* Stu: N.B. added parameter so that main() could control verbosity. */
+-nn_quant *nnq;
+-int verbose;
++static void learn(nn_quant *nnq, int verbose) /* Stu: N.B. added parameter so that main() could control verbosity. */
+ {
+ 	register int i,j,al,b,g,r;
+ 	int radius,rad,alpha,step,delta,samplepixels;
+diff --git a/src/gd_tiff.c b/src/gd_tiff.c
+index 7f72b610..3d90e61a 100644
+--- a/src/gd_tiff.c
++++ b/src/gd_tiff.c
+@@ -446,9 +446,7 @@ BGD_DECLARE(void) gdImageTiffCtx(gdImagePtr image, gdIOCtx *out)
+ }
+ 
+ /* Check if we are really in 8bit mode */
+-static int checkColorMap(n, r, g, b)
+-int n;
+-uint16_t *r, *g, *b;
++static int checkColorMap(int n, uint16_t *r, uint16_t *g, uint16_t *b)
+ {
+ 	while (n-- > 0)
+ 		if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
meta-oe/recipes-support/gd/gd_2.3.3.bb +1 -0
index 9d4ee1fe4b..cc2c1571e6 100644
@@ -14,6 +14,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=ace63adfdac78400fc30fa22ee9c1bb1"
 DEPENDS = "freetype libpng jpeg zlib tiff"
 
 SRC_URI = "git://github.com/libgd/libgd.git;nobranch=1;protocol=https \
+           file://0001-Fix-deprecared-function-prototypes.patch \
            "
 
 SRCREV = "b5319a41286107b53daa0e08e402aa1819764bdc"
Signature · 1 line
2.37.2
author
#2 lore raw

PATCH 3/4 cpulimit: Define -D_GNU_SOURCE

In reply to Khem Raj

This define is needed for getting memrchr() declaration

---
 meta-oe/recipes-support/cpulimit/cpulimit_0.2.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-support/cpulimit/cpulimit_0.2.bb +1 -1
index 3ee2b5c239..86a58beda4 100644
@@ -18,5 +18,5 @@ do_install() {
     install -m 0755 ${B}/src/${PN} ${D}${sbindir}/
 }
 
-CFLAGS += "${LDFLAGS}"
+CFLAGS += "-D_GNU_SOURCE ${LDFLAGS}"
 
Signature · 1 line
2.37.2
author
#3 lore raw

PATCH 4/4 safec: Remove unused variable 'len'

In reply to Khem Raj
---
 ...strpbrk_s-Remove-unused-variable-len.patch | 42 +++++++++++++++++++
 meta-oe/recipes-core/safec/safec_3.7.1.bb     |  3 +-
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-core/safec/safec/0001-strpbrk_s-Remove-unused-variable-len.patch
meta-oe/recipes-core/safec/safec/0001-strpbrk_s-Remove-unused-variable-len.patch new file +42 -0
new file mode 100644
index 0000000000..4fd36ab8ab
@@ -0,0 +1,42 @@
+From b1d7cc6495c541cdd99399b4d1a835997376dcbf Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 22 Aug 2022 23:42:33 -0700
+Subject: [PATCH] strpbrk_s: Remove unused variable len
+
+Fixes
+error: variable 'len' set but not used [-Werror,-Wunused-but-set-variable]
+
+Upstream-Status: Submitted [https://github.com/rurban/safeclib/pull/123]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/extstr/strpbrk_s.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/src/extstr/strpbrk_s.c b/src/extstr/strpbrk_s.c
+index 5bb7a0f8..2cf8a8be 100644
+--- a/src/extstr/strpbrk_s.c
++++ b/src/extstr/strpbrk_s.c
+@@ -79,7 +79,6 @@ EXPORT errno_t _strpbrk_s_chk(char *dest, rsize_t dmax, char *src, rsize_t slen,
+ #endif
+ {
+     char *ps;
+-    rsize_t len;
+ 
+     CHK_SRC_NULL("strpbrk_s", firstp)
+     *firstp = NULL;
+@@ -121,7 +120,6 @@ EXPORT errno_t _strpbrk_s_chk(char *dest, rsize_t dmax, char *src, rsize_t slen,
+     while (*dest && dmax) {
+ 
+         ps = src;
+-        len = slen;
+         while (*ps) {
+ 
+             /* check for a match with the substring */
+@@ -130,7 +128,6 @@ EXPORT errno_t _strpbrk_s_chk(char *dest, rsize_t dmax, char *src, rsize_t slen,
+                 return RCNEGATE(EOK);
+             }
+             ps++;
+-            len--;
+         }
+         dest++;
+         dmax--;
meta-oe/recipes-core/safec/safec_3.7.1.bb +2 -1
index 5ffe7d7528..9dd6f1c7cc 100644
@@ -9,7 +9,8 @@ inherit autotools pkgconfig
 S = "${WORKDIR}/git"
 SRCREV = "f9add9245b97c7bda6e28cceb0ee37fb7e254fd8"
 SRC_URI = "git://github.com/rurban/safeclib.git;branch=master;protocol=https \
-"
+           file://0001-strpbrk_s-Remove-unused-variable-len.patch \
+           "
 
 COMPATIBLE_HOST = '(x86_64|i.86|powerpc|powerpc64|arm|aarch64|mips).*-linux'
 
Signature · 1 line
2.37.2