blob: b3b64799ae2757e9d05486f68e29658e8bcf9b2f [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
8SRCREV = "14c8f7b705de944beb4de3f296506d80871e410f"
9PV = "0.1+git${SRCPV}"
10PR = "r15"
11
12SRC_URI = "git://git.yoctoproject.org/${BPN} \
13 file://0001-psplash-fb-Convert-psplash_fb_plot_pixel-to-a-static.patch \
14 file://psplash-init \
15 ${SPLASH_IMAGES}"
16
17SPLASH_IMAGES = "file://psplash-poky-img.h;outsuffix=default"
18
19python __anonymous() {
20 oldpkgs = d.getVar("PACKAGES", True).split()
21 splashfiles = d.getVar('SPLASH_IMAGES', True).split()
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)))
54 mlprefix = d.getVar('MLPREFIX', True) or ''
55 pn = d.getVar('PN', True) or ''
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
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
78 workdir = d.getVar('WORKDIR', True)
79 convertscript = "%s/make-image-header.sh" % d.getVar('S', True)
80 destfile = "%s/psplash-poky-img.h" % d.getVar('S', True)
81 localfiles = d.getVar('SPLASH_LOCALPATHS', True).split()
82 outputfiles = d.getVar('SPLASH_INSTALL', True).split()
83 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
93 os.utime("%s/psplash.c" % d.getVar('S', True), None)
94 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
114DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
115pkg_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}