source: waflib/Tools/perl.py @ 926f0f6

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 926f0f6 was 0fa325b, checked in by Paul Brossier <piem@piem.org>, 11 years ago

waf: unpack

  • Property mode set to 100644
File size: 2.9 KB
Line 
1#! /usr/bin/env python
2# encoding: utf-8
3# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
4
5import os
6from waflib import Task,Options,Utils
7from waflib.Configure import conf
8from waflib.TaskGen import extension,feature,before_method
9@before_method('apply_incpaths','apply_link','propagate_uselib_vars')
10@feature('perlext')
11def init_perlext(self):
12        self.uselib=self.to_list(getattr(self,'uselib',[]))
13        if not'PERLEXT'in self.uselib:self.uselib.append('PERLEXT')
14        self.env['cshlib_PATTERN']=self.env['cxxshlib_PATTERN']=self.env['perlext_PATTERN']
15@extension('.xs')
16def xsubpp_file(self,node):
17        outnode=node.change_ext('.c')
18        self.create_task('xsubpp',node,outnode)
19        self.source.append(outnode)
20class xsubpp(Task.Task):
21        run_str='${PERL} ${XSUBPP} -noprototypes -typemap ${EXTUTILS_TYPEMAP} ${SRC} > ${TGT}'
22        color='BLUE'
23        ext_out=['.h']
24@conf
25def check_perl_version(self,minver=None):
26        res=True
27        if minver:
28                cver='.'.join(map(str,minver))
29        else:
30                cver=''
31        self.start_msg('Checking for minimum perl version %s'%cver)
32        perl=getattr(Options.options,'perlbinary',None)
33        if not perl:
34                perl=self.find_program('perl',var='PERL')
35        if not perl:
36                self.end_msg("Perl not found",color="YELLOW")
37                return False
38        self.env['PERL']=perl
39        version=self.cmd_and_log([perl,"-e",'printf \"%vd\", $^V'])
40        if not version:
41                res=False
42                version="Unknown"
43        elif not minver is None:
44                ver=tuple(map(int,version.split(".")))
45                if ver<minver:
46                        res=False
47        self.end_msg(version,color=res and"GREEN"or"YELLOW")
48        return res
49@conf
50def check_perl_module(self,module):
51        cmd=[self.env['PERL'],'-e','use %s'%module]
52        self.start_msg('perl module %s'%module)
53        try:
54                r=self.cmd_and_log(cmd)
55        except Exception:
56                self.end_msg(False)
57                return None
58        self.end_msg(r or True)
59        return r
60@conf
61def check_perl_ext_devel(self):
62        env=self.env
63        perl=env.PERL
64        if not perl:
65                self.fatal('find perl first')
66        def read_out(cmd):
67                return Utils.to_list(self.cmd_and_log(perl+cmd))
68        env['LINKFLAGS_PERLEXT']=read_out(" -MConfig -e'print $Config{lddlflags}'")
69        env['INCLUDES_PERLEXT']=read_out(" -MConfig -e'print \"$Config{archlib}/CORE\"'")
70        env['CFLAGS_PERLEXT']=read_out(" -MConfig -e'print \"$Config{ccflags} $Config{cccdlflags}\"'")
71        env['XSUBPP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/xsubpp$Config{exe_ext}\"'")
72        env['EXTUTILS_TYPEMAP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/typemap\"'")
73        if not getattr(Options.options,'perlarchdir',None):
74                env['ARCHDIR_PERL']=self.cmd_and_log(perl+" -MConfig -e'print $Config{sitearch}'")
75        else:
76                env['ARCHDIR_PERL']=getattr(Options.options,'perlarchdir')
77        env['perlext_PATTERN']='%s.'+self.cmd_and_log(perl+" -MConfig -e'print $Config{dlext}'")
78def options(opt):
79        opt.add_option('--with-perl-binary',type='string',dest='perlbinary',help='Specify alternate perl binary',default=None)
80        opt.add_option('--with-perl-archdir',type='string',dest='perlarchdir',help='Specify directory where to install arch specific files',default=None)
Note: See TracBrowser for help on using the repository browser.