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,
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>/)
18 DEPENDS_prepend = "${@["libopie2 ", ""][(oe.data.getVar('PN', d, 1) == 'libopie2')]}"
20 # to be consistent, put all targets into workdir
21 EXTRA_QMAKEVARS_POST_append = " DESTDIR=${S}"
24 # add common scopes for opie applications, see qmake-native/common.pro
25 # qmake should care about all the details then. qmake can do that, i know it :)
28 python opie_do_opie_install() {
30 section = oe.data.getVar( "SECTION", d ).split( '/' )[1] or "Applications"
31 section = section.title()
32 if section in ( "Base", "Libs" ):
33 oe.note( "Section = Base or Libs. Target won't be installed automatically." )
36 # SECTION : BINDIR DESKTOPDIR
37 dirmap = { "Applets" : ( "/plugins/applets", None ),
38 "Applications" : ( "<BINDIR>", "/apps/Applications" ),
39 "Multimedia" : ( "<BINDIR>", "/apps/Applications" ),
40 "Games" : ( "<BINDIR>", "/apps/Games" ),
41 "Settings" : ( "<BINDIR>", "/apps/Settings" ),
42 "Pim" : ( "<BINDIR>", "/apps/1Pim" ),
43 "Examples" : ( "<BINDIR>", "/apps/Examples" ),
44 "Shell" : ( "/bin", "/apps/Opie-SH" ),
45 "Codecs" : ( "/plugins/codecs", None ),
46 "Decorations" : ( "/plugins/decorations", None ),
47 "Inputmethods" : ( "/plugins/inputmethods", None ),
48 "Fontfactories" : ( "/plugins/fontfactories", None ),
49 "Styles" : ( "/plugins/styles", None ),
50 "Today" : ( "/plugins/today", None ),
51 "Networksettings" : ( "/plugins/networksettings", None ) }
53 if section not in dirmap:
54 raise ValueError, "Unknown section '%s'. Valid sections are: %s" % ( section, dirmap.keys() )
56 bindir, desktopdir = dirmap[section]
57 APPNAME = oe.data.getVar( "APPNAME", d, True ) or oe.data.getVar( "PN", d, True )
58 APPTYPE = oe.data.getVar( "APPTYPE", d, True )
60 if bindir == "<BINDIR>":
61 APPTYPE = "quicklaunch"
65 appmap = { "binary":"/bin", "quicklaunch":"/plugins/application" }
66 if bindir == "<BINDIR>": bindir = appmap[APPTYPE]
68 oe.note( "Section='%s', bindir='%s', desktopdir='%s', name='%s', type='%s'" %
69 ( section, bindir, desktopdir, APPNAME, APPTYPE ) )
71 S = oe.data.getVar( "S", d, 1 )
72 D = "%s/image" % oe.data.getVar( "WORKDIR", d, True )
73 WORKDIR = oe.data.getVar( "WORKDIR", d, True )
74 palmtopdir = oe.data.getVar( "palmtopdir", d )
75 APPDESKTOP = oe.data.getVar( "APPDESKTOP", d, True ) or "%s/%s" % ( WORKDIR, desktopdir )
77 if desktopdir is not None:
78 os.system( "install -d %s%s%s/" % ( D, palmtopdir, desktopdir ) )
79 os.system( "install -m 0644 %s/%s.desktop %s%s%s/" % ( APPDESKTOP, APPNAME, D, palmtopdir, desktopdir ) )
81 os.system( "install -d %s%s%s/" % ( D, palmtopdir, bindir ) )
83 if APPTYPE == "binary":
84 os.system( "install -m 0755 %s/%s %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) )
85 elif APPTYPE == "quicklaunch":
86 os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) )
87 os.system( "install -d %s%s/bin/" % ( D, palmtopdir ) )
88 os.system( "ln -sf %s/bin/quicklauncher %s%s/bin/%s" % ( palmtopdir, D, palmtopdir, APPNAME ) )
89 elif APPTYPE == "plugin":
90 os.system( "install -m 0755 %s/lib%s.so %s%s%s/" % ( S, APPNAME, D, palmtopdir, bindir ) )
93 EXPORT_FUNCTIONS do_opie_install
94 addtask opie_install after do_compile before do_populate_staging