-
Notifications
You must be signed in to change notification settings - Fork 31
/
wscript
144 lines (123 loc) · 4.43 KB
/
wscript
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
143
144
#! /usr/bin/env python
# encoding: utf-8
# SkyzohKey, 2016
from waflib import Utils
# the following two variables are used by the target "waf dist"
VERSION = '0.1.0'
APPNAME = 'ricin'
# these variables are mandatory ('/' are converted automatically)
top = '.'
out = 'build'
def options(opt):
opt.load('compiler_c vala')
opt.add_option('--enable-docs', action='store_true', default=False, help='Generate user documentation')
opt.add_option('--enable-text-view', action='store_true', default=False, help='Enable use of GtkTextView to display messages')
#opt.recurse('tests')
def configure(conf):
conf.load('compiler_c vala gnu_dirs intltool glib2')
conf.check_vala(min_version=(0, 28, 0))
conf.check_cfg(package='glib-2.0', uselib_store='GLIB', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='gio-2.0', uselib_store='GIO', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='gobject-2.0', uselib_store='GOBJECT', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='gmodule-2.0', uselib_store='GMODULE', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='gtk+-3.0', uselib_store='GTK3', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='libsoup-2.4', uselib_store='SOUP', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='json-glib-1.0', uselib_store='JSONGLIB', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='libnotify', uselib_store='NOTIFY', mandatory=1, args='--cflags --libs')
conf.check_cfg(package='libtoxcore', uselib_store='TOXCORE', mandatory=1, args='--cflags --libs')
conf.check(lib='toxencryptsave', uselib_store='TOXES', mandatory=1, args='--cflags --libs')
# C compiler flags.
conf.env.append_unique('CFLAGS', [
'-fsanitize=address',
'-Wall',
'-Wno-deprecated-declarations',
'-Wno-unused-variable',
'-Wno-unused-but-set-variable',
'-Wno-unused-function',
'-Wno-incompatible-pointer-types',
'-Wno-int-conversion',
'-Wno-discarded-qualifiers',
'-Wno-unused-label',
'-Wno-format',
'-Wno-strict-overflow',
'-DGETTEXT_PACKAGE="ricin"',
'-O3' # Optimizatiooooons!
])
# Linker flags.
conf.env.append_unique('LDFLAGS', [
'-fsanitize=address'
])
# Vala compiler flags.
conf.env.append_unique('VALAFLAGS', [
'--enable-experimental',
'--enable-deprecated',
'--debug'
#'--fatal-warnings'
])
#conf.recurse('res tests')
if conf.options.enable_docs:
conf.env.ENABLE_DOCS = True
conf.recurse('docs')
# TODO: Add a way to enable this.
if conf.options.enable_text_view:
conf.env.ENABLE_TEXT_VIEW = True
def build(bld):
bld.load('compiler_c vala')
#bld.recurse('src')
#bld.recurse('tests')
if bld.env.ENABLE_DOCS:
bld.recurse('docs')
# TODO: Add a way to enable this.
if bld.env.ENABLE_TEXT_VIEW:
pass
# Lang files
langs = bld(
features = 'intltool_po',
appname = APPNAME,
podir = 'po',
install_path = "${LOCALEDIR}"
)
# Icon
icon = bld.install_as('${DATADIR}/icons/hicolor/scalable/apps/ricin.svg', 'res/images/icons/ricin.svg')
# Appdata
appdata = bld.install_as('${DATADIR}/appdata/ricin.appdata.xml', 'res/ricin.appdata.xml')
# Desktop file
desktop = bld(
features = "intltool_in",
podir = "po",
style = "desktop",
source = 'res/ricin.desktop.in',
target = 'ricin.desktop',
install_path = "${DATADIR}/applications",
)
# Resources file
resource = bld(
features = 'c glib2',
use = 'GLIB GIO GOBJECT',
source = 'res/ricin.gresource.xml',
target = 'ricinres'
)
# Ricin
ricin = bld.program(
appname = APPNAME,
features = 'c cprogram glib2',
use = 'ricinres',
packages = 'glib-2.0 gio-2.0 gobject-2.0 gmodule-2.0 gtk+-3.0 libsoup-2.4 json-glib-1.0 libnotify libtoxcore libtoxencryptsave',
uselib = 'GLIB GIO GOBJECT GMODULE GTK3 SOUP JSONGLIB NOTIFY TOXCORE TOXES',
vala_target_glib = '2.38',
source = bld.path.ant_glob('src/*.vala'),
vapi_dirs = 'vapis',
vala_resources = 'res/ricin.gresource.xml',
valaflags = '--generate-source',
target = 'Ricin',
install_binding = False,
header_path = None,
install_path = "${BINDIR}"
)
# Now that everything is installed, lets update icons cache and desktop db
if bld.cmd == 'install':
try:
bld.exec_command(["update-mime-database", Utils.subst_vars("${DATADIR}/mime", bld.env)])
bld.exec_command(["update-desktop-database", Utils.subst_vars("${DATADIR}/applications", bld.env)])
except:
pass