summaryrefslogtreecommitdiffstats
path: root/abs/core/grub/PKGBUILD
blob: 38c6a2874020bd885de6391798a67dbea24b325c (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# $Id: PKGBUILD 22874 2008-12-29 18:25:08Z tpowa $
# Maintainer: Ronald van Haren <ronald.archlinux.org>

pkgname=grub
pkgver=0.97
pkgrel=31
pkgdesc="A GNU multiboot boot loader"
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.gnu.org/software/grub/"
groups=('base')
depends=('ncurses' 'diffutils' 'sed')
source=(ftp://alpha.gnu.org/gnu/grub/grub-$pkgver.tar.gz
        menu.lst
        install-grub
        040_all_grub-0.96-nxstack.patch
        05-grub-0.97-initrdaddr.diff
        i2o.patch
        special-devices.patch
        more-raid.patch
        intelmac.patch
        grub-inode-size.patch
	ext4.patch)
backup=('boot/grub/menu.lst')
install=grub.install

build() {
  cd $srcdir/$pkgname-$pkgver

  #set destination architecture here
  DESTARCH="i686"
  #DESTARCH="x86_64"
  # optimizations break the build -- disable them
  # adding special devices to grub, patches are from fedora
  patch -Np1 -i ../special-devices.patch || return 1
  patch -Np1 -i ../i2o.patch || return 1
  patch -Np1 -i ../more-raid.patch || return 1
  patch -Np1 -i ../intelmac.patch || return 1
  # Add support for bigger inode size to e2fs_stage1_5
  patch -Np1 -i ../grub-inode-size.patch || return 1
  # Add ext4 support
  # http://www.mail-archive.com/bug-grub@gnu.org/msg11458.html
  patch -Np1 -i ../ext4.patch || return 1

  #arch64 fixes for static build
  if [ "$CARCH" = "x86_64" ]; then
    echo "this package has to be built on i686, won't compile on x86_64"
    sleep 5
  else
    if [ "$DESTARCH" = "x86_64" ]; then
      # patch from gentoo for fixing a segfault
      patch -Np1 -i ../040_all_grub-0.96-nxstack.patch || return 1
      # patch from frugalware to make it boot when more than 2GB ram installed
      patch -Np1 -i ../05-grub-0.97-initrdaddr.diff || return 1
      CFLAGS="-static" ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin \
                           --mandir=/usr/share/man --infodir=/usr/share/info
    else
      CFLAGS= ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin \
                  --mandir=/usr/share/man --infodir=/usr/share/info
    fi
  fi

  CFLAGS= make || return 1
  make DESTDIR=$pkgdir install || return 1
  install -D -m644 ../menu.lst $startdir/pkg/boot/grub/menu.lst
  install -D -m755 ../install-grub $startdir/pkg/sbin/install-grub
 
  rm -f $pkgdir/usr/share/info/dir || return 1
  gzip /$pkgdir/usr/share/info/*

  if [ "$DESTARCH" = "x86_64" ]; then
    # fool makepkg into building a x86_64 package
    export CARCH="x86_64"
  fi
}