aboutsummaryrefslogtreecommitdiffstats
path: root/efi/build-gnu-efi.sh
blob: e72d8720926b4e4c1a3c0f72a353f1af6a73b087 (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
39
40
41
42
43
44
45
#!/bin/sh

set -e

# Initialise the gnu-efi submodule and ensure the source is up-to-date.
# Then build and install it for the given architecture.

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

Build the <arch> gnu-efi libs and header files and install in <objdir>.

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

EOF
    exit 1
fi

ARCH="$1"
objdir="$(readlink -f $2)"

if [ ! -e ../version.h ]; then
    printf "build-gnu-efi.sh: Cannot be run outside Syslinux object tree\n"
    pwd
    exit 1
fi

(
	cd ../..
	if [ -d .git ]; then
	    git submodule update --init
	fi
)

mkdir -p "$objdir/gnu-efi"
cd "$objdir/gnu-efi"

EFIDIR="$(readlink -f "$objdir/../gnu-efi/gnu-efi-3.0")"

make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH
make SRCDIR="$EFIDIR" TOPDIR="$EFIDIR" -f "$EFIDIR/Makefile" ARCH=$ARCH PREFIX="$objdir" install

cd "$objdir/efi"