diff options
Diffstat (limited to 'meta/recipes-core/psplash')
-rw-r--r-- | meta/recipes-core/psplash/psplash_git.bb | 93 |
1 files changed, 87 insertions, 6 deletions
diff --git a/meta/recipes-core/psplash/psplash_git.bb b/meta/recipes-core/psplash/psplash_git.bb index 9112aa9168..42ea6151e5 100644 --- a/meta/recipes-core/psplash/psplash_git.bb +++ b/meta/recipes-core/psplash/psplash_git.bb | |||
@@ -7,27 +7,108 @@ LIC_FILES_CHKSUM = "file://psplash.h;md5=a87c39812c1e37f3451567cc29a29c8f" | |||
7 | 7 | ||
8 | SRCREV = "e05374aae945bcfc6d962ed0d7b2774b77987e1d" | 8 | SRCREV = "e05374aae945bcfc6d962ed0d7b2774b77987e1d" |
9 | PV = "0.1+git${SRCPV}" | 9 | PV = "0.1+git${SRCPV}" |
10 | PR = "r0" | 10 | PR = "r1" |
11 | 11 | ||
12 | SRC_URI = "git://git.yoctoproject.org/${BPN};protocol=git \ | 12 | SRC_URI = "git://git.yoctoproject.org/${BPN};protocol=git \ |
13 | file://psplash-init \ | 13 | file://psplash-init \ |
14 | file://psplash-poky-img.h" | 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 = fetcher.localpath(uri) | ||
27 | fbase = os.path.splitext(os.path.basename(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 | for p in pkgs: | ||
54 | d.setVar("FILES_%s" % p, "${bindir}/%s" % p) | ||
55 | d.setVar("ALTERNATIVE_PATH", "${bindir}/%s" % p) | ||
56 | d.setVar("ALTERNATIVE_PRIORITY", "100") | ||
57 | postinst = d.getVar("psplash_alternatives_postinst", True) | ||
58 | d.setVar('pkg_postinst_%s' % p, postinst) | ||
59 | postrm = d.getVar("psplash_alternatives_postrm", True) | ||
60 | d.setVar('pkg_postrm_%s' % p, postrm) | ||
61 | d.appendVar("RDEPENDS_%s" % p, " ${PN}") | ||
62 | if p == "psplash-default": | ||
63 | d.appendVar("RRECOMMENDS_${PN}", " %s" % p) | ||
64 | } | ||
15 | 65 | ||
16 | S = "${WORKDIR}/git" | 66 | S = "${WORKDIR}/git" |
17 | 67 | ||
18 | inherit autotools pkgconfig update-rc.d | 68 | inherit autotools pkgconfig update-rc.d |
19 | 69 | ||
20 | FILES_${PN} += "/mnt/.psplash" | 70 | python do_compile () { |
71 | import shutil | ||
21 | 72 | ||
22 | do_configure_prepend () { | 73 | # Build a separate executable for each splash image |
23 | cp -f ${WORKDIR}/psplash-poky-img.h ${S}/ | 74 | destfile = "%s/psplash-poky-img.h" % d.getVar('S', True) |
75 | localfiles = d.getVar('SPLASH_LOCALPATHS', True).split() | ||
76 | outputfiles = d.getVar('SPLASH_INSTALL', True).split() | ||
77 | for localfile, outputfile in zip(localfiles, outputfiles): | ||
78 | if localfile.endswith(".png"): | ||
79 | outp = commands.getstatusoutput('./make-image-header.sh %s POKY' % localfile) | ||
80 | print(outp[1]) | ||
81 | fbase = os.path.splitext(os.path.basename(localfile))[0] | ||
82 | shutil.copyfile("%s-img.h" % fbase, destfile) | ||
83 | else: | ||
84 | shutil.copyfile(localfile, destfile) | ||
85 | # For some reason just updating the header is not enough, we have to touch the .c | ||
86 | # file in order to get it to rebuild | ||
87 | os.utime("psplash.c", None) | ||
88 | bb.build.exec_func("oe_runmake", d) | ||
89 | shutil.copyfile("psplash", outputfile) | ||
24 | } | 90 | } |
25 | 91 | ||
26 | do_install_prepend() { | 92 | do_install_append() { |
27 | install -d ${D}/mnt/.psplash/ | 93 | install -d ${D}/mnt/.psplash/ |
28 | install -d ${D}${sysconfdir}/init.d/ | 94 | install -d ${D}${sysconfdir}/init.d/ |
29 | install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh | 95 | install -m 0755 ${WORKDIR}/psplash-init ${D}${sysconfdir}/init.d/psplash.sh |
96 | install -d ${D}${bindir} | ||
97 | for i in ${SPLASH_INSTALL} ; do | ||
98 | install -m 0755 $i ${D}${bindir}/$i | ||
99 | done | ||
100 | rm -f ${D}${bindir}/psplash | ||
30 | } | 101 | } |
31 | 102 | ||
103 | psplash_alternatives_postinst() { | ||
104 | update-alternatives --install ${bindir}/psplash psplash ${ALTERNATIVE_PATH} ${ALTERNATIVE_PRIORITY} | ||
105 | } | ||
106 | |||
107 | psplash_alternatives_postrm() { | ||
108 | update-alternatives --remove psplash ${ALTERNATIVE_PATH} | ||
109 | } | ||
110 | |||
111 | FILES_${PN} += "/mnt/.psplash" | ||
112 | |||
32 | INITSCRIPT_NAME = "psplash.sh" | 113 | INITSCRIPT_NAME = "psplash.sh" |
33 | INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ." | 114 | INITSCRIPT_PARAMS = "start 0 S . stop 20 0 1 6 ." |