forked from vapoursynth/vapoursynth
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wscript_build.py
137 lines (105 loc) · 4.91 KB
/
wscript_build.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import os
def build(ctx):
def _search_paths(paths):
srcpaths = []
for path in paths:
srcpaths += [os.path.join(path, '*.c'), os.path.join(path, '*.cpp')]
if ctx.dependency_satisfied('cpu-x86'):
srcpaths += [os.path.join(path, '*.asm')]
else:
srcpaths += [os.path.join(path, '*.S')]
return srcpaths
def _build_core():
sources = _search_paths([os.path.join('src', 'core'),
os.path.join('src', 'core', 'asm'),
os.path.join('src', 'core', 'asm', 'x86'),
os.path.join('src', 'core', 'asm', 'arm'),
os.path.join('src', 'core', 'asm', 'ppc')])
if ctx.dependency_satisfied('avisynth-compat'):
sources += _search_paths([os.path.join('src', 'avisynth')])
ctx(features = 'c cxx asm',
includes = ['include'] + ctx.dependencies_includes('vapoursynth'),
source = ctx.path.ant_glob(sources),
target = 'core_objs')
uses = ['core_objs'] + \
ctx.dependencies_use('vapoursynth') + ctx.dependencies_global()
if ctx.dependency_satisfied('shared'):
ctx(features = 'c cxx asm cxxshlib',
use = uses,
target = 'vapoursynth',
install_path = ctx.env.LIBDIR)
if ctx.dependency_satisfied('static'):
ctx(features = 'c cxx asm cxxstlib',
use = uses,
target = 'vapoursynth',
install_path = ctx.env.LIBDIR)
ctx.install_files(ctx.env.INCLUDEDIR,
[os.path.join('include', 'VapourSynth.h'),
os.path.join('include', 'VSHelper.h')])
libs = ['-l' + l for l in ctx.dependencies_libs('vapoursynth')]
ctx(source = os.path.join('pc', 'vapoursynth.pc.in'),
install_path = os.path.join(ctx.env.LIBDIR, 'pkgconfig'),
PREFIX = ctx.env.PREFIX,
LIBDIR = ctx.env.LIBDIR,
INCLUDEDIR = ctx.env.INCLUDEDIR,
LIBS = ' '.join(libs),
VERSION = ctx.env.VSVERSION)
def _build_vsscript():
sources = _search_paths([os.path.join('src', 'vsscript')])
ctx(features = 'c cxx asm pyembed',
includes = ['include'] + ctx.dependencies_includes('vsscript'),
source = ctx.path.ant_glob(sources),
target = 'vsscript_objs')
uses = ['vsscript_objs'] + \
ctx.dependencies_use('vapoursynth_script') + ctx.dependencies_global()
if ctx.dependency_satisfied('shared'):
ctx(features = 'c cxx asm cxxshlib pyembed',
use = uses,
target = 'vapoursynth-script',
install_path = ctx.env.LIBDIR)
if ctx.dependency_satisfied('static'):
ctx(features = 'c cxx asm cxxstlib pyembed',
use = uses,
target = 'vapoursynth-script',
install_path = ctx.env.LIBDIR)
libs = ['-l' + l for l in ctx.dependencies_libs('vapoursynth-script')]
ctx(source = os.path.join('pc', 'vapoursynth-script.pc.in'),
install_path = os.path.join(ctx.env.LIBDIR, 'pkgconfig'),
PREFIX = ctx.env.PREFIX,
LIBDIR = ctx.env.LIBDIR,
INCLUDEDIR = ctx.env.INCLUDEDIR,
LIBS = ' '.join(libs),
VERSION = ctx.env.VSVERSION)
ctx.install_files(ctx.env.INCLUDEDIR,
[os.path.join('include', 'VSScript.h')])
def _build_vspipe():
sources = _search_paths([os.path.join('src', 'vspipe')])
ctx(features = 'c cxx asm cxxprogram',
includes = ['include'] + ctx.dependencies_includes('vspipe'),
source = ctx.path.ant_glob(sources),
use = ctx.dependencies_use('vspipe') + ctx.dependencies_global(),
target = 'vspipe',
install_path = ctx.env.BINDIR)
def _build_filters():
fpath = os.path.join('src', 'filters')
for f in ctx.group_dependencies('filters'):
sources = _search_paths([os.path.join(fpath, f)])
ctx(features = 'c cxx asm cxxshlib',
includes = ['include'] + ctx.dependencies_includes(f),
use = ctx.dependencies_use(f) + ctx.dependencies_global(),
source = ctx.path.ant_glob(sources),
target = f,
install_path = ctx.env.PLUGINDIR)
def _build_docs():
ctx(features = 'sphinxhtml',
source = os.path.join('doc', 'conf.py'),
install_path = ctx.env.DOCDIR)
if ctx.dependency_satisfied('vapoursynth'):
_build_core()
if ctx.dependency_satisfied('vapoursynth-script'):
_build_vsscript()
if ctx.dependency_satisfied('vspipe'):
_build_vspipe()
_build_filters()
if ctx.dependency_satisfied('docs'):
_build_docs()