From: Christian Storm <
christi...@siemens.com>
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 distrbutions
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 <
christi...@siemens.com>
---
.gitignore | 4 ++++
Makefile.am | 9 +++++++++
configure.ac | 3 +++
3 files changed, 16 insertions(+)
diff --git a/.gitignore b/.gitignore
index 6433560..c1f0088 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
@@ -79,3 +81,5 @@ Makefile.in
/tools/tests/Makefile
.deps/
version.h
+m4/
+libtool
diff --git a/Makefile.am b/Makefile.am
index 12dcb19..7c18227 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -92,6 +92,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
#
@@ -113,6 +121,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 d7a7451..6b46349 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])
@@ -47,6 +49,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