increase dvbapp PR.
[vuplus_openembedded] / classes / opie.bbclass
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 OPIE_CVS_PV ?= "1.2.2+cvs${SRCDATE}"
19
20 DEPENDS_prepend = "${@["libopie2 ", ""][(bb.data.getVar('PN', d, 1) == 'libopie2')]}"
21
22 # to be consistent, put all targets into workdir
23 # NOTE: leave one space at the end, other files are expecting that
24 EXTRA_QMAKEVARS_POST += " DESTDIR=${S} "
25
26 # Opie standard TAG value
27 TAG = "${@'v' + bb.data.getVar('PV',d,1).replace('.', '_')}"
28
29 # plan for later:
30 # add common scopes for opie applications, see qmake-native/common.pro
31 # qmake should care about all the details then. qmake can do that, i know it :)
32 #
33
34 python opie_do_opie_install() {
35         import os, shutil
36         section = bb.data.getVar( "SECTION", d ).split( '/' )[1] or "Applications"
37         section = section.title()
38         if section in ( "Base", "Libs" ):
39                 bb.note( "Section = Base or Libs. Target won't be installed automatically." )
40                 return
41
42         #               SECTION         : BINDIR                        DESKTOPDIR
43         dirmap = {      "Applets"       : ( "/plugins/applets",         None                    ),
44                         "Applications"  : ( "<BINDIR>",                 "/apps/Applications"    ),
45                         "Multimedia"    : ( "<BINDIR>",                 "/apps/Applications"    ),
46                         "Games"         : ( "<BINDIR>",                 "/apps/Games"           ),
47                         "Settings"      : ( "<BINDIR>",                 "/apps/Settings"        ),
48                         "Pim"           : ( "<BINDIR>",                 "/apps/1Pim"            ),
49                         "Examples"      : ( "<BINDIR>",                 "/apps/Examples"        ),
50                         "Shell"         : ( "/bin",                     "/apps/Opie-SH"         ),
51                         "Codecs"        : ( "/plugins/codecs",          None                    ),
52                         "Decorations"   : ( "/plugins/decorations",     None                    ),
53                         "Inputmethods"  : ( "/plugins/inputmethods",    None                    ),
54                         "Fontfactories" : ( "/plugins/fontfactories",   None                    ),
55                         "Security"      : ( "/plugins/security",        None                    ),
56                         "Styles"        : ( "/plugins/styles",          None                    ),
57                         "Today"         : ( "/plugins/today",           None                    ),
58                         "Datebook"      : ( "/plugins/holidays",        None                    ),
59                 "Networksettings"       : ( "/plugins/networksettings", None                    ) }
60
61         if section not in dirmap:
62                 raise ValueError, "Unknown section '%s'. Valid sections are: %s" % ( section, dirmap.keys() )
63         
64         bindir, desktopdir = dirmap[section]
65         APPNAME = bb.data.getVar( "APPNAME", d, True ) or bb.data.getVar( "PN", d, True )
66         APPTYPE = bb.data.getVar( "APPTYPE", d, True )
67         if not APPTYPE:
68                 if bindir == "<BINDIR>":
69                         APPTYPE = "quicklaunch"
70                 else:
71                         APPTYPE = "plugin"
72
73         appmap = { "binary":"/bin", "quicklaunch":"/plugins/application" }
74         if bindir == "<BINDIR>": bindir = appmap[APPTYPE]
75         
76         bb.note( "Section='%s', bindir='%s', desktopdir='%s', name='%s', type='%s'" %
77                ( section, bindir, desktopdir, APPNAME, APPTYPE ) )
78
79         S = bb.data.getVar( "S", d, 1 )
80         D = "%s/image" % bb.data.getVar( "WORKDIR", d, True )
81         WORKDIR = bb.data.getVar( "WORKDIR", d, True )
82         palmtopdir = bb.data.getVar( "palmtopdir", d, True )
83         gnubindir = bb.data.getVar( "bindir", d, True )
84         APPDESKTOP = bb.data.getVar( "APPDESKTOP", d, True ) or "%s/%s" % ( WORKDIR, desktopdir )
85
86         if desktopdir is not None:
87                 os.system( "install -d %s%s%s/" % ( D, palmtopdir, desktopdir ) )
88                 os.system( "install -m 0644 %s/%s.desktop %s%s%s/" % ( APPDESKTOP, APPNAME, D, palmtopdir, desktopdir ) )
89
90         os.system( "install -d %s%s%s/" % ( D, palmtopdir, bindir ) )
91
92         if APPTYPE == "binary":
93                 os.system( "install -d %s%s/" % ( D, gnubindir ) )
94                 os.system( "install -m 0755 %s/%s %s%s/" % ( S, APPNAME, D, gnubindir ) )
95         elif APPTYPE == "quicklaunch":
96                 os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) )
97                 os.system( "install -d %s%s/" % ( D, gnubindir ) )
98                 os.system( "ln -sf %s/quicklauncher %s%s/%s" % ( gnubindir, D, gnubindir, APPNAME ) )
99         elif APPTYPE == "plugin":
100                 os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) )
101 }
102
103 EXPORT_FUNCTIONS do_opie_install
104 addtask opie_install after do_compile before do_package