From 1ac8a51a1426068addc282d86b148fc00a27787d Mon Sep 17 00:00:00 2001 From: ajayk Date: Wed, 31 May 2023 19:49:32 -0700 Subject: [PATCH 1/4] Add libapr --- libapr.yaml | 78 ++++++++++++++++++++++++ libapr/apr-1.7.2-autoconf-2.72.patch | 22 +++++++ libapr/fix-atomics.patch | 89 ++++++++++++++++++++++++++++ packages.txt | 2 + 4 files changed, 191 insertions(+) create mode 100644 libapr.yaml create mode 100644 libapr/apr-1.7.2-autoconf-2.72.patch create mode 100644 libapr/fix-atomics.patch diff --git a/libapr.yaml b/libapr.yaml new file mode 100644 index 00000000000..19e84fde644 --- /dev/null +++ b/libapr.yaml @@ -0,0 +1,78 @@ +package: + name: libapr + version: 1.7.4 + epoch: 0 + description: "Apache Portable Runtime Library (APR)" + copyright: + - license: Apache-2.0 + +environment: + contents: + packages: + - wolfi-base + - busybox + - ca-certificates-bundle + - build-base + - elfutils-dev + - linux-headers + - zstd-dev + - zlib-dev + - automake + - autoconf + - python3 + - libtool + +pipeline: + - uses: git-checkout + with: + repository: https://github.com/apache/apr + tag: ${{package.version}} + expected-commit: 22867ddac49b7dcf356556577461231acdff6445 + + - uses: patch + with: + patches: apr-1.7.2-autoconf-2.72.patch + + - runs: | + ./buildconf + + - if: ${{build.arch}} == 'x86_64' + uses: autoconf/configure + with: + opts: | + --prefix=/usr \ + --libdir=/usr/lib \ + --enable-nonportable-atomics=no + + - if: ${{build.arch}} == 'aarch64' + uses: autoconf/configure + with: + opts: | + --prefix=/usr \ + --libdir=/usr/lib \ + --enable-nonportable-atomics=yes + + - uses: autoconf/make + + - uses: autoconf/make-install + + - runs: | + mkdir -p "${{targets.destdir}}"/usr/share/ + mv "${{targets.destdir}}"/usr/build-1 "${{targets.destdir}}"/usr/share/ + + - uses: strip + +subpackages: + - name: "libapr-dev" + description: "headers for libapr" + pipeline: + - uses: split/dev + dependencies: + runtime: + - libapr + +update: + enabled: false + github: + identifier: apache/apr + use-tag: true diff --git a/libapr/apr-1.7.2-autoconf-2.72.patch b/libapr/apr-1.7.2-autoconf-2.72.patch new file mode 100644 index 00000000000..689e2fa082d --- /dev/null +++ b/libapr/apr-1.7.2-autoconf-2.72.patch @@ -0,0 +1,22 @@ +https://src.fedoraproject.org/rpms/apr/raw/rawhide/f/apr-1.7.2-autoconf.patch + +Similar to https://github.com/apache/apr/commit/a15958a37a06f71c42c690278f9c958b93b7ee20. +--- a/build/apr_common.m4 ++++ b/build/apr_common.m4 +@@ -468,15 +468,8 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING], + fi + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( +- [ +-#ifndef PACKAGE_NAME +-#include "confdefs.h" +-#endif +- ] +- [[$1]] +- [int main(int argc, const char *const *argv) {] ++ [[$1]], + [[$2]] +- [ return 0; }] + )], [CFLAGS=$apr_save_CFLAGS + $3], [CFLAGS=$apr_save_CFLAGS + $4]) \ No newline at end of file diff --git a/libapr/fix-atomics.patch b/libapr/fix-atomics.patch new file mode 100644 index 00000000000..b6ddfc43e4d --- /dev/null +++ b/libapr/fix-atomics.patch @@ -0,0 +1,89 @@ +# upstream trunk commits r1907442, r1907441 +--- apr.orig/atomic/unix/builtins.c ++++ apr/atomic/unix/builtins.c +@@ -26,7 +26,11 @@ + + APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p) + { ++#if defined (NEED_ATOMICS_GENERIC64) ++ return apr__atomic_generic64_init(p); ++#else + return APR_SUCCESS; ++#endif + } + + APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) +--- apr.orig/atomic/unix/builtins64.c ++++ apr/atomic/unix/builtins64.c +@@ -26,7 +26,7 @@ + + APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem) + { +-#if HAVE__ATOMIC_BUILTINS ++#if HAVE__ATOMIC_BUILTINS64 + return __atomic_load_n(mem, __ATOMIC_SEQ_CST); + #elif WEAK_MEMORY_ORDERING + /* No __sync_load() available => apr_atomic_add64(mem, 0) */ +@@ -38,7 +38,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_rea + + APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val) + { +-#if HAVE__ATOMIC_BUILTINS ++#if HAVE__ATOMIC_BUILTINS64 + __atomic_store_n(mem, val, __ATOMIC_SEQ_CST); + #elif WEAK_MEMORY_ORDERING + /* No __sync_store() available => apr_atomic_xchg64(mem, val) */ +@@ -51,7 +51,7 @@ APR_DECLARE(void) apr_atomic_set64(volat + + APR_DECLARE(apr_uint64_t) apr_atomic_add64(volatile apr_uint64_t *mem, apr_uint64_t val) + { +-#if HAVE__ATOMIC_BUILTINS ++#if HAVE__ATOMIC_BUILTINS64 + return __atomic_fetch_add(mem, val, __ATOMIC_SEQ_CST); + #else + return __sync_fetch_and_add(mem, val); +@@ -60,7 +60,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_add + + APR_DECLARE(void) apr_atomic_sub64(volatile apr_uint64_t *mem, apr_uint64_t val) + { +-#if HAVE__ATOMIC_BUILTINS ++#if HAVE__ATOMIC_BUILTINS64 + __atomic_fetch_sub(mem, val, __ATOMIC_SEQ_CST); + #else + __sync_fetch_and_sub(mem, val); +@@ -69,7 +69,7 @@ APR_DECLARE(void) apr_atomic_sub64(volat + + APR_DECLARE(apr_uint64_t) apr_atomic_inc64(volatile apr_uint64_t *mem) + { +-#if HAVE__ATOMIC_BUILTINS ++#if HAVE__ATOMIC_BUILTINS64 + return __atomic_fetch_add(mem, 1, __ATOMIC_SEQ_CST); + #else + return __sync_fetch_and_add(mem, 1); +@@ -78,7 +78,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_inc + + APR_DECLARE(int) apr_atomic_dec64(volatile apr_uint64_t *mem) + { +-#if HAVE__ATOMIC_BUILTINS ++#if HAVE__ATOMIC_BUILTINS64 + return __atomic_sub_fetch(mem, 1, __ATOMIC_SEQ_CST); + #else + return __sync_sub_and_fetch(mem, 1); +@@ -88,7 +88,7 @@ APR_DECLARE(int) apr_atomic_dec64(volati + APR_DECLARE(apr_uint64_t) apr_atomic_cas64(volatile apr_uint64_t *mem, apr_uint64_t val, + apr_uint64_t cmp) + { +-#if HAVE__ATOMIC_BUILTINS ++#if HAVE__ATOMIC_BUILTINS64 + __atomic_compare_exchange_n(mem, &cmp, val, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); + return cmp; + #else +@@ -98,7 +98,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_cas + + APR_DECLARE(apr_uint64_t) apr_atomic_xchg64(volatile apr_uint64_t *mem, apr_uint64_t val) + { +-#if HAVE__ATOMIC_BUILTINS ++#if HAVE__ATOMIC_BUILTINS64 + return __atomic_exchange_n(mem, val, __ATOMIC_SEQ_CST); + #else + __sync_synchronize(); \ No newline at end of file diff --git a/packages.txt b/packages.txt index 21445a3de8d..1fbc81d538f 100644 --- a/packages.txt +++ b/packages.txt @@ -711,3 +711,5 @@ newrelic-prometheus-configurator prometheus-nats-exporter docker-credential-gcr kyverno +alsa-lib +libapr From affef4025111e4529810114237d3b3215c5c3720 Mon Sep 17 00:00:00 2001 From: ajayk Date: Sat, 3 Jun 2023 18:10:30 -0700 Subject: [PATCH 2/4] remove atomics patch --- libapr/fix-atomics.patch | 89 ---------------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 libapr/fix-atomics.patch diff --git a/libapr/fix-atomics.patch b/libapr/fix-atomics.patch deleted file mode 100644 index b6ddfc43e4d..00000000000 --- a/libapr/fix-atomics.patch +++ /dev/null @@ -1,89 +0,0 @@ -# upstream trunk commits r1907442, r1907441 ---- apr.orig/atomic/unix/builtins.c -+++ apr/atomic/unix/builtins.c -@@ -26,7 +26,11 @@ - - APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p) - { -+#if defined (NEED_ATOMICS_GENERIC64) -+ return apr__atomic_generic64_init(p); -+#else - return APR_SUCCESS; -+#endif - } - - APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) ---- apr.orig/atomic/unix/builtins64.c -+++ apr/atomic/unix/builtins64.c -@@ -26,7 +26,7 @@ - - APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem) - { --#if HAVE__ATOMIC_BUILTINS -+#if HAVE__ATOMIC_BUILTINS64 - return __atomic_load_n(mem, __ATOMIC_SEQ_CST); - #elif WEAK_MEMORY_ORDERING - /* No __sync_load() available => apr_atomic_add64(mem, 0) */ -@@ -38,7 +38,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_rea - - APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val) - { --#if HAVE__ATOMIC_BUILTINS -+#if HAVE__ATOMIC_BUILTINS64 - __atomic_store_n(mem, val, __ATOMIC_SEQ_CST); - #elif WEAK_MEMORY_ORDERING - /* No __sync_store() available => apr_atomic_xchg64(mem, val) */ -@@ -51,7 +51,7 @@ APR_DECLARE(void) apr_atomic_set64(volat - - APR_DECLARE(apr_uint64_t) apr_atomic_add64(volatile apr_uint64_t *mem, apr_uint64_t val) - { --#if HAVE__ATOMIC_BUILTINS -+#if HAVE__ATOMIC_BUILTINS64 - return __atomic_fetch_add(mem, val, __ATOMIC_SEQ_CST); - #else - return __sync_fetch_and_add(mem, val); -@@ -60,7 +60,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_add - - APR_DECLARE(void) apr_atomic_sub64(volatile apr_uint64_t *mem, apr_uint64_t val) - { --#if HAVE__ATOMIC_BUILTINS -+#if HAVE__ATOMIC_BUILTINS64 - __atomic_fetch_sub(mem, val, __ATOMIC_SEQ_CST); - #else - __sync_fetch_and_sub(mem, val); -@@ -69,7 +69,7 @@ APR_DECLARE(void) apr_atomic_sub64(volat - - APR_DECLARE(apr_uint64_t) apr_atomic_inc64(volatile apr_uint64_t *mem) - { --#if HAVE__ATOMIC_BUILTINS -+#if HAVE__ATOMIC_BUILTINS64 - return __atomic_fetch_add(mem, 1, __ATOMIC_SEQ_CST); - #else - return __sync_fetch_and_add(mem, 1); -@@ -78,7 +78,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_inc - - APR_DECLARE(int) apr_atomic_dec64(volatile apr_uint64_t *mem) - { --#if HAVE__ATOMIC_BUILTINS -+#if HAVE__ATOMIC_BUILTINS64 - return __atomic_sub_fetch(mem, 1, __ATOMIC_SEQ_CST); - #else - return __sync_sub_and_fetch(mem, 1); -@@ -88,7 +88,7 @@ APR_DECLARE(int) apr_atomic_dec64(volati - APR_DECLARE(apr_uint64_t) apr_atomic_cas64(volatile apr_uint64_t *mem, apr_uint64_t val, - apr_uint64_t cmp) - { --#if HAVE__ATOMIC_BUILTINS -+#if HAVE__ATOMIC_BUILTINS64 - __atomic_compare_exchange_n(mem, &cmp, val, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); - return cmp; - #else -@@ -98,7 +98,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_cas - - APR_DECLARE(apr_uint64_t) apr_atomic_xchg64(volatile apr_uint64_t *mem, apr_uint64_t val) - { --#if HAVE__ATOMIC_BUILTINS -+#if HAVE__ATOMIC_BUILTINS64 - return __atomic_exchange_n(mem, val, __ATOMIC_SEQ_CST); - #else - __sync_synchronize(); \ No newline at end of file From 2014386edaa555054cb7861acb7614a0cb9b7984 Mon Sep 17 00:00:00 2001 From: ajayk Date: Sat, 3 Jun 2023 19:05:30 -0700 Subject: [PATCH 3/4] address review comments remove unncessary package --- libapr.yaml | 13 ++----------- packages.txt | 1 - 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/libapr.yaml b/libapr.yaml index 19e84fde644..26f692fac79 100644 --- a/libapr.yaml +++ b/libapr.yaml @@ -36,21 +36,12 @@ pipeline: - runs: | ./buildconf - - if: ${{build.arch}} == 'x86_64' - uses: autoconf/configure + - uses: autoconf/configure with: opts: | --prefix=/usr \ - --libdir=/usr/lib \ - --enable-nonportable-atomics=no + --libdir=/usr/lib - - if: ${{build.arch}} == 'aarch64' - uses: autoconf/configure - with: - opts: | - --prefix=/usr \ - --libdir=/usr/lib \ - --enable-nonportable-atomics=yes - uses: autoconf/make diff --git a/packages.txt b/packages.txt index f2eb5b135e2..dbc269a8a3b 100644 --- a/packages.txt +++ b/packages.txt @@ -714,5 +714,4 @@ newrelic-prometheus-configurator prometheus-nats-exporter docker-credential-gcr kyverno -alsa-lib libapr From 538a6363e62a278e8d6235580af5a9f019ded705 Mon Sep 17 00:00:00 2001 From: ajayk Date: Sat, 3 Jun 2023 19:11:27 -0700 Subject: [PATCH 4/4] lint --- libapr.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/libapr.yaml b/libapr.yaml index 26f692fac79..1cd379370c0 100644 --- a/libapr.yaml +++ b/libapr.yaml @@ -42,7 +42,6 @@ pipeline: --prefix=/usr \ --libdir=/usr/lib - - uses: autoconf/make - uses: autoconf/make-install