<commit_before>#!/bin/bash

# Originally from the Galileo port in contiki
# https://github.com/otcshare/contiki-x86

set -e

JOBS=5
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

if [ "x$1" == "x" ]; then
  echo "Usage: $0 [i386|x86_64]"
  exit 1
fi

TARGET_ARCH=$1

prepare() {
  if [[ ! -d ./src ]]; then
    git clone http://git.savannah.gnu.org/r/grub.git src
  fi

  pushd src
  git checkout grub-2.02
  git cherry-pick c36c2a86404f373100775305f532c09d46f3c6ce
  git clean -fdx
  popd
}

build() {
  pushd src

  ./autogen.sh
  ./configure --with-platform=efi --target=${TARGET_ARCH}

  make -j${JOBS}

  ./grub-mkimage -p /EFI/BOOT -d ./grub-core/ -O ${TARGET_ARCH}-efi \
           -o grub_${TARGET_ARCH}.efi \
            boot efifwsetup efi_gop efinet efi_uga lsefimmap lsefi lsefisystab \
            exfat fat multiboot2 multiboot terminal part_msdos part_gpt normal \
            all_video aout configfile echo file fixvideo fshelp gfxterm gfxmenu \
            gfxterm_background gfxterm_menu legacycfg video_bochs video_cirrus \
            video_colors video_fb videoinfo video net tftp

  popd
}

setup() {
  mkdir -p bin
  cp src/grub_${TARGET_ARCH}.efi bin/
}
<commit_msg>x86: grub_build.sh: fix compilation failures on Fedora 29<commit_after>#!/bin/bash

# Originally from the Galileo port in contiki
# https://github.com/otcshare/contiki-x86

set -e

JOBS=5
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

if [ "x$1" == "x" ]; then
  echo "Usage: $0 [i386|x86_64]"
  exit 1
fi

TARGET_ARCH=$1

prepare() {
  if [[ ! -d ./src ]]; then
    git clone http://git.savannah.gnu.org/r/grub.git src
  fi

  pushd src
  git checkout grub-2.02
  cat << EOF | awk ' { print $1 }' | git cherry-pick -x --stdin
  grub-2.02-69-gc36c2a864  yylex: Explicilty cast fprintf to void.
  grub-2.02-136-g563b1da6e Fix packed-not-aligned error on GCC 8
  grub-2.02-100-g842c39046 x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32
EOF
  git clean -fdx
  popd
}

build() {
  pushd src

  ./autogen.sh
  ./configure --with-platform=efi --target=${TARGET_ARCH}

  make -j${JOBS}

  ./grub-mkimage -p /EFI/BOOT -d ./grub-core/ -O ${TARGET_ARCH}-efi \
           -o grub_${TARGET_ARCH}.efi \
            boot efifwsetup efi_gop efinet efi_uga lsefimmap lsefi lsefisystab \
            exfat fat multiboot2 multiboot terminal part_msdos part_gpt normal \
            all_video aout configfile echo file fixvideo fshelp gfxterm gfxmenu \
            gfxterm_background gfxterm_menu legacycfg video_bochs video_cirrus \
            video_colors video_fb videoinfo video net tftp

  popd
}

setup() {
  mkdir -p bin
  cp src/grub_${TARGET_ARCH}.efi bin/
}

{'fraction_non_alphanumeric': 0.11881559220389805, 'fraction_numerical': 0.04685157421289355, 'mean_word_length': 2.7804532577903682, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1068580', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1040, 'n_words': 260}