upgpkg: sbcl 2.2.9-1
[arch-packages.git] / grub / trunk / PKGBUILD
blob4d86cc1dda64f78d157244232bbf9f6dee030494
1 # Maintainer : Christian Hesse <mail@eworm.de>
2 # Maintainer : Ronald van Haren <ronald.archlinux.org>
3 # Contributor: Tobias Powalowski <tpowa@archlinux.org>
4 # Contributor: Keshav Amburay <(the ddoott ridikulus ddoott rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
6 ## "1" to enable IA32-EFI build in Arch x86_64, "0" to disable
7 _IA32_EFI_IN_ARCH_X64="1"
9 ## "1" to enable EMU build, "0" to disable
10 _GRUB_EMU_BUILD="0"
12 [[ "${CARCH}" == 'x86_64' ]] && _EFI_ARCH='x86_64'
13 [[ "${CARCH}" == 'i686' ]] && _EFI_ARCH='i386'
15 [[ "${CARCH}" == 'x86_64' ]] && _EMU_ARCH='x86_64'
16 [[ "${CARCH}" == 'i686' ]] && _EMU_ARCH='i386'
18 pkgname='grub'
19 pkgdesc='GNU GRand Unified Bootloader (2)'
20 epoch=2
21 _commit='34037747033879287864be289abb911a29751634'
22 _pkgver=2.06.r334.g340377470
23 _unifont_ver='15.0.01'
24 pkgver=${_pkgver/-/}
25 pkgrel=1
26 url='https://www.gnu.org/software/grub/'
27 arch=('x86_64')
28 license=('GPL3')
29 backup=('etc/default/grub'
30         'etc/grub.d/40_custom')
31 install="${pkgname}.install"
32 options=('!makeflags')
34 conflicts=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-legacy')
35 replaces=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}")
36 provides=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}")
38 makedepends=('git' 'rsync' 'xz' 'freetype2' 'ttf-dejavu' 'python' 'autogen'
39              'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse2')
40 depends=('sh' 'xz' 'gettext' 'device-mapper')
41 optdepends=('freetype2: For grub-mkfont usage'
42             'fuse2: For grub-mount usage'
43             'dosfstools: For grub-mkrescue FAT FS and EFI support'
44             'lzop: For grub-mkrescue LZO support'
45             'efibootmgr: For grub-install EFI support'
46             'libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue'
47             'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
48             'mtools: For grub-mkrescue FAT FS support')
50 if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then
51     makedepends+=('libusbx' 'sdl')
52     optdepends+=('libusbx: For grub-emu USB support'
53                  'sdl: For grub-emu SDL support')
56 validpgpkeys=('E53D497F3FA42AD8C9B4D1E835A93B74E82E4209'  # Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
57               'BE5C23209ACDDACEB20DB0A28C8189F1988C2166'  # Daniel Kiper <dkiper@net-space.pl>
58               '95D2E9AB8740D8046387FD151A09227B1F435A33') # Paul Hardy <unifoundry@unifoundry.com>
60 source=("git+https://git.savannah.gnu.org/git/grub.git#commit=${_commit}"
61         'git+https://git.savannah.gnu.org/git/gnulib.git'
62         "https://ftp.gnu.org/gnu/unifont/unifont-${_unifont_ver}/unifont-${_unifont_ver}.bdf.gz"{,.sig}
63         '0001-00_header-add-GRUB_COLOR_-variables.patch'
64         '0002-10_linux-detect-archlinux-initramfs.patch'
65         'grub.default'
66         'sbat.csv')
68 sha256sums=('SKIP'
69             'SKIP'
70             '1fddba900a36b8a067bf2177b05c4a2482a0f7ca1545cf531c03509f47ce1590'
71             'SKIP'
72             '5dee6628c48eef79812bb9e86ee772068d85e7fcebbd2b2b8d1e19d24eda9dab'
73             '8488aec30a93e8fe66c23ef8c23aefda39c38389530e9e73ba3fbcc8315d244d'
74             'c17bf255a41103f6b71a1710afc7e9addaebc578bcf51a48845e227b2f651682'
75             '98b23d41e223bdc0a6e20bdcb3aa77e642f29b64081b1fd2f575314172fc89df')
77 _backports=(
80 _reverts=(
83 _configure_options=(
84         PACKAGE_VERSION="${epoch}:${pkgver}-${pkgrel}"
85         FREETYPE="pkg-config freetype2"
86         BUILD_FREETYPE="pkg-config freetype2"
87         --enable-mm-debug
88         --enable-nls
89         --enable-device-mapper
90         --enable-cache-stats
91         --enable-grub-mkfont
92         --enable-grub-mount
93         --prefix="/usr"
94         --bindir="/usr/bin"
95         --sbindir="/usr/bin"
96         --mandir="/usr/share/man"
97         --infodir="/usr/share/info"
98         --datarootdir="/usr/share"
99         --sysconfdir="/etc"
100         --program-prefix=""
101         --with-bootdir="/boot"
102         --with-grubdir="grub"
103         --disable-silent-rules
104         --disable-werror
107 prepare() {
108         cd "${srcdir}/grub/"
110         echo "Apply backports..."
111         local _c
112         for _c in "${_backports[@]}"; do
113                 git log --oneline -1 "${_c}"
114                 git cherry-pick -n "${_c}"
115         done
117         echo "Apply reverts..."
118         local _c
119         for _c in "${_reverts[@]}"; do
120                 git log --oneline -1 "${_c}"
121                 git revert -n "${_c}"
122         done
124         echo "Patch to enable GRUB_COLOR_* variables in grub-mkconfig..."
125         ## Based on http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html
126         patch -Np1 -i "${srcdir}/0001-00_header-add-GRUB_COLOR_-variables.patch"
128         echo "Patch to detect of Arch Linux initramfs images by grub-mkconfig..."
129         patch -Np1 -i "${srcdir}/0002-10_linux-detect-archlinux-initramfs.patch"
131         echo "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme..."
132         sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "configure.ac"
134         echo "Fix mkinitcpio 'rw' FS#36275..."
135         sed 's| ro | rw |g' -i "util/grub.d/10_linux.in"
137         echo "Fix OS naming FS#33393..."
138         sed 's|GNU/Linux|Linux|' -i "util/grub.d/10_linux.in"
140         echo "Pull in latest language files..."
141         ./linguas.sh
143         echo "Avoid problem with unifont during compile of grub..."
144         # http://savannah.gnu.org/bugs/?40330 and https://bugs.archlinux.org/task/37847
145         gzip -cd "${srcdir}/unifont-${_unifont_ver}.bdf.gz" > "unifont.bdf"
147         echo "Run bootstrap..."
148         ./bootstrap \
149                 --gnulib-srcdir="${srcdir}/gnulib/" \
150                 --no-git
152         echo "Make translations reproducible..."
153         sed -i '1i /^PO-Revision-Date:/ d' po/*.sed
156 _build_grub-common_and_bios() {
157         echo "Set ARCH dependent variables for bios build..."
158         if [[ "${CARCH}" == 'x86_64' ]]; then
159                 _EFIEMU="--enable-efiemu"
160         else
161                 _EFIEMU="--disable-efiemu"
162         fi
164         echo "Copy the source for building the bios part..."
165         cp -r "${srcdir}/grub/" "${srcdir}/grub-bios/"
166         cd "${srcdir}/grub-bios/"
168         echo "Unset all compiler FLAGS for bios build..."
169         unset CFLAGS
170         unset CPPFLAGS
171         unset CXXFLAGS
172         unset LDFLAGS
173         unset MAKEFLAGS
175         echo "Run ./configure for bios build..."
176         ./configure \
177                 --with-platform="pc" \
178                 --target="i386" \
179                 "${_EFIEMU}" \
180                 --enable-boot-time \
181                 "${_configure_options[@]}"
183         if [ ! -z "${SOURCE_DATE_EPOCH}" ]; then
184                 echo "Make info pages reproducible..."
185                 touch -d "@${SOURCE_DATE_EPOCH}" $(find -name '*.texi')
186         fi
188         echo "Run make for bios build..."
189         make
192 _build_grub-efi() {
193         echo "Copy the source for building the ${_EFI_ARCH} efi part..."
194         cp -r "${srcdir}/grub/" "${srcdir}/grub-efi-${_EFI_ARCH}/"
195         cd "${srcdir}/grub-efi-${_EFI_ARCH}/"
197         echo "Unset all compiler FLAGS for ${_EFI_ARCH} efi build..."
198         unset CFLAGS
199         unset CPPFLAGS
200         unset CXXFLAGS
201         unset LDFLAGS
202         unset MAKEFLAGS
204         echo "Run ./configure for ${_EFI_ARCH} efi build..."
205         ./configure \
206                 --with-platform="efi" \
207                 --target="${_EFI_ARCH}" \
208                 --disable-efiemu \
209                 --enable-boot-time \
210                 "${_configure_options[@]}"
212         echo "Run make for ${_EFI_ARCH} efi build..."
213         make
216 _build_grub-emu() {
217         echo "Copy the source for building the emu part..."
218         cp -r "${srcdir}/grub/" "${srcdir}/grub-emu/"
219         cd "${srcdir}/grub-emu/"
221         echo "Unset all compiler FLAGS for emu build..."
222         unset CFLAGS
223         unset CPPFLAGS
224         unset CXXFLAGS
225         unset LDFLAGS
226         unset MAKEFLAGS
228         echo "Run ./configure for emu build..."
229         ./configure \
230                 --with-platform="emu" \
231                 --target="${_EMU_ARCH}" \
232                 --enable-grub-emu-usb=no \
233                 --enable-grub-emu-sdl=no \
234                 --disable-grub-emu-pci \
235                 "${_configure_options[@]}"
237         echo "Run make for emu build..."
238         make
241 build() {
242         cd "${srcdir}/grub/"
244         echo "Build grub bios stuff..."
245         _build_grub-common_and_bios
247         echo "Build grub ${_EFI_ARCH} efi stuff..."
248         _build_grub-efi
250         if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then
251                 echo "Build grub i386 efi stuff..."
252                 _EFI_ARCH="i386" _build_grub-efi
253         fi
255         if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then
256                 echo "Build grub emu stuff..."
257                 _build_grub-emu
258         fi
261 _package_grub-common_and_bios() {
262         cd "${srcdir}/grub-bios/"
264         echo "Run make install for bios build..."
265         make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
267         echo "Remove gdb debugging related files for bios build..."
268         rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.module || true
269         rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.image || true
270         rm -f "${pkgdir}/usr/lib/grub/i386-pc"/{kernel.exec,gdb_grub,gmodule.pl} || true
272         echo "Install /etc/default/grub (used by grub-mkconfig)..."
273         install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
276 _package_grub-efi() {
277         cd "${srcdir}/grub-efi-${_EFI_ARCH}/"
279         echo "Run make install for ${_EFI_ARCH} efi build..."
280         make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
282         echo "Remove gdb debugging related files for ${_EFI_ARCH} efi build..."
283         rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.module || true
284         rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.image || true
285         rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/{kernel.exec,gdb_grub,gmodule.pl} || true
287         sed -e "s/%PKGVER%/${epoch}:${pkgver}-${pkgrel}/" < "${srcdir}/sbat.csv" > "${pkgdir}/usr/share/grub/sbat.csv"
290 _package_grub-emu() {
291         cd "${srcdir}/grub-emu/"
293         echo "Run make install for emu build..."
294         make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
296         echo "Remove gdb debugging related files for emu build..."
297         rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.module || true
298         rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.image || true
299         rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/{kernel.exec,gdb_grub,gmodule.pl} || true
302 package() {
303         cd "${srcdir}/grub/"
305         echo "Package grub ${_EFI_ARCH} efi stuff..."
306         _package_grub-efi
308         if [[ "${CARCH}" == "x86_64" ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" == "1" ]]; then
309                 echo "Package grub i386 efi stuff..."
310                 _EFI_ARCH="i386" _package_grub-efi
311         fi
313         if [[ "${_GRUB_EMU_BUILD}" == "1" ]]; then
314                 echo "Package grub emu stuff..."
315                 _package_grub-emu
316         fi
318         echo "Package grub bios stuff..."
319         _package_grub-common_and_bios