Add pkgconfig file

Also add EXEC_PREFIX and INCLUDEDIR variables

This was requested by fwupd-efi, to be able
to retrieve the version number of gnu-efi
so we can detect features

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
This commit is contained in:
Callum Farmer 2023-04-06 21:36:07 +01:00
parent 4f8b339fac
commit 63a9a4d4c0
5 changed files with 36 additions and 12 deletions

View File

@ -47,8 +47,10 @@ TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
#
INSTALLROOT := /
PREFIX := /usr/local
LIBDIR := $(PREFIX)/lib
INSTALL := install
EXEC_PREFIX := $(PREFIX)
LIBDIR := $(EXEC_PREFIX)/lib
INCLUDEDIR := $(PREFIX)/include
INSTALL := install
# Compilation tools
HOSTCC := $(prefix)gcc

View File

@ -34,7 +34,7 @@
# SUCH DAMAGE.
#
VERSION = 3.0.15
export VERSION = 3.0.15
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
SRCDIR = $(dir $(MKFILE_PATH))

View File

@ -43,6 +43,7 @@ include $(SRCDIR)/../Make.defaults
TOPDIR = $(SRCDIR)/..
CDIR=$(TOPDIR)/..
PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig
FILES = reloc_$(ARCH)
OBJS = $(FILES:%=%.o)
@ -52,11 +53,20 @@ reloc_aarch64.o: CFLAGS += -fno-jump-tables
TARGETS = crt0-efi-$(ARCH).o libgnuefi.a
all: $(TARGETS)
all: $(TARGETS) gnu-efi.pc
libgnuefi.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $^
gnu-efi.pc:
sed \
-e 's:@PREFIX@:$(PREFIX):g' \
-e 's:@EXEC_PREFIX@:$(EXEC_PREFIX):g' \
-e 's:@INCLUDEDIR@:$(INCLUDEDIR):g' \
-e 's:@LIBDIR@:$(LIBDIR):g' \
-e 's:@VERSION@:$(VERSION):g' \
$(SRCDIR)/gnu-efi.pc.in > gnu-efi.pc
clean:
rm -f $(TARGETS) *~ *.o $(OBJS)
@ -73,5 +83,7 @@ ifneq (,$(findstring FreeBSD,$(OS)))
else
$(INSTALL) -m 644 $(SRCDIR)/elf_$(ARCH)_efi.lds $(INSTALLROOT)$(LIBDIR)
endif
$(INSTALL) -d $(INSTALLROOT)$(PKGCONFIGDIR)
$(INSTALL) -m 644 gnu-efi.pc $(INSTALLROOT)$(PKGCONFIGDIR)
include $(SRCDIR)/../Make.rules

10
gnuefi/gnu-efi.pc.in Normal file
View File

@ -0,0 +1,10 @@
prefix=@PREFIX@
exec_prefix=@EXEC_PREFIX@
includedir=@INCLUDEDIR@
libdir=@LIBDIR@
Name: gnu-efi
Description: EFI development toolkit
Version: @VERSION@
Cflags: -I${includedir}/efi
Libs: -lefi

View File

@ -13,15 +13,15 @@ all:
clean:
install:
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH)
$(INSTALL) -m 644 $(SRCDIR)/*.h $(INSTALLROOT)$(PREFIX)/include/efi
$(INSTALL) -m 644 $(SRCDIR)/protocol/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol
$(INSTALL) -m 644 $(SRCDIR)/$(ARCH)/*.h $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH)
mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi
mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol
mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi/$(ARCH)
$(INSTALL) -m 644 $(SRCDIR)/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi
$(INSTALL) -m 644 $(SRCDIR)/protocol/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol
$(INSTALL) -m 644 $(SRCDIR)/$(ARCH)/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi/$(ARCH)
ifeq ($(ARCH),ia64)
mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64
$(INSTALL) -m 644 $(SRCDIR)/protocol/ia64/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64
mkdir -p $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol/ia64
$(INSTALL) -m 644 $(SRCDIR)/protocol/ia64/*.h $(INSTALLROOT)$(INCLUDEDIR)/efi/protocol/ia64
endif
include $(SRCDIR)/../Make.rules