summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorLlewelyn Trahaearn2019-01-20 22:26:54 -0800
committerLlewelyn Trahaearn2019-01-20 22:26:54 -0800
commit6fcc288e5fd3027df42b31669620bf481683a6c3 (patch)
treefe5cb143ba8add16fa6a5c6ba626de87fc0bf32d /PKGBUILD
parent94d9003d6882600828b6eb63fe5f5908b1e3fdc7 (diff)
downloadaur-6fcc288e5fd3027df42b31669620bf481683a6c3.tar.gz
Major rewrite of build() and package() for increased readability and easier maintenance of the PKGBUILD.
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD317
1 files changed, 84 insertions, 233 deletions
diff --git a/PKGBUILD b/PKGBUILD
index cdf5d9b1fef6..cc222bb6ad73 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,122 +4,81 @@
# Contributor: Keshav Amburay <(the ddoott ridikulus ddoott rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
## "1" to enable IA32-EFI build in Arch x86_64, "0" to disable
-_IA32_EFI_IN_ARCH_X64="1"
+_ia32_efi_in_arch_x64="1"
## "1" to enable EMU build, "0" to disable
-_GRUB_EMU_BUILD="0"
+_grub_emu_build="1"
-_UNIFONT_VER="10.0.06"
+[[ "${CARCH}" == "x86_64" ]] && _target_arch="x86_64"
+[[ "${CARCH}" == "i686" ]] && _target_arch="i386"
-[[ "${CARCH}" == "x86_64" ]] && _EFI_ARCH="x86_64"
-[[ "${CARCH}" == "i686" ]] && _EFI_ARCH="i386"
-
-[[ "${CARCH}" == "x86_64" ]] && _EMU_ARCH="x86_64"
-[[ "${CARCH}" == "i686" ]] && _EMU_ARCH="i386"
+_build_platforms="i386-pc ${_target_arch}-efi"
+[[ "${CARCH}" == "x86_64" ]] && [[ "${_ia32_efi_in_arch_x64}" == "1" ]] && _build_platforms+=" i386-efi"
+[[ "${_grub_emu_build}" == "1" ]] && _build_platforms+=" ${_target_arch}-emu"
pkgname="grub-git"
-pkgver=2.02.r164.gc79ebcd18
+pkgver=2.02.r241.ged087f046
pkgrel=1
pkgdesc="GNU GRand Unified Bootloader (2)"
arch=('x86_64' 'i686')
url="https://www.gnu.org/software/grub/"
license=('GPL3')
-depends=('sh' 'xz' 'gettext' 'device-mapper')
-makedepends=('autogen' 'device-mapper' 'freetype2' 'fuse2' 'gettext' 'git'
- 'help2man' 'python' 'rsync' 'ttf-dejavu' 'texinfo' 'xz')
+depends=('device-mapper' 'freetype2' 'fuse2' 'gettext')
+makedepends=('autogen' 'bdf-unifont' 'git' 'help2man'
+ 'python' 'rsync' 'texinfo' 'ttf-dejavu')
optdepends=('dosfstools: For grub-mkrescue FAT FS and EFI support'
'efibootmgr: For grub-install EFI support'
- 'freetype2: For grub-mkfont usage'
- 'fuse2: For grub-mount usage'
'libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue'
'mtools: For grub-mkrescue FAT FS support'
'os-prober: To detect other OSes when generating grub.cfg in BIOS systems')
-if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then
- makedepends+=('libusbx' 'sdl')
- optdepends+=('libusbx: For grub-emu USB support'
- 'sdl: For grub-emu SDL support')
+if [[ "${_grub_emu_build}" == "1" ]]; then
+ depends+=('sdl')
+ makedepends+=('libusb')
+ optdepends+=('libusb: For grub-emu USB support')
fi
-provides=("${pkgname%-*}" 'grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}")
-conflicts=("${pkgname%-*}" 'grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-legacy')
-backup=('boot/grub/grub.cfg'
- 'etc/default/grub'
+provides=("${pkgname%-*}")
+conflicts=("${pkgname%-*}")
+backup=('etc/default/grub'
'etc/grub.d/40_custom')
-options=('!makeflags')
install="${pkgname}.install"
-source=("grub::git+git://git.savannah.gnu.org/grub.git"
- "grub-extras::git+git://git.savannah.gnu.org/grub-extras.git"
- "https://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz"{,.sig}
+source=("grub::git://git.savannah.gnu.org/grub.git"
+ "grub-extras::git://git.savannah.gnu.org/grub-extras.git"
'10_linux-detect-archlinux-initramfs.patch'
'add-GRUB_COLOR_variables.patch'
- 'grub.default'
- 'grub.cfg')
+ 'grub.default')
sha256sums=('SKIP'
'SKIP'
- '0d81571fc519573057b7641d26a31ead55cc0b02a931589fb346a3a534c3dcc1'
- 'SKIP'
'b41e4438319136b5e74e0abdfcb64ae115393e4e15207490272c425f54026dd3'
'a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29'
- '74e5dd2090a153c10a7b9599b73bb09e70fddc6a019dd41641b0f10b9d773d82'
- 'c5e4f3836130c6885e9273c21f057263eba53f4b7c0e2f111f6e5f2e487a47ad')
-validpgpkeys=('E53D497F3FA42AD8C9B4D1E835A93B74E82E4209' # Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
- '95D2E9AB8740D8046387FD151A09227B1F435A33') # Paul Hardy <unifoundry@unifoundry.com>
+ '74e5dd2090a153c10a7b9599b73bb09e70fddc6a019dd41641b0f10b9d773d82')
-_configure_options=(
- FREETYPE="pkg-config freetype2"
- BUILD_FREETYPE="pkg-config freetype2"
- --enable-mm-debug
- --enable-nls
- --enable-device-mapper
- --enable-cache-stats
- --enable-grub-mkfont
- --enable-grub-mount
- --prefix="/usr"
- --bindir="/usr/bin"
- --sbindir="/usr/bin"
- --mandir="/usr/share/man"
- --infodir="/usr/share/info"
- --datarootdir="/usr/share"
- --sysconfdir="/etc"
- --program-prefix=""
- --with-bootdir="/boot"
- --with-grubdir="grub"
- --disable-silent-rules
- --disable-werror
-)
-
prepare() {
cd grub
- msg "Patch to detect of Arch Linux initramfs images by grub-mkconfig"
- patch -Np1 -i "${srcdir}/10_linux-detect-archlinux-initramfs.patch"
+ # Patch grub-mkconfig to detect Arch Linux initramfs images.
+ patch -Np1 -i "$srcdir"/10_linux-detect-archlinux-initramfs.patch
- msg "Patch to enable GRUB_COLOR_* variables in grub-mkconfig"
- ## Based on http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html
- patch -Np1 -i "${srcdir}/add-GRUB_COLOR_variables.patch"
+ # Patch to enable GRUB_COLOR_* variables in grub-mkconfig.
+ # Based on http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html
+ patch -Np1 -i "$srcdir"/add-GRUB_COLOR_variables.patch
- msg "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme"
+ # Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme.
sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "configure.ac"
- msg "Fix mkinitcpio 'rw' FS#36275"
+ # Modify grub-mkconfig behaviour to silence warnings FS#36275
sed 's| ro | rw |g' -i "util/grub.d/10_linux.in"
- msg "Fix OS naming FS#33393"
+ # Modify grub-mkconfig behaviour so automatically generated entries read 'Arch Linux' FS#33393
sed 's|GNU/Linux|Linux|' -i "util/grub.d/10_linux.in"
- msg "Pull in latest language files"
+ # Pull in latest language files
./linguas.sh
-
- msg "Remove not working langs which need LC_ALL=C.UTF-8"
- sed -e 's#en@cyrillic en@greek##g' -i "po/LINGUAS"
-
- msg "Avoid problem with unifont during compile of grub"
- # http://savannah.gnu.org/bugs/?40330 and https://bugs.archlinux.org/task/37847
- cp "${srcdir}/unifont-${_UNIFONT_VER}.bdf" "unifont.bdf"
-
- msg "Run autogen.sh"
- ./autogen.sh
+
+ # Remove lua module from grub-extras as it is incompatible with changes to grub_file_open
+ # http://git.savannah.gnu.org/cgit/grub.git/commit/?id=ca0a4f689a02c2c5a5e385f874aaaa38e151564e
+ rm -rf "$srcdir"/grub-extras/lua
}
pkgver() {
@@ -130,165 +89,57 @@ pkgver() {
)
}
-_build_grub-common_and_bios() {
- msg "Set ARCH dependent variables for bios build"
- if [[ "${CARCH}" == 'x86_64' ]]; then
- _EFIEMU="--enable-efiemu"
- else
- _EFIEMU="--disable-efiemu"
- fi
-
- msg "Copy the source for building the bios part"
- cp -r "${srcdir}/grub" "${srcdir}/grub-bios"
- cd "${srcdir}/grub-bios"
-
- msg "Add the grub-extra sources for bios build"
- install -d "${srcdir}/grub-bios/grub-extras"
- cp -r "${srcdir}/grub-extras/915resolution" "${srcdir}/grub-bios/grub-extras/915resolution"
- export GRUB_CONTRIB="${srcdir}/grub-bios/grub-extras"
-
- msg "Unset all compiler FLAGS for bios build"
- unset CFLAGS
- unset CPPFLAGS
- unset CXXFLAGS
- unset LDFLAGS
- unset MAKEFLAGS
-
- msg "Run ./configure for bios build"
- ./configure \
- --with-platform="pc" \
- --target="i386" \
- "${_EFIEMU}" \
- --enable-boot-time \
- "${_configure_options[@]}"
-
- msg "Run make for bios build"
- make
-}
-
-_build_grub-efi() {
- msg "Copy the source for building the ${_EFI_ARCH} efi part"
- cp -r "${srcdir}/grub" "${srcdir}/grub-efi-${_EFI_ARCH}"
- cd "${srcdir}/grub-efi-${_EFI_ARCH}"
-
- msg "Unset all compiler FLAGS for ${_EFI_ARCH} efi build"
- unset CFLAGS
- unset CPPFLAGS
- unset CXXFLAGS
- unset LDFLAGS
- unset MAKEFLAGS
-
- msg "Run ./configure for ${_EFI_ARCH} efi build"
- ./configure \
- --with-platform="efi" \
- --target="${_EFI_ARCH}" \
- --disable-efiemu \
- --enable-boot-time \
- "${_configure_options[@]}"
-
- msg "Run make for ${_EFI_ARCH} efi build"
- make
-}
-
-_build_grub-emu() {
- msg "Copy the source for building the emu part"
- cp -r "${srcdir}/grub" "${srcdir}/grub-emu"
- cd "${srcdir}/grub-emu"
-
- msg "Unset all compiler FLAGS for emu build"
- unset CFLAGS
- unset CPPFLAGS
- unset CXXFLAGS
- unset LDFLAGS
- unset MAKEFLAGS
-
- msg "Run ./configure for emu build"
- ./configure \
- --with-platform="emu" \
- --target="${_EMU_ARCH}" \
- --enable-grub-emu-usb=no \
- --enable-grub-emu-sdl=no \
- --disable-grub-emu-pci \
- "${_configure_options[@]}"
-
- msg "Run make for emu build"
- make
-}
-
build() {
- msg "Build grub bios stuff"
- _build_grub-common_and_bios
-
- msg "Build grub ${_EFI_ARCH} efi stuff"
- _build_grub-efi
-
- if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then
- msg "Build grub i386 efi stuff"
- _EFI_ARCH="i386" _build_grub-efi
- fi
-
- if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then
- msg "Build grub emu stuff"
- _build_grub-emu
- fi
-}
-
-_package_grub-common_and_bios() {
- cd "${srcdir}/grub-bios/"
-
- msg "Run make install for bios build"
- make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
-
- msg "Remove gdb debugging related files for bios build"
- rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.module || true
- rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.image || true
- rm -f "${pkgdir}/usr/lib/grub/i386-pc"/{kernel.exec,gdb_grub,gmodule.pl} || true
-
- msg "Install /etc/default/grub (used by grub-mkconfig)"
- install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
-
- msg "Install grub.cfg for backup array"
- install -D -m0644 "${srcdir}/grub.cfg" "${pkgdir}/boot/grub/grub.cfg"
-}
-
-_package_grub-efi() {
- cd "${srcdir}/grub-efi-${_EFI_ARCH}/"
-
- msg "Run make install for ${_EFI_ARCH} efi build"
- make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
-
- msg "Remove gdb debugging related files for ${_EFI_ARCH} efi build"
- rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.module || true
- rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.image || true
- rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/{kernel.exec,gdb_grub,gmodule.pl} || true
-}
-
-_package_grub-emu() {
- cd "${srcdir}/grub-emu/"
-
- msg "Run make install for emu build"
- make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
+ cd grub
+ export GRUB_CONTRIB="$srcdir"/grub-extras
+ ./autogen.sh
- msg "Remove gdb debugging related files for emu build"
- rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.module || true
- rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.image || true
- rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/{kernel.exec,gdb_grub,gmodule.pl} || true
+ # Undefined references to __stack_chk_fail
+ CFLAGS=${CFLAGS/-fstack-protector-strong}
+
+ # Undefined references to _GLOBAL_OFFSET_TABLE_
+ CFLAGS=${CFLAGS/-fno-plt}
+
+ for _arch in $_build_platforms; do
+ mkdir "$srcdir"/grub/build_"$_arch"
+ cd "$srcdir"/grub/build_"$_arch"
+
+ # Explicitly set ac_cv_header_sys_sysmacros_h
+ # https://savannah.gnu.org/bugs/index.php?55520
+ ../configure --with-platform="${_arch##*-}" \
+ --target="${_arch%%-*}" \
+ --prefix="/usr" \
+ --sbindir="/usr/bin" \
+ --sysconfdir="/etc" \
+ --enable-boot-time \
+ --enable-cache-stats \
+ --enable-device-mapper \
+ --enable-grub-mkfont \
+ --enable-grub-mount \
+ --enable-mm-debug \
+ --enable-nls \
+ --disable-silent-rules \
+ --disable-werror \
+ ac_cv_header_sys_sysmacros_h=yes
+ make
+ done
}
package() {
- msg "Package grub ${_EFI_ARCH} efi stuff"
- _package_grub-efi
-
- if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then
- msg "Package grub i386 efi stuff"
- _EFI_ARCH="i386" _package_grub-efi
- fi
-
- if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then
- msg "Package grub emu stuff"
- _package_grub-emu
- fi
-
- msg "Package grub bios stuff"
- _package_grub-common_and_bios
-}
+ cd grub
+
+ for _arch in $_build_platforms; do
+ cd "$srcdir"/grub/build_"$_arch"
+ make DESTDIR="$pkgdir" bashcompletiondir=/usr/share/bash-completion/completions install
+ done
+
+ # Install /etc/default/grub (used by grub-mkconfig)
+ install -D -m0644 "$srcdir"/grub.default "$pkgdir"/etc/default/grub
+
+ # Tidy up
+ find "$pkgdir"/usr/lib/grub \( -name '*.module' -o \
+ -name '*.image' -o \
+ -name 'kernel.exec' -o \
+ -name 'gdb_grub' -o \
+ -name 'gmodule.pl' \) -delete
+} \ No newline at end of file