PKGBUILD 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  1. # Maintainer (arch): Christian Hesse <mail@eworm.de>
  2. # Maintainer (arch): 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)>
  5. # Contributor: André Silva <emulatorman@hyperbola.info>
  6. # Contributor: 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. _UNIFONT_VER="12.1.02"
  17. [[ "${CARCH}" = "armv7h" ]] && _EFI_ARCH="arm"
  18. [[ "${CARCH}" = "x86_64" ]] && _EFI_ARCH="x86_64"
  19. [[ "${CARCH}" = "i686" ]] && _EFI_ARCH="i386"
  20. [[ "${CARCH}" = "x86_64" ]] && _XEN_ARCH="x86_64"
  21. [[ "${CARCH}" = "i686" ]] && _XEN_ARCH="i386"
  22. [[ "${CARCH}" = "armv7h" ]] && _EMU_ARCH="arm"
  23. [[ "${CARCH}" = "x86_64" ]] && _EMU_ARCH="x86_64"
  24. [[ "${CARCH}" = "i686" ]] && _EMU_ARCH="i386"
  25. pkgbase='grub'
  26. pkgname=('grub-crypt-git')
  27. [[ $CARCH = armv7h ]] && pkgname+=('grub-crypt-git-am335x_bone'
  28. 'grub-crypt-git-udoo'
  29. 'grub-crypt-git-omap3_beagle'
  30. 'grub-crypt-git-omap3_beagle_xm'
  31. 'grub-crypt-git-omap3_beagle_xm_ab')
  32. # GRUB crypt are a set of patches that are available at
  33. # https://grub.johnlane.ie/ however as they are not upstream.
  34. #
  35. # As distributions like ubuntu used them, the patches also ended up in Trisquel.
  36. # The consequence is that organizations like the FSF started depending on these
  37. # patches in their infrastructure which results in having only Trisquel
  38. # supported in the virtual machines that are provided to projects like
  39. # Replicant.
  40. #
  41. # To be able to use other distributions than Trisquel (like Guix or Parabola) we
  42. # needed such patches and upstreaming those that we needed was a saner decision
  43. # than maintaining ethernally these patches in every distributions we wanted to
  44. # use.
  45. #
  46. # As I need to test the patches anyway and that compiling and testing GRUB by
  47. # hand is time consuming, I ended up making a PKGBUILD to make testing faster.
  48. #
  49. # As the patches are interesting per se I added this PKGBUILD to Parabola, and
  50. # it will need to be replaced by a grub-git package once they land in GRUB
  51. # master and removed when we have a release of GRUB that incorporates the
  52. # patches.
  53. #
  54. # Note that not all GRUB crypt patches were sent upstream. Only the support
  55. # for LUKS1 detached headers and detached key files were sent.
  56. pkgdesc='GRUB with pending patches for detached header and key files.'
  57. _pkgver=2.04
  58. pkgver=${_pkgver/-/}
  59. pkgrel=2
  60. pkgrel+=.par1
  61. epoch=2
  62. url='https://www.gnu.org/software/grub/'
  63. arch=('x86_64')
  64. arch+=('i686' 'armv7h')
  65. license=('GPL3')
  66. backup=('etc/default/grub'
  67. 'etc/grub.d/40_custom')
  68. install="${pkgbase}.install"
  69. options=('!makeflags')
  70. makedepends=('git' 'rsync' 'xz' 'freetype2' 'ttf-dejavu' 'python' 'autogen'
  71. 'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse')
  72. depends=('sh' 'xz' 'gettext' 'device-mapper')
  73. optdepends=('freetype2: For grub-mkfont usage'
  74. 'fuse: For grub-mount usage')
  75. if [[ "${CARCH}" = 'x86_64' ]] && [[ "${_XEN}" = '1' ]]; then
  76. makedepends+=('xen')
  77. fi
  78. if [[ "${_GRUB_EMU_BUILD}" = "1" ]]; then
  79. makedepends+=('libusbx' 'sdl')
  80. fi
  81. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]]; then
  82. provides=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  83. conflicts=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-legacy' 'grub-parabola')
  84. replaces=('grub-common' 'grub-bios' 'grub-emu' "grub-efi-${_EFI_ARCH}" 'grub-parabola')
  85. elif [[ "${CARCH}" = 'armv7h' ]]; then
  86. provides=('grub-common' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  87. conflicts=('grub-common' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  88. replaces=('grub-common' 'grub-emu' "grub-efi-${_EFI_ARCH}")
  89. fi
  90. validpgpkeys=('E53D497F3FA42AD8C9B4D1E835A93B74E82E4209' # Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
  91. 'BE5C23209ACDDACEB20DB0A28C8189F1988C2166' # Daniel Kiper <dkiper@net-space.pl>
  92. '95D2E9AB8740D8046387FD151A09227B1F435A33') #Paul Hardy
  93. source=("git+https://git.savannah.gnu.org/git/grub.git"
  94. "git+https://git.savannah.gnu.org/git/grub-extras.git"
  95. "git+https://git.savannah.gnu.org/git/gnulib.git"
  96. "https://ftp.gnu.org/gnu/unifont/unifont-${_UNIFONT_VER}/unifont-${_UNIFONT_VER}.bdf.gz"{,.sig}
  97. '0003-10_linux-20_linux_xen-detect-parabola-initramfs.patch'
  98. '0004-add-GRUB_COLOR_variables.patch'
  99. 'grub.default'
  100. '0003-10_linux-20_linux_xen-detect-am335x_bone+am335x_boneblack-devicetree-file.patch'
  101. '0003-10_linux-20_linux_xen-detect-omap3_beagle-devicetree-file.patch'
  102. '0003-10_linux-20_linux_xen-detect-omap3_beagle_xm-devicetree-file.patch'
  103. '0003-10_linux-20_linux_xen-detect-omap3_beagle_xm_ab-devicetree-file.patch'
  104. '0003-10_linux-20_linux_xen-detect-udoo-devicetree-file.patch'
  105. '0003-10_linux-20_linux_xen-rebrand-free-distros.patch'
  106. 'v6-0001-cryptodisk-luks-unify-grub_cryptodisk_dev-functio.patch'
  107. 'v6-0002-cryptodisk-geli-unify-grub_cryptodisk_dev-functio.patch'
  108. 'v6-0003-cryptodisk-enable-the-backends-to-implement-detac.patch'
  109. 'v6-0004-cryptodisk-add-support-for-LUKS1-detached-headers.patch'
  110. 'v6-0005-cryptodisk-enable-the-backends-to-implement-key-f.patch'
  111. 'v6-0006-cryptodisk-Add-support-for-LUKS1-key-files.patch')
  112. sha256sums=('SKIP'
  113. 'SKIP'
  114. 'SKIP'
  115. '04d652be1e28a6d464965c75c71ac84633085cd0960c2687466651c34c94bd89'
  116. 'SKIP'
  117. '3f68a78ecba0284b9d39af60431236cb2ebc8547d3dc1fb26a1ac7a6b9afbbc7'
  118. 'a5198267ceb04dceb6d2ea7800281a42b3f91fd02da55d2cc9ea20d47273ca29'
  119. 'c700a3a2e0bdb47620a78b454aaa4bbf52989102eb47b08672240192e91b2a57'
  120. '9ece1db537a989ce4dc55ece471883e19b8ab16902f8c4feb68436c3b5700f71'
  121. 'de71452b9b0fbfb08ea742e9fa217ab34fddf6312452f155fb9d82ebf1c024a5'
  122. '222da944b4af43a1d86be0e3d91f2e1a82324fa51c7ad36cc25246ffa3739ab1'
  123. '9002c69e74143553ef8cdd32ca04e8bdcb7a1a0ba1c4564163bae061fe68d855'
  124. '6584a0dda9dbf6d70dbdfba619abbb628b1a092bd61d6d05e462d6771354223b'
  125. '7374137d183957ec8834ce749163c9fa98ff8ee61bbb74b0b38e29daf93857a4'
  126. 'SKIP'
  127. 'SKIP'
  128. 'SKIP'
  129. 'SKIP'
  130. 'SKIP'
  131. 'SKIP')
  132. _backports=(
  133. )
  134. _configure_options=(
  135. FREETYPE="pkg-config freetype2"
  136. --enable-mm-debug
  137. --enable-nls
  138. --enable-device-mapper
  139. --enable-cache-stats
  140. --enable-grub-mkfont
  141. --enable-grub-mount
  142. --prefix="/usr"
  143. --bindir="/usr/bin"
  144. --sbindir="/usr/bin"
  145. --mandir="/usr/share/man"
  146. --infodir="/usr/share/info"
  147. --datarootdir="/usr/share"
  148. --sysconfdir="/etc"
  149. --program-prefix=""
  150. --with-bootdir="/boot"
  151. --with-grubdir="grub"
  152. --disable-silent-rules
  153. --disable-werror
  154. )
  155. prepare() {
  156. cd "${srcdir}/grub/"
  157. echo "Apply backports..."
  158. local _c
  159. for _c in "${_backports[@]}"; do
  160. git log --oneline -1 "${_c}"
  161. git cherry-pick -n "${_c}"
  162. done
  163. echo "Patch to detect of Parabola GNU/Linux-libre initramfs images by grub-mkconfig..."
  164. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-parabola-initramfs.patch"
  165. echo "Patch to enable GRUB_COLOR_* variables in grub-mkconfig..."
  166. ## Based on http://lists.gnu.org/archive/html/grub-devel/2012-02/msg00021.html
  167. patch -Np1 -i "${srcdir}/0004-add-GRUB_COLOR_variables.patch"
  168. echo "Fix DejaVuSans.ttf location so that grub-mkfont can create *.pf2 files for starfield theme..."
  169. sed 's|/usr/share/fonts/dejavu|/usr/share/fonts/dejavu /usr/share/fonts/TTF|g' -i "configure.ac"
  170. echo "Rebranding for some free distros..."
  171. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-rebrand-free-distros.patch"
  172. echo "Fix mkinitcpio 'rw' FS#36275..."
  173. sed 's| ro | rw |g' -i "util/grub.d/10_linux.in"
  174. echo "Pull in latest language files..."
  175. ./linguas.sh
  176. echo "Remove not working langs which need LC_ALL=C.UTF-8..."
  177. sed -e 's#en@cyrillic en@greek##g' -i "po/LINGUAS"
  178. echo "Avoid problem with unifont during compile of grub..."
  179. # http://savannah.gnu.org/bugs/?40330 and https://bugs.archlinux.org/task/37847
  180. gzip -cd "${srcdir}/unifont-${_UNIFONT_VER}.bdf.gz" > "unifont.bdf"
  181. echo "Add the grub-extra sources for BIOS build..."
  182. install -d "grub-extras"
  183. cp -r "${srcdir}/grub-extras/915resolution" \
  184. "grub-extras/915resolution"
  185. export GRUB_CONTRIB="${srcdir}/grub/grub-extras/"
  186. }
  187. _build_grub-efi() {
  188. echo "Copy the source for building the ${_EFI_ARCH} EFI part..."
  189. cp -r "${srcdir}/grub/" "${srcdir}/grub-efi-${_EFI_ARCH}/"
  190. cd "${srcdir}/grub-efi-${_EFI_ARCH}/"
  191. echo "Unset all compiler FLAGS for ${_EFI_ARCH} EFI build..."
  192. unset CFLAGS
  193. unset CPPFLAGS
  194. unset CXXFLAGS
  195. unset LDFLAGS
  196. unset MAKEFLAGS
  197. echo "Run bootstrap for ${_EFI_ARCH} EFI build..."
  198. ./bootstrap \
  199. --gnulib-srcdir="${srcdir}/gnulib/" \
  200. --no-git
  201. echo "Run ./configure for ${_EFI_ARCH} EFI build..."
  202. ./configure \
  203. --with-platform="efi" \
  204. --target="${_EFI_ARCH}" \
  205. --disable-efiemu \
  206. --enable-boot-time \
  207. "${_configure_options[@]}"
  208. echo "Run make for ${_EFI_ARCH} EFI build..."
  209. make
  210. }
  211. _build_grub-xen() {
  212. echo "Copy the source for building the ${_XEN_ARCH} XEN part..."
  213. cp -r "${srcdir}/grub/" "${srcdir}/grub-xen-${_XEN_ARCH}/"
  214. cd "${srcdir}/grub-xen-${_XEN_ARCH}/"
  215. echo "Unset all compiler FLAGS for ${_XEN_ARCH} XEN build..."
  216. unset CFLAGS
  217. unset CPPFLAGS
  218. unset CXXFLAGS
  219. unset LDFLAGS
  220. unset MAKEFLAGS
  221. echo "Run bootstrap for ${_XEN_ARCH} XEN build..."
  222. ./bootstrap \
  223. --gnulib-srcdir="${srcdir}/gnulib/" \
  224. --no-git
  225. echo "Run ./configure for ${_XEN_ARCH} XEN build..."
  226. ./configure \
  227. --with-platform='xen' \
  228. --target="${_XEN_ARCH}" \
  229. --disable-efiemu \
  230. --enable-boot-time \
  231. "${_configure_options[@]}"
  232. echo "Run make for ${_XEN_ARCH} XEN build..."
  233. make
  234. }
  235. _build_grub-bios() {
  236. echo 'Set ARCH dependent variables for BIOS build...'
  237. if [[ "${CARCH}" = 'x86_64' ]]; then
  238. _EFIEMU='--enable-efiemu'
  239. else
  240. _EFIEMU='--disable-efiemu'
  241. fi
  242. echo 'Copy the source for building the BIOS part...'
  243. cp -r "${srcdir}/grub/" "${srcdir}/grub-bios/"
  244. cd "${srcdir}/grub-bios/"
  245. echo 'Unset all compiler FLAGS for BIOS build...'
  246. unset CFLAGS
  247. unset CPPFLAGS
  248. unset CXXFLAGS
  249. unset LDFLAGS
  250. unset MAKEFLAGS
  251. echo 'Run bootstrap for BIOS build...'
  252. ./bootstrap \
  253. --gnulib-srcdir="${srcdir}/gnulib/" \
  254. --no-git
  255. echo 'Run ./configure for BIOS build...'
  256. ./configure \
  257. --with-platform='pc' \
  258. --target='i386' \
  259. "${_EFIEMU}" \
  260. --enable-boot-time \
  261. "${_configure_options[@]}"
  262. echo 'Run make for BIOS build...'
  263. make
  264. }
  265. _build_grub-qemu() {
  266. echo 'Copy the source for building the QEMU part...'
  267. cp -r "${srcdir}/grub/" "${srcdir}/grub-qemu/"
  268. cd "${srcdir}/grub-qemu/"
  269. echo 'Unset all compiler FLAGS for QEMU build...'
  270. unset CFLAGS
  271. unset CPPFLAGS
  272. unset CXXFLAGS
  273. unset LDFLAGS
  274. unset MAKEFLAGS
  275. echo 'Run bootstrap for QEMU build...'
  276. ./bootstrap \
  277. --gnulib-srcdir="${srcdir}/gnulib/" \
  278. --no-git
  279. echo 'Run ./configure for QEMU build...'
  280. ./configure \
  281. BUILD_FREETYPE="pkg-config freetype2" \
  282. --with-platform='qemu' \
  283. --target='i386' \
  284. --disable-efiemu \
  285. --enable-boot-time \
  286. "${_configure_options[@]}"
  287. echo 'Run make for QEMU build...'
  288. make
  289. }
  290. _build_grub-ieee1275() {
  291. echo 'Copy the source for building the IEEE1275 (OpenFirmware) part...'
  292. cp -r "${srcdir}/grub/" "${srcdir}/grub-ieee1275/"
  293. cd "${srcdir}/grub-ieee1275/"
  294. echo 'Unset all compiler FLAGS for IEEE1275 (OpenFirmware) build...'
  295. unset CFLAGS
  296. unset CPPFLAGS
  297. unset CXXFLAGS
  298. unset LDFLAGS
  299. unset MAKEFLAGS
  300. echo 'Run bootstrap for IEEE1275 (OpenFirmware) build...'
  301. ./bootstrap \
  302. --gnulib-srcdir="${srcdir}/gnulib/" \
  303. --no-git
  304. echo 'Run ./configure for IEEE1275 (OpenFirmware) build...'
  305. ./configure \
  306. --with-platform='ieee1275' \
  307. --target='i386' \
  308. --disable-efiemu \
  309. --enable-boot-time \
  310. "${_configure_options[@]}"
  311. echo 'Run make for IEEE1275 (OpenFirmware) build...'
  312. make
  313. }
  314. _build_grub-libreboot() {
  315. echo 'Copy the source for building the Libreboot part...'
  316. cp -r "${srcdir}/grub/" "${srcdir}/grub-libreboot/"
  317. cd "${srcdir}/grub-libreboot/"
  318. echo 'Unset all compiler FLAGS for Libreboot build...'
  319. unset CFLAGS
  320. unset CPPFLAGS
  321. unset CXXFLAGS
  322. unset LDFLAGS
  323. unset MAKEFLAGS
  324. echo 'Run bootstrap for Libreboot build...'
  325. ./bootstrap \
  326. --gnulib-srcdir="${srcdir}/gnulib/" \
  327. --no-git
  328. echo 'Run ./configure for Libreboot build...'
  329. ./configure \
  330. BUILD_FREETYPE="pkg-config freetype2" \
  331. --with-platform='coreboot' \
  332. --target='i386' \
  333. --disable-efiemu \
  334. --enable-boot-time \
  335. "${_configure_options[@]}"
  336. echo 'Run make for Libreboot build...'
  337. make
  338. }
  339. _build_grub-multiboot() {
  340. echo 'Copy the source for building the Multiboot part...'
  341. cp -r "${srcdir}/grub/" "${srcdir}/grub-multiboot/"
  342. cd "${srcdir}/grub-multiboot/"
  343. echo 'Unset all compiler FLAGS for Multiboot build...'
  344. unset CFLAGS
  345. unset CPPFLAGS
  346. unset CXXFLAGS
  347. unset LDFLAGS
  348. unset MAKEFLAGS
  349. echo 'Run bootstrap for Multiboot build...'
  350. ./bootstrap \
  351. --gnulib-srcdir="${srcdir}/gnulib/" \
  352. --no-git
  353. echo 'Run ./configure for Multiboot build...'
  354. ./configure \
  355. --with-platform='multiboot' \
  356. --target='i386' \
  357. --disable-efiemu \
  358. --enable-boot-time \
  359. "${_configure_options[@]}"
  360. echo 'Run make for Multiboot build...'
  361. make
  362. }
  363. _build_grub-emu() {
  364. echo 'Copy the source for building the emu part...'
  365. cp -r "${srcdir}/grub/" "${srcdir}/grub-emu/"
  366. cd "${srcdir}/grub-emu/"
  367. echo 'Unset all compiler FLAGS for emu build...'
  368. unset CFLAGS
  369. unset CPPFLAGS
  370. unset CXXFLAGS
  371. unset LDFLAGS
  372. unset MAKEFLAGS
  373. echo 'Run bootstrap for emu build...'
  374. ./bootstrap \
  375. --gnulib-srcdir="${srcdir}/gnulib/" \
  376. --no-git
  377. echo 'Run ./configure for emu build...'
  378. ./configure \
  379. --with-platform='emu' \
  380. --target="${_EMU_ARCH}" \
  381. --enable-grub-emu-usb=no \
  382. --enable-grub-emu-sdl=no \
  383. --disable-grub-emu-pci \
  384. "${_configure_options[@]}"
  385. echo 'Run make for emu build...'
  386. make
  387. }
  388. _build_grub-uboot() {
  389. echo "Copy the source for building the U-Boot part..."
  390. cp -r "${srcdir}/grub/" "${srcdir}/grub-uboot/"
  391. cd "${srcdir}/grub-uboot/"
  392. echo 'Unset all compiler FLAGS for U-Boot build...'
  393. unset CFLAGS
  394. unset CPPFLAGS
  395. unset CXXFLAGS
  396. unset LDFLAGS
  397. unset MAKEFLAGS
  398. #sed -i '\|grub_arm_disable_caches_mmu|,+4 d
  399. # ' grub-core/loader/arm/linux.c
  400. echo 'Run bootstrap for U-Boot build...'
  401. ./bootstrap \
  402. --gnulib-srcdir="${srcdir}/gnulib/" \
  403. --no-git
  404. echo 'Run ./configure for U-Boot build...'
  405. ./configure \
  406. --with-platform='uboot' \
  407. --target='arm' \
  408. --disable-efiemu \
  409. --enable-boot-time \
  410. "${_configure_options[@]}"
  411. echo 'Run make for U-Boot build...'
  412. make
  413. }
  414. build() {
  415. cd "${srcdir}/grub/"
  416. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]] || [[ "${CARCH}" = 'armv7h' ]]; then
  417. echo "Build grub ${_EFI_ARCH} EFI stuff..."
  418. _build_grub-efi
  419. if [[ "${CARCH}" = 'x86_64' ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" = '1' ]]; then
  420. echo 'Build grub i386 EFI stuff...'
  421. _EFI_ARCH='i386' _build_grub-efi
  422. fi
  423. fi
  424. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]]; then
  425. if [[ "${_XEN}" = '1' ]]; then
  426. echo "Build grub ${_XEN_ARCH} XEN stuff..."
  427. _build_grub-xen
  428. if [[ "${_IA32_XEN_IN_ARCH_X64}" = '1' ]]; then
  429. echo 'Build grub i386 XEN stuff...'
  430. _XEN_ARCH='i386' _build_grub-xen
  431. fi
  432. fi
  433. echo 'Build grub BIOS stuff...'
  434. _build_grub-bios
  435. echo 'Build grub QEMU stuff...'
  436. _build_grub-qemu
  437. echo 'Build grub IEEE1275 (OpenFirmware) stuff...'
  438. _build_grub-ieee1275
  439. echo 'Build grub Libreboot stuff...'
  440. _build_grub-libreboot
  441. echo 'Build grub Multiboot stuff...'
  442. _build_grub-multiboot
  443. elif [[ "${CARCH}" = 'armv7h' ]]; then
  444. echo 'Build grub U-Boot stuff...'
  445. _build_grub-uboot
  446. fi
  447. if [[ "${_GRUB_EMU_BUILD}" = '1' ]]; then
  448. echo 'Build grub emu stuff...'
  449. _build_grub-emu
  450. fi
  451. }
  452. _package_grub-crypt-git-efi() {
  453. cd "${srcdir}/grub-efi-${_EFI_ARCH}/"
  454. echo "Run make install for ${_EFI_ARCH} EFI build..."
  455. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  456. echo "Remove gdb debugging related files for ${_EFI_ARCH} EFI build..."
  457. rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.module || true
  458. rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/*.image || true
  459. rm -f "${pkgdir}/usr/lib/grub/${_EFI_ARCH}-efi"/{kernel.exec,gdb_grub,gmodule.pl} || true
  460. }
  461. _package_grub-crypt-git-xen() {
  462. cd "${srcdir}/grub-xen-${_XEN_ARCH}/"
  463. echo "Run make install for ${_XEN_ARCH} XEN build..."
  464. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  465. echo "Remove gdb debugging related files for ${_XEN_ARCH} XEN build..."
  466. rm -f "${pkgdir}/usr/lib/grub/${_XEN_ARCH}-xen"/*.module || true
  467. rm -f "${pkgdir}/usr/lib/grub/${_XEN_ARCH}-xen"/*.image || true
  468. rm -f "${pkgdir}/usr/lib/grub/${_XEN_ARCH}-xen"/{kernel.exec,gdb_grub,gmodule.pl} || true
  469. }
  470. _package_grub-crypt-git-bios() {
  471. cd "${srcdir}/grub-bios/"
  472. echo 'Run make install for BIOS build...'
  473. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  474. echo 'Remove gdb debugging related files for BIOS build...'
  475. rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.module || true
  476. rm -f "${pkgdir}/usr/lib/grub/i386-pc"/*.image || true
  477. rm -f "${pkgdir}/usr/lib/grub/i386-pc"/{kernel.exec,gdb_grub,gmodule.pl} || true
  478. }
  479. _package_grub-crypt-git-qemu() {
  480. cd "${srcdir}/grub-qemu/"
  481. echo 'Run make install for QEMU build...'
  482. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  483. echo 'Remove gdb debugging related files for QEMU build...'
  484. rm -f "${pkgdir}/usr/lib/grub/i386-qemu"/*.module || true
  485. rm -f "${pkgdir}/usr/lib/grub/i386-qemu"/*.image || true
  486. rm -f "${pkgdir}/usr/lib/grub/i386-qemu"/{kernel.exec,gdb_grub,gmodule.pl} || true
  487. }
  488. _package_grub-crypt-git-ieee1275() {
  489. cd "${srcdir}/grub-ieee1275/"
  490. echo 'Run make install for IEEE1275 (OpenFirmware) build...'
  491. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  492. echo 'Remove gdb debugging related files for IEEE1275 (OpenFirmware) build...'
  493. rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.module || true
  494. rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/*.image || true
  495. rm -f "${pkgdir}/usr/lib/grub/i386-ieee1275"/{kernel.exec,gdb_grub,gmodule.pl} || true
  496. }
  497. _package_grub-crypt-git-libreboot() {
  498. cd "${srcdir}/grub-libreboot/"
  499. echo 'Run make install for Libreboot build...'
  500. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  501. echo 'Remove gdb debugging related files for Libreboot build...'
  502. rm -f "${pkgdir}/usr/lib/grub/i386-coreboot"/*.module || true
  503. rm -f "${pkgdir}/usr/lib/grub/i386-coreboot"/*.image || true
  504. rm -f "${pkgdir}/usr/lib/grub/i386-coreboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  505. }
  506. _package_grub-crypt-git-multiboot() {
  507. cd "${srcdir}/grub-multiboot/"
  508. echo 'Run make install for Multiboot build...'
  509. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  510. echo 'Remove gdb debugging related files for Multiboot build...'
  511. rm -f "${pkgdir}/usr/lib/grub/i386-multiboot"/*.module || true
  512. rm -f "${pkgdir}/usr/lib/grub/i386-multiboot"/*.image || true
  513. rm -f "${pkgdir}/usr/lib/grub/i386-multiboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  514. }
  515. _package_grub-crypt-git-emu() {
  516. cd "${srcdir}/grub-emu/"
  517. echo 'Run make install for emu build...'
  518. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  519. echo 'Remove gdb debugging related files for emu build...'
  520. rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.module || true
  521. rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/*.image || true
  522. rm -f "${pkgdir}/usr/lib/grub/${_EMU_ARCH}-emu"/{kernel.exec,gdb_grub,gmodule.pl} || true
  523. }
  524. _package_grub-crypt-git-uboot() {
  525. cd "${srcdir}/grub-uboot/"
  526. echo 'Run make install for U-Boot build...'
  527. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  528. echo 'Remove gdb debugging related files for U-Boot build...'
  529. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  530. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  531. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  532. }
  533. package_grub-crypt-git() {
  534. optdepends+=('dosfstools: For grub-mkrescue FAT FS and EFI support'
  535. 'efibootmgr: For grub-install EFI support'
  536. 'libisoburn: Provides xorriso for generating grub rescue iso using grub-mkrescue'
  537. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  538. 'mtools: For grub-mkrescue FAT FS support')
  539. if [[ "${_GRUB_EMU_BUILD}" = '1' ]]; then
  540. optdepends+=('libusbx: For grub-emu USB support'
  541. 'sdl: For grub-emu SDL support')
  542. fi
  543. cd "${srcdir}/grub/"
  544. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]] || [[ "${CARCH}" = 'armv7h' ]]; then
  545. echo "Package grub ${_EFI_ARCH} EFI stuff..."
  546. _package_grub-efi
  547. if [[ "${CARCH}" = 'x86_64' ]] && [[ "${_IA32_EFI_IN_ARCH_X64}" = '1' ]]; then
  548. echo 'Package grub i386 EFI stuff...'
  549. _EFI_ARCH='i386' _package_grub-efi
  550. fi
  551. fi
  552. if [[ "${CARCH}" = 'x86_64' ]] || [[ "${CARCH}" = 'i686' ]]; then
  553. if [[ "${_XEN}" = '1' ]]; then
  554. echo "Package grub ${_XEN_ARCH} XEN stuff..."
  555. _package_grub-xen
  556. if [[ "${_IA32_XEN_IN_ARCH_X64}" = '1' ]]; then
  557. echo 'Package grub i386 XEN stuff...'
  558. _XEN_ARCH='i386' _package_grub-xen
  559. fi
  560. fi
  561. echo 'Package grub BIOS stuff...'
  562. _package_grub-bios
  563. echo 'Package grub QEMU stuff...'
  564. _package_grub-qemu
  565. echo 'Package grub IEEE1275 (OpenFirmware) stuff...'
  566. _package_grub-ieee1275
  567. echo 'Package grub Libreboot stuff...'
  568. _package_grub-libreboot
  569. echo 'Package grub Multiboot stuff...'
  570. _package_grub-multiboot
  571. elif [[ "${CARCH}" = 'armv7h' ]]; then
  572. echo 'Package grub U-Boot stuff...'
  573. _package_grub-uboot
  574. fi
  575. if [[ "${_GRUB_EMU_BUILD}" = '1' ]]; then
  576. echo 'Package grub emu stuff...'
  577. _package_grub-emu
  578. fi
  579. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  580. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  581. }
  582. package_grub-crypt-git-am335x_bone() {
  583. pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBone and BeagleBone Black (am335x-bone), (Parabola rebranded)'
  584. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  585. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  586. 'mtools: For grub-mkrescue FAT FS support')
  587. echo "Copy the source for packaging the U-Boot (am335x-bone) part..."
  588. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_am335x-bone/"
  589. cd "${srcdir}/grub-uboot_am335x-bone/"
  590. echo 'Patch to detect am335x-bone device tree blob file (dtb)...'
  591. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-am335x_bone+am335x_boneblack-devicetree-file.patch"
  592. echo 'Package grub U-Boot stuff...'
  593. ## _package_grub-uboot
  594. echo 'Run make install for U-Boot build...'
  595. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  596. echo 'Remove gdb debugging related files for U-Boot build...'
  597. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  598. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  599. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  600. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  601. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  602. ## echo 'Patch to detect am335x-bone device tree blob file (dtb)...'
  603. ## cd "${pkgdir}/etc/grub.d/"
  604. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-am335x_bone+am335x_boneblack-devicetree-file.patch"
  605. }
  606. package_grub-crypt-git-omap3_beagle() {
  607. pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBoard (omap3_beagle), (Parabola rebranded)'
  608. provides+=('grub-beagleboard')
  609. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  610. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  611. 'mtools: For grub-mkrescue FAT FS support')
  612. echo "Copy the source for packaging the U-Boot (omap3_beagle) part..."
  613. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_omap3_beagle/"
  614. cd "${srcdir}/grub-uboot_omap3_beagle/"
  615. echo 'Patch to detect omap3_beagle device tree blob file (dtb)...'
  616. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle-devicetree-file.patch"
  617. echo 'Package grub U-Boot stuff...'
  618. ## _package_grub-uboot
  619. echo 'Run make install for U-Boot build...'
  620. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  621. echo 'Remove gdb debugging related files for U-Boot build...'
  622. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  623. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  624. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  625. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  626. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  627. ## echo 'Patch to detect omap3_beagle device tree blob file (dtb)...'
  628. ## cd "${pkgdir}/etc/grub.d/"
  629. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle-devicetree-file.patch"
  630. }
  631. package_grub-crypt-git-omap3_beagle_xm() {
  632. pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBoard-xM (omap3_beagle_xm), (Parabola rebranded)'
  633. provides+=('grub-beagleboard')
  634. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  635. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  636. 'mtools: For grub-mkrescue FAT FS support')
  637. echo "Copy the source for packaging the U-Boot (omap3_beagle_xm) part..."
  638. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_omap3_beagle_xm/"
  639. cd "${srcdir}/grub-uboot_omap3_beagle_xm/"
  640. echo 'Patch to detect omap3_beagle_xm device tree blob file (dtb)...'
  641. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle_xm-devicetree-file.patch"
  642. echo 'Package grub U-Boot stuff...'
  643. ## _package_grub-uboot
  644. echo 'Run make install for U-Boot build...'
  645. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  646. echo 'Remove gdb debugging related files for U-Boot build...'
  647. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  648. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  649. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  650. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  651. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  652. ## echo 'Patch to detect omap3_beagle_xm device tree blob file (dtb)...'
  653. ## cd "${pkgdir}/etc/grub.d/"
  654. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle_xm-devicetree-file.patch"
  655. }
  656. package_grub-crypt-git-omap3_beagle_xm_ab() {
  657. pkgdesc='GNU GRand Unified Bootloader (2) for BeagleBoard-xM rev A/B (omap3_beagle_xm_ab), (Parabola rebranded)'
  658. provides+=('grub-beagleboard')
  659. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  660. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  661. 'mtools: For grub-mkrescue FAT FS support')
  662. echo "Copy the source for packaging the U-Boot (omap3_beagle_xm_ab) part..."
  663. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_omap3_beagle_xm_ab/"
  664. cd "${srcdir}/grub-uboot_omap3_beagle_xm_ab/"
  665. echo 'Patch to detect omap3_beagle_xm_ab device tree blob file (dtb)...'
  666. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle_xm_ab-devicetree-file.patch"
  667. echo 'Package grub U-Boot stuff...'
  668. ## _package_grub-uboot
  669. echo 'Run make install for U-Boot build...'
  670. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  671. echo 'Remove gdb debugging related files for U-Boot build...'
  672. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  673. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  674. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  675. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  676. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  677. ## echo 'Patch to detect omap3_beagle_xm_ab device tree blob file (dtb)...'
  678. ## cd "${pkgdir}/etc/grub.d/"
  679. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-omap3_beagle_xm_ab-devicetree-file.patch"
  680. }
  681. package_grub-crypt-git-udoo() {
  682. pkgdesc='GNU GRand Unified Bootloader (2) for UDOO (udoo), (Parabola rebranded)'
  683. optdepends+=('dosfstools: For grub-mkrescue FAT FS'
  684. 'os-prober: To detect other OSes when generating grub.cfg in BIOS systems'
  685. 'mtools: For grub-mkrescue FAT FS support')
  686. echo "Copy the source for packaging the U-Boot (udoo) part..."
  687. cp -r "${srcdir}/grub-uboot/" "${srcdir}/grub-uboot_udoo/"
  688. cd "${srcdir}/grub-uboot_udoo/"
  689. echo 'Patch to detect udoo device tree blob file (dtb)...'
  690. patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-udoo-devicetree-file.patch"
  691. echo 'Package grub U-Boot stuff...'
  692. ## _package_grub-uboot
  693. echo 'Run make install for U-Boot build...'
  694. make DESTDIR="${pkgdir}/" bashcompletiondir="/usr/share/bash-completion/completions" install
  695. echo 'Remove gdb debugging related files for U-Boot build...'
  696. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.module || true
  697. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/*.image || true
  698. rm -f "${pkgdir}/usr/lib/grub/arm-uboot"/{kernel.exec,gdb_grub,gmodule.pl} || true
  699. echo 'Install /etc/default/grub (used by grub-mkconfig)...'
  700. install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
  701. ## echo 'Patch to detect udoo device tree blob file (dtb)...'
  702. ## cd "${pkgdir}/etc/grub.d/"
  703. ## patch -Np1 -i "${srcdir}/0003-10_linux-20_linux_xen-detect-udoo-devicetree-file.patch"
  704. }