From 175d4985203b8f5933c019e19c655bfb37cf5548 Mon Sep 17 00:00:00 2001 From: Reagan Bohan Date: Fri, 29 Apr 2022 14:24:28 +1200 Subject: [PATCH] Initial support for meson build system Signed-off-by: Reagan Bohan --- Makefile | 86 ----------- docs/Makefile | 58 -------- docs/meson.build | 29 ++++ meson.build | 7 + meson_options.txt | 1 + src/Makefile | 166 --------------------- src/compiler.h | 9 -- src/include/coverity.mk | 43 ------ src/include/defaults.mk | 126 ---------------- src/include/deprecated.mk | 52 ------- src/include/deps.mk | 21 --- src/include/gcc.specs | 8 -- src/include/rules.mk | 101 ------------- src/include/scan-build.mk | 21 --- src/include/version.mk | 1 - src/include/workarounds.mk | 24 ---- src/lib.c | 3 - src/makeguids.c | 56 +++----- src/meson.build | 30 ++++ src/test/Makefile | 24 ---- tests/Makefile | 287 ------------------------------------- todo | 3 + 22 files changed, 92 insertions(+), 1064 deletions(-) delete mode 100644 Makefile delete mode 100644 docs/Makefile create mode 100644 docs/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt delete mode 100644 src/Makefile delete mode 100644 src/include/coverity.mk delete mode 100644 src/include/defaults.mk delete mode 100644 src/include/deprecated.mk delete mode 100644 src/include/deps.mk delete mode 100644 src/include/gcc.specs delete mode 100644 src/include/rules.mk delete mode 100644 src/include/scan-build.mk delete mode 100644 src/include/version.mk delete mode 100644 src/include/workarounds.mk create mode 100644 src/meson.build delete mode 100644 src/test/Makefile delete mode 100644 tests/Makefile create mode 100644 todo diff --git a/Makefile b/Makefile deleted file mode 100644 index c896fc38..00000000 --- a/Makefile +++ /dev/null @@ -1,86 +0,0 @@ -export TOPDIR = $(realpath $(dir $(firstword $(MAKEFILE_LIST)))) - -include $(TOPDIR)/src/include/deprecated.mk -include $(TOPDIR)/src/include/version.mk -include $(TOPDIR)/src/include/rules.mk -include $(TOPDIR)/src/include/defaults.mk -include $(TOPDIR)/src/include/coverity.mk -include $(TOPDIR)/src/include/scan-build.mk - -SUBDIRS := src docs - -all : | efivar.spec src/include/version.mk prep -all clean install prep : - @set -e ; for x in $(SUBDIRS) ; do \ - $(MAKE) -C $$x $@ ; \ - done - -abicheck abidw efisecdb efisecdb-static efivar efivar-static static : | all - $(MAKE) -C src $@ - -abiupdate : - $(MAKE) clean all - $(MAKE) -C src abiclean abixml - -$(SUBDIRS) : - $(MAKE) -C $@ all - -brick : all - @echo -n $(info this is the rule for brick PWD:$(PWD) MAKECMDGOALS:$(MAKECMDGOALS)) - @set -e ; for x in $(SUBDIRS) ; do \ - $(MAKE) -C $${x} test ; \ - done - -a : - @if [ $${EUID} != 0 ]; then \ - echo no 1>&2 ; \ - exit 1 ; \ - fi - -GITTAG = $(shell bash -c "echo $$(($(VERSION) + 1))") - -efivar.spec : | Makefile src/include/version.mk - -clean : clean-toplevel -clean-toplevel: - @rm -vf efivar.spec vgcore.* core.* - @$(MAKE) -C tests clean - -test : all - @$(MAKE) -C tests - -test-archive: abicheck efivar.spec - @rm -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp - @mkdir -p /tmp/efivar-$(GITTAG)-tmp - @git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; tar x ) - @git diff | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; patch -s -p1 -b -z .gitdiff ) - @mv /tmp/efivar-$(GITTAG)-tmp/ /tmp/efivar-$(GITTAG)/ - @cp efivar.spec /tmp/efivar-$(GITTAG)/ - @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efivar-$(GITTAG).tar.bz2 efivar-$(GITTAG) - @rm -rf /tmp/efivar-$(GITTAG) - @echo "The archive is in efivar-$(GITTAG).tar.bz2" - -bumpver : - @echo VERSION=$(GITTAG) > src/include/version.mk - @git add src/include/version.mk - git commit -m "Bump version to $(GITTAG)" -s - -tag: - git tag -s $(GITTAG) refs/heads/master - -archive: abicheck bumpver abidw tag efivar.spec - @rm -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp - @mkdir -p /tmp/efivar-$(GITTAG)-tmp - @git archive --format=tar $(GITTAG) | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; tar x ) - @mv /tmp/efivar-$(GITTAG)-tmp/ /tmp/efivar-$(GITTAG)/ - @cp efivar.spec /tmp/efivar-$(GITTAG)/ - @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efivar-$(GITTAG).tar.bz2 efivar-$(GITTAG) - @rm -rf /tmp/efivar-$(GITTAG) - @echo "The archive is in efivar-$(GITTAG).tar.bz2" - -.PHONY: $(SUBDIRS) -.PHONY: a abiclean abicheck abidw abiupdate all archive -.PHONY: brick bumpver clean clean-toplevel -.PHONY: efivar efivar-static -.PHONY: install prep tag test test-archive -.NOTPARALLEL: diff --git a/docs/Makefile b/docs/Makefile deleted file mode 100644 index c9bf585f..00000000 --- a/docs/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -SRCDIR = $(realpath .) - -include $(TOPDIR)/src/include/deprecated.mk -include $(TOPDIR)/src/include/version.mk -include $(TOPDIR)/src/include/rules.mk -include $(TOPDIR)/src/include/defaults.mk - -MAN1TARGETS = efisecdb.1 \ - efivar.1 - -MAN3TARGETS = efi_append_variable.3 \ - efi_del_variable.3 \ - efi_get_next_variable_name.3 \ - efi_get_variable.3 \ - efi_get_variable_attributes.3 \ - efi_get_variable_size.3 \ - efi_guid_to_id_guid.3 \ - efi_guid_to_name.3 \ - efi_guid_to_str.3 \ - efi_guid_to_symbol.3 \ - efi_name_to_guid.3 \ - efi_set_variable.3 \ - efi_str_to_guid.3 \ - efi_symbol_to_guid.3 \ - efi_variables_supported.3 \ - efi_variable_t.3 \ - efi_variable_import.3 \ - efi_variable_export.3 \ - efi_variable_alloc.3 \ - efi_variable_free.3 \ - efi_variable_set_name.3 \ - efi_variable_get_name.3 \ - efi_variable_set_guid.3 \ - efi_variable_get_guid.3 \ - efi_variable_set_data.3 \ - efi_variable_get_data.3 \ - efi_variable_get_attributes.3 \ - efi_variable_set_attributes.3 \ - efi_variable_realize.3 - -all : $(MAN1TARGETS) $(MAN3TARGETS) - -clean : - @rm -f efisecdb.1 - -prep : - -test : - -install : $(MAN1TARGETS) $(MAN3TARGETS) - $(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man1 - $(foreach x, $(MAN1TARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)/$(MANDIR)/man1/;) - $(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man3 - $(foreach x, $(MAN3TARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)/$(MANDIR)/man3/;) - -.PHONY: all clean install - -include $(TOPDIR)/src/include/rules.mk diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 00000000..4c623c7c --- /dev/null +++ b/docs/meson.build @@ -0,0 +1,29 @@ +mans = ['efi_append_variable.3', 'efi_del_variable.3', 'efidp_make_generic.3', 'efi_get_next_variable_name.3', 'efi_get_variable.3', 'efi_get_variable_attributes.3', 'efi_get_variable_size.3', 'efi_guid_to_id_guid.3', 'efi_guid_to_name.3', 'efi_guid_to_str.3', 'efi_guid_to_symbol.3', 'efi_id_guid_to_guid.3', 'efi_name_to_guid.3', 'efi_set_variable.3', 'efi_str_to_guid.3', 'efi_symbol_to_guid.3', 'efivar.1', 'efi_variable_alloc.3', 'efi_variable_export.3', 'efi_variable_free.3', 'efi_variable_get_attributes.3', 'efi_variable_get_data.3', 'efi_variable_get_guid.3', 'efi_variable_get_name.3', 'efi_variable_import.3', 'efi_variable_realize.3', 'efi_variable_set_attributes.3', 'efi_variable_set_data.3', 'efi_variable_set_guid.3', 'efi_variable_set_name.3', 'efi_variables_supported.3', 'efi_variable_t.3'] + +mdocs = ['efisecdb.1.mdoc'] + +foreach man : mans + install_man(man) +endforeach + +mandoc = find_program('mandoc', required : get_option('convert_mandocs')) + +foreach mdoc : mdocs + if mandoc.found() + # Unfortunately install_man won't take target or generator output: meson bug #1550 + man = custom_target(mdoc.substring(0, -5), + input : mdoc, + output : mdoc.substring(0, -5), + command : [mandoc, '-mdoc', '-Tman', + '-Ios=Linux', '@INPUT@'], + capture : true, + install : true, + install_dir : join_paths(get_option('mandir'), 'man' + mdoc[-6])) + else + # configure_file is used to remove .mdoc extension + man = configure_file(input : mdoc, + output : mdoc.substring(0, -5), + copy : true) + install_man(man) + endif +endforeach diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..ded6e714 --- /dev/null +++ b/meson.build @@ -0,0 +1,7 @@ +project('efivar', 'c', license: 'LGPL-2.1-only', version: '38') + +so_ver = '1.@0@'.format(meson.project_version()) +add_project_arguments('-DLIBEFIVAR_VERSION=@0@'.format(meson.project_version()), language : 'c') + +subdir('src') +subdir('docs') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..7e018c94 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('convert_mandocs', type : 'feature', value : 'auto', description : 'Convert man pages in mdoc format to man format.') diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 0e423c44..00000000 --- a/src/Makefile +++ /dev/null @@ -1,166 +0,0 @@ -SRCDIR = $(realpath .) - -include $(TOPDIR)/src/include/deprecated.mk -include $(TOPDIR)/src/include/version.mk -include $(TOPDIR)/src/include/rules.mk -include $(TOPDIR)/src/include/defaults.mk -include $(TOPDIR)/src/include/workarounds.mk - -LIBTARGETS=libefivar.so libefiboot.so libefisec.so -STATICLIBTARGETS=libefivar.a libefiboot.a libefisec.a -BINTARGETS=efivar efisecdb thread-test -STATICBINTARGETS=efivar-static efisecdb-static -PCTARGETS=efivar.pc efiboot.pc efisec.pc -TARGETS=$(LIBTARGETS) $(BINTARGETS) $(PCTARGETS) -STATICTARGETS=$(STATICLIBTARGETS) $(STATICBINTARGETS) - -LIBEFISEC_SOURCES = sec.c secdb.c esl-iter.c util.c -LIBEFISEC_OBJECTS = $(patsubst %.c,%.o,$(LIBEFISEC_SOURCES)) -LIBEFIBOOT_SOURCES = crc32.c creator.c disk.c gpt.c loadopt.c path-helpers.c \ - linux.c $(sort $(wildcard linux-*.c)) -LIBEFIBOOT_OBJECTS = $(patsubst %.c,%.o,$(LIBEFIBOOT_SOURCES)) -LIBEFIVAR_SOURCES = crc32.c dp.c dp-acpi.c dp-hw.c dp-media.c dp-message.c \ - efivarfs.c error.c export.c guid.c guid-symbols.c \ - lib.c vars.c time.c -LIBEFIVAR_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(LIBEFIVAR_SOURCES))) -EFIVAR_SOURCES = efivar.c guid.c util.c -EFIVAR_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(EFIVAR_SOURCES))) -EFISECDB_SOURCES = efisecdb.c guid-symbols.c secdb-dump.c util.c -EFISECDB_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(EFISECDB_SOURCES))) -GENERATED_SOURCES = include/efivar/efivar-guids.h guid-symbols.c -MAKEGUIDS_SOURCES = makeguids.c util.c -MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES))) -MAKEGUIDS_OUTPUT = $(GENERATED_SOURCES) guids.lds - -ALL_SOURCES=$(LIBEFISEC_SOURCES) $(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) \ - $(MAKEGUIDS_SOURCES) $(GENERATED_SOURCES) $(EFIVAR_SOURCES) \ - $(sort $(wildcard include/efivar/*.h)) - -ifneq ($(MAKECMDGOALS),clean) -$(call deps-of,$(ALL_SOURCES)) : | deps --include $(call deps-of,$(ALL_SOURCES)) -endif - -all : $(TARGETS) - -static : $(STATICTARGETS) - -$(BINTARGETS) : | $(LIBTARGETS) $(PCTARGETS) -$(STATICTARGETS) : | $(STATICLIBTARGETS) $(PCTARGETS) - -abiclean : - @rm -vf $(patsubst %.so,%.abixml,$@) - -abixml : | $(LIBTARGETS) -abixml : $(patsubst %.so,%.abixml,$(LIBTARGETS)) - -abidw : $(patsubst %.so,%.abixml,$(LIBTARGETS)) - git commit -s --amend $^ - -abicheck : $(patsubst %.so,%.abicheck,$(LIBTARGETS)) - -makeguids : CPPFLAGS=$(HOST_CPPFLAGS) -makeguids : LIBS=dl -makeguids : CC=$(HOSTCC) -makeguids : CCLD=$(HOSTCCLD) -makeguids : CFLAGS=$(HOST_CFLAGS) -makeguids : LDFLAGS=$(HOST_LDFLAGS) -makeguids : CCLDFLAGS=$(HOST_CCLDFLAGS) -makeguids : $(MAKEGUIDS_OBJECTS) - -$(MAKEGUIDS_OUTPUT) : makeguids -$(MAKEGUIDS_OUTPUT) : guids.txt - @set -e ; \ - missing=no ; \ - for x in $$(cat guids.txt | awk '{ print $$2 }' | grep -v ^zz) ; do \ - if ! grep -q "efi_guid_$${x}" libefivar.map.in ; then \ - echo missing symbol "efi_guid_$${x}" ; \ - missing=yes ; \ - fi ; \ - done ; \ - if [ "$${missing}" != "no" ]; then \ - exit 1 ; \ - fi - ./makeguids $(LD_DASH_T) guids.txt guid-symbols.c include/efivar/efivar-guids.h guids.lds - -prep : makeguids $(GENERATED_SOURCES) - -$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : prep - -libefivar.a : | $(GENERATED_SOURCES) -libefivar.a : $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS)) - -libefivar.so : $(LIBEFIVAR_OBJECTS) -libefivar.so : | $(GENERATED_SOURCES) libefivar.map -libefivar.so : LIBS=dl -libefivar.so : LDSCRIPTS=guids.lds -libefivar.so : MAP=libefivar.map - -efivar : $(EFIVAR_OBJECTS) | libefivar.so -efivar : LIBS=efivar dl - -efivar-static : $(EFIVAR_OBJECTS) $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS)) -efivar-static : | $(GENERATED_SOURCES) -efivar-static : LIBS=dl - -libefiboot.a : $(patsubst %.o,%.static.o,$(LIBEFIBOOT_OBJECTS)) - -libefiboot.so : $(LIBEFIBOOT_OBJECTS) -libefiboot.so : | libefiboot.map libefivar.so -libefiboot.so : LIBS=efivar -libefiboot.so : MAP=libefiboot.map - -libefisec.a : $(patsubst %.o,%.static.o,$(LIBEFISEC_OBJECTS)) - -libefisec.so : $(LIBEFISEC_OBJECTS) -libefisec.so : | libefisec.map -libefisec.so : MAP=libefisec.map - -efisecdb : $(EFISECDB_OBJECTS) | libefisec.so -efisecdb : LIBS=efivar efisec dl - -efisecdb-static : $(EFISECDB_OBJECTS) -efisecdb-static : $(patsubst %.o,%.static.o,$(LIBEFISEC_OBJECTS) $(LIBEFIVAR_OBJECTS)) -efisecdb-static : | $(GENERATED_SOURCES) -efisecdb-static : LIBS=dl - -thread-test : libefivar.so -thread-test : CFLAGS=$(HOST_CFLAGS) -I$(TOPDIR)/src/include/efivar -thread-test : LIBS=pthread efivar - -deps : $(ALL_SOURCES) - @$(MAKE) -f $(SRCDIR)/include/deps.mk deps SOURCES="$(ALL_SOURCES)" - -clean : - @rm -rfv *~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \ - makeguids guid-symbols.c include/efivar/efivar-guids.h \ - guids.lds \ - $(TARGETS) $(STATICTARGETS) - @# remove the deps files we used to create, as well. - @rm -rfv .*.P .*.h.P *.S.P include/efivar/.*.h.P - -install : all - $(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR) - $(foreach x,$(LIBTARGETS), \ - $(INSTALL) -m 755 $(x) $(DESTDIR)$(LIBDIR)/$(x).1.$(VERSION) ;\ - ln -fs $(x).1.$(VERSION) $(DESTDIR)$(LIBDIR)/$(x).1 ;\ - ln -fs $(x).1.$(VERSION) $(DESTDIR)$(LIBDIR)/$(x) ;\ - ) - $(INSTALL) -d -m 755 $(DESTDIR)$(PCDIR) - $(foreach x, $(PCTARGETS), $(INSTALL) -m 644 $(x) $(DESTDIR)$(PCDIR) ;) - $(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/efivar - $(foreach x, $(sort $(wildcard $(TOPDIR)/src/include/efivar/*.h)), $(INSTALL) -m 644 $(x) $(DESTDIR)$(INCLUDEDIR)/efivar/$(notdir $(x));) - $(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) - $(foreach x, $(filter-out %-test,$(BINTARGETS)), $(INSTALL) -m 755 $(x) $(DESTDIR)$(BINDIR);) - -test : all - $(MAKE) -C test $@ - -.PHONY: abiclean abicheck abidw abixml all -.PHONY: clean deps install test -.SECONDARY : libefivar.so.1.$(VERSION) libefivar.so.1 -.SECONDARY : libefiboot.so.1.$(VERSION) libefiboot.so.1 -.SECONDARY : libefisec.so.1.$(VERSION) libefisec.so.1 -.SECONDARY : $(GENERATED_SOURCES) -.INTERMEDIATE : guids.bin names.bin -.PRECIOUS : makeguids diff --git a/src/compiler.h b/src/compiler.h index d95fb014..f00e514b 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -53,15 +53,6 @@ #define PRINTF(...) __attribute__((__format__(printf, __VA_ARGS__))) #define FLATTEN __attribute__((__flatten__)) #define PACKED __attribute__((__packed__)) -#if defined(__clang__) -# define VERSION(sym, ver) -#else -# if GNUC_PREREQ(10,0) -# define VERSION(sym, ver) __attribute__ ((symver (# ver))) -# else -# define VERSION(sym, ver) __asm__(".symver " # sym "," # ver); -# endif -#endif #define NORETURN __attribute__((__noreturn__)) #define ALIGNED(n) __attribute__((__aligned__(n))) #define CLEANUP_FUNC(x) __attribute__((__cleanup__(x))) diff --git a/src/include/coverity.mk b/src/include/coverity.mk deleted file mode 100644 index 2e7024b9..00000000 --- a/src/include/coverity.mk +++ /dev/null @@ -1,43 +0,0 @@ -COV_EMAIL=$(call get-config,coverity.email) -COV_TOKEN=$(call get-config,coverity.token) -COV_URL=$(call get-config,coverity.url) -COV_FILE=$(NAME)-coverity-$(VERSION)-$(COMMIT_ID).tar.bz2 - -cov-int : clean - cov-build --dir cov-int make all - -cov-clean : - @rm -vf $(NAME)-coverity-*.tar.* - @if [[ -d cov-int ]]; then rm -rf cov-int && echo "removed 'cov-int'"; fi - -cov-file : | $(COV_FILE) - -$(COV_FILE) : cov-int - tar caf $@ cov-int - -cov-upload : - @if [[ -n "$(COV_URL)" ]] && \ - [[ -n "$(COV_TOKEN)" ]] && \ - [[ -n "$(COV_EMAIL)" ]] ; \ - then \ - echo curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \ - curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \ - else \ - echo Coverity output is in $(COV_FILE) ; \ - fi - -coverity : | cov-test -coverity : cov-file cov-upload - -clean : | cov-clean - -COV_BUILD ?= $(shell x=$$(which --skip-alias --skip-functions cov-build 2>/dev/null) ; [ -n "$$x" ] && echo 1) -ifeq ($(COV_BUILD),) - COV_BUILD_ERROR = $(error cov-build not found) -endif - -cov-test : ; $(COV_BUILD_ERROR) - -.PHONY : coverity cov-upload cov-clean cov-file cov-test - -# vim:ft=make diff --git a/src/include/defaults.mk b/src/include/defaults.mk deleted file mode 100644 index b8cc590c..00000000 --- a/src/include/defaults.mk +++ /dev/null @@ -1,126 +0,0 @@ -PREFIX ?= /usr -EXEC_PREFIX ?= $(PREFIX) -LIBDIR ?= $(PREFIX)/lib64 -DATADIR ?= $(PREFIX)/share -MANDIR ?= $(DATADIR)/man -INCLUDEDIR ?= $(PREFIX)/include -BINDIR ?= $(EXEC_PREFIX)/bin -PCDIR ?= $(LIBDIR)/pkgconfig -DESTDIR ?= -PKGS ?= - -CROSS_COMPILE ?= -COMPILER ?= gcc -ifeq ($(origin CC),command line) -override COMPILER := $(CC) -override CC := $(CROSS_COMPILE)$(COMPILER) -endif -$(call set-if-undefined,CC,$(CROSS_COMPILE)$(COMPILER)) -$(call set-if-undefined,CCLD,$(CC)) -$(call set-if-undefined,HOSTCC,$(COMPILER)) -$(call set-if-undefined,HOSTCCLD,$(HOSTCC)) - -# temporary, see https://sourceware.org/bugzilla/show_bug.cgi?id=28264 -#OPTIMIZE_GCC = -flto -OPTIMIZE_GCC = -OPTIMIZE ?= -Og $(call family,OPTIMIZE) -DEBUGINFO ?= -g3 -WARNINGS_GCC ?= -WARNINGS_CCC_ANALYZER ?= $(WARNINGS_GCC) -WARNINGS ?= -Wall -Wextra $(call family,WARNINGS) -ERRORS_GCC ?= -ERRORS ?= -Werror $(call family,ERRORS) -CPPFLAGS ?= -override _CPPFLAGS := $(CPPFLAGS) -override CPPFLAGS = $(_CPPFLAGS) -DLIBEFIVAR_VERSION=$(VERSION) \ - -D_GNU_SOURCE \ - -I$(TOPDIR)/src/include/ -CFLAGS ?= $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS) -CFLAGS_GCC ?= -specs=$(TOPDIR)/src/include/gcc.specs \ - -fno-merge-constants -override _CFLAGS := $(CFLAGS) -override CFLAGS = $(_CFLAGS) \ - -std=gnu11 \ - -funsigned-char \ - -fvisibility=hidden \ - $(call family,CFLAGS) \ - $(call pkg-config-cflags) -LDFLAGS_CLANG ?= -rtlib=compiler-rt -CCLDFLAGS ?= -LDFLAGS ?= -override _CCLDFLAGS := $(CCLDFLAGS) -override _LDFLAGS := $(LDFLAGS) -override LDFLAGS = $(CFLAGS) -L. $(_LDFLAGS) $(_CCLDFLAGS) \ - -Wl,--add-needed \ - -Wl,--build-id \ - -Wl,--no-allow-shlib-undefined \ - -Wl,--no-undefined-version \ - -Wl,-z,now \ - -Wl,-z,muldefs \ - -Wl,-z,relro \ - -Wl,--fatal-warnings \ - $(call family,LDFLAGS) $(call family,CCLDFLAGS) \ - $(call pkg-config-ccldflags) -override CCLDFLAGS = $(LDFLAGS) -SOFLAGS_GCC = -SOFLAGS_CLANG = -SOFLAGS ?= -override _SOFLAGS := $(SOFLAGS) -override SOFLAGS = $(_SOFLAGS) \ - -shared -Wl,-soname,$@.1 \ - -Wl,--version-script=$(MAP) \ - $(call family,SOFLAGS) - -HOST_ARCH=$(shell uname -m) -ifneq ($(HOST_ARCH),ia64) -ifneq ($(HOST_ARCH),riscv64) - HOST_MARCH=-march=native -else - HOST_MARCH= -endif -else - HOST_MARCH= -endif -HOST_CPPFLAGS ?= $(CPPFLAGS) -override _HOST_CPPFLAGS := $(HOST_CPPFLAGS) -override HOST_CPPFLAGS = $(_HOST_CPPFLAGS) \ - -DEFIVAR_BUILD_ENVIRONMENT $(HOST_MARCH) -HOST_CFLAGS_GCC ?= -HOST_CFLAGS_CLANG ?= -HOST_CFLAGS ?= $(CFLAGS) $(call family,HOST_CFLAGS) -override _HOST_CFLAGS := $(HOST_CFLAGS) -override HOST_CFLAGS = $(_HOST_CFLAGS) -HOST_LDFLAGS_CLANG ?= -Wl,--fatal-warnings,-z,relro -rtlib=compiler-rt -HOST_LDFLAGS_GCC ?= -Wl,--no-undefined-version -HOST_LDFLAGS ?= -HOST_CCLDFLAGS ?= -override _HOST_LDFLAGS := $(HOST_LDFLAGS) -override _HOST_CCLDFLAGS := $(HOST_CCLDFLAGS) -override HOST_LDFLAGS = $(HOST_CFLAGS) -L. \ - $(_HOST_LDFLAGS) $(_HOST_CCLDFLAGS) \ - -Wl,--add-needed \ - -Wl,--build-id \ - -Wl,--no-allow-shlib-undefined \ - -Wl,-z,now \ - -Wl,-z,muldefs \ - $(call family,HOST_LDFLAGS) \ - $(call family,HOST_CCLDFLAGS) \ - $(call pkg-config-ccldflags) -override HOST_CCLDFLAGS = $(HOST_LDFLAGS) - -PKG_CONFIG = $(shell if [ -e "$$(env $(CROSS_COMPILE)pkg-config 2>&1)" ]; then echo $(CROSS_COMPILE)pkg-config ; else echo pkg-config ; fi) -INSTALL ?= install -AR := $(CROSS_COMPILE)$(COMPILER)-ar -NM := $(CROSS_COMPILE)$(COMPILER)-nm -RANLIB := $(CROSS_COMPILE)$(COMPILER)-ranlib -ABIDW := abidw -ABIDIFF := abidiff -MANDOC := mandoc - -LDLIBS=$(foreach lib,$(LIBS),-l$(lib)) $(call pkg-config-ldlibs) - -COMMIT_ID=$(shell git log -1 --pretty=%H 2>/dev/null || echo master) - -NAME=efivar - -# vim:ft=make diff --git a/src/include/deprecated.mk b/src/include/deprecated.mk deleted file mode 100644 index 00abc8c8..00000000 --- a/src/include/deprecated.mk +++ /dev/null @@ -1,52 +0,0 @@ -# -# This is all stuff pjones should not have done the way he did initially, and -# it's deprecated and will eventually go away. -# - -ifneq ($(origin prefix),undefined) - ifeq ($(origin PREFIX),undefined) - override PREFIX = $(prefix) - endif -endif -ifneq ($(origin exec_prefix),undefined) - ifeq ($(origin EXEC_PREFIX),undefined) - override EXEC_PREFIX = $(exec_prefix) - endif -endif -ifneq ($(origin libdir),undefined) - ifeq ($(origin LIBDIR),undefined) - override LIBDIR = $(libdir) - endif -endif -ifneq ($(origin datadir),undefined) - ifeq ($(origin DATADIR),undefined) - override DATADIR = $(datadir) - endif -endif -ifneq ($(origin mandir),undefined) - ifeq ($(origin MANDIR),undefined) - override MANDIR = $(mandir) - endif -endif -ifneq ($(origin includedir),undefined) - ifeq ($(origin INCLUDEDIR),undefined) - override INCLUDEDIR = $(includedir) - endif -endif -ifneq ($(origin bindir),undefined) - ifeq ($(origin BINDIR),undefined) - override BINDIR = $(bindir) - endif -endif -ifneq ($(origin CC_FOR_BUILD),undefined) - ifeq ($(origin HOSTCC),file) - override HOSTCC = $(CC_FOR_BUILD) - endif -endif -ifneq ($(origin CCLD_FOR_BUILD),undefined) - ifeq ($(origin HOSTCCLD),file) - override HOSTCCLD = $(CCLD_FOR_BUILD) - endif -endif - -# vim:ft=make diff --git a/src/include/deps.mk b/src/include/deps.mk deleted file mode 100644 index b33a926f..00000000 --- a/src/include/deps.mk +++ /dev/null @@ -1,21 +0,0 @@ -SRCDIR = $(realpath .) - -all : deps - -include $(TOPDIR)/src/include/version.mk -include $(TOPDIR)/src/include/rules.mk -include $(TOPDIR)/src/include/defaults.mk - -.%.d : %.c - @$(CC) $(CFLAGS) $(CPPFLAGS) -MM -MG -MF $@ $^ - @sed -i 's/:/: |/g' $@ - -.%.d : %.S - @$(CC) $(CFLAGS) $(CPPFLAGS) -MM -MG -MF $@ $^ - @sed -i 's/:/: |/g' $@ - -SOURCES ?= - -deps : $(call deps-of,$(filter-out %.h,$(SOURCES))) - -.PHONY: deps diff --git a/src/include/gcc.specs b/src/include/gcc.specs deleted file mode 100644 index ef28e2bb..00000000 --- a/src/include/gcc.specs +++ /dev/null @@ -1,8 +0,0 @@ -*cc1_options: -+ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}} -grecord-gcc-switches - -*self_spec: -+ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches - -*link: -+ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:% $@ - -%.3 : %.3.mdoc - $(MANDOC) -mdoc -Tman -Ios=Linux $^ > $@ - -% : %.c - -% : %.o - $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $(sort $^) $(LDLIBS) - -%-static : CCLDFLAGS+=-static -%-static : %.o - $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $(sort $^) $(LDLIBS) - -%.so : - $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) $(SOFLAGS) \ - $(foreach LDS,$(LDSCRIPTS),$(LD_DASH_T) $(LDS)) \ - -o $@ $^ $(LDLIBS) - ln -vfs $@ $@.1 - -%.abixml : %.so - $(ABIDW) --headers-dir $(TOPDIR)/src/include/efivar/ --out-file $@ $^ - @sed -i -s 's,$(TOPDIR)/,,g' $@ - -%.abicheck : %.so - $(ABIDIFF) \ - --suppr abignore \ - --headers-dir2 $(TOPDIR)/src/include/efivar/ \ - $(patsubst %.so,%.abixml,$<) \ - $< - -%.o : %.c - $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^) - -%.static.o : %.c - $(CC) $(CFLAGS) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^) - -%.o : %.S - $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^) - -%.static.o : %.S - $(CC) $(CFLAGS) -fPIE $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^) - -%.S: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) -S $< -o $@ - -%.E: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) -E $< -o $@ - -%.c : %.h - -define substitute-version - sed \ - -e "s,@@VERSION@@,$(VERSION),g" \ - -e "s,@@LIBDIR@@,$(LIBDIR),g" \ - -e "s,@@PREFIX@@,$(PREFIX),g" \ - -e "s,@@EXEC_PREFIX@@,$(EXEC_PREFIX),g" \ - -e "s,@@INCLUDEDIR@@,$(INCLUDEDIR),g" \ - $(1) > $(2) -endef - -%.pc : %.pc.in - @$(call substitute-version,$<,$@) -%.spec : %.spec.in - @$(call substitute-version,$<,$@) -%.map : %.map.in - @$(call substitute-version,$<,$@) - -pkg-config-cflags = $(if $(PKGS),$(shell $(PKG_CONFIG) --cflags $(PKGS))) -pkg-config-ccldflags = $(if $(PKGS),$(shell $(PKG_CONFIG) --libs-only-L --libs-only-other $(PKGS))) -pkg-config-ldlibs = $(if $(PKGS),$(shell $(PKG_CONFIG) --libs-only-l $(PKGS))) - -deps-of = $(foreach src,$(filter %.c,$(1)),$(patsubst %.c,.%.d,$(src))) \ - $(foreach src,$(filter %.S,$(1)),$(patsubst %.S,.%.d,$(src))) - -get-config = $(shell git config --local --get "efivar.$(1)") - -# vim:ft=make diff --git a/src/include/scan-build.mk b/src/include/scan-build.mk deleted file mode 100644 index 19da90cd..00000000 --- a/src/include/scan-build.mk +++ /dev/null @@ -1,21 +0,0 @@ -SCAN_BUILD ?= $(shell x=$$(which --skip-alias --skip-functions scan-build 2>/dev/null) ; [ -n "$$x" ] && echo 1) -ifeq ($(SCAN_BUILD),) - SCAN_BUILD_ERROR = $(error scan-build not found) -endif - -scan-test : ; $(SCAN_BUILD_ERROR) - -scan-clean : clean - @if [[ -d scan-results ]]; then rm -rf scan-results && echo "removed 'scan-results'"; fi - -scan-build : | scan-test -scan-build : clean - $(MAKE) -C src makeguids - scan-build -o scan-results make $(DASHJ) CC=clang all - -scan-build-all: | scan-build -scan : | scan-build - -.PHONY : scan-build scan-clean scan-build-all scan - -# vim:ft=make diff --git a/src/include/version.mk b/src/include/version.mk deleted file mode 100644 index eeaf6c59..00000000 --- a/src/include/version.mk +++ /dev/null @@ -1 +0,0 @@ -VERSION=38 diff --git a/src/include/workarounds.mk b/src/include/workarounds.mk deleted file mode 100644 index 143e7902..00000000 --- a/src/include/workarounds.mk +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-License-Identifier: SPDX-License-Identifier: LGPL-2.1-or-later -# -# workarounds.mk - workarounds for weird stuff behavior - -LD_FLAVOR := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g') -LD_VERSION := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //') -# 2.35 is definitely broken and 2.36 seems to work -LD_DASH_T := $(shell \ - if [ "x${LD_FLAVOR}" = xLLD ] ; then \ - echo '-T' ; \ - elif [ "x${LD_FLAVOR}" = xGNU ] ; then \ - if echo "${LD_VERSION}" | grep -q -E '^2\.3[6789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \ - echo '-T' ; \ - else \ - echo "" ; \ - fi ; \ - else \ - echo "Your linker is not supported" ; \ - exit 1 ; \ - fi) - -export LD_DASH_T - -# vim:ft=make diff --git a/src/lib.c b/src/lib.c index 1592cdf9..8f6dcb5d 100644 --- a/src/lib.c +++ b/src/lib.c @@ -28,7 +28,6 @@ struct efi_var_operations default_ops = { struct efi_var_operations *ops = NULL; -VERSION(_efi_set_variable, _efi_set_variable@libefivar.so.0) int NONNULL(2, 3) PUBLIC _efi_set_variable(efi_guid_t guid, const char *name, uint8_t *data, size_t data_size, uint32_t attributes) @@ -45,7 +44,6 @@ _efi_set_variable(efi_guid_t guid, const char *name, uint8_t *data, return rc; } -VERSION(_efi_set_variable_variadic, efi_set_variable@libefivar.so.0) int NONNULL(2, 3) PUBLIC _efi_set_variable_variadic(efi_guid_t guid, const char *name, uint8_t *data, size_t data_size, uint32_t attributes, ...) @@ -62,7 +60,6 @@ _efi_set_variable_variadic(efi_guid_t guid, const char *name, uint8_t *data, return rc; } -VERSION(_efi_set_variable_mode,efi_set_variable@@LIBEFIVAR_0.24) int NONNULL(2, 3) PUBLIC _efi_set_variable_mode(efi_guid_t guid, const char *name, uint8_t *data, size_t data_size, uint32_t attributes, mode_t mode) diff --git a/src/makeguids.c b/src/makeguids.c index 376bffba..9cea21bc 100644 --- a/src/makeguids.c +++ b/src/makeguids.c @@ -77,7 +77,7 @@ static void make_aliases(FILE *symout, FILE *header, static void write_guidnames(FILE *out, const char *listname, - struct efivar_guidname *guidnames, size_t n, const char *symver) + struct efivar_guidname *guidnames, size_t n) { size_t i; @@ -107,6 +107,12 @@ write_guidnames(FILE *out, const char *listname, gn->symbol, gn->name, gn->description); } fprintf(out, "};\n"); + fprintf(out, + "extern const struct efivar_guidname\n" + "\t%s[%zd]\n" + "\t__attribute__((__visibility__(\"default\")))\n" + "\t__attribute__((alias(\"%s_\")));\n\n", + listname, n, listname); } int @@ -114,15 +120,11 @@ main(int argc, char *argv[]) { int rc; int argstart = 0; - FILE *symout, *header, *ldsout; - int dash_t = 0; + FILE *symout, *header; - if (argc < 5) { + if (argc < 4) { errx(1, "Not enough arguments.\n"); - } else if (argc > 5 && !strcmp(argv[1],"-T")) { - argstart = 1; - dash_t = 1; - } else if (argc > 5) { + } else if (argc > 4) { errx(1, "Too many arguments.\n"); } @@ -140,13 +142,6 @@ main(int argc, char *argv[]) if (rc < 0) warn("chmod(%s, 0644)", argv[argstart + 3]); - ldsout = fopen(argv[argstart + 4], "w"); - if (ldsout == NULL) - err(1, "could not open \"%s\"", argv[argstart + 4]); - rc = chmod(argv[argstart + 4], 0644); - if (rc < 0) - warn("chmod(%s, 0644)", argv[argstart + 4]); - struct guidname_index *guidnames = NULL; rc = read_guids_at(AT_FDCWD, argv[argstart + 1], &guidnames); @@ -245,6 +240,11 @@ struct efivar_guidname {\n\ "\t__attribute__((__visibility__ (\"default\")))\n" "\tefi_well_known_guids[%d];\n", i); + fprintf(header, + "extern const struct efivar_guidname\n" + "\t__attribute__((__visibility__ (\"default\")))\n" + "\tefi_well_known_guids_[%d];\n", + i); fprintf(header, "extern const struct efivar_guidname\n" "\t__attribute__((__visibility__ (\"default\")))\n" @@ -258,6 +258,11 @@ struct efivar_guidname {\n\ "\t__attribute__((__visibility__ (\"default\")))\n" "\tefi_well_known_names[%d];\n", i); + fprintf(header, + "extern const struct efivar_guidname\n" + "\t__attribute__((__visibility__ (\"default\")))\n" + "\tefi_well_known_names_[%d];\n", + i); fprintf(header, "extern const struct efivar_guidname\n" "\t__attribute__((__visibility__ (\"default\")))\n" @@ -303,30 +308,13 @@ struct efivar_guidname {\n\ "} __attribute__((__aligned__(16)));\n\n"); qsort(outbuf, line, sizeof(struct efivar_guidname), cmpguidp); - write_guidnames(symout, "efi_well_known_guids", outbuf, line, "libefivar.so.0"); + write_guidnames(symout, "efi_well_known_guids", outbuf, line); qsort(outbuf, line, sizeof(struct efivar_guidname), cmpnamep); - write_guidnames(symout, "efi_well_known_names", outbuf, line, "LIBEFIVAR_1.38"); + write_guidnames(symout, "efi_well_known_names", outbuf, line); fclose(symout); - fprintf(ldsout, - "SECTIONS\n" - "{\n" - " .data :\n" - " {\n" - " efi_well_known_guids = efi_well_known_guids_;\n" - " efi_well_known_guids_end = efi_well_known_guids_ + %zd;\n" - " efi_well_known_names = efi_well_known_names_;\n" - " efi_well_known_names_end = efi_well_known_names_ + %zd;\n" - " }\n" - "}%s;\n", - (line - 1) * sizeof(struct efivar_guidname), - (line - 1) * sizeof(struct efivar_guidname), - dash_t ? " INSERT AFTER .data" : ""); - - fclose(ldsout); - free(guidnames->strtab); free(guidnames); diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 00000000..51d4bd5e --- /dev/null +++ b/src/meson.build @@ -0,0 +1,30 @@ +makeguids_sources = ['makeguids.c', 'util.c'] +makeguids = executable('makeguids', makeguids_sources, c_args : ['-DEFIVAR_BUILD_ENVIRONMENT']) + +gen_guids = custom_target('gen-guids', + input : ['guids.txt'], + output : ['guid-symbols.c', 'efivar-guids.h'], + command : [makeguids, '@INPUT@', '@OUTPUT0@', '@OUTPUT1@']) + + +lib_efivar_sources = ['crc32.c', 'dp.c', 'dp-acpi.c', 'dp-hw.c', 'dp-media.c', 'dp-message.c', 'efivarfs.c', 'error.c', 'export.c', 'guid.c', 'lib.c', 'vars.c', 'time.c'] +lib_efivar = library('efivar', lib_efivar_sources, gen_guids, version : '1.@0@'.format(meson.project_version()), soversion : '1') + +lib_efiboot_sources = ['crc32.c', 'creator.c', 'disk.c', 'gpt.c', 'loadopt.c', 'path-helpers.c', 'linux.c', 'linux-acpi.c', 'linux-acpi-root.c', 'linux-ata.c', 'linux-emmc.c', 'linux-i2o.c', 'linux-md.c', 'linux-nvme.c', 'linux-pci.c', 'linux-pci-root.c', 'linux-pmem.c', 'linux-sas.c', 'linux-sata.c', 'linux-scsi.c', 'linux-soc-root.c', 'linux-virtblk.c', 'linux-virtual-root.c'] +lib_efiboot = library('efiboot', lib_efiboot_sources, version : so_ver, soversion : '1', link_with : [lib_efivar]) + +lib_efisec_sources = ['sec.c', 'secdb.c', 'esl-iter.c', 'util.c'] +lib_efisec = library('efisec', lib_efisec_sources, version : so_ver, soversion : '1', link_with : [lib_efivar]) + +efivar_sources = ['efivar.c', 'guid.c', 'util.c'] +efivar = executable('efivar', efivar_sources, install : true, link_with : [lib_efivar]) + +efisecdb_sources = ['efisecdb.c', 'secdb-dump.c', 'util.c'] +efisecdb = executable('efisecdb', efisecdb_sources, install : true, link_with : [lib_efivar, lib_efisec]) + + +pkg = import('pkgconfig') + +pkg.generate(lib_efivar, description : 'UEFI Variable Management', subdirs : ['efivar']) +pkg.generate(lib_efiboot, description : 'UEFI Boot variable support', subdirs : ['efivar']) +pkg.generate(lib_efisec, description : 'UEFI Security Features', subdirs : ['efivar']) diff --git a/src/test/Makefile b/src/test/Makefile deleted file mode 100644 index 7a2aa496..00000000 --- a/src/test/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -SRCDIR = $(realpath .) - -include $(TOPDIR)/src/include/defaults.mk -include $(TOPDIR)/src/include/version.mk - -CCLDFLAGS += -L$(TOPDIR)/src/ -Wl,-rpath=$(TOPDIR)/src/ -LIBS=efivar - -all : tester - -install : - -clean : - @rm -rfv tester *.o *.E *.S - -test : tester - ./tester - -tester :: tester.o - $(CC) $(cflags) $(LDFLAGS) -Wl,-rpath,$(TOPDIR)/src -L$(TOPDIR)/src -o $@ $^ -lefivar -ldl - -.PHONY: all clean install test - -include $(TOPDIR)/src/include/rules.mk diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 4b1e62a5..00000000 --- a/tests/Makefile +++ /dev/null @@ -1,287 +0,0 @@ -# -# Makefile -# Peter Jones, 2019-06-18 11:10 -# - -TESTS = test.dmpstore.export \ - test.efivar.export \ - test.grubenv.var \ - test.bootorder.var \ - test.conin.var \ - test.efivar.threading \ - test.parse.db \ - test.esl.annotation \ - test.esl.sha256.unsorted \ - test.esl.sha256.ascending \ - test.esl.sha256.removal.descending \ - test.esl.sha256.addition.unsorted \ - test.esl.cert.addition \ - test.esl.cert.removal - -all: clean $(TESTS) - -GRUB_PREFIX ?= grub2 -VALGRIND ?= - -V ?= 0 -ifeq ($(V),0) - quiet=@ - rmverbose= -else - quiet= - rmverbose=-v -endif -ifeq ($(V),2) - loud=-vvvv -else - loud= -endif - -EFIVAR ?= $(VALGRIND) $(TOPDIR)/src/efivar $(loud) -EFISECDB ?= $(VALGRIND) $(TOPDIR)/src/efisecdb $(loud) - -EFIVAR ?= $(VALGRIND) $(TOPDIR)/src/efivar $(loud) - -clean: - $(quiet)rm $(rmverbose) -f test.*.result* \ - test.esl.annotation.esl.result \ - test.esl.cert.addition.esl.goal.txt \ - test.esl.cert.removal.esl.goal.txt \ - test.esl.sha256.addition.unsorted.esl.goal.txt \ - test.esl.sha256.ascending.esl.goal.txt \ - test.esl.sha256.removal.descending.esl.goal.txt \ - test.esl.sha256.unsorted.esl.goal.txt - -test.dmpstore.export: - $(quiet)echo testing export to DMPSTORE format - $(quiet)$(GRUB_PREFIX)-editenv test.dmpstore.export.result.env create - $(quiet)$(GRUB_PREFIX)-editenv test.dmpstore.export.result.env set debug=all,-scripting,-lexer - $(quiet)truncate -s 512 test.dmpstore.export.result.env - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.dmpstore.export.result.env -D -e test.dmpstore.export.result.var - $(quiet)@if grep -q "Do not edit" test.dmpstore.export.result.env ; then \ - cmp test.dmpstore.export.result.var test.dmpstore.export.new.goal.var ; \ - else \ - cmp test.dmpstore.export.result.var test.dmpstore.export.old.goal.var ; \ - fi - $(quiet)rm -f test.dmpstore.export.result.* - $(quiet)echo passed - -test.efivar.export: - $(quiet)echo testing export to libefivar format - $(quiet)$(GRUB_PREFIX)-editenv test.efivar.export.result.env create - $(quiet)$(GRUB_PREFIX)-editenv test.efivar.export.result.env set debug=all,-scripting,-lexer - $(quiet)truncate -s 512 test.efivar.export.result.env - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.efivar.export.result.env -e test.efivar.export.result.var - $(quiet)if grep -q "Do not edit" test.efivar.export.result.env ; then \ - cmp test.efivar.export.result.var test.efivar.export.new.goal.var ; \ - else \ - cmp test.efivar.export.result.var test.efivar.export.old.goal.var ; \ - fi - $(quiet)rm -f test.efivar.export.result.* - $(quiet)echo passed - -test.grubenv.var: - $(quiet)$(GRUB_PREFIX)-editenv test.grubenv.var.result.env create - $(quiet)$(GRUB_PREFIX)-editenv test.grubenv.var.result.env set debug=all,-scripting,-lexer - $(quiet)truncate -s 512 test.grubenv.var.result.env - $(quiet)echo test importing from DMPSTORE and exporting to DMPSTORE and symbolic guid-name validation - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.grubenv.var.result.env -D -e test.grubenv.var.0.export.var - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.grubenv.var.0.export.var -e test.grubenv.var.0.result.var -D - $(quiet)if grep -q "Do not edit" test.grubenv.var.result.env ; then \ - cmp test.grubenv.var.0.result.var test.grubenv.var.0.new.goal.var ; \ - else \ - cmp test.grubenv.var.0.result.var test.grubenv.var.0.old.goal.var ; \ - fi - $(quiet)rm test.grubenv.var.0.result.* - $(quiet)echo passed - $(quiet)echo test importing from DMPSTORE and exporting to libefivar - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n {grub}-GRUB_ENV -f test.grubenv.var.result.env -D -e test.grubenv.var.1.export.var - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.grubenv.var.1.export.var -e test.grubenv.var.1.result.var - $(quiet)if grep -q "Do not edit" test.grubenv.var.result.env ; then \ - cmp test.grubenv.var.1.result.var test.grubenv.var.1.new.goal.var ; \ - else \ - cmp test.grubenv.var.1.result.var test.grubenv.var.1.old.goal.var ; \ - fi - $(quiet)rm test.grubenv.var.1.result.* - $(quiet)echo passed - $(quiet)echo test importing from libefivar and exporting to DMPSTORE and mixed-case guid-name validation - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n 91376aff-cBa6-42bE-949d-06fde81128e8-GRUB_ENV -f test.grubenv.var.result.env -e test.grubenv.var.2.export.var - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.grubenv.var.2.export.var -e test.grubenv.var.2.result.var -D - $(quiet)if grep -q "Do not edit" test.grubenv.var.result.env ; then \ - cmp test.grubenv.var.2.result.var test.grubenv.var.2.new.goal.var ; \ - else \ - cmp test.grubenv.var.2.result.var test.grubenv.var.2.old.goal.var ; \ - fi - $(quiet)rm test.grubenv.var.2.result.* - $(quiet)echo passed - $(quiet)echo test importing from libefivar and exporting to libefivar and guid-name validation - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -n 91376aff-cba6-42be-949d-06fde81128e8-GRUB_ENV -f test.grubenv.var.result.env -e test.grubenv.var.3.export.var - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.grubenv.var.3.export.var -e test.grubenv.var.3.result.var - $(quiet)if grep -q "Do not edit" test.grubenv.var.result.env ; then \ - cmp test.grubenv.var.3.result.var test.grubenv.var.3.new.goal.var ; \ - else \ - cmp test.grubenv.var.3.result.var test.grubenv.var.3.old.goal.var ; \ - fi - $(quiet)rm -f test.grubenv.var.3.result.* test.grubenv.var.result.env test.grubenv.var.3.goal.var - $(quiet)echo passed - $(quiet)echo testing efivar -L - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -L | \ - grep -q '^{91376aff-cba6-42be-949d-06fde81128e8} {grub} efi_guid_grub GRUB$$' - $(quiet)echo passed - -test.bootorder.var: - $(quiet)echo testing with BootOrder variable dmpstore generated - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.bootorder.var.goal.var -e test.bootorder.var.0.result.var - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.bootorder.var.0.result.var -e test.bootorder.var.1.result.var -D - $(quiet)cmp test.bootorder.var.goal.var test.bootorder.var.1.result.var - $(quiet)echo passed - -test.conin.var: - $(quiet)echo testing with ConIn variable dmpstore generated - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.conin.var.goal.var -e test.conin.var.0.result.var - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFIVAR) -i test.conin.var.0.result.var -e test.conin.var.1.result.var -D - $(quiet)cmp test.conin.var.goal.var test.conin.var.1.result.var - $(quiet)echo passed - -test.efivar.threading: - $(quiet)echo testing threading in libefivar - $(quiet)TOPDIR=$(TOPDIR) $(TOPDIR)/tests/test-threading - -test.esl.dump.x509.sha256: - $(quiet)echo testing ESL dumping with x509 + sha256 sums - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) \ - -i test.esl.sha256.addition.unsorted.esl.goal -A > test.esl.dump.x509.sha256.result.txt - $(quiet)cmp test.esl.dump.x509.sha256.goal.txt test.esl.sha256.addition.unsorted.result.txt - $(quiet)echo passed - -%.goal.txt : %.goal - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src ../src/efisecdb --dump --annotate \ - -s none -i $< > $@ - -%.result.txt : %.result - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src ../src/efisecdb --dump --annotate \ - -s none -i $< > $@ - -%.var.result.txt : %.var - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src ../src/efisecdb --dump --annotate \ - -s none -i $< > $@ - -test.parse.db: test.parse.db.var.result.txt - $(quiet)echo testing parsing db variable - $(quiet)if ! cmp test.parse.db.var.goal.txt test.parse.db.var.result.txt ; then \ - diff -U 200 test.parse.db.var.goal.txt test.parse.db.var.result.txt ; \ - exit 1 ; \ - fi - $(quiet)echo passed - -test.esl.annotation.esl.result : test.esl.annotation.esl - $(quiet)cp $(rmverbose) $< $@ - -test.esl.annotation: test.esl.annotation.esl.goal.txt -test.esl.annotation: test.esl.annotation.esl.result.txt - $(quiet)echo testing ESL annotation with x509 + sha256 sums - $(quiet)if ! cmp $@.esl.goal.txt $@.esl.result.txt ; then \ - diff -U 200 $@.esl.goal.txt $@.esl.result.txt ; \ - exit 1 ; \ - fi - $(quiet)echo passed - -test.esl.sha256.unsorted.esl.result: - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 -a \ - -h 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 \ - -h 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f \ - -h a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 \ - -h 8d74beec1be996322ad76813bafb92d40839895d6dd7ee808b17ca201eac98be \ - -s none -f -o $@ - -test.esl.sha256.unsorted: test.esl.sha256.unsorted.esl.result.txt test.esl.sha256.unsorted.esl.goal.txt - $(quiet)echo testing ESL creation with sha256 sums '(unsorted)' - $(quiet)if ! cmp $@.esl.goal $@.esl.result ; then \ - diff -U 200 $@.esl.goal.txt $@.esl.result.txt ; \ - exit 1 ; \ - fi - $(quiet)echo passed - -test.esl.sha256.ascending.esl.result: - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 -a \ - -h 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 \ - -h 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f \ - -h a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 \ - -h 8d74beec1be996322ad76813bafb92d40839895d6dd7ee808b17ca201eac98be \ - -s data -s ascending -f -o $@ - -test.esl.sha256.ascending: test.esl.sha256.ascending.esl.goal.txt test.esl.sha256.ascending.esl.result.txt - $(quiet)echo testing ESL creation with sha256 sums '(ascending)' - $(quiet)if ! cmp $@.esl.goal $@.esl.result ; then \ - diff -U 200 $@.esl.goal.txt $@.esl.result.txt ; \ - exit 1 ; \ - fi - $(quiet)echo passed - -test.esl.sha256.removal.descending.esl.result: - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 \ - -i test.esl.sha256.unsorted.esl.goal -r \ - -h a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 \ - -s data -s descending -f -o $@ - -test.esl.sha256.removal.descending: test.esl.sha256.removal.descending.esl.result.txt -test.esl.sha256.removal.descending: test.esl.sha256.removal.descending.esl.goal.txt - $(quiet)echo testing ESL entry removal with sha256 sums '(descending)' - $(quiet)if ! cmp $@.esl.goal $@.esl.result ; then \ - diff -U 200 $@.esl.goal.txt $@.esl.result.txt ; \ - exit 1 ; \ - fi - $(quiet)echo passed - -test.esl.sha256.addition.unsorted.esl.result: - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 \ - -i test.esl.sha256.addition.unsorted.esl.goal -a \ - -h a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 \ - -s none -f -o test.esl.sha256.addition.unsorted.esl.result - -test.esl.sha256.addition.unsorted: test.esl.sha256.addition.unsorted.esl.result.txt -test.esl.sha256.addition.unsorted: test.esl.sha256.addition.unsorted.esl.goal.txt - $(quiet)echo testing adding a sha256 sum to an existing ESL '(unsorted)' - $(quiet)if ! cmp $@.esl.goal $@.esl.result ; then \ - diff -U 200 $@.esl.goal.txt $@.esl.result.txt ; \ - exit 1 ; \ - fi - $(quiet)echo passed - -test.esl.cert.addition.esl.result: - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 \ - -i test.esl.sha256.unsorted.esl.goal -a -c test.esl.cert.addition.cert.cer \ - -f -o test.esl.cert.addition.esl.result - -test.esl.cert.addition: - $(quiet)echo testing ESL entry addition with x509 cert - $(quiet)$(MAKE) test.esl.cert.addition.esl.result.txt test.esl.cert.addition.esl.goal.txt - $(quiet)if ! cmp test.esl.cert.addition.esl.goal test.esl.cert.addition.esl.result ; then \ - diff -U 200 test.esl.cert.addition.esl.goal.txt test.esl.cert.addition.esl.result.txt ; \ - exit 1 ; \ - fi - $(quiet)rm -f test.esl.cert.addition.esl.result test.esl.cert.addition.*.esl.txt - $(quiet)echo passed - -test.esl.cert.removal.esl.goal.txt : test.esl.cert.removal.esl.goal - -test.esl.cert.removal.esl.result: - $(quiet)LD_LIBRARY_PATH=$(TOPDIR)/src $(EFISECDB) -g {redhat} -t sha256 \ - -i test.esl.cert.addition.cert.esl.goal -r -c test.esl.cert.addition.cert.cer \ - -f -o test.esl.cert.removal.esl.result - -test.esl.cert.removal: - $(quiet)echo testing ESL entry removal with x509 cert - $(quiet)$(MAKE) test.esl.cert.removal.esl.goal.txt test.esl.cert.removal.esl.result.txt - $(quiet)if ! cmp test.esl.cert.removal.esl.goal test.esl.cert.removal.esl.result ; then \ - diff -U 200 test.esl.cert.removal.esl.goal.txt test.esl.cert.removal.esl.result.txt ; \ - exit 1 ; \ - fi - $(quiet)cmp test.esl.cert.removal.esl.goal test.esl.cert.removal.esl.result - $(quiet)rm -f test.esl.cert.removal.esl.result - $(quiet)echo passed - -.PHONY: all clean $(TESTS) - -# vim:ft=make -# diff --git a/todo b/todo new file mode 100644 index 00000000..d7a13812 --- /dev/null +++ b/todo @@ -0,0 +1,3 @@ +.spec file +mandoc +tests nwe option a brick