updated on Tue Jan 17 12:00:36 UTC 2012
[aur-mirror.git] / grub-legacy-gfx / PKGBUILD
blob70e3b19ab7b83b0657996680ca6ce226b6e35a04
1 # $Id: PKGBUILD 82656 2010-06-15 05:20:23Z allan $
2 # Maintainer: Ronald van Haren <ronald.archlinux.org>
3 # Contributor: Douglas Soares de Andrade <dsandrade@gmail.com>
4 # Contributor: judd <jvinet@zeroflux.org>
5 # Contributor: Mario A. Vazquez
6 # Contributor: Jerzy Goca <juras256@epf.pl>
7 # Contributor: Keshav P R
9 _pkgname="grub"
10 __pkgname="${_pkgname}-legacy"
12 # pkgname="${__pkgname}"    ## grub-Legacy without graphics support
13 pkgname="${__pkgname}-gfx"    ## grub-Legacy with graphics support
15 pkgver=0.97
17 ## pkgrel follows grub-legacy package in the official repo
18 pkgrel=18
20 pkgdesc="GNU GRand Unified Bootloader Legacy version compiled for BIOS systems"
22 if [ "${pkgname}" == "${__pkgname}-gfx" ]
23 then
24     pkgdesc="GNU GRand Unified Bootloader Legacy version compiled for BIOS systems - with Graphics support"
25     echo
28 arch=('i686' 'x86_64')
29 license=('GPL')
30 url="http://www.gnu.org/software/grub/grub-legacy.en.html"
31 # groups=('base')
32 makedepends=('ncurses')
33 depends=('bash' 'ncurses')
34 options=(strip docs !libtool !emptydirs zipman purge)
35 backup=('boot/grub/menu.lst')
36 install="${__pkgname}.install"
38 replaces=('grub')
39 provides=('grub')
41 if [ "${pkgname}" == "${__pkgname}-gfx" ]
42 then
43     conflicts=('grub' 'grub-legacy')
44     replaces=('grub-gfx')
45     provides=('grub' 'grub-legacy' 'grub-gfx')
48 source=("ftp://alpha.gnu.org/gnu/grub/grub-${pkgver}.tar.gz"
49         'menu.lst'
50         'install-grub'
51         '040_all_grub-0.96-nxstack.patch'
52         '05-grub-0.97-initrdaddr.diff'
53         'ext4.patch'
54         'grub-0.97-gpt.patch'
55         'grub-0.97-graphics.patch'
56         'grub-0.97-ldflags-objcopy-remove-build-id.patch'
57         'grub-inode-size.patch'
58         'i2o.patch'
59         'intelmac.patch'
60         'more-raid.patch'
61         'special-devices.patch'
62         'splash.xpm.gz')
64 sha1sums=('2580626c4579bd99336d3af4482c346c95dac4fb'
65           '885c39d2819620c70bcd91cb9203d0c9e19b886f'
66           'e88a68204c9c9d4bd0b50fa11cab789df4ac55f8'
67           '157b81dbad3576536b08642242accfa1aeb093a9'
68           'adbb4685c98797ffb4dc83561ec75698991dddbd'
69           'a36f34e51efed540f1ddafd78e9c9f6d83e4c8d4'
70           '6057a076110d469fb63e56e57711d281221f9b42'
71           '0ca831c79c9248cddeeaf055b9276bee14e78be9'
72           '61c4b58d2eaa3c1561d8e9d8fc41341ce8882869'
73           '0436aa6fa0b6f768289172f983a3f4b69384629e'
74           'f2e0dff29a7c8a45e90aa07298a1b2a9a9d29afc'
75           '066d7ab1ae442f88e94c9e4f1867ac6682965d06'
76           '45fe668a3779664fb292591f426976b6c784d6c8'
77           'c5e2c94ed0e759590b9eb38c9d979f075d19d7c0'
78           'd1d05c66170fa7ed0dee28cc13de162741debd25')
80 if [ "${CARCH}" == 'x86_64' ]
81 then
82     makedepends=(${makedepends[@]} 'gcc-multilib' 'gcc-libs-multilib' 'lib32-glibc' 'binutils-multilib' 'libtool-multilib')
83     echo
86 build() {
87   
88   cd "${srcdir}/${_pkgname}-${pkgver}"
89   
90   ## set destination architecture here
91   # DESTARCH="i686"
92   DESTARCH="x86_64"
93   
94   if [ "${pkgname}" == "${__pkgname}-gfx" ]
95   then
96       ## apply graphics patch
97       patch -Np1 -i "${srcdir}/grub-0.97-graphics.patch"
98       echo
99   fi
100   
101   ## optimizations break the build -- disable them
102   ## adding special devices to grub, patches are from fedora
103   patch -Np1 -i "${srcdir}/special-devices.patch"
104   patch -Np1 -i "${srcdir}/i2o.patch"
105   patch -Np1 -i "${srcdir}/more-raid.patch"
106   patch -Np1 -i "${srcdir}/intelmac.patch"
107   
108   ## Add support for bigger inode size to e2fs_stage1_5
109   patch -Np1 -i "${srcdir}/grub-inode-size.patch"
110   
111   ## Add ext4 support
112   ## http://www.mail-archive.com/bug-grub@gnu.org/msg11458.html
113   patch -Np1 -i "${srcdir}/ext4.patch"
114   
115   ## Objcopy and LDFLAGS remove build-id configure and Makefiles patch, taken from grub-fedora git repo
116   ## http://git.kernel.org/?p=boot/grub-fedora/grub-fedora.git;a=summary
117   patch -Np1 -i "${srcdir}/grub-0.97-ldflags-objcopy-remove-build-id.patch"
118   
119   ## correcting problems for new wersion of autotools
120   sed -e'/^AC_PROG_CC/ a\AM_PROG_CC_C_O\ ' -i "${srcdir}/${_pkgname}-${pkgver}/configure.ac" || true
121   sed -e'/^AC_PROG_CC/ a\AM_PROG_AS\ ' -i "${srcdir}/${_pkgname}-${pkgver}/configure.ac" || true
122   
123   ## recreate ./configure script with the required changes in LDFLAGS and objcopy
124   aclocal
125   autoconf
126   autoreconf
127   automake
128   
129   ## CFLAGS taken from grub-fedora
130   # _CFLAGS="-Os -g -fno-strict-aliasing -Wall -Wno-error -Wno-shadow -Wno-unused -Wno-pointer-sign -m32"
131   _CFLAGS="-Wall -Wno-error -Wno-unused -m32"
132   
133   # if [ "${CARCH}" == 'x86_64' ]
134   # then
135     #    echo "This package has to be built on i686, won't compile on x86_64 without multilib."
136     #    sleep 5
137   # fi
138   
139   if [ "${DESTARCH}" == 'x86_64' ]
140   then
141       _CFLAGS="${_CFLAGS} -static"
142       
143       ## patch from gentoo for fixing a segfault
144       patch -Np1 -i "${srcdir}/040_all_grub-0.96-nxstack.patch"
145       
146       ## patch from frugalware to make it boot when more than 2GB ram installed
147       patch -Np1 -i "${srcdir}/05-grub-0.97-initrdaddr.diff"
148   else
149       _CFLAGS="${_CFLAGS}"
150   fi
151   
152   CFLAGS="${_CFLAGS}" ./configure --host=i386-pc-linux-gnu \
153                                   --disable-auto-linux-mem-opt \
154                                   --prefix=/usr --bindir=/bin --sbindir=/sbin \
155                                   --mandir=/usr/share/man --infodir=/usr/share/info \
156                                   --libdir=/usr/lib
157   
158   CFLAGS="" make
159   
162 package() {
163   
164   cd "${srcdir}/${_pkgname}-${pkgver}"
165   
166   make DESTDIR="${pkgdir}" install
167   
168   install -D -m644 "${srcdir}/menu.lst" "${pkgdir}/boot/grub/menu.lst"
169   
170   if [ "${pkgname}" == "${__pkgname}-gfx" ]
171   then
172       ## install the splash image file
173       install -D -m644 "${srcdir}/splash.xpm.gz" "${pkgdir}/boot/grub/splash.xpm.gz"
174       echo
175   fi
176   
177   install -D -m755 "${srcdir}/install-grub" "${pkgdir}/sbin/install-grub"
178   
179   if [ "${DESTARCH}" == 'x86_64' ]
180   then
181       ## fool makepkg into building a x86_64 package
182       export CARCH="x86_64"
183       echo
184   fi
185