psplash_git.bb 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 = "GPLv2+"
  6. LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=8;md5=8f232c1e95929eacab37f00900580224"
  7. DEPENDS = "gdk-pixbuf-native"
  8. SRCREV = "0a902f7cd875ccf018456451be369f05fa55f962"
  9. PV = "0.1+git${SRCPV}"
  10. PR = "r15"
  11. SRC_URI = "git://git.yoctoproject.org/${BPN} \
  12. file://psplash-init \
  13. file://psplash-start.service \
  14. file://psplash-systemd.service \
  15. ${SPLASH_IMAGES}"
  16. UPSTREAM_CHECK_COMMITS = "1"
  17. SPLASH_IMAGES = "file://psplash-poky-img.h;outsuffix=default"
  18. python __anonymous() {
  19. oldpkgs = d.getVar("PACKAGES").split()
  20. splashfiles = d.getVar('SPLASH_IMAGES').split()
  21. mlprefix = d.getVar('MLPREFIX') or ''
  22. pkgs = []
  23. localpaths = []
  24. for uri in splashfiles:
  25. fetcher = bb.fetch2.Fetch([uri], d)
  26. flocal = os.path.basename(fetcher.localpath(uri))
  27. fbase = os.path.splitext(flocal)[0]
  28. outsuffix = fetcher.ud[uri].parm.get("outsuffix")
  29. if not outsuffix:
  30. if fbase.startswith("psplash-"):
  31. outsuffix = fbase[8:]
  32. else:
  33. outsuffix = fbase
  34. if outsuffix.endswith('-img'):
  35. outsuffix = outsuffix[:-4]
  36. outname = "psplash-%s" % outsuffix
  37. if outname == '' or outname in oldpkgs:
  38. bb.fatal("The output name '%s' derived from the URI %s is not valid, please specify the outsuffix parameter" % (outname, uri))
  39. else:
  40. pkgs.append(outname)
  41. localpaths.append(flocal)
  42. # Set these so that we have less work to do in do_compile and do_install_append
  43. d.setVar("SPLASH_INSTALL", " ".join(pkgs))
  44. d.setVar("SPLASH_LOCALPATHS", " ".join(localpaths))
  45. for p in pkgs:
  46. d.prependVar("PACKAGES", "%s%s " % (mlprefix, p))
  47. pn = d.getVar('PN') or ''
  48. for p in pkgs:
  49. ep = '%s%s' % (mlprefix, p)
  50. epsplash = '%s%s' % (mlprefix, 'psplash')
  51. d.setVar("FILES_%s" % ep, "${bindir}/%s" % p)
  52. d.setVar("ALTERNATIVE_%s" % ep, 'psplash')
  53. d.setVarFlag("ALTERNATIVE_TARGET_%s" % ep, 'psplash', '${bindir}/%s' % p)
  54. d.appendVar("RDEPENDS_%s" % ep, " %s" % pn)
  55. if p == "psplash-default":
  56. d.appendVar("RRECOMMENDS_%s" % pn, " %s" % ep)
  57. }
  58. S = "${WORKDIR}/git"
  59. inherit autotools pkgconfig update-rc.d update-alternatives systemd
  60. PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
  61. PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
  62. ALTERNATIVE_PRIORITY = "100"
  63. ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
  64. python do_compile () {
  65. import shutil
  66. import subprocess
  67. # Build a separate executable for each splash image
  68. workdir = d.getVar('WORKDIR')
  69. convertscript = "%s/make-image-header.sh" % d.getVar('S')
  70. destfile = "%s/psplash-poky-img.h" % d.getVar('B')
  71. localfiles = d.getVar('SPLASH_LOCALPATHS').split()
  72. outputfiles = d.getVar('SPLASH_INSTALL').split()
  73. for localfile, outputfile in zip(localfiles, outputfiles):
  74. if localfile.endswith(".png"):
  75. if subprocess.call([ convertscript, os.path.join(workdir, localfile), 'POKY' ], cwd=workdir):
  76. bb.fatal("Error calling convert script '%s'" % (convertscript))
  77. fbase = os.path.splitext(localfile)[0]
  78. shutil.copyfile(os.path.join(workdir, "%s-img.h" % fbase), destfile)
  79. else:
  80. shutil.copyfile(os.path.join(workdir, localfile), destfile)
  81. # For some reason just updating the header is not enough, we have to touch the .c
  82. # file in order to get it to rebuild
  83. os.utime("%s/psplash.c" % d.getVar('S'), None)
  84. bb.build.exec_func("oe_runmake", d)
  85. shutil.copyfile("psplash", outputfile)
  86. }
  87. do_install_append() {
  88. if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
  89. install -d ${D}${sysconfdir}/init.d/
  90. install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh
  91. fi
  92. if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
  93. install -d ${D}${systemd_unitdir}/system
  94. install -m 644 ${WORKDIR}/psplash-start.service ${D}/${systemd_unitdir}/system
  95. install -m 644 ${WORKDIR}/psplash-systemd.service ${D}/${systemd_unitdir}/system
  96. fi
  97. install -d ${D}${bindir}
  98. for i in ${SPLASH_INSTALL} ; do
  99. install -m 0755 $i ${D}${bindir}/$i
  100. done
  101. rm -f ${D}${bindir}/psplash
  102. }
  103. SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
  104. SYSTEMD_SERVICE_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'psplash-start.service psplash-systemd.service', '', d)}"
  105. INITSCRIPT_NAME = "psplash.sh"
  106. INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ."