[PATCH] build: support building static library

Gao Xiang hsiangkao at linux.alibaba.com
Thu May 23 18:05:25 AEST 2024


Hi Comix!

On 2024/5/23 15:31, ComixHe wrote:
> In some cases, developer may need to integrate erofs-utils into their
> proejct as a static library to reduce package dependencies and
> have more finer control over the feature used by the project.

Thanks for sharing this.

> 
> For exapmle, squashfuse provides a static library `libsquashfuse.a` and
> exposes some useful functions, Appimage uses this static library to build
> image. It could ensure that the executable image can be executed directly
> on most linux platforms and the user doesn't need to install squashfuse
> in order to execute the image.
> 
> Signed-off-by: ComixHe <heyuming at deepin.org>
> ---
>   configure.ac     | 28 ++++++++++++++++++++++++++++
>   dump/Makefile.am | 10 ++++++++++
>   fsck/Makefile.am | 10 ++++++++++
>   fuse/Makefile.am | 10 ++++++++++
>   mkfs/Makefile.am | 10 ++++++++++
>   5 files changed, 68 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 1989bca..16ddb7c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -147,6 +147,30 @@ AC_ARG_ENABLE(fuse,
>      [AS_HELP_STRING([--enable-fuse], [enable erofsfuse @<:@default=no@:>@])],
>      [enable_fuse="$enableval"], [enable_fuse="no"])
>   
> +AC_ARG_ENABLE([static-fuse],
> +    [AS_HELP_STRING([--enable-static-fuse],
> +                    [build erofsfuse as a static library @<:@default=no@:>@])],
> +    [enable_static_fuse="$enableval"],
> +    [enable_static_fuse="no"])
> +
> +AC_ARG_ENABLE([static-dump],
> +    [AS_HELP_STRING([--enable-static-dump],
> +                    [build dump.erofs as a static library @<:@default=no@:>@])],
> +    [enable_static_dump="$enableval"],
> +    [enable_static_dump="no"])
> +
> +AC_ARG_ENABLE([static-mkfs],
> +    [AS_HELP_STRING([--enable-static-mkfs],
> +                    [build mkfs.erofs as a static library @<:@default=no@:>@])],
> +    [enable_static_mkfs="$enableval"],
> +    [enable_static_mkfs="no"])
> +
> +AC_ARG_ENABLE([static-fsck],
> +    [AS_HELP_STRING([--enable-static-fsck],
> +                    [build fsck.erofs as a static library @<:@default=no@:>@])],
> +    [enable_static_fsck="$enableval"],
> +    [enable_static_fsck="no"])

But how could we support static libraries from binaries?

I guess you need static liberofs instead?

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list