blob: e9789c4ce0fab40461f8556406e34f4b86901c6d [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"
5LICENSE = "GPLv2+"
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 Geissler82c905d2020-04-13 13:39:40 -05009SRCREV = "0a902f7cd875ccf018456451be369f05fa55f962"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010PV = "0.1+git${SRCPV}"
11PR = "r15"
12
13SRC_URI = "git://git.yoctoproject.org/${BPN} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014 file://psplash-init \
Andrew Geissler82c905d2020-04-13 13:39:40 -050015 file://psplash-start.service \
16 file://psplash-systemd.service \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017 ${SPLASH_IMAGES}"
Brad Bishop316dfdd2018-06-25 12:45:53 -040018UPSTREAM_CHECK_COMMITS = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019
20SPLASH_IMAGES = "file://psplash-poky-img.h;outsuffix=default"
21
22python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050023 oldpkgs = d.getVar("PACKAGES").split()
24 splashfiles = d.getVar('SPLASH_IMAGES').split()
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050025 mlprefix = d.getVar('MLPREFIX') or ''
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026 pkgs = []
27 localpaths = []
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028 for uri in splashfiles:
29 fetcher = bb.fetch2.Fetch([uri], d)
30 flocal = os.path.basename(fetcher.localpath(uri))
31 fbase = os.path.splitext(flocal)[0]
32 outsuffix = fetcher.ud[uri].parm.get("outsuffix")
33 if not outsuffix:
34 if fbase.startswith("psplash-"):
35 outsuffix = fbase[8:]
36 else:
37 outsuffix = fbase
38 if outsuffix.endswith('-img'):
39 outsuffix = outsuffix[:-4]
40 outname = "psplash-%s" % outsuffix
41 if outname == '' or outname in oldpkgs:
42 bb.fatal("The output name '%s' derived from the URI %s is not valid, please specify the outsuffix parameter" % (outname, uri))
43 else:
44 pkgs.append(outname)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045 localpaths.append(flocal)
46
Patrick Williams213cb262021-08-07 19:21:33 -050047 # Set these so that we have less work to do in do_compile and do_install:append
Patrick Williamsc124f4f2015-09-15 14:41:29 -050048 d.setVar("SPLASH_INSTALL", " ".join(pkgs))
49 d.setVar("SPLASH_LOCALPATHS", " ".join(localpaths))
Andrew Geissler1e34c2d2020-05-29 16:02:59 -050050 for p in pkgs:
51 d.prependVar("PACKAGES", "%s%s " % (mlprefix, p))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052
Brad Bishop6e60e8b2018-02-01 10:27:11 -050053 pn = d.getVar('PN') or ''
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054 for p in pkgs:
55 ep = '%s%s' % (mlprefix, p)
56 epsplash = '%s%s' % (mlprefix, 'psplash')
Patrick Williams213cb262021-08-07 19:21:33 -050057 d.setVar("FILES:%s" % ep, "${bindir}/%s" % p)
58 d.setVar("ALTERNATIVE:%s" % ep, 'psplash')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059 d.setVarFlag("ALTERNATIVE_TARGET_%s" % ep, 'psplash', '${bindir}/%s' % p)
Patrick Williams213cb262021-08-07 19:21:33 -050060 d.appendVar("RDEPENDS:%s" % ep, " %s" % pn)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061 if p == "psplash-default":
Patrick Williams213cb262021-08-07 19:21:33 -050062 d.appendVar("RRECOMMENDS:%s" % pn, " %s" % ep)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050063}
64
65S = "${WORKDIR}/git"
66
Andrew Geissler82c905d2020-04-13 13:39:40 -050067inherit autotools pkgconfig update-rc.d update-alternatives systemd
68
69PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
70
71PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050072
73ALTERNATIVE_PRIORITY = "100"
74ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
75
76python do_compile () {
77 import shutil
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080078 import subprocess
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079
80 # Build a separate executable for each splash image
Brad Bishop6e60e8b2018-02-01 10:27:11 -050081 workdir = d.getVar('WORKDIR')
82 convertscript = "%s/make-image-header.sh" % d.getVar('S')
Andrew Geissler82c905d2020-04-13 13:39:40 -050083 destfile = "%s/psplash-poky-img.h" % d.getVar('B')
Brad Bishop6e60e8b2018-02-01 10:27:11 -050084 localfiles = d.getVar('SPLASH_LOCALPATHS').split()
85 outputfiles = d.getVar('SPLASH_INSTALL').split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -050086 for localfile, outputfile in zip(localfiles, outputfiles):
87 if localfile.endswith(".png"):
Brad Bishop19323692019-04-05 15:28:33 -040088 if subprocess.call([ convertscript, os.path.join(workdir, localfile), 'POKY' ], cwd=workdir):
89 bb.fatal("Error calling convert script '%s'" % (convertscript))
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090 fbase = os.path.splitext(localfile)[0]
Brad Bishop19323692019-04-05 15:28:33 -040091 shutil.copyfile(os.path.join(workdir, "%s-img.h" % fbase), destfile)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050092 else:
93 shutil.copyfile(os.path.join(workdir, localfile), destfile)
94 # For some reason just updating the header is not enough, we have to touch the .c
95 # file in order to get it to rebuild
Brad Bishop6e60e8b2018-02-01 10:27:11 -050096 os.utime("%s/psplash.c" % d.getVar('S'), None)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097 bb.build.exec_func("oe_runmake", d)
98 shutil.copyfile("psplash", outputfile)
99}
100
Patrick Williams213cb262021-08-07 19:21:33 -0500101do_install:append() {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500102 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
103 install -d ${D}${sysconfdir}/init.d/
104 install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600105
106 # make fifo for psplash
107 install -d ${D}/mnt
108 mkfifo ${D}/mnt/psplash_fifo
Andrew Geissler82c905d2020-04-13 13:39:40 -0500109 fi
110
111 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
112 install -d ${D}${systemd_unitdir}/system
113 install -m 644 ${WORKDIR}/psplash-start.service ${D}/${systemd_unitdir}/system
114 install -m 644 ${WORKDIR}/psplash-systemd.service ${D}/${systemd_unitdir}/system
115 fi
116
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500117 install -d ${D}${bindir}
118 for i in ${SPLASH_INSTALL} ; do
119 install -m 0755 $i ${D}${bindir}/$i
120 done
121 rm -f ${D}${bindir}/psplash
122}
123
Andrew Geissler82c905d2020-04-13 13:39:40 -0500124SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
Patrick Williams213cb262021-08-07 19:21:33 -0500125SYSTEMD_SERVICE:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'psplash-start.service psplash-systemd.service', '', d)}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500126
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500127INITSCRIPT_NAME = "psplash.sh"
128INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ."
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600129
Patrick Williams213cb262021-08-07 19:21:33 -0500130FILES:${PN} += "/mnt"