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