Skip to contentSkip to conversation

libb64: Add recipe

PATCH New Armin Kuster 1 participant 2 messages Jul 18, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libb64: Add recipe

From: Khem Raj <[email protected]>

Add Base64 encode/decode library, some packages e.g. sysdig can benefit from it

Disable parallel make as it races at times
make[1]: *** No rule to make target 'libb64.a', needed by 'c-example1'. Stop.

(cherry picked from commit 6946f40707ed43426cd05ada1933e4867c7f6d4f)
---
 .../0001-example-Do-not-run-the-tests.patch   | 27 +++++++
 .../0002-use-BUFSIZ-as-buffer-size.patch      | 57 ++++++++++++++
 .../libb64/0003-fix-integer-overflows.patch   | 77 +++++++++++++++++++
 .../libb64/0004-Fix-off-by-one-error.patch    | 26 +++++++
 ...0005-make-overriding-CFLAGS-possible.patch | 40 ++++++++++
 ...t-export-the-CHARS_PER_LINE-variable.patch | 27 +++++++
 ...er-decoder-state-in-the-constructors.patch | 44 +++++++++++
 .../recipes-support/libb64/libb64_1.2.1.bb    | 39 ++++++++++
 8 files changed, 337 insertions(+)
 create mode 100644 meta-oe/recipes-support/libb64/libb64/0001-example-Do-not-run-the-tests.patch
 create mode 100644 meta-oe/recipes-support/libb64/libb64/0002-use-BUFSIZ-as-buffer-size.patch
 create mode 100644 meta-oe/recipes-support/libb64/libb64/0003-fix-integer-overflows.patch
 create mode 100644 meta-oe/recipes-support/libb64/libb64/0004-Fix-off-by-one-error.patch
 create mode 100644 meta-oe/recipes-support/libb64/libb64/0005-make-overriding-CFLAGS-possible.patch
 create mode 100644 meta-oe/recipes-support/libb64/libb64/0006-do-not-export-the-CHARS_PER_LINE-variable.patch
 create mode 100644 meta-oe/recipes-support/libb64/libb64/0007-initialize-encoder-decoder-state-in-the-constructors.patch
 create mode 100644 meta-oe/recipes-support/libb64/libb64_1.2.1.bb
meta-oe/recipes-support/libb64/libb64/0001-example-Do-not-run-the-tests.patch new file +27 -0
new file mode 100644
index 0000000000..ea3ddfb64b
@@ -0,0 +1,27 @@
+From 68f66d1583be670eb8d5f3f38dbd5dd1d63b733c Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 27 Mar 2021 21:41:04 -0700
+Subject: [PATCH] example: Do not run the tests
+
+Upstream-Status: Inappropritate [Cross-compile specific]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ examples/Makefile | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/examples/Makefile b/examples/Makefile
+index d9667a5..554b346 100644
+--- a/examples/Makefile
++++ b/examples/Makefile
+@@ -33,11 +33,8 @@ depend: $(SOURCES)
+ 	makedepend -f- $(CFLAGS) $(SOURCES) 2> /dev/null 1> depend
+ 
+ test-c-example1: c-example1
+-	./c-example1
+ 
+ test-c-example2: c-example2
+-	./c-example2 loremgibson.txt encoded.txt decoded.txt
+-	diff -q loremgibson.txt decoded.txt
+ 
+ test: test-c-example1 test-c-example2
+ 
meta-oe/recipes-support/libb64/libb64/0002-use-BUFSIZ-as-buffer-size.patch new file +57 -0

57 lines not on this page · raw message

meta-oe/recipes-support/libb64/libb64/0003-fix-integer-overflows.patch new file +77 -0

77 lines not on this page · raw message

meta-oe/recipes-support/libb64/libb64/0004-Fix-off-by-one-error.patch new file +26 -0
new file mode 100644
index 0000000000..e19dbad08d
@@ -0,0 +1,26 @@
+From 8144fd9e02bd5ccd1e080297b19a1e9eb4d3ff96 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 27 Mar 2021 22:07:15 -0700
+Subject: [PATCH] Fix off by one error
+
+Launchpad bug #1501176 reported by William McCall on 2015-09-30
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/cdecode.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/cdecode.c b/src/cdecode.c
+index 4e47e9f..45da4e1 100644
+--- a/src/cdecode.c
++++ b/src/cdecode.c
+@@ -13,7 +13,7 @@ int base64_decode_value(char value_in)
+ 	static const char decoding_size = sizeof(decoding);
+ 	if (value_in < 43) return -1;
+ 	value_in -= 43;
+-	if (value_in > decoding_size) return -1;
++	if (value_in >= decoding_size) return -1;
+ 	return decoding[(int)value_in];
+ }
+ 
meta-oe/recipes-support/libb64/libb64/0005-make-overriding-CFLAGS-possible.patch new file +40 -0
new file mode 100644
index 0000000000..e93015ee48
@@ -0,0 +1,40 @@
+From a7914d5ffee6ffdfb3f2b8ebcc22c8367d078301 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 27 Mar 2021 22:08:43 -0700
+Subject: [PATCH] make overriding CFLAGS possible
+
+Author: Jakub Wilk <[email protected]>
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ base64/Makefile | 2 +-
+ src/Makefile    | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/base64/Makefile b/base64/Makefile
+index 30a2c5c..783a248 100644
+--- a/base64/Makefile
++++ b/base64/Makefile
+@@ -3,7 +3,7 @@ BINARIES = base64
+ # Build flags (uncomment one)
+ #############################
+ # Release build flags
+-CFLAGS += -O3
++CFLAGS ?= -O3
+ #############################
+ # Debug build flags
+ #CFLAGS += -g
+diff --git a/src/Makefile b/src/Makefile
+index 28b2382..48801fc 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -3,7 +3,7 @@ LIBRARIES = libb64.a
+ # Build flags (uncomment one)
+ #############################
+ # Release build flags
+-CFLAGS += -O3
++CFLAGS ?= -O3
+ #############################
+ # Debug build flags
+ #CFLAGS += -g
meta-oe/recipes-support/libb64/libb64/0006-do-not-export-the-CHARS_PER_LINE-variable.patch new file +27 -0
new file mode 100644
index 0000000000..9ba08c87ee
@@ -0,0 +1,27 @@
+From a1b9bb4af819ed389675f16e4a521efeda4cc3f3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 27 Mar 2021 22:10:48 -0700
+Subject: [PATCH] do not export the CHARS_PER_LINE variable
+
+The library exports a variable named "CHARS_PER_LINE". This is a generic name that could conflict with a name in user's code.
+Please either rename the variable or make it static.
+
+Upstream-Status: Submitted [http://sourceforge.net/tracker/?func=detail&aid=3591420&group_id=152942&atid=785907]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/cencode.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/cencode.c b/src/cencode.c
+index 03ba5b6..3df62a8 100644
+--- a/src/cencode.c
++++ b/src/cencode.c
+@@ -7,7 +7,7 @@ For details, see http://sourceforge.net/projects/libb64
+ 
+ #include <b64/cencode.h>
+ 
+-const int CHARS_PER_LINE = 72;
++static const int CHARS_PER_LINE = 72;
+ 
+ void base64_init_encodestate(base64_encodestate* state_in)
+ {
meta-oe/recipes-support/libb64/libb64/0007-initialize-encoder-decoder-state-in-the-constructors.patch new file +44 -0

44 lines not on this page · raw message

meta-oe/recipes-support/libb64/libb64_1.2.1.bb new file +39 -0
new file mode 100644
index 0000000000..64a34fece7
@@ -0,0 +1,39 @@
+SUMMARY = "Base64 Encoding/Decoding Routines"
+DESCRIPTION = "base64 encoding/decoding library - runtime library \
+libb64 is a library of ANSI C routines for fast encoding/decoding data into \
+and from a base64-encoded format"
+HOMEPAGE = "http://libb64.sourceforge.net/"
+LICENSE = "PD"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=ce551aad762074c7ab618a0e07a8dca3"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}/${BP}.zip \
+           file://0001-example-Do-not-run-the-tests.patch \
+           file://0002-use-BUFSIZ-as-buffer-size.patch \
+           file://0003-fix-integer-overflows.patch \
+           file://0004-Fix-off-by-one-error.patch \
+           file://0005-make-overriding-CFLAGS-possible.patch \
+           file://0006-do-not-export-the-CHARS_PER_LINE-variable.patch \
+           file://0007-initialize-encoder-decoder-state-in-the-constructors.patch \
+           "
+SRC_URI[sha256sum] = "20106f0ba95cfd9c35a13c71206643e3fb3e46512df3e2efb2fdbf87116314b2"
+
+PARALLEL_MAKE = ""
+
+CFLAGS += "-fPIC"
+
+do_configure () {
+    :
+}
+
+do_compile () {
+    oe_runmake
+    ${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,${BPN}.so.0 src/*.o -o src/${BPN}.so.0
+}
+
+do_install () {
+    install -d ${D}${includedir}/b64
+    install -Dm 0644 ${B}/src/libb64.a ${D}${libdir}/libb64.a
+    install -Dm 0644 ${B}/src/libb64.so.0 ${D}${libdir}/libb64.so.0
+    ln -s libb64.so.0 ${D}${libdir}/libb64.so
+    install -Dm 0644 ${S}/include/b64/*.h ${D}${includedir}/b64/
+}
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 sysdig: Depend on system libb64

From: Khem Raj <[email protected]>

avoid using vendored version

(cherry picked from commit d8053b7e2b21c651b34b48f025f47cb511c36e37)

[FIxes this error
--- LOG END ---

 |          error: downloading 'http://download.draios.com/dependencies/libb64-1.2.src.zip' failed
 |          status_code: 22
 |          status_string: "HTTP response code said error"
 |          log:
 |          --- LOG BEGIN ---

]

---
 meta-oe/recipes-extended/sysdig/sysdig_git.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta-oe/recipes-extended/sysdig/sysdig_git.bb +1 -2
index d15ecdb03f..b06340f82f 100644
@@ -15,7 +15,7 @@ JIT_mipsarchn64 = ""
 JIT_riscv64 = ""
 JIT_riscv32 = ""
 
-DEPENDS += "lua${JIT} zlib c-ares grpc-native grpc curl ncurses jsoncpp tbb jq openssl elfutils protobuf protobuf-native jq-native"
+DEPENDS += "libb64 lua${JIT} zlib c-ares grpc-native grpc curl ncurses jsoncpp tbb jq openssl elfutils protobuf protobuf-native jq-native"
 RDEPENDS_${PN} = "bash"
 
 SRC_URI = "git://github.com/draios/sysdig.git;branch=dev;protocol=https \
@@ -32,7 +32,6 @@ S = "${WORKDIR}/git"
 EXTRA_OECMAKE = "\
                 -DBUILD_DRIVER=OFF \
                 -DUSE_BUNDLED_DEPS=OFF \
-                -DUSE_BUNDLED_B64=ON \
                 -DCREATE_TEST_TARGETS=OFF \
                 -DDIR_ETC=${sysconfdir} \
                 -DLUA_INCLUDE_DIR=${STAGING_INCDIR}/luajit-2.1 \
Signature · 1 line
2.34.1