File: plugin.py

package info (click to toggle)
xmms2 0.5DrLecter-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 6,988 kB
  • ctags: 11,272
  • sloc: ansic: 51,389; cpp: 26,556; python: 11,479; perl: 202; ruby: 138; makefile: 100; asm: 7; sh: 4
file content (44 lines) | stat: -rw-r--r-- 1,381 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Stock plugin configuration and build methods. These factor out the
# common tasks carried out by plugins in order to configure and build
# themselves.

def plugin(name, source=None, configure=False, build=False,
           build_replace=False, needs_lib=False, extra_libs=[],
           tool='cc', broken=False, output_prio=None):
    def stock_configure(conf):
        if broken:
            conf.check_message_custom('%s plugin' % name, '',
                                      'disabled (broken)')
            return
        if configure and not configure(conf):
            return
        conf.env.append_value('XMMS_PLUGINS_ENABLED', name)
        if output_prio:
            conf.env.append_value('XMMS_OUTPUT_PLUGINS', (output_prio, name))

    def stock_build(bld):
        env = bld.env()

        obj = bld.create_obj(tool, 'plugin')
        obj.target = 'xmms_%s' % name
        obj.includes = '../../include'
        if source:
            obj.source = source
        else:
            obj.source = ['%s.c' % name]

        libs = ['glib2']
        if needs_lib:
            libs.append(name)
        libs += extra_libs
        obj.uselib = ' '.join(libs)

        if env['xmms_shared_library']:
            obj.uselib_local = 'xmms2core'

        obj.install_var = 'PLUGINDIR'

        if build:
            build(bld, obj)

    return stock_configure, stock_build