PKGBUILD 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. # Maintainer (Arch): Christian Hesse <mail@eworm.de>
  2. # Maintainer (Arch): Ronald van Haren <ronald.archlinux.org>
  3. # Contributor (Arch): Tobias Powalowski <tpowa@archlinux.org>
  4. # Contributor (Arch): Keshav Amburay <(the ddoott ridikulus ddoott rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
  5. # Maintainer (Hyperbola): André Silva <emulatorman@hyperbola.info>
  6. # Maintainer (Hyperbola): Márcio Silva <coadde@hyperbola.info>
  7. # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
  8. ## '1' to enable Xen support, '0' to disable
  9. _XEN='0'
  10. ## '1' to enable IA32-EFI build in Arch x86_64, '0' to disable
  11. _IA32_EFI_IN_ARCH_X64='1'
  12. ## '1' to enable IA32-XEN build in Arch x86_64, "0" to disable
  13. _IA32_XEN_IN_ARCH_X64='1'
  14. ## '1' to enable EMU build (x86_64 and i686 only), "0" to disable
  15. _GRUB_EMU_BUILD='0'
  16. [[ "${CARCH}" = 'armv7h' ]] && _EFI_ARCH='arm'
  17. [[ "${CARCH}" = 'x86_64' ]] && _EFI_ARCH='x86_64'
  18. [[ "${CARCH}" = 'i686' ]] && _EFI_ARCH='i386'
  19. [[ "${CARCH}" = 'x86_64' ]] && _XEN_ARCH='x86_64'
  20. [[ "${CARCH}" = 'i686' ]] && _XEN_ARCH='i386'
  21. [[ "${CARCH}" = 'armv7h' ]] && _EMU_ARCH='arm'
  22. [[ "${CARCH}" = 'x86_64' ]] && _EMU_ARCH='x86_64'
  23. [[ "${CARCH}" = 'i686' ]] && _EMU_ARCH='i386'
  24. pkgbase='grub'
  25. pkgname=('grub')
  26. [[ $CARCH = armv7h ]] && pkgname+=('grub-am335x_bone' 'grub-udoo' 'grub-omap3_beagle'
  27. 'grub-omap3_beagle_xm' 'grub-omap3_beagle_xm_ab')
  28. pkgdesc='GNU GRand Unified Bootloader (2), (Parabola rebranded)'
  29. epoch=2
  30. _tag='53c5000739db114c229fe69ec3d4b76b92441098' # git rev-parse grub-${_pkgver}
  31. _gnulib_commit='be584c56eb1311606e5ea1a36363b97bddb6eed3'
  32. _unifont_ver='13.0.06'
  33. _pkgver=2.06
  34. pkgver=${_pkgver/-/}
  35. pkgrel=1
  36. pkgrel+=.parabola1
  37. url='https://www.gnu.org/software/grub/'
  38. arch=('x86_64')
  39. arch+=('i686' 'armv7h')
  40. license=('GPL3')
  41. backup=('etc/default/grub'
  42. 'etc/grub.d/40_custom')
  43. install="${pkgname}.install"
  44. options=('!makeflags')
  45. makedepends=('git' 'rsync' 'xz' 'freetype2' 'ttf-dejavu' 'python' 'autogen'
  46. 'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse')
  47. depends=('sh' 'xz' 'gettext' 'device-mapper')
  48. optdepends=('freetype2: For grub-mkfont usage'
  49. 'fuse: For grub-mount usage')
  50. if [[ "${CARCH}" = 'x86_64' ]] && [[ "${_XEN}" = '1' ]]; then
  51. makedepends+=('xen')
  52. fi
  53. if [[ "${_GRUB_EMU_BUILD}" = "1" ]]; then
  54. makedepends+=('libusbx' 'sdl')
  55. fi
  56. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]]; then
  57. provides=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  58. conflicts=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-legacy' 'grub-parabola')
  59. replaces=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-parabola')
  60. elif [[ "${CARCH}" = 'armv7h' ]]; then
  61. provides=('grub-common' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  62. conflicts=('grub-common' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  63. replaces=('grub-common' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  64. fi
  65. validpgpkeys=('E53D497F3FA42AD8C9B4D1E835A93B74E82E4209' # Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
  66. 'BE5C23209ACDDACEB20DB0A28C8189F1988C2166' # Daniel Kiper <dkiper@net-space.pl>
  67. '95D2E9AB8740D8046387FD151A09227B1F435A33') #Paul Hardy
  68. source=("git+https://git.savannah.gnu.org/git/grub.git#tag=${_tag}?signed"
  69. "git+https://git.savannah.gnu.org/git/gnulib.git#commit=${_gnulib_commit}"
  70. "https://ftp.gnu.org/gnu/unifont/unifont-${_unifont_ver}/unifont-${_unifont_ver}.bdf.gz"{,.sig}
  71. '0003-10_linux-20_linux_xen-detect-parabola-initramfs.patch'
  72. '0001-00_header-add-GRUB_COLOR_-variables.patch'
  73. 'grub.default'
  74. '0003-10_linux-20_linux_xen-detect-am335x_bone+am335x_boneblack-devicetree-file.patch'
  75. '0003-10_linux-20_linux_xen-detect-omap3_beagle-devicetree-file.patch'
  76. '0003-10_linux-20_linux_xen-detect-omap3_beagle_xm-devicetree-file.patch'
  77. '0003-10_linux-20_linux_xen-detect-omap3_beagle_xm_ab-devicetree-file.patch'
  78. '0003-10_linux-20_linux_xen-detect-udoo-devicetree-file.patch'
  79. '0003-10_linux-20_linux_xen-rebrand-free-distros.patch')
  80. sha256sums=('SKIP'
  81. 'SKIP'
  82. 'b7668a5d498972dc4981250c49f83601babce797be19b4fdd0f2f1c6cfbd0fc5'
  83. 'SKIP'
  84. 'b32a28cb5b97b0bb139c0ee2199b81a2aba124c2ead9b01cfd4485fd2551257f'
  85. '5dee6628c48eef79812bb9e86ee772068d85e7fcebbd2b2b8d1e19d24eda9dab'
  86. 'ed6cf7d8efc391b9331322e4502f7469473a8ed05599c36e2b18f167b3cb7879'
  87. '0f2e9abaf872e1e18dfe0cd1da42bdc4f49d3956f97a01c39b82c0e3016c1a32'
  88. 'c0d84384db273d9fd6ea2aab2a9d8ba36402daf8daf591dcba329cfa02253c87'
  89. 'ef105dcc067c673e543d4d5384aa7bf6b93e9eca96fec4323ab69a91ec079f56'
  90. 'f5fb1673536d56a88b3d1aaec75501e4d0acca081ac658d1059ec276f9e062c6'
  91. 'd8911a513166d2db337b9449542e0ad0e91b114f92dc4b876d88d77d23829a1d'
  92. '7374137d183957ec8834ce749163c9fa98ff8ee61bbb74b0b38e29daf93857a4')
  93. _backports=(
  94. )
  95. _configure_options=(
  96. FREETYPE="pkg-config freetype2"
  97. --enable-mm-debug
  98. --enable-nls
  99. --enable-device-mapper
  100. --enable-cache-stats
  101. --enable-grub-mkfont
  102. --enable-grub-mount
  103. --prefix="/usr"
  104. --bindir="/usr/bin"
  105. --sbindir="/usr/bin"
  106. --mandir="/usr/share/man"
  107. --infodir="/usr/share/info"
  108. --datarootdir="/usr/share"
  109. --sysconfdir="/etc"
  110. --program-prefix=""
  111. --with-bootdir="/boot"
  112. --with-grubdir="grub"
  113. --disable-silent-rules
  114. --disable-werror
  115. )
  116. prepare() {
  117. cd "${srcdir}/grub/"
  118. echo "Apply backports..."
  119. local _c
  120. for _c in "${_backports[@]}"; do
  121. git log --oneline -1 "${_c}"
  122. git cherry-pick -n "${_c}"
  123. 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"
  127. echo "Patch to detect of Parabola GNU/Linux-libre initramfs images by grub-mkconfig..."
  128. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-parabola-initramfs.patch"
  129. echo "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme..."
  130. sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "configure.ac"
  131. echo "Rebranding for some free distros..."
  132. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-rebrand-free-distros.patch"
  133. echo "Fix mkinitcpio 'rw' FS#36275..."
  134. sed 's| ro | rw |g' -i "util/grub.d/10_linux.in"
  135. echo "Pull in latest language files..."
  136. ./linguas.sh
  137. echo "Avoid problem with unifont during compile of grub..."
  138. # http://savannah.gnu.org/bugs/?40330 and https://bugs.archlinux.org/task/37847
  139. gzip -cd "${srcdir}/unifont-${_unifont_ver}.bdf.gz" > "unifont.bdf"
  140. }
  141. _build_grub-efi() {
  142. echo "Copy the source for building the ${_EFI_ARCH} EFI part..."
  143. cp -r "${srcdir}/grub/" "${srcdir}/grub-efi-${_EFI_ARCH}/"
  144. cd "${srcdir}/grub-efi-${_EFI_ARCH}/"
  145. echo "Unset all compiler FLAGS for ${_EFI_ARCH} EFI build..."
  146. unset CFLAGS
  147. unset CPPFLAGS
  148. unset CXXFLAGS
  149. unset LDFLAGS
  150. unset MAKEFLAGS
  151. echo "Run bootstrap for ${_EFI_ARCH} EFI build..."
  152. ./bootstrap \
  153. --gnulib-srcdir="${srcdir}/gnulib/" \
  154. --no-git
  155. echo "Run ./configure for ${_EFI_ARCH} EFI build..."
  156. ./configure \
  157. --with-platform="efi" \
  158. --target="${_EFI_ARCH}" \
  159. --disable-efiemu \
  160. --enable-boot-time \
  161. "${_configure_options[@]}"
  162. echo "Run make for ${_EFI_ARCH} EFI build..."
  163. make
  164. }
  165. _build_grub-xen() {
  166. echo "Copy the source for building the ${_XEN_ARCH} XEN part..."
  167. cp -r "${srcdir}/grub/" "${srcdir}/grub-xen-${_XEN_ARCH}/"
  168. cd "${srcdir}/grub-xen-${_XEN_ARCH}/"
  169. echo "Unset all compiler FLAGS for ${_XEN_ARCH} XEN build..."
  170. unset CFLAGS
  171. unset CPPFLAGS
  172. unset CXXFLAGS
  173. unset LDFLAGS
  174. unset MAKEFLAGS
  175. echo "Run bootstrap for ${_XEN_ARCH} XEN build..."
  176. ./bootstrap \
  177. --gnulib-srcdir="${srcdir}/gnulib/" \
  178. --no-git
  179. echo "Run ./configure for ${_XEN_ARCH} XEN build..."
  180. ./configure \
  181. --with-platform='xen' \
  182. --target="${_XEN_ARCH}" \
  183. --disable-efiemu \
  184. --enable-boot-time \
  185. "${_configure_options[@]}"
  186. echo "Run make for ${_XEN_ARCH} XEN build..."
  187. make
  188. }
  189. _build_grub-bios() {
  190. echo 'Set ARCH dependent variables for BIOS build...'
  191. if [[ "${CARCH}" = 'x86_64' ]]; then
  192. _EFIEMU='--enable-efiemu'
  193. else
  194. _EFIEMU='--disable-efiemu'
  195. fi
  196. echo 'Copy the source for building the BIOS part...'
  197. cp -r "${srcdir}/grub/" "${srcdir}/grub-bios/"
  198. cd "${srcdir}/grub-bios/"
  199. echo 'Unset all compiler FLAGS for BIOS build...'
  200. unset CFLAGS
  201. unset CPPFLAGS
  202. unset CXXFLAGS
  203. unset LDFLAGS
  204. unset MAKEFLAGS
  205. echo 'Run bootstrap for BIOS build...'
  206. ./bootstrap \
  207. --gnulib-srcdir="${srcdir}/gnulib/" \
  208. --no-git
  209. echo 'Run ./configure for BIOS build...'
  210. ./configure \
  211. --with-platform='pc' \
  212. --target='i386' \
  213. "${_EFIEMU}" \
  214. --enable-boot-time \
  215. "${_configure_options[@]}"
  216. echo 'Run make for BIOS build...'
  217. make
  218. }
  219. _build_grub-qemu() {
  220. echo 'Copy the source for building the QEMU part...'
  221. cp -r "${srcdir}/grub/" "${srcdir}/grub-qemu/"
  222. cd "${srcdir}/grub-qemu/"
  223. echo 'Unset all compiler FLAGS for QEMU build...'
  224. unset CFLAGS
  225. unset CPPFLAGS
  226. unset CXXFLAGS
  227. unset LDFLAGS
  228. unset MAKEFLAGS
  229. echo 'Run bootstrap for QEMU build...'
  230. ./bootstrap \
  231. --gnulib-srcdir="${srcdir}/gnulib/" \
  232. --no-git
  233. echo 'Run ./configure for QEMU build...'
  234. ./configure \
  235. BUILD_FREETYPE="pkg-config freetype2" \
  236. --with-platform='qemu' \
  237. --target='i386' \
  238. --disable-efiemu \
  239. --enable-boot-time \
  240. "${_configure_options[@]}"
  241. echo 'Run make for QEMU build...'
  242. make
  243. }
  244. _build_grub-ieee1275() {
  245. echo 'Copy the source for building the IEEE1275 (OpenFirmware) part...'
  246. cp -r "${srcdir}/grub/" "${srcdir}/grub-ieee1275/"
  247. cd "${srcdir}/grub-ieee1275/"
  248. echo 'Unset all compiler FLAGS for IEEE1275 (OpenFirmware) build...'
  249. unset CFLAGS
  250. unset CPPFLAGS
  251. unset CXXFLAGS
  252. unset LDFLAGS
  253. unset MAKEFLAGS
  254. echo 'Run bootstrap for IEEE1275 (OpenFirmware) build...'
  255. ./bootstrap \
  256. --gnulib-srcdir="${srcdir}/gnulib/" \
  257. --no-git
  258. echo 'Run ./configure for IEEE1275 (OpenFirmware) build...'
  259. ./configure \
  260. --with-platform='ieee1275' \
  261. --target='i386' \
  262. --disable-efiemu \
  263. --enable-boot-time \
  264. "${_configure_options[@]}"
  265. echo 'Run make for IEEE1275 (OpenFirmware) build...'
  266. make
  267. }
  268. _build_grub-libreboot() {
  269. echo 'Copy the source for building the Libreboot part...'
  270. cp -r "${srcdir}/grub/" "${srcdir}/grub-libreboot/"
  271. cd "${srcdir}/grub-libreboot/"
  272. echo 'Unset all compiler FLAGS for Libreboot build...'
  273. unset CFLAGS
  274. unset CPPFLAGS
  275. unset CXXFLAGS
  276. unset LDFLAGS
  277. unset MAKEFLAGS
  278. echo 'Run bootstrap for Libreboot build...'
  279. ./bootstrap \
  280. --gnulib-srcdir="${srcdir}/gnulib/" \
  281. --no-git
  282. echo 'Run ./configure for Libreboot build...'
  283. ./configure \
  284. BUILD_FREETYPE="pkg-config freetype2" \
  285. --with-platform='coreboot' \
  286. --target='i386' \
  287. --disable-efiemu \
  288. --enable-boot-time \
  289. "${_configure_options[@]}"
  290. echo 'Run make for Libreboot build...'
  291. make
  292. }
  293. _build_grub-multiboot() {
  294. echo 'Copy the source for building the Multiboot part...'
  295. cp -r "${srcdir}/grub/" "${srcdir}/grub-multiboot/"
  296. cd "${srcdir}/grub-multiboot/"
  297. echo 'Unset all compiler FLAGS for Multiboot build...'
  298. unset CFLAGS
  299. unset CPPFLAGS
  300. unset CXXFLAGS
  301. unset LDFLAGS
  302. unset MAKEFLAGS
  303. echo 'Run bootstrap for Multiboot build...'
  304. ./bootstrap \
  305. --gnulib-srcdir="${srcdir}/gnulib/" \
  306. --no-git
  307. echo 'Run ./configure for Multiboot build...'
  308. ./configure \
  309. --with-platform='multiboot' \
  310. --target='i386' \
  311. --disable-efiemu \
  312. --enable-boot-time \
  313. "${_configure_options[@]}"
  314. echo 'Run make for Multiboot build...'
  315. make
  316. }
  317. _build_grub-emu() {
  318. echo 'Copy the source for building the emu part...'
  319. cp -r "${srcdir}/grub/" "${srcdir}/grub-emu/"
  320. cd "${srcdir}/grub-emu/"
  321. echo 'Unset all compiler FLAGS for emu build...'
  322. unset CFLAGS
  323. unset CPPFLAGS
  324. unset CXXFLAGS
  325. unset LDFLAGS
  326. unset MAKEFLAGS
  327. echo 'Run bootstrap for emu build...'
  328. ./bootstrap \
  329. --gnulib-srcdir="${srcdir}/gnulib/" \
  330. --no-git
  331. echo 'Run ./configure for emu build...'
  332. ./configure \
  333. --with-platform='emu' \
  334. --target="${_EMU_ARCH}" \
  335. --enable-grub-emu-usb=no \
  336. --enable-grub-emu-sdl=no \
  337. --disable-grub-emu-pci \
  338. "${_configure_options[@]}"
  339. echo 'Run make for emu build...'
  340. make
  341. }
  342. _build_grub-uboot() {
  343. echo "Copy the source for building the U-Boot part..."
  344. cp -r "${srcdir}/grub/" "${srcdir}/grub-uboot/"
  345. cd "${srcdir}/grub-uboot/"
  346. echo 'Unset all compiler FLAGS for U-Boot build...'
  347. unset CFLAGS
  348. unset CPPFLAGS
  349. unset CXXFLAGS
  350. unset LDFLAGS
  351. unset MAKEFLAGS
  352. #sed -i '\|grub_arm_disable_caches_mmu|,+4 d
  353. # ' grub-core/loader/arm/linux.c
  354. echo 'Run bootstrap for U-Boot build...'
  355. ./bootstrap \
  356. --gnulib-srcdir="${srcdir}/gnulib/" \
  357. --no-git
  358. echo 'Run ./configure for U-Boot build...'
  359. ./configure \
  360. --with-platform='uboot' \
  361. --target='arm' \
  362. --disable-efiemu \
  363. --enable-boot-time \
  364. "${_configure_options[@]}"
  365. echo 'Run make for U-Boot build...'
  366. make
  367. }
  368. build() {
  369. cd "${srcdir}/grub/"
  370. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]] || [[ "${CARCH}" = 'armv7h' ]]; then
  371. echo "Build grub ${_EFI_ARCH} EFI stuff..."
  372. _build_grub-efi
  373. if [[ "${CARCH}" = 'x86_64' ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" = '1' ]]; then
  374. echo 'Build grub i386 EFI stuff...'
  375. _EFI_ARCH='i386' _build_grub-efi
  376. fi
  377. fi
  378. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]]; then
  379. if [[ "${_XEN}" = '1' ]]; then
  380. echo "Build grub ${_XEN_ARCH} XEN stuff..."
  381. _build_grub-xen
  382. if [[ "${_IA32_XEN_IN_ARCH_X64}" = '1' ]]; then
  383. echo 'Build grub i386 XEN stuff...'
  384. _XEN_ARCH='i386' _build_grub-xen
  385. fi
  386. fi
  387. echo 'Build grub BIOS stuff...'
  388. _build_grub-bios
  389. echo 'Build grub QEMU stuff...'
  390. _build_grub-qemu
  391. echo 'Build grub IEEE1275 (OpenFirmware) stuff...'
  392. _build_grub-ieee1275
  393. echo 'Build grub Libreboot stuff...'
  394. _build_grub-libreboot
  395. echo 'Build grub Multiboot stuff...'
  396. _build_grub-multiboot
  397. elif [[ "${CARCH}" = 'armv7h' ]]; then
  398. echo 'Build grub U-Boot stuff...'
  399. _build_grub-uboot
  400. fi
  401. if [[ "${_GRUB_EMU_BUILD}" = '1' ]]; then
  402. echo 'Build grub emu stuff...'
  403. _build_grub-emu
  404. fi
  405. }
  406. _package_grub-efi() {
  407. cd "${srcdir}/grub-efi-${_EFI_ARCH}/"
  408. echo "Run make install for ${_EFI_ARCH} EFI build..."
  409. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  410. echo "Remove gdb debugging related files for ${_EFI_ARCH} EFI build..."
  411. rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.module || true
  412. rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.image || true
  413. rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/{kernel.exec,gdb_grub,gmodule.pl} || true
  414. }
  415. _package_grub-xen() {
  416. cd "${srcdir}/grub-xen-${_XEN_ARCH}/"
  417. echo "Run make install for ${_XEN_ARCH} XEN build..."
  418. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  419. echo "Remove gdb debugging related files for ${_XEN_ARCH} XEN build..."
  420. rm -f "${pkgdir}/usr/lib/grub/${_XEN_ARCH}-xen"/*.module || true
  421. rm -f "${pkgdir}/usr/lib/grub/${_XEN_ARCH}-xen"/*.image || true
  422. rm -f "${pkgdir}/usr/lib/grub/${_XEN_ARCH}-xen"/{kernel.exec,gdb_grub,gmodule.pl} || true
  423. }
  424. _package_grub-bios() {
  425. cd "${srcdir}/grub-bios/"
  426. echo 'Run make install for BIOS build...'
  427. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  428. echo 'Remove gdb debugging related files for BIOS build...'
  429. rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.module || true
  430. rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.image || true
  431. rm -f "${pkgdir}/usr/lib/grub/i386-pc"/{kernel.exec,gdb_grub,gmodule.pl} || true
  432. }
  433. _package_grub-qemu() {
  434. cd "${srcdir}/grub-qemu/"
  435. echo 'Run make install for QEMU build...'
  436. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  437. echo 'Remove gdb debugging related files for QEMU build...'
  438. rm -f "${pkgdir}/usr/lib/grub/i386-qemu"/*.module || true
  439. rm -f "${pkgdir}/usr/lib/grub/i386-qemu"/*.image || true
  440. rm -f "${pkgdir}/usr/lib/grub/i386-qemu"/{kernel.exec,gdb_grub,gmodule.pl} || true
  441. }
  442. _package_grub-ieee1275() {
  443. cd "${srcdir}/grub-ieee1275/"
  444. echo 'Run make install for IEEE1275 (OpenFirmware) build...'
  445. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  446. echo 'Remove gdb debugging related files for IEEE1275 (OpenFirmware) build...'
  447. rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.module || true
  448. rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.image || true
  449. rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/{kernel.exec,gdb_grub,gmodule.pl} || true
  450. }
  451. _package_grub-libreboot() {
  452. cd "${srcdir}/grub-libreboot/"
  453. echo 'Run make install for Libreboot build...'
  454. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  455. echo 'Remove gdb debugging related files for Libreboot build...'
  456. rm -f "${pkgdir}/usr/lib/grub/i386-coreboot"/*.module || true
  457. rm -f "${pkgdir}/usr/lib/grub/i386-coreboot"/*.image || true
  458. rm -f "${pkgdir}/usr/lib/grub/i386-coreboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  459. }
  460. _package_grub-multiboot() {
  461. cd "${srcdir}/grub-multiboot/"
  462. echo 'Run make install for Multiboot build...'
  463. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  464. echo 'Remove gdb debugging related files for Multiboot build...'
  465. rm -f "${pkgdir}/usr/lib/grub/i386-multiboot"/*.module || true
  466. rm -f "${pkgdir}/usr/lib/grub/i386-multiboot"/*.image || true
  467. rm -f "${pkgdir}/usr/lib/grub/i386-multiboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  468. }
  469. _package_grub-emu() {
  470. cd "${srcdir}/grub-emu/"
  471. echo 'Run make install for emu build...'
  472. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  473. echo 'Remove gdb debugging related files for emu build...'
  474. rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.module || true
  475. rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.image || true
  476. rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/{kernel.exec,gdb_grub,gmodule.pl} || true
  477. }
  478. _package_grub-uboot() {
  479. cd "${srcdir}/grub-uboot/"
  480. echo 'Run make install for U-Boot build...'
  481. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  482. echo 'Remove gdb debugging related files for U-Boot build...'
  483. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  484. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  485. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  486. }
  487. package_grub() {
  488. optdepends+=('dosfstools: For grub-mkrescue FAT FS and EFI support'
  489. 'efibootmgr: For grub-install EFI support'
  490. 'libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue'
  491. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  492. 'mtools: For grub-mkrescue FAT FS support')
  493. if [[ "${_GRUB_EMU_BUILD}" = '1' ]]; then
  494. optdepends+=('libusbx: For grub-emu USB support'
  495. 'sdl: For grub-emu SDL support')
  496. fi
  497. cd "${srcdir}/grub/"
  498. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]] || [[ "${CARCH}" = 'armv7h' ]]; then
  499. echo "Package grub ${_EFI_ARCH} EFI stuff..."
  500. _package_grub-efi
  501. if [[ "${CARCH}" = 'x86_64' ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" = '1' ]]; then
  502. echo 'Package grub i386 EFI stuff...'
  503. _EFI_ARCH='i386' _package_grub-efi
  504. fi
  505. fi
  506. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]]; then
  507. if [[ "${_XEN}" = '1' ]]; then
  508. echo "Package grub ${_XEN_ARCH} XEN stuff..."
  509. _package_grub-xen
  510. if [[ "${_IA32_XEN_IN_ARCH_X64}" = '1' ]]; then
  511. echo 'Package grub i386 XEN stuff...'
  512. _XEN_ARCH='i386' _package_grub-xen
  513. fi
  514. fi
  515. echo 'Package grub BIOS stuff...'
  516. _package_grub-bios
  517. echo 'Package grub QEMU stuff...'
  518. _package_grub-qemu
  519. echo 'Package grub IEEE1275 (OpenFirmware) stuff...'
  520. _package_grub-ieee1275
  521. echo 'Package grub Libreboot stuff...'
  522. _package_grub-libreboot
  523. echo 'Package grub Multiboot stuff...'
  524. _package_grub-multiboot
  525. elif [[ "${CARCH}" = 'armv7h' ]]; then
  526. echo 'Package grub U-Boot stuff...'
  527. _package_grub-uboot
  528. fi
  529. if [[ "${_GRUB_EMU_BUILD}" = '1' ]]; then
  530. echo 'Package grub emu stuff...'
  531. _package_grub-emu
  532. fi
  533. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  534. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  535. }
  536. package_grub-am335x_bone() {
  537. pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBone and BeagleBone Black (am335x-bone), (Parabola rebranded)'
  538. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  539. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  540. 'mtools: For grub-mkrescue FAT FS support')
  541. echo "Copy the source for packaging the U-Boot (am335x-bone) part..."
  542. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_am335x-bone/"
  543. cd "${srcdir}/grub-uboot_am335x-bone/"
  544. echo 'Patch to detect am335x-bone device tree blob file (dtb)...'
  545. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-am335x_bone+am335x_boneblack-devicetree-file.patch"
  546. echo 'Package grub U-Boot stuff...'
  547. ## _package_grub-uboot
  548. echo 'Run make install for U-Boot build...'
  549. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  550. echo 'Remove gdb debugging related files for U-Boot build...'
  551. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  552. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  553. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  554. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  555. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  556. ## echo 'Patch to detect am335x-bone device tree blob file (dtb)...'
  557. ## cd "${pkgdir}/etc/grub.d/"
  558. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-am335x_bone+am335x_boneblack-devicetree-file.patch"
  559. }
  560. package_grub-omap3_beagle() {
  561. pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBoard (omap3_beagle), (Parabola rebranded)'
  562. provides+=('grub-beagleboard')
  563. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  564. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  565. 'mtools: For grub-mkrescue FAT FS support')
  566. echo "Copy the source for packaging the U-Boot (omap3_beagle) part..."
  567. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_omap3_beagle/"
  568. cd "${srcdir}/grub-uboot_omap3_beagle/"
  569. echo 'Patch to detect omap3_beagle device tree blob file (dtb)...'
  570. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle-devicetree-file.patch"
  571. echo 'Package grub U-Boot stuff...'
  572. ## _package_grub-uboot
  573. echo 'Run make install for U-Boot build...'
  574. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  575. echo 'Remove gdb debugging related files for U-Boot build...'
  576. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  577. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  578. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  579. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  580. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  581. ## echo 'Patch to detect omap3_beagle device tree blob file (dtb)...'
  582. ## cd "${pkgdir}/etc/grub.d/"
  583. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle-devicetree-file.patch"
  584. }
  585. package_grub-omap3_beagle_xm() {
  586. pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBoard-xM (omap3_beagle_xm), (Parabola rebranded)'
  587. provides+=('grub-beagleboard')
  588. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  589. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  590. 'mtools: For grub-mkrescue FAT FS support')
  591. echo "Copy the source for packaging the U-Boot (omap3_beagle_xm) part..."
  592. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_omap3_beagle_xm/"
  593. cd "${srcdir}/grub-uboot_omap3_beagle_xm/"
  594. echo 'Patch to detect omap3_beagle_xm device tree blob file (dtb)...'
  595. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle_xm-devicetree-file.patch"
  596. echo 'Package grub U-Boot stuff...'
  597. ## _package_grub-uboot
  598. echo 'Run make install for U-Boot build...'
  599. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  600. echo 'Remove gdb debugging related files for U-Boot build...'
  601. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  602. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  603. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  604. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  605. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  606. ## echo 'Patch to detect omap3_beagle_xm device tree blob file (dtb)...'
  607. ## cd "${pkgdir}/etc/grub.d/"
  608. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle_xm-devicetree-file.patch"
  609. }
  610. package_grub-omap3_beagle_xm_ab() {
  611. pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBoard-xM rev A/B (omap3_beagle_xm_ab), (Parabola rebranded)'
  612. provides+=('grub-beagleboard')
  613. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  614. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  615. 'mtools: For grub-mkrescue FAT FS support')
  616. echo "Copy the source for packaging the U-Boot (omap3_beagle_xm_ab) part..."
  617. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_omap3_beagle_xm_ab/"
  618. cd "${srcdir}/grub-uboot_omap3_beagle_xm_ab/"
  619. echo 'Patch to detect omap3_beagle_xm_ab device tree blob file (dtb)...'
  620. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle_xm_ab-devicetree-file.patch"
  621. echo 'Package grub U-Boot stuff...'
  622. ## _package_grub-uboot
  623. echo 'Run make install for U-Boot build...'
  624. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  625. echo 'Remove gdb debugging related files for U-Boot build...'
  626. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  627. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  628. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  629. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  630. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  631. ## echo 'Patch to detect omap3_beagle_xm_ab device tree blob file (dtb)...'
  632. ## cd "${pkgdir}/etc/grub.d/"
  633. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle_xm_ab-devicetree-file.patch"
  634. }
  635. package_grub-udoo() {
  636. pkgdesc='GNU GRand Unified Bootloader (2) for UDOO (udoo), (Parabola rebranded)'
  637. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  638. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  639. 'mtools: For grub-mkrescue FAT FS support')
  640. echo "Copy the source for packaging the U-Boot (udoo) part..."
  641. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_udoo/"
  642. cd "${srcdir}/grub-uboot_udoo/"
  643. echo 'Patch to detect udoo device tree blob file (dtb)...'
  644. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-udoo-devicetree-file.patch"
  645. echo 'Package grub U-Boot stuff...'
  646. ## _package_grub-uboot
  647. echo 'Run make install for U-Boot build...'
  648. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  649. echo 'Remove gdb debugging related files for U-Boot build...'
  650. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  651. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  652. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  653. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  654. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  655. ## echo 'Patch to detect udoo device tree blob file (dtb)...'
  656. ## cd "${pkgdir}/etc/grub.d/"
  657. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-udoo-devicetree-file.patch"
  658. }