blob: edc0ac1d89611dbba528ef93e0170c7ab773c2b4 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Userspace framebuffer boot logo based on usplash"
2DESCRIPTION = "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."
3HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/psplash"
4SECTION = "base"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00005LICENSE = "GPL-2.0-or-later"
Andrew Geissler82c905d2020-04-13 13:39:40 -05006LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=8;md5=8f232c1e95929eacab37f00900580224"
7DEPENDS = "gdk-pixbuf-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05008
Andrew Geissler595f6302022-01-24 19:11:47 +00009SRCREV = "44afb7506d43cca15582b4c5b90ba5580344d75d"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010PV = "0.1+git${SRCPV}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011
Andrew Geissler595f6302022-01-24 19:11:47 +000012SRC_URI = "git://git.yoctoproject.org/${BPN};branch=master \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013 file://psplash-init \
Andrew Geissler82c905d2020-04-13 13:39:40 -050014 file://psplash-start.service \
15 file://psplash-systemd.service \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016 ${SPLASH_IMAGES}"
Brad Bishop316dfdd2018-06-25 12:45:53 -040017UPSTREAM_CHECK_COMMITS = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018
19SPLASH_IMAGES = "file://psplash-poky-img.h;outsuffix=default"
20
21python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022 oldpkgs = d.getVar("PACKAGES").split()
23 splashfiles = d.getVar('SPLASH_IMAGES').split()
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050024 mlprefix = d.getVar('MLPREFIX') or ''
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025 pkgs = []
26 localpaths = []
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027 for uri in splashfiles:
28 fetcher = bb.fetch2.Fetch([uri], d)
29 flocal = os.path.basename(fetcher.localpath(uri))
30 fbase = os.path.splitext(flocal)[0]
31 outsuffix = fetcher.ud[uri].parm.get("outsuffix")
32 if not outsuffix:
33 if fbase.startswith("psplash-"):
34 outsuffix = fbase[8:]
35 else:
36 outsuffix = fbase
37 if outsuffix.endswith('-img'):
38 outsuffix = outsuffix[:-4]
39 outname = "psplash-%s" % outsuffix
40 if outname == '' or outname in oldpkgs:
41 bb.fatal("The output name '%s' derived from the URI %s is not valid, please specify the outsuffix parameter" % (outname, uri))
42 else:
43 pkgs.append(outname)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044 localpaths.append(flocal)
45
Patrick Williams213cb262021-08-07 19:21:33 -050046 # Set these so that we have less work to do in do_compile and do_install:append
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047 d.setVar("SPLASH_INSTALL", " ".join(pkgs))
48 d.setVar("SPLASH_LOCALPATHS", " ".join(localpaths))
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050049 for p in pkgs:
50 d.prependVar("PACKAGES", "%s%s " % (mlprefix, p))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051
Brad Bishop6e60e8b2018-02-01 10:27:11 -050052 pn = d.getVar('PN') or ''
Patrick Williamsc124f4f2015-09-15 14:41:29 -050053 for p in pkgs:
54 ep = '%s%s' % (mlprefix, p)
55 epsplash = '%s%s' % (mlprefix, 'psplash')
Patrick Williams213cb262021-08-07 19:21:33 -050056 d.setVar("FILES:%s" % ep, "${bindir}/%s" % p)
57 d.setVar("ALTERNATIVE:%s" % ep, 'psplash')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058 d.setVarFlag("ALTERNATIVE_TARGET_%s" % ep, 'psplash', '${bindir}/%s' % p)
Patrick Williams213cb262021-08-07 19:21:33 -050059 d.appendVar("RDEPENDS:%s" % ep, " %s" % pn)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050060 if p == "psplash-default":
Patrick Williams213cb262021-08-07 19:21:33 -050061 d.appendVar("RRECOMMENDS:%s" % pn, " %s" % ep)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062}
63
64S = "${WORKDIR}/git"
65
Andrew Geissler82c905d2020-04-13 13:39:40 -050066inherit autotools pkgconfig update-rc.d update-alternatives systemd
67
68PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
69
70PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071
72ALTERNATIVE_PRIORITY = "100"
73ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
74
75python do_compile () {
76 import shutil
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080077 import subprocess
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078
79 # Build a separate executable for each splash image
Brad Bishop6e60e8b2018-02-01 10:27:11 -050080 workdir = d.getVar('WORKDIR')
81 convertscript = "%s/make-image-header.sh" % d.getVar('S')
Andrew Geissler82c905d2020-04-13 13:39:40 -050082 destfile = "%s/psplash-poky-img.h" % d.getVar('B')
Brad Bishop6e60e8b2018-02-01 10:27:11 -050083 localfiles = d.getVar('SPLASH_LOCALPATHS').split()
84 outputfiles = d.getVar('SPLASH_INSTALL').split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085 for localfile, outputfile in zip(localfiles, outputfiles):
86 if localfile.endswith(".png"):
Brad Bishop19323692019-04-05 15:28:33 -040087 if subprocess.call([ convertscript, os.path.join(workdir, localfile), 'POKY' ], cwd=workdir):
88 bb.fatal("Error calling convert script '%s'" % (convertscript))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050089 fbase = os.path.splitext(localfile)[0]
Brad Bishop19323692019-04-05 15:28:33 -040090 shutil.copyfile(os.path.join(workdir, "%s-img.h" % fbase), destfile)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091 else:
92 shutil.copyfile(os.path.join(workdir, localfile), destfile)
93 # For some reason just updating the header is not enough, we have to touch the .c
94 # file in order to get it to rebuild
Brad Bishop6e60e8b2018-02-01 10:27:11 -050095 os.utime("%s/psplash.c" % d.getVar('S'), None)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050096 bb.build.exec_func("oe_runmake", d)
97 shutil.copyfile("psplash", outputfile)
98}
99
Patrick Williams213cb262021-08-07 19:21:33 -0500100do_install:append() {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500101 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
102 install -d ${D}${sysconfdir}/init.d/
103 install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600104
105 # make fifo for psplash
106 install -d ${D}/mnt
107 mkfifo ${D}/mnt/psplash_fifo
Andrew Geissler82c905d2020-04-13 13:39:40 -0500108 fi
109
110 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
Andrew Geissler5199d832021-09-24 16:47:35 -0500111 install -d ${D}${systemd_system_unitdir}
112 install -m 644 ${WORKDIR}/psplash-start.service ${D}/${systemd_system_unitdir}
113 install -m 644 ${WORKDIR}/psplash-systemd.service ${D}/${systemd_system_unitdir}
Andrew Geissler82c905d2020-04-13 13:39:40 -0500114 fi
115
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500116 install -d ${D}${bindir}
117 for i in ${SPLASH_INSTALL} ; do
118 install -m 0755 $i ${D}${bindir}/$i
119 done
120 rm -f ${D}${bindir}/psplash
121}
122
Andrew Geissler82c905d2020-04-13 13:39:40 -0500123SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
Patrick Williams213cb262021-08-07 19:21:33 -0500124SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'psplash-start.service psplash-systemd.service', '', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500125
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500126INITSCRIPT_NAME = "psplash.sh"
127INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ."
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600128
Patrick Williams213cb262021-08-07 19:21:33 -0500129FILES:${PN} += "/mnt"