recipe 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # Build recipe for grub.
  2. #
  3. # Copyright (c) 2017-2018 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. program=grub
  17. version=a661a321c314d23cd2666c82cbb38d356c7956ba
  18. pkgversion=a661a32
  19. release=2
  20. # Set 'outdir' for a nice and well-organized output directory
  21. outdir="${outdir}/${arch}/boot"
  22. tarname=${program}-${version}.tar.gz
  23. # Remote source(s)
  24. #fetch=ftp://ftp.gnu.org/gnu/grub/$tarname
  25. fetch=http://git.savannah.nongnu.org/cgit/grub.git/snapshot/$tarname
  26. description="
  27. A multiboot boot loader.
  28. GNU GRUB is a Multiboot boot loader. It was derived from GRUB,
  29. the GRand Unified Bootloader, which was originally designed and
  30. implemented by Erich Stefan Boleyn.
  31. "
  32. homepage=http://www.gnu.org/software/grub
  33. license=GPLv3+
  34. # Source documentation
  35. docs="AUTHORS BUGS COPYING NEWS README THANKS TODO"
  36. docsdir="${docdir}/${program}-${pkgversion}"
  37. build()
  38. {
  39. set -e
  40. unpack "${tardir}/$tarname"
  41. cd "$srcdir"
  42. # Set sane permissions
  43. chmod -R u+w,go-w,a+rX-s .
  44. # This patch contains fixes for Musl
  45. # http://patchwork.ozlabs.org/patch/488325/
  46. patch -p1 < "${worktree}/patches/grub/OpenWrt-Devel-package-grub2-fix-musl-build.patch"
  47. sh ./autogen.sh
  48. ./configure \
  49. $configure_args \
  50. --libdir=/usr/lib${libSuffix} \
  51. --infodir=$infodir \
  52. --mandir=$mandir \
  53. --docdir=$docsdir \
  54. --enable-device-mapper \
  55. --disable-werror \
  56. --disable-liblzma \
  57. --disable-efiemu \
  58. --build="$(cc -dumpmachine)"
  59. make -j${jobs} V=1
  60. make -j${jobs} DESTDIR="$destdir" \
  61. bashcompletiondir=/usr/share/bash-completion/completions \
  62. install-strip
  63. # Remove generated charset.alias
  64. rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
  65. # Make required directories
  66. mkdir -p "${destdir}/boot/grub/" "${destdir}/etc/default"
  67. # Insert file for default settings
  68. cp -p "${worktree}/archive/grub/etc/default/grub" "${destdir}/etc/default/"
  69. chmod 644 "${destdir}/etc/default/grub"
  70. # Manage config (.new) file(s)
  71. touch "${destdir}/etc/default/.graft-config" \
  72. "${destdir}/etc/grub.d/.graft-config" \
  73. "${destdir}/usr/share/bash-completion/completions/.graft-config"
  74. # Compress info documents deleting index file for the package
  75. if test -d "${destdir}/$infodir"
  76. then
  77. rm -f "${destdir}/${infodir}/dir"
  78. lzip -9 "${destdir}/${infodir}"/*
  79. fi
  80. # Compress and link man pages (if needed)
  81. if test -d "${destdir}/$mandir"
  82. then
  83. (
  84. cd "${destdir}/$mandir"
  85. find . -type f -exec lzip -9 '{}' +
  86. find . -type l | while read -r file
  87. do
  88. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  89. rm -- "$file"
  90. done
  91. )
  92. fi
  93. # Copy documentation
  94. mkdir -p "${destdir}${docsdir}"
  95. cp -p $docs "${destdir}${docsdir}"
  96. }