PKGBUILD 28 KB

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