From a00024e8d7fef1d214fb3603ec247a8370a22ca7 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 23 Sep 2020 13:23:28 -0700 Subject: [PATCH] Move libfsverity.h to its own directory libfsverity.h is the public API, but the other headers in common/ are private headers for fsverity-utils. Move libfsverity.h to its own directory to make this clear. This is also needed for Android's build system in order to restrict the exported headers to libfsverity.h. This doesn't affect users who are using 'make install', since 'make install' still installs libfsverity.h to the same place, and it doesn't install any private headers. Link: https://lore.kernel.org/r/20200923202328.16310-1-ebiggers@kernel.org Signed-off-by: Eric Biggers --- Makefile | 4 ++-- {common => include}/libfsverity.h | 0 lib/lib_private.h | 2 +- programs/utils.h | 2 +- scripts/do-release.sh | 2 +- scripts/run-sparse.sh | 2 +- scripts/run-tests.sh | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) rename {common => include}/libfsverity.h (100%) diff --git a/Makefile b/Makefile index ec23ed6..deffe8b 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ CFLAGS ?= -O2 -Wall -Wundef \ $(call cc-option,-Wunused-parameter) \ $(call cc-option,-Wvla) -override CPPFLAGS := -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) +override CPPFLAGS := -Iinclude -D_FILE_OFFSET_BITS=64 $(CPPFLAGS) ifneq ($(V),1) QUIET_CC = @echo ' CC ' $@; @@ -182,7 +182,7 @@ install:all install -m644 libfsverity.a $(DESTDIR)$(LIBDIR) install -m755 libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR) ln -sf libfsverity.so.$(SOVERSION) $(DESTDIR)$(LIBDIR)/libfsverity.so - install -m644 common/libfsverity.h $(DESTDIR)$(INCDIR) + install -m644 include/libfsverity.h $(DESTDIR)$(INCDIR) uninstall: rm -f $(DESTDIR)$(BINDIR)/fsverity diff --git a/common/libfsverity.h b/include/libfsverity.h similarity index 100% rename from common/libfsverity.h rename to include/libfsverity.h diff --git a/lib/lib_private.h b/lib/lib_private.h index 54f583e..ff00490 100644 --- a/lib/lib_private.h +++ b/lib/lib_private.h @@ -11,7 +11,7 @@ #ifndef LIB_LIB_PRIVATE_H #define LIB_LIB_PRIVATE_H -#include "../common/libfsverity.h" +#include "libfsverity.h" #include "../common/common_defs.h" #include "../common/fsverity_uapi.h" diff --git a/programs/utils.h b/programs/utils.h index cd5641c..6968708 100644 --- a/programs/utils.h +++ b/programs/utils.h @@ -11,7 +11,7 @@ #ifndef PROGRAMS_UTILS_H #define PROGRAMS_UTILS_H -#include "../common/libfsverity.h" +#include "libfsverity.h" #include "../common/common_defs.h" #include diff --git a/scripts/do-release.sh b/scripts/do-release.sh index 9662919..255fc53 100755 --- a/scripts/do-release.sh +++ b/scripts/do-release.sh @@ -27,7 +27,7 @@ major=$(echo "$VERS" | cut -d. -f1) minor=$(echo "$VERS" | cut -d. -f2) sed -E -i -e "/FSVERITY_UTILS_MAJOR_VERSION/s/[0-9]+/$major/" \ -e "/FSVERITY_UTILS_MINOR_VERSION/s/[0-9]+/$minor/" \ - common/libfsverity.h + include/libfsverity.h git commit -a --signoff --message="v$VERS" git tag --sign "v$VERS" --message="$PKG" diff --git a/scripts/run-sparse.sh b/scripts/run-sparse.sh index 5b6a0ba..30730b2 100755 --- a/scripts/run-sparse.sh +++ b/scripts/run-sparse.sh @@ -10,5 +10,5 @@ set -e -u -o pipefail find . -name '*.c' | while read -r file; do sparse "$file" -gcc-base-dir "$(gcc --print-file-name=)" \ - -D_FILE_OFFSET_BITS=64 -I. -Wbitwise + -Iinclude -D_FILE_OFFSET_BITS=64 -Wbitwise done diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh index 44df304..c061e34 100755 --- a/scripts/run-tests.sh +++ b/scripts/run-tests.sh @@ -71,7 +71,7 @@ int main() std::cout << libfsverity_get_digest_size(FS_VERITY_HASH_ALG_SHA256) << std::endl; } EOF -c++ -Wall -Werror "$TMPDIR/test.cc" -Icommon -L. -lfsverity -o "$TMPDIR/test" +c++ -Wall -Werror "$TMPDIR/test.cc" -Iinclude -L. -lfsverity -o "$TMPDIR/test" [ "$(LD_LIBRARY_PATH=. "$TMPDIR/test")" = "32" ] rm "${TMPDIR:?}"/*