-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdodo.py
143 lines (112 loc) · 3.93 KB
/
dodo.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
138
139
140
141
142
"""
Copyright (C) 2012, 2013, 2014 Eduardo Naufel Schettino and Johan Mattsson
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import glob
import subprocess
from optparse import OptionParser
from doit.tools import run_once
from doit.action import CmdAction
from scripts.bavala import Vala
from scripts import version
from scripts.translations import compile_translations
from scripts import config
DOIT_CONFIG = {
'default_tasks': [
'build',
'libbirdfont',
'birdfont',
'birdfont_autotrace',
'birdfont_export',
'birdfont_import',
'compile_translations',
'man'
],
}
# external Vala libs
LIBS = [
'glib-2.0',
'libxml-2.0',
'gio-2.0',
'cairo',
'gdk-pixbuf-2.0',
'webkitgtk-3.0',
config.GEE,
'libnotify',
'libgit2'
]
def task_build ():
if not os.path.exists ("build/configured"):
print ("Project is not configured")
exit (1)
subprocess.check_output ('mkdir -p build', shell=True)
subprocess.check_output ('touch build/installed', shell=True)
return {
'actions': ['echo "Build"'],
}
def task_pkg_flags():
"""get compiler flags for libs/pkgs """
for pkg in LIBS:
cmd = 'pkg-config --cflags --libs {pkg}'
yield {
'name': pkg,
'actions': [CmdAction(cmd.format(pkg=pkg), save_out='out')],
'uptodate': [run_once],
}
valac_options = [
'--enable-experimental-non-null',
'--enable-experimental',
'--target-glib=2.34', # see bug 0000004
'--define=LINUX'
]
libbird = Vala(src='libbirdfont', build='build', library='birdfont', so_version=version.SO_VERSION, pkg_libs=LIBS)
def task_libbirdfont():
yield libbird.gen_c(valac_options)
yield libbird.gen_o(['-fPIC', """-D 'GETTEXT_PACKAGE="birdfont"'"""])
yield libbird.gen_so()
yield libbird.gen_ln()
def task_birdfont():
bird = Vala(src='birdfont', build='build', pkg_libs=LIBS, vala_deps=[libbird])
yield bird.gen_c(valac_options)
yield bird.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """])
def task_birdfont_autotrace():
exp = Vala(src='birdfont-autotrace', build='build', pkg_libs=LIBS, vala_deps=[libbird])
yield exp.gen_c(valac_options)
yield exp.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """])
def task_birdfont_export():
exp = Vala(src='birdfont-export', build='build', pkg_libs=LIBS, vala_deps=[libbird])
yield exp.gen_c(valac_options)
yield exp.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """])
def task_birdfont_import():
exp = Vala(src='birdfont-import', build='build', pkg_libs=LIBS, vala_deps=[libbird])
yield exp.gen_c(valac_options)
yield exp.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """])
def task_compile_translations ():
"""translate po files"""
return {
'actions': [compile_translations]
}
def task_man():
"""gzip linux man pages"""
for name in ("birdfont.1", "birdfont-export.1",
"birdfont-import.1", "birdfont-autotrace.1"):
yield {
'name': name,
'file_dep': ['resources/linux/%s' % name],
'targets': ['build/%s.gz' % name],
'actions': ["gzip -9 -c %(dependencies)s > %(targets)s"],
}
def task_distclean ():
return {
'actions': ['rm -rf .doit.db build scripts/config.py scripts/*.pyc dodo.pyc libbirdfont/Config.vala'],
}