core/grub2/PKGBUILD
philm ece6ca2bbc grub2: fix resume hook
filesystem: restore /run/var
2012-02-01 23:28:38 +01:00

220 lines
7.7 KiB
Bash

#
# Core Packages for Chakra, part of chakra-project.org
#
# maintainer (i686): Phil Miller <philm[at]chakra-project[dot]org
# maintainer (x86_64): Daniele Cocca <jmc[at]chakra-project[dot]org>
# The src pkg includes grub2_bzr_export.sh to create newer grub-extras snapshots. Modify the paths in it accordingly.
# _grub2_rev=3238
_grub2_lua_ver=20
_grub2_gpxe_ver=12
_grub2_ntldr_ver=17
_grub2_915_ver=7
pkgname=('grub2-common' 'grub2-bios' 'grub2-efi-x32')
pkgbase="grub2"
pkgver='1.99'
pkgrel=9
url="http://www.gnu.org/software/grub/"
arch=('i686' 'x86_64')
license=('GPL3')
epoch=1
makedepends=('bdf-unifont' 'python2' 'xz' 'autogen' 'texinfo' 'help2man' 'gettext' 'device-mapper')
options=(strip purge docs zipman !emptydirs)
# "http://alpha.gnu.org/gnu/grub/grub-${pkgver}.tar.xz"
source=("ftp://ftp.gnu.org/gnu/grub/grub-1.99.tar.xz"
"http://chakra-linux.org/sources/grub2/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
"http://chakra-linux.org/sources/grub2/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz"
"http://chakra-linux.org/sources/grub2/grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz"
"http://chakra-linux.org/sources/grub2/grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz"
'chakra_grub2_mkconfig_fixes.patch'
'resume-hook.patch'
'grub.default'
'20_memtest86+'
'grub2_bzr_export.sh'
'update-grub')
noextract=("grub2_extras_lua_r${_grub2_lua_ver}.tar.xz"
"grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz"
"grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz"
"grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz")
sha1sums=('a5ae9558f30ce7757a76aa130088b053a87e2fb6'
'd21ca5033f7069cbb36934cdb71f57a1c7829234'
'6c58eee654fa4eb7f057275b330710ffd4a9e989'
'0e50955141a45918fcf56f3a5e15fb477f0448a7'
'f2a5f1d5b75bd3286b63aefaf5e6553aa03e772b'
'3424cf1c43be5145e3b6be9e32c9217f07658a9a'
'af049daee1a93590ac13e73bbfb8b778f89ca1fb'
'01d35b970b672731c6cd4e05975adad11a3f6491'
'82a27eca5277218cf57c6c5767e0b17a72f62229'
'beb31419045db70fee7401aa6448c220a491e2a3'
'5770fbb559b1f463e1a735a1463d24af489bcc3e')
build() {
# set architecture dependent variables
_HOST="${CARCH}"
[ "${CARCH}" = 'i686' ] && _EFIEMU="--disable-efiemu"
[ "${CARCH}" = 'x86_64' ] && _EFIEMU="--enable-efiemu"
build_grub2-common_and_bios
build_grub2-efi
}
build_grub2-common_and_bios() {
# copy the source for building the common/bios package
cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub2_bios-${pkgver}"
## Apply Chakra specific fixes to enable grub2-mkconfig detect Chakra kernels and initramfs
cd "${srcdir}/grub2_bios-${pkgver}"
patch -Np1 -i "${srcdir}/chakra_grub2_mkconfig_fixes.patch"
# add the grub-extra sources
export GRUB_CONTRIB="${srcdir}/grub2_bios-${pkgver}/grub2-extras"
install -d "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz" \
-C "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz" \
-C "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_ntldr-img_r${_grub2_ntldr_ver}.tar.xz" \
-C "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_915resolution_r${_grub2_915_ver}.tar.xz" \
-C "${srcdir}/grub2_bios-${pkgver}/grub2-extras"
cd "${srcdir}/grub2_bios-${pkgver}"
## Need to use python2
sed -i 's|python|python2|' autogen.sh
# start the actual build process
./autogen.sh
## fix unifont.bdf location so grub-mkfont can create *.pf2 files
sed -i 's|/usr/share/fonts/unifont|/usr/share/fonts/misc|' configure
# mkdir ${srcdir}/grub2_bios-${pkgver}/BUILD_BIOS
# cd ${srcdir}/grub2_bios-${pkgver}/BUILD_BIOS
CFLAGS="" ./configure \
--with-platform=pc --enable-mm-debug \
"${_EFIEMU}" --host="${CARCH}-unknown-linux-gnu" \
--enable-grub-mkfont --prefix=/usr \
--bindir=/bin --sbindir=/sbin \
--mandir=/usr/share/man --infodir=/usr/share/info \
--sysconfdir=/etc --enable-nls \
--program-transform-name=s,grub,grub,
CFLAGS="" make
}
build_grub2-efi() {
# copy the source for building the efi package
cp -r "${srcdir}/grub-${pkgver}" "${srcdir}/grub2_efi-${pkgver}"
# add the grub-extra sources
export GRUB_CONTRIB="${srcdir}/grub2_efi-${pkgver}/grub2-extras"
install -d "${srcdir}/grub2_efi-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_lua_r${_grub2_lua_ver}.tar.xz" \
-C "${srcdir}/grub2_efi-${pkgver}/grub2-extras"
bsdtar xf "${srcdir}/grub2_extras_gpxe_r${_grub2_gpxe_ver}.tar.xz" \
-C "${srcdir}/grub2_efi-${pkgver}/grub2-extras"
cd "${srcdir}/grub2_efi-${pkgver}"
## Need to use python2
sed -i 's|python|python2|' autogen.sh
# start the actual build process
./autogen.sh
CFLAGS="" ./configure \
--with-platform=efi --target=i386 \
--enable-mm-debug --disable-efiemu \
--host="${CARCH}-unknown-linux-gnu" \
--prefix=/usr --bindir=/bin \
--sbindir=/sbin --mandir=/usr/share/man \
--infodir=/usr/share/info --sysconfdir=/etc \
--enable-nls --program-transform-name=s,grub,grub,
CFLAGS="" make
}
package_grub2-common() {
pkgdesc="The GNU GRand Unified Bootloader version 2 - Files common for all platforms"
install="grub2.install"
depends=('xz' 'freetype2' 'device-mapper' 'gettext' 'texinfo')
conflicts=('grub')
backup=('boot/grub/grub.cfg' 'etc/default/grub' 'etc/grub.d/40_custom')
cd "${srcdir}/grub2_bios-${pkgver}"
make DESTDIR="${pkgdir}" install
install -Dm755 "${pkgdir}/sbin/grub-install" "${pkgdir}/sbin/grub_bios-install"
install -Dm755 "${pkgdir}/sbin/grub-install" "${pkgdir}/sbin/grub_efi_x86_64-install"
install -Dm755 "${pkgdir}/sbin/grub-install" "${pkgdir}/sbin/grub_efi_i386-install"
# install update-burg script
install -Dm755 "${srcdir}/update-grub" "${pkgdir}/sbin/update-grub"
sed -i "s|^\(target_cpu\)=.*|\1=i386|; \
s|^\(platform\)=.*|\1=pc|" \
"${pkgdir}/sbin/grub_bios-install"
sed -i "s|^\(target_cpu\)=.*|\1=x86_64|; \
s|^\(platform\)=.*|\1=efi|" \
"${pkgdir}/sbin/grub_efi_x86_64-install"
sed -i "s|^\(target_cpu\)=.*|\1=i386|; \
s|^\(platform\)=.*|\1=efi|" \
"${pkgdir}/sbin/grub_efi_i386-install"
## install extra /etc/grub.d/ files
install -Dm755 "${srcdir}/20_memtest86+" "${pkgdir}/etc/grub.d/20_memtest86+"
## install /etc/default/grub (used by grub-mkconfig)
install -Dm644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
## create blank grub.cfg so it won't get removed on upgrade
mkdir -p "${pkgdir}/boot/grub"
touch "${pkgdir}/boot/grub/grub.cfg"
# remove platform specific files
rm -rf "${pkgdir}/usr/lib/grub/i386-pc"
# add resume-hook support
cd ${pkgdir}/sbin
patch -Np0 -i ${srcdir}/resume-hook.patch
}
package_grub2-bios() {
pkgdesc="The GNU GRand Unified Bootloader version 2 - Built for PC BIOS"
depends=("grub2-common=${pkgver}")
replaces=('grub2')
provides=('grub2')
cd "${srcdir}/grub2_bios-${pkgver}"
make DESTDIR="${pkgdir}" install
## remove non platform-specific files
rm -rf "${pkgdir}"/{boot,bin,sbin,etc,usr/share}
rm "${pkgdir}/usr/lib/grub"/{grub-mkconfig_lib,update-grub_lib}
}
package_grub2-efi-x32() {
pkgdesc="The GNU GRand Unified Bootloader version 2 - i386 UEFI version"
depends=("grub2-common=${pkgver}" 'dosfstools' 'efibootmgr')
optdepends=('mtools')
cd "${srcdir}/grub2_efi-${pkgver}"
make DESTDIR="${pkgdir}" install
## remove non platform-specific files
rm -rf "${pkgdir}"/{boot,bin,sbin,etc,usr/share}
rm "${pkgdir}/usr/lib/grub"/{grub-mkconfig_lib,update-grub_lib}
}
# vim:set ts=2 sw=2 et: