diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3678c18..508b8e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ "container": "vathpela/efi-ci:f36-x64", "steps": [ { "uses": "actions/checkout@v2" }, - { "run": "EFIDIR=test make" }, + { "run": "meson build && ninja -C build" }, ], }, }, diff --git a/Make.coverity b/Make.coverity deleted file mode 100644 index ef172b8..0000000 --- a/Make.coverity +++ /dev/null @@ -1,41 +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 diff --git a/Make.defaults b/Make.defaults deleted file mode 100644 index c4c0592..0000000 --- a/Make.defaults +++ /dev/null @@ -1,64 +0,0 @@ -NAME = efibootmgr -prefix ?= /usr -libdir ?= $(prefix)/lib64 -datadir ?= $(prefix)/share -mandir ?= $(datadir)/man -includedir ?= $(prefix)/include -bindir ?= $(prefix)/bin -sbindir ?= $(prefix)/sbin -localedir ?= $(datadir)/locale/ -PCDIR ?= $(libdir)/pkgconfig -DESTDIR ?= -ifneq ($(origin EXTRALIBDIRS),undefined) -override EXTRALIBDIR := $(foreach dir,$(EXTRALIBDIRS),-L$(dir)) -endif -ifneq ($(origin EXTRAINCDIRS),undefined) -override EXTRAINCDIR := $(foreach dir,$(EXTRAINCDIRS),-I$(dir)) -endif - -EFIDIR ?= $(shell x=$$(which --skip-alias --skip-functions git 2>/dev/null) ; [ -n "$$x" ] && git config --get efibootmgr.efidir) -ifeq ($(EFIDIR),) - EFIDIR_ERROR = $(error EFIDIR or .gitconfig efibootmgr.efidir must be set to this distro's reserved EFI System Partition subdirectory name) -endif -EFI_LOADER := grub.efi - -INSTALL ?= install -CROSS_COMPILE ?= -PKG_CONFIG = $(CROSS_COMPILE)pkg-config -CC := $(if $(filter default,$(origin CC)),$(CROSS_COMPILE)gcc,$(CC)) -CCLD := $(if $(filter undefined,$(origin CCLD)),$(CC),$(CCLD)) -CFLAGS ?= -O2 -g -flto -AR := $(CROSS_COMPILE)gcc-ar -NM := $(CROSS_COMPILE)gcc-nm -RANLIB := $(CROSS_COMPILE)gcc-ranlib - -PKGS = - -SUBDIR_CFLAGS ?= -clang_cflags = -gcc_cflags = -cflags = $(EXTRALIBDIR) $(EXTRAINCDIR) $(CFLAGS) $(SUBDIR_CFLAGS) \ - -Werror -Wall -Wextra -Wsign-compare -Wstrict-aliasing \ - -std=gnu11 -fPIC \ - -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DLOCALEDIR=\"$(localedir)\" \ - -DEFIBOOTMGR_VERSION="\"$(VERSION)\"" \ - -DDEFAULT_LOADER=\"\\\\EFI\\\\$(EFIDIR)\\\\$(EFI_LOADER)\" \ - $(if $(findstring clang,$(CC)),$(clang_cflags),) \ - $(if $(findstring gcc,$(CC)),$(gcc_cflags),) \ - $(call pkg-config-cflags) -clang_ccldflags = -gcc_ccldflags = -fno-merge-constants \ - -Wl,--fatal-warnings,--no-allow-shlib-undefined \ - -Wl,-O2 -Wl,--no-undefined-version -ccldflags = $(cflags) $(CCLDFLAGS) $(LDFLAGS) \ - $(if $(findstring clang,$(CCLD)),$(clang_ccldflags),) \ - $(if $(findstring gcc,$(CCLD)),$(gcc_ccldflags),) \ - $(call pkg-config-ldflags) -CPPFLAGS?= -SOFLAGS=-shared -LDLIBS=$(foreach lib,$(LIBS),-l$(lib)) $(call pkg-config-ldlibs) - -.PHONY: check_efidir_error -check_efidir_error : ; $(EFIDIR_ERROR) $(info Building with EFIDIR as $(EFIDIR)) - -COMMIT_ID=$(shell git log -1 --pretty=%H 2>/dev/null || echo master) diff --git a/Make.deps b/Make.deps deleted file mode 100644 index 5a43fef..0000000 --- a/Make.deps +++ /dev/null @@ -1,15 +0,0 @@ -SRCDIR = $(realpath .) -TOPDIR = $(realpath ..) - -include $(TOPDIR)/Make.version -include $(TOPDIR)/Make.rules -include $(TOPDIR)/Make.defaults - -.%.d : %.c - $(CC) $(cflags) $(CPPFLAGS) -MM -MG -MF $@ $^ - -.%.d : %.S - $(CC) $(cflags) $(CPPFLAGS) -MM -MG -MF $@ $^ - -SOURCES ?= -deps : $(call deps-of,$(filter-out %.h,$(SOURCES))) diff --git a/Make.fanalyzer b/Make.fanalyzer deleted file mode 100644 index 87297d8..0000000 --- a/Make.fanalyzer +++ /dev/null @@ -1,9 +0,0 @@ -GCC_BINARY ?= $(shell x=$$(which --skip-alias --skip-functions gcc 2>/dev/null) ; [ -n "$$x" ] && echo "$$x") - -fanalyzer-test : ; $(if $(findstring /,$(GCC_BINARY)),,$(error gcc not found)) - -fanalyzer : | fanalyzer-test -fanalyzer : clean - $(MAKE) CC=gcc CCACHE_DISABLE=1 CFLAGS="-O2 -g -fanalyzer -Werror=analyzer-null-dereference" - -.PHONY : fanalyzer diff --git a/Make.rules b/Make.rules deleted file mode 100644 index 7b2f12f..0000000 --- a/Make.rules +++ /dev/null @@ -1,81 +0,0 @@ -default : all - -.PHONY: default all deps clean install - -include $(TOPDIR)/Make.version - -all : deps - -deps : - -clean : - -install : - -%.a : %.so - $(AR) -cvqs $@ $^ - -% : %.c - -% : | %.c - $(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS) - -%-static : %.c - $(CCLD) $(ccldflags) $(CPPFLAGS) -o $@ $^ $(LDLIBS) - -%.so : - $(CCLD) $(ccldflags) $(CPPFLAGS) $(SOFLAGS) \ - -Wl,-soname,$@.$(VERSION) \ - -o $@ $^ $(LDLIBS) - -%.o : %.c - $(CC) $(cflags) $(CPPFLAGS) -c -o $@ $(filter %.c %.o %.S,$^) - -%.S: %.c - $(CC) $(cflags) $(CPPFLAGS) -S $< -o $@ - -%.E: %.c - $(CC) $(cflags) $(CPPFLAGS) -E $< -o $@ - -%.c : %.h - -.%.d : - -define substitute-version = - sed \ - -e "s,@@VERSION@@,$(VERSION),g" \ - -e "s,@@LIBDIR@@,$(libdir),g" \ - -e "s,@@LIBEXECDIR@@,$(libexecdir),g" \ - -e "s,@@EFIDIR@@,$(EFIDIR),g" \ - -e "s,@@EFI_LOADER@@,$(EFI_LOADER),g" \ - -e 's,@@DEFAULT_LOADER@@,\\\\EFI\\\\$(EFIDIR)\\\\$(EFI_LOADER),g' \ - $(1) > $(2) -endef - -%.8 : %.8.in - @$(call substitute-version,$<,$@) - -%.pc : %.pc.in - @$(call substitute-version,$<,$@) - -%.spec : %.spec.in - @$(call substitute-version,$<,$@) - -pkg-config-cflags = \ - $(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --cflags $(PKGS); fi) -pkg-config-ldflags = \ - $(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --libs-only-L --libs-only-other $(PKGS) ; fi) -pkg-config-ldlibs = \ - $(shell if [ -n "$(PKGS)" ]; then $(PKG_CONFIG) --libs-only-l $(PKGS) ; fi) - -objects-of = \ - $(patsubst %.c,%.o,$(1)) - -define deps-of = - $(foreach src,$(filter %.c,$(1)),$(patsubst %.c,.%.d,$(src))) \ - $(foreach src,$(filter %.S,$(1)),$(patsubst %.S,.%.d,$(src))) -endef - -define get-config = -$(shell git config --local --get "efibootmgr.$(1)") -endef diff --git a/Make.scan-build b/Make.scan-build deleted file mode 100644 index b3e03ee..0000000 --- a/Make.scan-build +++ /dev/null @@ -1,20 +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 - scan-build -o scan-results make $(DASHJ) CC=clang all - -scan-build-all : | scan-test -scan-build-all : clean - scan-build -o scan-results make $(DASHJ) CC=clang all - -.PHONY : scan-build scan-clean - diff --git a/Make.version b/Make.version deleted file mode 100644 index 7905ca1..0000000 --- a/Make.version +++ /dev/null @@ -1 +0,0 @@ -VERSION=18 diff --git a/Makefile b/Makefile deleted file mode 100644 index a693a71..0000000 --- a/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -TOPDIR = $(shell echo $$PWD) - -include $(TOPDIR)/Make.version -include $(TOPDIR)/Make.rules -include $(TOPDIR)/Make.defaults -include $(TOPDIR)/Make.coverity -include $(TOPDIR)/Make.fanalyzer -include $(TOPDIR)/Make.scan-build - -SUBDIRS := src - -all install deps : | check_efidir_error Make.version - @set -e ; for x in $(SUBDIRS) ; do \ - $(MAKE) -C $$x $@ ; \ - done - -clean : | check_efidir_error Make.version - @set -e ; for x in $(SUBDIRS) ; do \ - $(MAKE) -C $$x $@ ; \ - done - -all : efibootmgr.spec - -efibootmgr efibootmgr-static : - $(MAKE) -C src $@ - -$(SUBDIRS) : - $(MAKE) -C $@ - -.PHONY: $(SUBDIRS) - -efibootmgr.spec : | Makefile Make.version - -distclean : - $(MAKE) clean - @rm -vf efibootmgr.spec - -GITTAG = $(shell bash -c "echo $$(($(VERSION) + 1))") - -test-archive: efibootmgr.spec - @rm -rf /tmp/efibootmgr-$(GITTAG) /tmp/efibootmgr-$(GITTAG)-tmp - @mkdir -p /tmp/efibootmgr-$(GITTAG)-tmp - @git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/efibootmgr-$(GITTAG)-tmp/ ; tar x ) - @git diff | ( cd /tmp/efibootmgr-$(GITTAG)-tmp/ ; patch -s -p1 -b -z .gitdiff ) - @mv /tmp/efibootmgr-$(GITTAG)-tmp/ /tmp/efibootmgr-$(GITTAG)/ - @cp efibootmgr.spec /tmp/efibootmgr-$(GITTAG)/ - @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efibootmgr-$(GITTAG).tar.bz2 efibootmgr-$(GITTAG) - @rm -rf /tmp/efibootmgr-$(GITTAG) - @echo "The archive is in efibootmgr-$(GITTAG).tar.bz2" - -bumpver : - @echo VERSION=$(GITTAG) > Make.version - @git add Make.version - git commit -m "Bump version to $(GITTAG)" -s - -tag: - git tag -s $(GITTAG) refs/heads/main - -archive: bumpver tag efibootmgr.spec - @rm -rf /tmp/efibootmgr-$(GITTAG) /tmp/efibootmgr-$(GITTAG)-tmp - @mkdir -p /tmp/efibootmgr-$(GITTAG)-tmp - @git archive --format=tar $(GITTAG) | ( cd /tmp/efibootmgr-$(GITTAG)-tmp/ ; tar x ) - @mv /tmp/efibootmgr-$(GITTAG)-tmp/ /tmp/efibootmgr-$(GITTAG)/ - @cp efibootmgr.spec /tmp/efibootmgr-$(GITTAG)/ - @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efibootmgr-$(GITTAG).tar.bz2 efibootmgr-$(GITTAG) - @rm -rf /tmp/efibootmgr-$(GITTAG) - @echo "The archive is in efibootmgr-$(GITTAG).tar.bz2" - diff --git a/README.md b/README.md index 6265005..4ceb0d4 100644 --- a/README.md +++ b/README.md @@ -100,3 +100,15 @@ Alternative use cases could be as follows: `efibootmgr -c -i eth0 -L netboot` Please direct any bugs, features, patches, etc. to the Red Hat bootloader team at https://github.com/rhboot/efibootmgr . + +Meson Notes +=========== + +Following the port to Meson, the old build targets are now as follows: + + * `make archive` -> `ninja dist` + * `make distclean` -> `ninja clean` + * `make scanbuild` -> `ninja scan-build` + * `make fanalyzer` -> `meson configure -Db_sanitize=address,undefined && ninja build` + * `make efibootmgr-static` -> `meson configure -Dprefer_static=true && ninja build` + * `EFIDIR=fedora make` -> `meson configure -Defidir=fedora && ninja build` diff --git a/efibootmgr.spec.in b/efibootmgr.spec.in index f20e405..e7a5c67 100644 --- a/efibootmgr.spec.in +++ b/efibootmgr.spec.in @@ -1,21 +1,24 @@ -Summary: EFI Boot Manager +%define efivar_version 39-1 + Name: efibootmgr -Version: @@VERSION@@ -Release: 1%{?dist} -Group: System Environment/Base -License: GPLv2+ +Version: @VERSION@ +Release: %autorelease +Summary: EFI Boot Manager +License: GPL-2.0-or-later URL: https://github.com/rhboot/%{name}/ -BuildRequires: git, popt-devel -BuildRequires: efivar-libs >= 30-1, efivar-devel >= 30-1 -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXXXX) -# EFI/UEFI don't exist on PPC -ExclusiveArch: %{ix86} x86_64 aarch64 arm -# for RHEL / Fedora when efibootmgr was part of the elilo package -Conflicts: elilo <= 3.6-6 -Obsoletes: elilo <= 3.6-6 +BuildRequires: efi-srpm-macros >= 3-2 +BuildRequires: efi-filesystem +BuildRequires: popt-devel +BuildRequires: efivar-libs >= %{efivar_version} +BuildRequires: efivar-devel >= %{efivar_version} +BuildRequires: gcc +BuildRequires: meson +Requires: efi-filesystem + +ExclusiveArch: %{efi} -Source0: https://github.com/rhboot/%{name}/releases/download/%{name}-%{version}/%{name}-%{version}.tar.bz2 +Source0: https://github.com/rhboot/%{name}/releases/download/%{name}-%{version}/%{name}-%{version}.tar.xz %description %{name} displays and allows the user to edit the UEFI Boot Manager @@ -23,87 +26,21 @@ variables. Additional information about UEFI can be found at http://www.uefi.org %prep -%setup -q -git init -git config user.email "example@example.com" -git config user.name "RHEL Ninjas" -git add . -git commit -a -q -m "%{version} baseline." -git am %{patches} - 14-1 -- Update to efibootmgr 14 -- Remove "(hex)" from description of --delete-bootnum -- Fix a typo in the popt options -- Add README.md -- make efibootdump install by default -- Man page fixes -- Better compiler detection -- Don't use --default-symver in efibootmgr -- Make -flto part of the overrideable CFLAGS - -* Wed Aug 17 2016 Peter Jones - 13-1 -- Update to efibootmgr 13 -- Add support for --sysprep and --driver to support UEFI System Prep - Applications and UEFI Drivers. -- use efivar's error reporting facility, and show error traces when - "-v -v" is used. -- Still yet better error codes returned on failures. -- Add -m and -M to support Memory Address Range Mirroring. -- Add efibootdump, to examine Boot* variables found in tarballs in bug - reports and similar. -- miscellaneous bugfixes. - -* Thu May 28 2015 Peter Jones - 0.12-1 -- Update to 0.12 -- use libefiboot and libefivar to make device paths and load options -- don't depend on -lz or -lpci any more -* Tue Oct 21 2014 Peter Jones - 0.11.0-1 -- Fix "-n" and friends not being assigned/checked right sometimes from 0.10.0-1 -- Generate more archives to avoid people using github's, because they're just - bad. - -* Mon Oct 20 2014 Peter Jones - 0.10.0-1 -- Make -o parameter validation work better and be more informative -- Better exit values -- Fix a segfault with appending ascii arguments. - -* Tue Sep 09 2014 Peter Jones - 0.8.0-1 -- Release 0.8.0 - -* Mon Jan 13 2014 Peter Jones - 0.6.1-1 -- Release 0.6.1 - -* Mon Jan 13 2014 Jared Dominguez -- new home https://github.com/vathpela/efibootmgr - -* Thu Jan 3 2008 Matt Domsch 0.5.4-1 -- split efibootmgr into its own RPM for Fedora/RHEL. - -* Tue Aug 24 2004 Matt Domsch -- new home linux.dell.com - -* Fri May 18 2001 Matt Domsch -- See doc/ChangeLog +%changelog +%autochangelog diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..4aadfd7 --- /dev/null +++ b/meson.build @@ -0,0 +1,52 @@ +project('efibootmgr', 'c', + version: '18', + license: 'GPL-2.1+', + meson_version: '>=0.61.0', + default_options: ['warning_level=2', 'c_std=c11'], +) + +warning_flags = [ + '-Wno-unused-parameter' +] +cc = meson.get_compiler('c') +add_project_arguments(cc.get_supported_arguments(warning_flags), language: 'c') + +add_project_arguments('-D_GNU_SOURCE', language: 'c') + +prefix = get_option('prefix') +sbindir = prefix / get_option('sbindir') +libdir = join_paths(prefix, get_option('libdir')) +datadir = prefix / get_option('datadir') +localedir = prefix / get_option('localedir') + +root_incdir = include_directories('.') + +efivar = dependency('efivar') +efiboot = dependency('efiboot') +popt = dependency('popt') + +conf = configuration_data() +conf.set_quoted('LOCALEDIR', localedir) +conf.set_quoted('LIBDIR', libdir) +conf.set_quoted('EFIBOOTMGR_VERSION', meson.project_version()) +conf.set_quoted('EFIDIR', get_option('efidir')) +conf.set_quoted('EFI_LABEL', get_option('efi_label')) +conf.set_quoted('EFI_LOADER', get_option('efi_loader')) + +default_loader = '\\\\EFI\\\\@0@\\\\@1@'.format(get_option('efidir'), get_option('efi_loader')) +conf.set_quoted('DEFAULT_LOADER', default_loader) + +configure_file( + output: 'config.h', + configuration: conf +) + +con2 = configuration_data() +con2.set('VERSION', meson.project_version()) +configure_file( + input: 'efibootmgr.spec.in', + output: 'efibootmgr.spec', + configuration: con2, +) + +subdir('src') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..15f238e --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,15 @@ +option('efidir', + type: 'string', + value: 'fedora', + description: 'Default EFI directory, e.g. fedora', +) +option('efi_loader', + type: 'string', + value: 'grub.efi', + description: 'Default EFI loader, e.g. grub.efi', +) +option('efi_label', + type: 'string', + value: 'Linux', + description: 'Default EFI label, e.g. Linux', +) diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 2f1bec4..0000000 --- a/src/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -SRCDIR = $(realpath .) -TOPDIR = $(realpath ..) - -include $(TOPDIR)/Make.version -include $(TOPDIR)/Make.rules -include $(TOPDIR)/Make.defaults - -BINTARGETS=efibootmgr efibootdump -TARGETS=$(BINTARGETS) efibootmgr.8 efibootdump.8 - -all : deps $(TARGETS) - -EFIBOOTMGR_SOURCES = efibootmgr.c efi.c parse_loader_data.c -EFICONMAN_SOURCES = eficonman.c -EFIBOOTDUMP_SOURCES = efibootdump.c parse_loader_data.c -EFIBOOTNEXT_SOURCES = efibootnext.c -ALL_SOURCES=$(EFIBOOTMGR_SOURCES) --include $(call deps-of,$(ALL_SOURCES)) - -efibootmgr : $(call objects-of,$(EFIBOOTMGR_SOURCES)) -efibootmgr : PKGS=efivar efiboot - -eficonman : $(call objects-of,$(EFICONMAN_SOURCES)) -eficonman : PKGS=efivar efiboot popt - -efibootdump : $(call objects-of,$(EFIBOOTDUMP_SOURCES)) -efibootdump : PKGS=efivar efiboot popt - -efibootnext : $(call objects-of,$(EFIBOOTNEXT_SOURCES)) -efibootnext : PKGS=efivar efiboot popt - -deps : PKGS=efivar efiboot popt -deps : $(ALL_SOURCES) - $(MAKE) -f $(TOPDIR)/Make.deps \ - SOURCES="$(ALL_SOURCES)" \ - PKGS="$(PKGS)" \ - deps - -clean : - @rm -rfv *.o *.a *.so $(TARGETS) - @rm -rfv .*.d - -install : $(TARGETS) - $(INSTALL) -d -m 755 $(DESTDIR)/$(sbindir)/ - $(INSTALL) -m 755 efibootmgr $(DESTDIR)/$(sbindir)/efibootmgr - $(INSTALL) -m 755 efibootdump $(DESTDIR)/$(sbindir)/efibootdump - $(INSTALL) -d -m 755 $(DESTDIR)/$(mandir)/man8/ - $(INSTALL) -m 644 efibootmgr.8 $(DESTDIR)/$(mandir)/man8/efibootmgr.8 - $(INSTALL) -m 644 efibootdump.8 $(DESTDIR)/$(mandir)/man8/efibootdump.8 - -.PHONY : all deps clean install diff --git a/src/efi.c b/src/efi.c index 4302b5c..aa4577f 100644 --- a/src/efi.c +++ b/src/efi.c @@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "fix_coverity.h" - #include #include #include diff --git a/src/efibootdump.c b/src/efibootdump.c index e376937..834b2fb 100644 --- a/src/efibootdump.c +++ b/src/efibootdump.c @@ -8,7 +8,7 @@ * Author: Peter Jones */ -#include "fix_coverity.h" +#include "config.h" #include #include diff --git a/src/efibootmgr.c b/src/efibootmgr.c index 0094e05..5e3dfcc 100644 --- a/src/efibootmgr.c +++ b/src/efibootmgr.c @@ -31,7 +31,7 @@ */ -#include "fix_coverity.h" +#include "config.h" #include #include @@ -1468,7 +1468,7 @@ usage() printf("\t-i | --iface name Create a netboot entry for the named interface.\n"); printf("\t-I | --index number When creating an entry, insert it in bootorder at specified position (default: 0).\n"); printf("\t-l | --loader name (Defaults to \""DEFAULT_LOADER"\").\n"); - printf("\t-L | --label label Boot manager display label (defaults to \"Linux\").\n"); + printf("\t-L | --label label Boot manager display label (defaults to \""EFI_LABEL"\").\n"); printf("\t-m | --mirror-below-4G t|f Mirror memory below 4GB.\n"); printf("\t-M | --mirror-above-4G X Percentage memory to mirror above 4GB.\n"); printf("\t-n | --bootnext XXXX Set BootNext to XXXX (hex).\n"); @@ -1499,7 +1499,7 @@ set_default_opts() opts.timeout = -1; /* Don't set it */ opts.edd10_devicenum = 0x80; opts.loader = DEFAULT_LOADER; - opts.label = (unsigned char *)"Linux"; + opts.label = (unsigned char *)EFI_LABEL; opts.disk = "/dev/sda"; opts.part = -1; } diff --git a/src/efibootnext.c b/src/efibootnext.c index 1b22573..cb4f368 100644 --- a/src/efibootnext.c +++ b/src/efibootnext.c @@ -20,7 +20,7 @@ * */ -#include "fix_coverity.h" +#include "config.h" #include #include diff --git a/src/eficonman.c b/src/eficonman.c index eec6fd1..ae04d20 100644 --- a/src/eficonman.c +++ b/src/eficonman.c @@ -8,7 +8,7 @@ * Author: Peter Jones */ -#include "fix_coverity.h" +#include "config.h" #include #include diff --git a/src/fix_coverity.h b/src/fix_coverity.h deleted file mode 100644 index bcdbb0d..0000000 --- a/src/fix_coverity.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * fix_coverity.h - * Copyright 2017 Peter Jones - * - * Distributed under terms of the GPLv3 license. - */ - -#pragma once - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#ifndef __COVERITY_GCC_VERSION_AT_LEAST -#define __COVERITY_GCC_VERSION_AT_LEAST(x, y) 0 -#define FAKE__COVERITY_GCC_VERSION_AT_LEAST__ -#endif /* __COVERITY_GCC_VERSION_AT_LEAST */ - -/* With gcc 7 on x86_64 (at least), coverity pretends to be GCC but - * accidentally doesn't create all of the types GCC would. - * - * In glibc's headers, bits/floatn.h has: - * - * #if (defined __x86_64__ \ - * ? __GNUC_PREREQ (4, 3) \ - * : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) - * # define __HAVE_FLOAT128 1 - * #else - * # define __HAVE_FLOAT128 0 - * #endif - * - * and stdlib.h has: - * - * #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT) - * slash* Likewise for the '_Float128' format *slash - * extern _Float128 strtof128 (const char *__restrict __nptr, - * char **__restrict __endptr) - * __THROW __nonnull ((1)); - * #endif - * - * Which then causes cov-emit to lose its shit: - * - * "/usr/include/stdlib.h", line 133: error #20: identifier "_Float128" is - * undefined - * extern _Float128 strtof128 (const char *__restrict __nptr, - * ^ - * "/usr/include/stdlib.h", line 190: error #20: identifier "_Float128" is - * undefined - * _Float128 __f) - * ^ - * "/usr/include/stdlib.h", line 236: error #20: identifier "_Float128" is - * undefined - * extern _Float128 strtof128_l (const char *__restrict __nptr, - * ^ - * - * And then you'll notice something like this later on: - * [WARNING] Emitted 0 C/C++ compilation units (0%) successfully - * - * 0 C/C++ compilation units (0%) are ready for analysis - * For more details, please look at: - * /home/pjones/devel/github.com/dbxtool/master/cov-int/build-log.txt - * - * You would think that if you're writing something that pretends to be - * gcc, and you've got a "build a configuration by running shit through gcc - * and looking at the output" stage (which they do), you would run "gcc -da - * -fdump-tree-all -c -o foo.o foo.c" on an empty file and snarf up all the - * types defined in the foo.c.001t.tu output. Apparently, they do not. - * - * Anyway, even just defining the type doesn't always work in the face of - * how _Complex is defined, so we cheat a bit here. Be prepared to vomit. - */ -#ifdef __x86_64__ -#if __COVERITY_GCC_VERSION_AT_LEAST(7, 0) -#if 0 -typedef float _Float128 __attribute__((__mode__(__TF__))); -typedef __complex__ float __cfloat128 __attribute__ ((__mode__ (__TC__))); -typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__))); -#else -#include -#define __cplusplus 201103L -#include -#undef __cplusplus -#endif -#endif -#endif - -#ifdef FAKE__COVERITY_GCC_VERSION_AT_LEAST__ -#undef FAKE__COVERITY_GCC_VERSION_AT_LEAST -#undef __COVERITY_GCC_VERSION_AT_LEAST -#endif - -// vim:fenc=utf-8:tw=75 diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..96df7dc --- /dev/null +++ b/src/meson.build @@ -0,0 +1,67 @@ +con2 = configuration_data() +con2.set_quoted('DEFAULT_LOADER', default_loader) +configure_file( + input: 'efibootmgr.8.in', + output: 'efibootmgr.8', + configuration: con2, + install: true, + install_dir: datadir / 'man/man8', +) +configure_file( + input: 'efibootdump.8.in', + output: 'efibootdump.8', + configuration: con2, + install: true, + install_dir: datadir / 'man/man8', +) + +executable( + 'efibootmgr', + sources: [ + 'efibootmgr.c', + 'efi.c', + 'parse_loader_data.c', + ], + include_directories: [ + root_incdir, + ], + dependencies: [ + efivar, + efiboot, + popt, + ], + install: true, + install_dir: sbindir, +) + +executable( + 'efibootdump', + sources: [ + 'efibootdump.c', + 'parse_loader_data.c', + ], + include_directories: [ + root_incdir, + ], + dependencies: [ + efivar, + efiboot, + popt, + ], + install: true, + install_dir: sbindir, +) + +executable( + 'eficonman', + sources: [ + 'eficonman.c', + ], + include_directories: [ + root_incdir, + ], + dependencies: [ + efivar, + popt, + ], +) diff --git a/src/parse_loader_data.c b/src/parse_loader_data.c index b718514..5099b45 100644 --- a/src/parse_loader_data.c +++ b/src/parse_loader_data.c @@ -21,8 +21,6 @@ /* For PRIx64 */ #define __STDC_FORMAT_MACROS -#include "fix_coverity.h" - #include #include #include