diff options
author | Matt Fleming <matt.fleming@intel.com> | 2014-01-08 10:10:36 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2014-01-08 10:57:37 +0000 |
commit | 9ab3608ba4a51e234f251d84f764f39f20e4ded3 (patch) | |
tree | 36566b980294e78284c17a184e1481eee5b968fc | |
parent | 481e37e0b6ab2f246ee4b46a1808c4a57ca4259f (diff) | |
download | syslinux-9ab3608ba4a51e234f251d84f764f39f20e4ded3.tar.gz |
efi: Make the gnu-efi build scripts more portable
Not all distributions point /bin/sh at /bin/bash, so remove some
bashisms (pushd/popd) and require that build-gnu-efi.sh be run from the
Syslinux object directory.
Also, swap realpath(1) for readlink(1) because the former isn't
available on Debian.
Reported-by: Ferenc Wagner <wferi@niif.hu>
Reported-by: Celelibi <celelibi@gmail.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rwxr-xr-x | efi/build-gnu-efi.sh | 17 | ||||
-rwxr-xr-x | efi/check-gnu-efi.sh | 13 | ||||
-rw-r--r-- | mk/efi.mk | 3 |
3 files changed, 16 insertions, 17 deletions
diff --git a/efi/build-gnu-efi.sh b/efi/build-gnu-efi.sh index 3844e75b..f9bab988 100755 --- a/efi/build-gnu-efi.sh +++ b/efi/build-gnu-efi.sh @@ -5,14 +5,13 @@ 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 3 ]; then +if [ $# -lt 2 ]; then cat <<EOF -Usage: $0: <arch> <srcdir> <objdir> +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 - <srcdir> - The top-level directory of the Syslinux source <objdir> - The Syslinux object directory EOF @@ -20,10 +19,14 @@ EOF fi ARCH=$1 -srcdir=`realpath $2` -objdir=`realpath $3` +objdir=`readlink -f $2` -pushd $srcdir +if [ ! -e ../version.h ]; then + printf "build-gnu-efi.sh: Cannot be run outside Syslinux object tree\n" + exit 1 +fi + +cd ../.. git submodule init git submodule update @@ -34,4 +37,4 @@ make ARCH=$ARCH make ARCH=$ARCH PREFIX=$objdir install make ARCH=$ARCH clean -popd +cd $objdir/efi diff --git a/efi/check-gnu-efi.sh b/efi/check-gnu-efi.sh index fcf5fd49..dc3b6914 100755 --- a/efi/check-gnu-efi.sh +++ b/efi/check-gnu-efi.sh @@ -3,15 +3,14 @@ # Verify that gnu-efi is installed in the object directory for our # firmware. If it isn't, build it. -if [ $# -lt 3 ]; then +if [ $# -lt 2 ]; then cat <<EOF -Usage: $0: <arch> <srcdir> <objdir> +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 - <srcdir> - The top-level directory of the Syslinux source <objdir> - The Syslinux object directory EOF @@ -19,20 +18,18 @@ EOF fi ARCH=$1 -srcdir=`realpath $2` -objdir=`realpath $3` +objdir=$2 if [ ! -f $objdir/include/efi/$ARCH/efibind.h ]; then # Build the external project with a clean make environment, as # Syslinux disables built-in implicit rules. export MAKEFLAGS= - build=$srcdir/efi/build-gnu-efi.sh - $build $ARCH $srcdir $objdir &> /dev/null + ../../efi/build-gnu-efi.sh $ARCH $objdir &> /dev/null if [ $? -ne 0 ]; then printf "Failed to build gnu-efi. " printf "Execute the following command for full details: \n\n" - printf "$build $ARCH $srcdir $objdir\n\n" + printf "build-gnu-efi.sh $ARCH $objdir\n\n" exit 1 fi @@ -21,8 +21,7 @@ ifeq ($(ARCH),x86_64) EFI_SUBARCH = $(ARCH) endif -output = $(shell $(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH) \ - $(topdir) $(objdir)) +output = $(shell $(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH) $(objdir)) ifneq ($(output),) $(error Failed to build gnu-efi for $(EFI_SUBARCH)) endif |