aboutsummaryrefslogtreecommitdiffstats
path: root/efi/check-gnu-efi.sh
blob: 7d99e9ab2ba50e2a21d5d1b50b684bd4cae8e49e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

# Verify that gnu-efi is installed in the object directory for our
# firmware. If it isn't, build it.

if [ $# -lt 2 ]; then
cat <<EOF
Usage: $0: <arch> <objdir>

Check for gnu-efi libraries and header files in <objdir> and, if none
exist, build and install them.

  <arch>   - A gnu-efi \$ARCH argument, i.e. ia32, x86_64
  <objdir> - The Syslinux object directory

EOF
    exit 1
fi

ARCH=$1
objdir=$2

if [ ! \( -f "$objdir/include/efi/$ARCH/efibind.h" -a -f "$objdir/lib/libefi.a" -a -f "$objdir/lib/libgnuefi.a" \) ]; then
    # Build the external project with a clean make environment, as
    # Syslinux disables built-in implicit rules.
    export MAKEFLAGS=

    ../../efi/build-gnu-efi.sh $ARCH "$objdir"
    if [ $? -ne 0 ]; then
	printf "Failed to build gnu-efi. "
	printf "Execute the following command for full details: \n\n"
	printf "build-gnu-efi.sh $ARCH $objdir\n\n"

	exit 1
    fi
else
    printf "skip gnu-efi build/install\n"
fi