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