actions.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/copyleft/gpl.txt
  6. from pisi.actionsapi import get
  7. from pisi.actionsapi import autotools
  8. from pisi.actionsapi import pisitools
  9. from pisi.actionsapi import shelltools
  10. #WorkDir="grub-%s" % (get.srcVERSION().replace("_", "~"))
  11. def setup():
  12. shelltools.export("PYTHON", "/usr/bin/python3")
  13. shelltools.copy("../unifont*.bdf", "./unifont.bdf")
  14. # shelltools.export("GRUB_CONTRIB", "%s/grub-2.06/grub-extras" % (get.workDIR()))
  15. pisitools.cflags.remove("-fstack-protector", "-fasynchronous-unwind-tables", "-fexceptions", "-fPIC")
  16. pisitools.cflags.sub("\s?(-O[\ds]|-D_FORTIFY_SOURCE=\d)\s?", " ")
  17. #pisitools.dosed('util/grub-mkconfig.in', 'GRUB_DISABLE_OS_PROBER="true"', 'GRUB_DISABLE_OS_PROBER="false"')
  18. #shelltools.system("./linguas.sh")
  19. #shelltools.system("./bootstrap")
  20. #shelltools.system('echo "Make translations reproducible..."')
  21. #shelltools.system("sed -i '1i /^PO-Revision-Date:/ d' po/*.sed")
  22. shelltools.copytree("../grub-%s" % (get.srcVERSION().replace("_", "~")), "../grub-%s-efi" % get.srcVERSION())
  23. autotools.autoreconf("-fi")
  24. autotools.configure("--disable-werror \
  25. --with-bootdir='/boot' \
  26. --with-grubdir=grub2 \
  27. --program-transform-name='s,grub,grub2,'\
  28. --program-prefix= \
  29. --with-platform=pc \
  30. --target='i386' \
  31. --htmldir='/usr/share/doc/grub2/html' ")
  32. shelltools.cd("../grub-%s-efi" % get.srcVERSION())
  33. #shelltools.system("./autogen.sh")
  34. autotools.autoreconf("-fi")
  35. autotools.configure("--disable-werror \
  36. --with-bootdir='/boot' \
  37. --with-grubdir=grub2 \
  38. --program-transform-name='s,grub,grub2,'\
  39. --program-prefix= \
  40. --with-platform=efi \
  41. --target=x86_64 \
  42. --htmldir='/usr/share/doc/grub2/html' ")
  43. shelltools.cd("..")
  44. def build():
  45. #make-dist for creating all updated translation files
  46. #autotools.make("dist")
  47. autotools.make()
  48. shelltools.cd("../grub-%s-efi" % get.srcVERSION())
  49. autotools.make()
  50. shelltools.cd("..")
  51. def install():
  52. # Install unicode.pf2 using downloaded font source.
  53. #shelltools.system("./grub-mkfont -o unicode.pf2 unifont.bdf")
  54. # Create directory for grub.cfg file
  55. #pisitools.dodir("/boot/grub2")
  56. #pisitools.insinto("/boot/grub2", "unicode.pf2")
  57. # Insall our theme
  58. pisitools.insinto("/usr/share/grub/themes/pisilinux","themes/Pisilinux2.4-Grub2-Themes-1.2/*")
  59. #remove -r 0x0-0x7F entries to fix ugly fonts or find a suitable range parameter -r ***
  60. shelltools.system("./grub-mkfont -o DejaVuSans-10.pf2 -r 0x0-0x7F -s 10 /usr/share/fonts/dejavu/DejaVuSans.ttf")
  61. shelltools.system("./grub-mkfont -o DejaVuSans-12.pf2 -r 0x0-0x7F -s 12 /usr/share/fonts/dejavu/DejaVuSans.ttf")
  62. shelltools.system("./grub-mkfont -o DejaVuSans-14.pf2 -r 0x0-0x7F -s 14 /usr/share/fonts/dejavu/DejaVuSans.ttf")
  63. shelltools.system("./grub-mkfont -o DejaVuSans-16.pf2 -r 0x0-0x7F -s 16 /usr/share/fonts/dejavu/DejaVuSans.ttf")
  64. shelltools.system("./grub-mkfont -o DejaVuSans-Bold-14.pf2 -r 0x0-0x7F -s 14 /usr/share/fonts/dejavu/DejaVuSans-Bold.ttf")
  65. shelltools.system("./grub-mkfont -o DejaVuSans-Mono-14.pf2 -r 0x0-0x7F -s 14 /usr/share/fonts/dejavu/DejaVuSansMono.ttf")
  66. shelltools.copy("ascii.pf2","%s/usr/share/grub/themes/pisilinux" % get.installDIR())
  67. # Do not install auto generated dejavu* fonts
  68. fonts=["DejaVuSans-10.pf2" , "DejaVuSans-12.pf2" , "DejaVuSans-14.pf2" , "DejaVuSans-16.pf2" , "DejaVuSans-Mono-14.pf2", "DejaVuSans-Bold-14.pf2"]
  69. for font in fonts:
  70. shelltools.copy(font,"%s/usr/share/grub/themes/pisilinux" % get.installDIR())
  71. autotools.rawInstall("DESTDIR=%s" % get.installDIR())
  72. pisitools.dodoc("ABOUT-NLS", "AUTHORS", "BUGS", "COPYING", "TODO", "README")
  73. shelltools.cd("../grub-%s-efi" % get.srcVERSION())
  74. autotools.rawInstall("DESTDIR=%s/efi" % get.installDIR())
  75. shelltools.copytree("/%s/efi/usr/lib/grub/x86_64-efi" % get.installDIR(), "%s/usr/lib/grub/x86_64-efi" % get.installDIR())
  76. pisitools.removeDir("/efi")