opie.bbclass 4.5 KB

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