From: Christian Storm <[email protected]> Adapt the build system to build a shared library libebgenv-${EBG_VERSION}.so symlinked to by a libebgenv.so in addition to the static libebgenv.a.
This shared library may be used by external software such as SWUpdate [1] wanting to modify EFI Boot Guard's environment without having to statically link against libebgenv.a, following the pattern of libubootenv [2]. Note that the bg_setenv utility deliberately remains statically linked against libebgenv.a. for easy inclusion in initramfs or rescue media and to not break existing deployments. Alike, libebgenv.a is still installed via make install (though distributions may decide to not package it). This may be deprecated and removed in future versions. [1] https://github.com/sbabic/swupdate [2] https://github.com/sbabic/libubootenv Signed-off-by: Christian Storm <[email protected]> --- .gitignore | 5 +++++ Makefile.am | 9 +++++++++ configure.ac | 3 +++ 3 files changed, 17 insertions(+) diff --git a/.gitignore b/.gitignore index 6433560..c8cb496 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ *.so *.so.* *.dylib +*.lai # EFI *.efi @@ -70,6 +71,7 @@ Makefile.in /config.status /config.sub /configure +/configure~ /configure.scan /depcomp /install-sh @@ -78,4 +80,7 @@ Makefile.in /Makefile /tools/tests/Makefile .deps/ +m4/libtool.m4 +m4/lt* version.h +libtool diff --git a/Makefile.am b/Makefile.am index ee142d1..9a171fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -90,6 +90,14 @@ libebgenv_a_CFLAGS = \ pkginclude_HEADERS = \ include/ebgenv.h +# +# Shared libraries +# +LIBEBGENV_SO_VERSION = $(shell $(EGREP) -o '[0-9]+\.[0-9]+' VERSION) +lib_LTLIBRARIES = libebgenv.la +libebgenv_la_SOURCES = $(libebgenv_a_SOURCES) +libebgenv_la_LDFLAGS = -release $(LIBEBGENV_SO_VERSION).0 + # # bg_setenv binary # @@ -111,6 +119,7 @@ bg_setenv_DEPENDENCIES = \ install-exec-hook: $(LN_S) -f bg_setenv$(EXEEXT) \ $(DESTDIR)$(bindir)/bg_printenv$(EXEEXT) + $(RM) $(DESTDIR)$(libdir)/$(lib_LTLIBRARIES) # # EFI compilation diff --git a/configure.ac b/configure.ac index fd75cb8..b332c6a 100644 --- a/configure.ac +++ b/configure.ac @@ -22,6 +22,8 @@ AC_INIT([efibootguard], [efibootguard], []) +LT_INIT + AC_CONFIG_SRCDIR([bootguard.c]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -49,6 +51,7 @@ AC_PROG_GCC_TRADITIONAL AC_PROG_MKDIR_P AC_PROG_RANLIB AC_PROG_LN_S +AC_PROG_EGREP AC_ARG_WITH([gnuefi-sys-dir], AS_HELP_STRING([--with-gnuefi-sys-dir=DIRECTORY], -- 2.33.0 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20210825162717.82513-1-christian.storm%40siemens.com.
