This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.py
89 lines (76 loc) · 3.07 KB
/
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
import bold
from bold import build_path, util
import multiprocessing
import shutil
class Libav (bold.builders.Builder):
required_by = lambda: Rtmp_load.target
src_path = 'src/libav'
sources = lambda self: list(util.get_file_paths_recursive(self.src_path))
src_copy_path = build_path + 'libav_src'
target = src_copy_path + '/libavformat/libavformat.a'
def build (self, _changed_targets, _src_paths):
shutil.rmtree(self.resolve(self.src_copy_path), ignore_errors = True)
shutil.copytree(self.src_path, self.resolve(self.src_copy_path))
with util.change_cwd(self.resolve(self.src_copy_path)):
# --disable-debug --enable-gpl --enable-nonfree
self.shell_run("./configure --enable-librtmp --disable-doc --disable-ffmpeg --disable-avconv"
" --disable-avplay --disable-avprobe --disable-avserver --disable-swscale --disable-avdevice"
" --disable-avfilter --enable-runtime-cpudetect --disable-encoders"
" && make --jobs %i" % (multiprocessing.cpu_count() * 2))
# self.shell_run("./configure --enable-librtmp --disable-doc --disable-ffmpeg"
# " --disable-ffplay --disable-ffprobe --disable-ffserver --disable-swscale --disable-avdevice"
# " --disable-avfilter --enable-runtime-cpudetect --disable-encoders"
# " && make --jobs %i" % (multiprocessing.cpu_count() * 2))
self._update_target(self.target)
class Luajit (bold.builders.Builder):
required_by = lambda: Rtmp_load.target
src_path = 'src/luajit'
src_copy_path = build_path + 'luajit_src'
target = src_copy_path + '/src/libluajit.a'
sources = lambda self: list(util.get_file_paths_recursive(self.src_path, [self.src_path + '/doc/*']))
def build (self, _changed_targets, _src_paths):
shutil.rmtree(self.resolve(self.src_copy_path), ignore_errors = True)
shutil.copytree(self.src_path, self.resolve(self.src_copy_path))
with util.change_cwd(self.resolve(self.src_copy_path)):
self.shell_run('''make amalg CCDEBUG=" -g" BUILDMODE=" static"''')
self._update_target(self.target)
class Rtmp_load (bold.builders.CProgram):
target = build_path + 'rtmp_load'
sources = 'src/*.c'
deps_include_missing_header = True
gopt_flags = '-DUSE_SYSEXITS'
compile_flags = '-O2 -g -std=gnu99 -Wall -pthread ' + gopt_flags
includes = [
Libav.src_copy_path,
# '/usr/include/lua5.1/',
Luajit.src_path + '/src',
]
link_flags = '-Wl,--export-dynamic' #-Wl,-rpath=/home/f/proj/libav-0.8.3/i/lib/
lib_paths = [
Libav.src_copy_path + '/libavformat',
Libav.src_copy_path + '/libavcodec',
Libav.src_copy_path + '/libavutil',
Luajit.src_copy_path + '/src',
]
libs = [
'rt',
'dl',
'avformat',
'avcodec',
'avutil',
'rtmp',
'luajit',
'm',
]
class FFIHeader (bold.builders.Builder):
required_by = Rtmp_load.target
sources = 'ffi.py', 'src/run.h'
target = build_path + 'luajit_ffi.h'
def build (self, changed_targets, src_paths):
headers = "\n".join([
"#include <time.h>",
"#include <pthread.h>",
'#include \\"src/run.h\\"',
])
self.shell_run("bash -o pipefail -c \"echo '" + headers + "' | gcc -E -dD - | grep -v '^# ' | python ffi.py > " + self.target + '"')
self._update_target(self.target)