-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject_duke.py
More file actions
executable file
·136 lines (104 loc) · 3.02 KB
/
project_duke.py
File metadata and controls
executable file
·136 lines (104 loc) · 3.02 KB
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
#! /usr/bin/env python
"""
NAME
{program_name} - {project_name} build actions script.
SYNOPSIS
{program_name} actions
DESCRIPTION
actions
{actions}
computed_env
{computed_env}
"""
import sys
import pprint
import worktry
project_name = 'duke'
depends = {
'darwin': {
'projects':[],
'formulae':['openimageio'],
},
}
envs = {
'default': {},
'darwin': {
'dyld_library_path': ['{oiio_project_dir}/dist/macosx']
},
}
computed_env = {}
def clean():
"""
clean action.
"""
if sys.platform != 'darwin':
raise NotImplementedError(sys.platform)
worktry.exec_cmd('cd {project_dir};'
'make clean'
.format(**computed_env), computed_env)
def configure():
"""
configure action.
"""
if sys.platform != 'darwin':
raise NotImplementedError(sys.platform)
worktry.exec_cmd('cd {project_dir};'
'VERBOSE=1 PKG_CONFIG_PATH={wt_root}/pkgconfig cmake . -Bbuild'
.format(**computed_env), computed_env)
def distclean():
"""
distclean action.
"""
if sys.platform != 'darwin':
raise NotImplementedError(sys.platform)
worktry.exec_cmd('cd {project_dir};'
'make distclean && rm -rf build'
.format(**computed_env), computed_env)
def make():
"""
make action.
"""
if sys.platform != 'darwin':
raise NotImplementedError(sys.platform)
worktry.exec_cmd('cd {project_dir};'
'VERBOSE=1 PKG_CONFIG_PATH={wt_root}/pkgconfig cmake --build build -j4'
.format(**computed_env), computed_env)
def make_depends():
"""
make_depends action.
"""
if sys.platform != 'darwin':
raise NotImplementedError(sys.platform)
if sys.platform == 'darwin':
worktry.make_depends(depends['darwin'], computed_env)
def materialize():
"""
"""
worktry.materialize(project_name, computed_env)
worktry.exec_cmd('cd {project_dir};'
'git apply {wt_root}/duke_osx2021.patch'
.format(**computed_env), computed_env)
def run(args=''):
worktry.exec_cmd('{project_dir}/build/src/duke/duke {args}'
.format(**computed_env, args=args), computed_env)
computed_env.update(worktry.compute_project(project_name, depends, envs))
actions = {
'all': lambda: (configure(), make()),
'configure': configure,
'make': make,
'clean': clean,
'distclean': distclean,
'make_depends': make_depends,
'materialize': materialize,
}
computed_env['actions'] = sorted(actions.keys())
computed_env['program_name'] = __file__
__doc__ = __doc__.format(computed_env=pprint.pformat(computed_env), **computed_env)
if __name__ == "__main__":
if len(sys.argv) != 2 or '-h' in sys.argv:
print(__doc__)
sys.exit(0)
action = sys.argv[1]
if action not in actions:
raise NotImplementedError('Action {}'.format(action))
actions[action]()