.
1 #!/usr/bin/python3
2 """
3 Copyright (C) 2012, 2013 Eduardo Naufel Schettino and Johan Mattsson
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 """
18
19 from . import version
20
21 VERSION = version.VERSION
22
23 def write_config (prefix):
24 print ("Writing Config.vala")
25
26 vars = (('VERSION', VERSION),
27 ('PREFIX', prefix),
28 )
29
30 f = open('./libbirdfont/Config.vala', 'w+')
31 f.write("// Don't edit this file -- it is generated by the build script\n")
32 f.write("namespace BirdFont {\n")
33
34 var_line = ' internal static const string %s = "%s";\n'
35 for name, value in vars:
36 f.write(var_line % (name, value))
37
38 f.write("}")
39
40 def write_compile_parameters (prefix, dest, cc, gee, valac, non_null,
41 valacflags, cflags, ldflags, gtk):
42 f = open('./scripts/config.py', 'w+')
43 f.write("#!/usr/bin/python3\n")
44 f.write("PREFIX = \"" + prefix + "\"\n")
45 f.write("DEST = \"" + dest + "\"\n")
46 f.write("CC = \"" + cc + "\"\n")
47 f.write("GEE = \"" + gee + "\"\n")
48 f.write("VALAC = \"" + valac + "\"\n")
49
50 if non_null:
51 f.write("NON_NULL = \"--enable-experimental-non-null\"\n")
52 else:
53 f.write("NON_NULL = \"\"\n")
54
55 f.write("VALACFLAGS = " + str(valacflags) + "\n")
56 f.write("CFLAGS = " + str(cflags) + "\n")
57 f.write("LDFLAGS = " + str(ldflags) + "\n")
58 f.write("GTK = " + str(gtk) + "\n")
59