blob: aab2c0360deee621c3c12bacb5d0a2e5cccee9f7 [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+"
6LIC_FILES_CHKSUM = "file://psplash.h;beginline=1;endline=16;md5=840fb2356b10a85bed78dd09dc7745c6"
7
Brad Bishopd7bf8c12018-02-25 22:55:05 -05008SRCREV = "2015f7073e98dd9562db0936a254af5ef56356cf"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05009PV = "0.1+git${SRCPV}"
10PR = "r15"
11
12SRC_URI = "git://git.yoctoproject.org/${BPN} \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013 file://psplash-init \
14 ${SPLASH_IMAGES}"
Brad Bishop316dfdd2018-06-25 12:45:53 -040015UPSTREAM_CHECK_COMMITS = "1"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050016
17SPLASH_IMAGES = "file://psplash-poky-img.h;outsuffix=default"
18
19python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -050020 oldpkgs = d.getVar("PACKAGES").split()
21 splashfiles = d.getVar('SPLASH_IMAGES').split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022 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 Bishop6e60e8b2018-02-01 10:27:11 -050054 mlprefix = d.getVar('MLPREFIX') or ''
55 pn = d.getVar('PN') or ''
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056 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
67S = "${WORKDIR}/git"
68
69inherit autotools pkgconfig update-rc.d update-alternatives
70
71ALTERNATIVE_PRIORITY = "100"
72ALTERNATIVE_LINK_NAME[psplash] = "${bindir}/psplash"
73
74python do_compile () {
75 import shutil
76
77 # Build a separate executable for each splash image
Brad Bishop6e60e8b2018-02-01 10:27:11 -050078 workdir = d.getVar('WORKDIR')
79 convertscript = "%s/make-image-header.sh" % d.getVar('S')
80 destfile = "%s/psplash-poky-img.h" % d.getVar('S')
81 localfiles = d.getVar('SPLASH_LOCALPATHS').split()
82 outputfiles = d.getVar('SPLASH_INSTALL').split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -050083 for localfile, outputfile in zip(localfiles, outputfiles):
84 if localfile.endswith(".png"):
85 outp = oe.utils.getstatusoutput('%s %s POKY' % (convertscript, os.path.join(workdir, localfile)))
86 print(outp[1])
87 fbase = os.path.splitext(localfile)[0]
88 shutil.copyfile("%s-img.h" % fbase, destfile)
89 else:
90 shutil.copyfile(os.path.join(workdir, localfile), destfile)
91 # For some reason just updating the header is not enough, we have to touch the .c
92 # file in order to get it to rebuild
Brad Bishop6e60e8b2018-02-01 10:27:11 -050093 os.utime("%s/psplash.c" % d.getVar('S'), None)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094 bb.build.exec_func("oe_runmake", d)
95 shutil.copyfile("psplash", outputfile)
96}
97
98do_install_append() {
99 install -d ${D}/mnt/.psplash/
100 install -d ${D}${sysconfdir}/init.d/
101 install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh
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
109FILES_${PN} += "/mnt/.psplash"
110
111INITSCRIPT_NAME = "psplash.sh"
112INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ."
113
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500114PACKAGE_WRITE_DEPS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115pkg_postinst_${PN} () {
116 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
117 if [ -n "$D" ]; then
118 OPTS="--root=$D"
119 fi
120 systemctl $OPTS mask psplash.service
121 fi
122}