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