On 2025/8/1 15:39, Gao Xiang wrote:
On 2025/8/1 15:30, Yifan Zhao wrote:
From: zhaoyifan <zhaoyifa...@huawei.com>
This patch adds additional dependencies on libcurl, openssl and
libxml2 library
for the upcoming S3 data source support, with libcurl to interact
with S3 API,
openssl to generate S3 auth signature and libxml2 to parse response
body.
The newly introduced dependencies are optional, controlled by the
`--enable-s3`
configure option.
Use 72-char per line at maximum...
Fixed in this and other 3 patches. Thanks for pointing it out!
Signed-off-by: Yifan Zhao <zhaoyifa...@huawei.com>
---
change since v1:
- rebase on the latest `experimental` branch
- rename: lib/s3.c => lib/remotes/s3.c
- configure.ac: introduce `subdir-objects` option as s3.c in a subdir
- move include/erofs/s3.h in the following patch
configure.ac | 43 ++++++++++++++++++++++++++++++++++++++++++-
lib/Makefile.am | 4 ++++
lib/remotes/s3.c | 6 ++++++
mkfs/Makefile.am | 3 ++-
4 files changed, 54 insertions(+), 2 deletions(-)
create mode 100644 lib/remotes/s3.c
diff --git a/configure.ac b/configure.ac
index 2d42b1f..82ff98e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ esac
# OS-specific treatment
AM_CONDITIONAL([OS_LINUX], [test "$build_linux" = "yes"])
-AM_INIT_AUTOMAKE([foreign -Wall])
+AM_INIT_AUTOMAKE([foreign subdir-objects -Wall])
# Checks for programs.
AM_PROG_AR
@@ -165,6 +165,10 @@ AC_ARG_WITH(xxhash,
[AS_HELP_STRING([--with-xxhash],
[Enable and build with libxxhash support
@<:@default=auto@:>@])])
+AC_ARG_ENABLE(s3,
+ [AS_HELP_STRING([--enable-s3], [enable s3 image generation
support @<:@default=no@:>@])],
+ [enable_s3="$enableval"], [enable_s3="no"])
+
AC_ARG_ENABLE(fuse,
[AS_HELP_STRING([--enable-fuse], [enable erofsfuse
@<:@default=no@:>@])],
[enable_fuse="$enableval"], [enable_fuse="no"])
@@ -578,6 +582,32 @@ AS_IF([test "x$with_xxhash" != "xno"], [
])
])
+AS_IF([test "x$enable_s3" != "xno"], [
+ # Paranoia: don't trust the result reported by pkgconfig before
trying out
+ saved_LIBS="$LIBS"
+ saved_CPPFLAGS=${CPPFLAGS}
+ PKG_CHECK_MODULES([libcurl], [libcurl])
+ PKG_CHECK_MODULES([openssl], [openssl])
+ PKG_CHECK_MODULES([libxml2], [libxml-2.0])
I wonder if it's possible to introduce
`--with-libcurl`
`--with-openssl`
`--with-libxml`
and `--enable-s3`, and if users disable any library,
it should fail.
I think why it should behave as this, because libcurl
openssl and libxml can be used for other use cases
(e.g. oci registry support), users can always link
these libs
Done. Introduce `--with-{libcurl,openssl,libxml2}` options,
and `--enable-s3` would fail if any of them is not satisfied.
IMHO, we should use --with-libxml2 instead of --with-libxml
here as this is its official name. Please point it out if I'm wrong.
Thanks,
Yifan Zhao
Thanks,
Gao Xiang