diff options
Diffstat (limited to 'meta/classes/opie.bbclass')
-rw-r--r-- | meta/classes/opie.bbclass | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/meta/classes/opie.bbclass b/meta/classes/opie.bbclass new file mode 100644 index 0000000000..47f364a644 --- /dev/null +++ b/meta/classes/opie.bbclass | |||
@@ -0,0 +1,105 @@ | |||
1 | # | ||
2 | # This oeclass takes care about some of the itchy details of installing parts | ||
3 | # of Opie applications. Depending on quicklaunch or not, plugin or not, the | ||
4 | # TARGET is either a shared object, a shared object with a link to quicklauncher, | ||
5 | # or a usual binary. | ||
6 | # | ||
7 | # You have to provide two things: 1.) A proper SECTION field, and 2.) a proper APPNAME | ||
8 | # Then opie.oeclass will: | ||
9 | # * create the directory for the binary and install the binary file(s) | ||
10 | # * for applications: create the directory for the .desktop and install the .desktop file | ||
11 | # * for quicklauncher applications: create the startup symlink to the quicklauncher | ||
12 | # You can override the automatic detection of APPTYPE, valid values are 'quicklaunch', 'binary', 'plugin' | ||
13 | # You can override the default location of APPDESKTOP (<workdir>/apps/<section>/) | ||
14 | # | ||
15 | |||
16 | inherit palmtop | ||
17 | |||
18 | # Note that when CVS changes to 1.2.2, the dash | ||
19 | # should be removed from OPIE_CVS_PV to convert | ||
20 | # to the standardised version format | ||
21 | OPIE_CVS_PV = "1.2.1+cvs-${SRCDATE}" | ||
22 | |||
23 | DEPENDS_prepend = "${@["libopie2 ", ""][(bb.data.getVar('PN', d, 1) == 'libopie2')]}" | ||
24 | |||
25 | # to be consistent, put all targets into workdir | ||
26 | # NOTE: leave one space at the end, other files are expecting that | ||
27 | EXTRA_QMAKEVARS_POST += "DESTDIR=${S} " | ||
28 | |||
29 | # Opie standard TAG value | ||
30 | TAG = "${@'v' + bb.data.getVar('PV',d,1).replace('.', '_')}" | ||
31 | |||
32 | # plan for later: | ||
33 | # add common scopes for opie applications, see qmake-native/common.pro | ||
34 | # qmake should care about all the details then. qmake can do that, i know it :) | ||
35 | # | ||
36 | |||
37 | python opie_do_opie_install() { | ||
38 | import os, shutil | ||
39 | section = bb.data.getVar( "SECTION", d ).split( '/' )[1] or "Applications" | ||
40 | section = section.title() | ||
41 | if section in ( "Base", "Libs" ): | ||
42 | bb.note( "Section = Base or Libs. Target won't be installed automatically." ) | ||
43 | return | ||
44 | |||
45 | # SECTION : BINDIR DESKTOPDIR | ||
46 | dirmap = { "Applets" : ( "/plugins/applets", None ), | ||
47 | "Applications" : ( "<BINDIR>", "/apps/Applications" ), | ||
48 | "Multimedia" : ( "<BINDIR>", "/apps/Applications" ), | ||
49 | "Games" : ( "<BINDIR>", "/apps/Games" ), | ||
50 | "Settings" : ( "<BINDIR>", "/apps/Settings" ), | ||
51 | "Pim" : ( "<BINDIR>", "/apps/1Pim" ), | ||
52 | "Examples" : ( "<BINDIR>", "/apps/Examples" ), | ||
53 | "Shell" : ( "/bin", "/apps/Opie-SH" ), | ||
54 | "Codecs" : ( "/plugins/codecs", None ), | ||
55 | "Decorations" : ( "/plugins/decorations", None ), | ||
56 | "Inputmethods" : ( "/plugins/inputmethods", None ), | ||
57 | "Fontfactories" : ( "/plugins/fontfactories", None ), | ||
58 | "Security" : ( "/plugins/security", None ), | ||
59 | "Styles" : ( "/plugins/styles", None ), | ||
60 | "Today" : ( "/plugins/today", None ), | ||
61 | "Datebook" : ( "/plugins/holidays", None ), | ||
62 | "Networksettings" : ( "/plugins/networksettings", None ) } | ||
63 | |||
64 | if section not in dirmap: | ||
65 | raise ValueError, "Unknown section '%s'. Valid sections are: %s" % ( section, dirmap.keys() ) | ||
66 | |||
67 | bindir, desktopdir = dirmap[section] | ||
68 | APPNAME = bb.data.getVar( "APPNAME", d, True ) or bb.data.getVar( "PN", d, True ) | ||
69 | APPTYPE = bb.data.getVar( "APPTYPE", d, True ) | ||
70 | if not APPTYPE: | ||
71 | if bindir == "<BINDIR>": | ||
72 | APPTYPE = "quicklaunch" | ||
73 | else: | ||
74 | APPTYPE = "plugin" | ||
75 | |||
76 | appmap = { "binary":"/bin", "quicklaunch":"/plugins/application" } | ||
77 | if bindir == "<BINDIR>": bindir = appmap[APPTYPE] | ||
78 | |||
79 | bb.note( "Section='%s', bindir='%s', desktopdir='%s', name='%s', type='%s'" % | ||
80 | ( section, bindir, desktopdir, APPNAME, APPTYPE ) ) | ||
81 | |||
82 | S = bb.data.getVar( "S", d, 1 ) | ||
83 | D = "%s/image" % bb.data.getVar( "WORKDIR", d, True ) | ||
84 | WORKDIR = bb.data.getVar( "WORKDIR", d, True ) | ||
85 | palmtopdir = bb.data.getVar( "palmtopdir", d ) | ||
86 | APPDESKTOP = bb.data.getVar( "APPDESKTOP", d, True ) or "%s/%s" % ( WORKDIR, desktopdir ) | ||
87 | |||
88 | if desktopdir is not None: | ||
89 | os.system( "install -d %s%s%s/" % ( D, palmtopdir, desktopdir ) ) | ||
90 | os.system( "install -m 0644 %s/%s.desktop %s%s%s/" % ( APPDESKTOP, APPNAME, D, palmtopdir, desktopdir ) ) | ||
91 | |||
92 | os.system( "install -d %s%s%s/" % ( D, palmtopdir, bindir ) ) | ||
93 | |||
94 | if APPTYPE == "binary": | ||
95 | os.system( "install -m 0755 %s/%s %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) | ||
96 | elif APPTYPE == "quicklaunch": | ||
97 | os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) | ||
98 | os.system( "install -d %s%s/bin/" % ( D, palmtopdir ) ) | ||
99 | os.system( "ln -sf %s/bin/quicklauncher %s%s/bin/%s" % ( palmtopdir, D, palmtopdir, APPNAME ) ) | ||
100 | elif APPTYPE == "plugin": | ||
101 | os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) ) | ||
102 | } | ||
103 | |||
104 | EXPORT_FUNCTIONS do_opie_install | ||
105 | addtask opie_install after do_compile before do_populate_staging | ||