diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-11-14 13:18:31 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-11-15 13:06:48 +0000 |
commit | 49acaea5184a5f83db3720c30a3f714b3cb65b34 (patch) | |
tree | cfe10f8fcbe24eda3d0204823d092afcdc6463bc | |
parent | 4eb06d95d882530375a82edb81b78bf5967b9ea3 (diff) | |
download | syslinux-49acaea5184a5f83db3720c30a3f714b3cb65b34.tar.gz syslinux-49acaea5184a5f83db3720c30a3f714b3cb65b34.tar.xz syslinux-49acaea5184a5f83db3720c30a3f714b3cb65b34.zip |
efi: Add a simple script to find gnu-efi files
The location of the installed gnu-efi libraries and header files
varies wildly with different distributions. We need a way to find the
correct location for a given architecture.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rwxr-xr-x | efi/find-gnu-efi.sh | 43 | ||||
-rw-r--r-- | mk/efi.mk | 13 |
2 files changed, 52 insertions, 4 deletions
diff --git a/efi/find-gnu-efi.sh b/efi/find-gnu-efi.sh new file mode 100755 index 00000000..9620a4f5 --- /dev/null +++ b/efi/find-gnu-efi.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Find where the gnu-efi package has been installed as this location +# differs across distributions. + +include_dirs="/usr/include /usr/local/include" +lib_dirs="/usr/lib /usr/lib64 /usr/local/lib" + +function find_include() +{ + for d in $include_dirs; do + found=`find $d -name efi -type d 2> /dev/null` + if [ "$found"x != "x" ] && [ -e $found/$ARCH/efibind.h ]; then + echo $found + break; + fi + done +} + +function find_lib() +{ + for d in $lib_dirs; do + found=`find $d -name libgnuefi.a 2> /dev/null` + if [ "$found"x != "x" ]; then + crt_name='crt0-efi-'$ARCH'.o' + crt=`find $d -name $crt_name 2> /dev/null` + if [ "$crt"x != "x" ]; then + echo $d + break; + fi + fi + done +} + +ARCH=$2 +case $1 in + include) + find_include + ;; + lib) + find_lib + ;; +esac @@ -16,16 +16,21 @@ ifeq ($(ARCH),i386) SARCHOPT = -march=i386 CARCHOPT = -m32 -march=i386 EFI_SUBARCH = ia32 - LIBDIR = /usr/local/lib - EFIINC = /usr/local/include/efi endif ifeq ($(ARCH),x86_64) SARCHOPT = -march=x86-64 CARCHOPT = -m64 -march=x86-64 EFI_SUBARCH = $(ARCH) - EFIINC = /usr/include/efi - LIBDIR=/usr/lib64 endif + +EFIINC = $(shell $(topdir)/efi//find-gnu-efi.sh include $(EFI_SUBARCH)) +$(if $(EFIINC),, \ + $(error Missing $(EFI_SUBARCH) gnu-efi header files)) + +LIBDIR = $(shell $(topdir)/efi/find-gnu-efi.sh lib $(EFI_SUBARCH)) +$(if $(LIBDIR),, \ + $(error Missing $(EFI_SUBARCH) gnu-efi libraries)) + #LIBDIR=/usr/lib FORMAT=efi-app-$(EFI_SUBARCH) |