psplash_git.bb 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. SUMMARY = "Userspace framebuffer boot logo based on usplash"
  2. DESCRIPTION = "PSplash is a userspace graphical boot splash screen for mainly embedded Linux devices supporting a 16bpp or 32bpp framebuffer. It has few dependencies (just libc), supports basic images and text and handles rotation. Its visual look is configurable by basic source changes. Also included is a 'client' command utility for sending information to psplash such as boot progress information."
  3. HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/psplash"
  4. SECTION = "base"
  5. LICENSE = "GPL-2.0-or-later"
  6. LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=8;md5=8f232c1e95929eacab37f00900580224"
  7. DEPENDS = "gdk-pixbuf-native"
  8. SRCREV = "ecc1913756698d0c87ad8fa10e44b29537f09ad1"
  9. PV = "0.1+git"
  10. SRC_URI = "git://git.yoctoproject.org/${BPN};branch=master;protocol=https \
  11. file://psplash-init \
  12. file://psplash-start.service \
  13. file://psplash-systemd.service \
  14. ${SPLASH_IMAGES}"
  15. UPSTREAM_CHECK_COMMITS = "1"
  16. SPLASH_IMAGES = "file://psplash-poky-img.png;outsuffix=default"
  17. python __anonymous() {
  18. oldpkgs = d.getVar("PACKAGES").split()
  19. splashfiles = d.getVar('SPLASH_IMAGES').split()
  20. mlprefix = d.getVar('MLPREFIX') or ''
  21. pkgs = []
  22. localpaths = []
  23. for uri in splashfiles:
  24. fetcher = bb.fetch2.Fetch([uri], d)
  25. flocal = os.path.basename(fetcher.localpath(uri))
  26. fbase = os.path.splitext(flocal)[0]
  27. outsuffix = fetcher.ud[uri].parm.get("outsuffix")
  28. if not outsuffix:
  29. if fbase.startswith("psplash-"):
  30. outsuffix = fbase[8:]
  31. else:
  32. outsuffix = fbase
  33. if outsuffix.endswith('-img'):
  34. outsuffix = outsuffix[:-4]
  35. outname = "psplash-%s" % outsuffix
  36. if outname == '' or outname in oldpkgs:
  37. bb.fatal("The output name '%s' derived from the URI %s is not valid, please specify the outsuffix parameter" % (outname, uri))
  38. else:
  39. pkgs.append(outname)
  40. localpaths.append(flocal)
  41. # Set these so that we have less work to do in do_compile and do_install:append
  42. d.setVar("SPLASH_INSTALL", " ".join(pkgs))
  43. d.setVar("SPLASH_LOCALPATHS", " ".join(localpaths))
  44. for p in pkgs:
  45. d.prependVar("PACKAGES", "%s%s " % (mlprefix, p))
  46. pn = d.getVar('PN') or ''
  47. for p in pkgs:
  48. ep = '%s%s' % (mlprefix, p)
  49. epsplash = '%s%s' % (mlprefix, 'psplash')
  50. d.setVar("FILES:%s" % ep, "${bindir}/%s" % p)
  51. d.setVar("ALTERNATIVE:%s" % ep, 'psplash')
  52. d.setVarFlag("ALTERNATIVE_TARGET_%s" % ep, 'psplash', '${bindir}/%s' % p)
  53. d.appendVar("RDEPENDS:%s" % ep, " %s" % pn)
  54. if p == "psplash-default":
  55. d.appendVar("RDEPENDS:%s" % pn, " %s" % ep)
  56. }
  57. S = "${WORKDIR}/git"
  58. inherit autotools pkgconfig update-rc.d update-alternatives systemd
  59. PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} progress-bar fullscreen"
  60. PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
  61. PACKAGECONFIG[fullscreen] = "--enable-img-fullscreen"
  62. PACKAGECONFIG[startup-msg] = ",--disable-startup-msg"
  63. PACKAGECONFIG[progress-bar] = ",--disable-progress-bar"
  64. ALTERNATIVE_PRIORITY = "100"
  65. ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
  66. python do_compile () {
  67. import shutil
  68. import subprocess
  69. # Build a separate executable for each splash image
  70. workdir = d.getVar('UNPACKDIR')
  71. convertscript = "%s/make-image-header.sh" % d.getVar('S')
  72. destfile = "%s/psplash-poky-img.h" % d.getVar('B')
  73. localfiles = d.getVar('SPLASH_LOCALPATHS').split()
  74. outputfiles = d.getVar('SPLASH_INSTALL').split()
  75. for localfile, outputfile in zip(localfiles, outputfiles):
  76. if localfile.endswith(".png"):
  77. if subprocess.call([ convertscript, os.path.join(workdir, localfile), 'POKY' ], cwd=workdir):
  78. bb.fatal("Error calling convert script '%s'" % (convertscript))
  79. fbase = os.path.splitext(localfile)[0]
  80. shutil.copyfile(os.path.join(workdir, "%s-img.h" % fbase), destfile)
  81. else:
  82. shutil.copyfile(os.path.join(workdir, localfile), destfile)
  83. # For some reason just updating the header is not enough, we have to touch the .c
  84. # file in order to get it to rebuild
  85. os.utime("%s/psplash.c" % d.getVar('S'), None)
  86. bb.build.exec_func("oe_runmake", d)
  87. shutil.copyfile("psplash", outputfile)
  88. }
  89. do_install:append() {
  90. if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
  91. install -d ${D}${sysconfdir}/init.d/
  92. install -m 0755 ${UNPACKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh
  93. # make fifo for psplash
  94. install -d ${D}/mnt
  95. mkfifo ${D}/mnt/psplash_fifo
  96. fi
  97. if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
  98. install -d ${D}${systemd_system_unitdir}
  99. install -m 644 ${UNPACKDIR}/psplash-start.service ${D}/${systemd_system_unitdir}
  100. install -m 644 ${UNPACKDIR}/psplash-systemd.service ${D}/${systemd_system_unitdir}
  101. fi
  102. install -d ${D}${bindir}
  103. for i in ${SPLASH_INSTALL} ; do
  104. install -m 0755 $i ${D}${bindir}/$i
  105. done
  106. rm -f ${D}${bindir}/psplash
  107. }
  108. SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
  109. SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'psplash-start.service psplash-systemd.service', '', d)}"
  110. INITSCRIPT_NAME = "psplash.sh"
  111. INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ."
  112. FILES:${PN} += "/mnt"