.
1 #!/usr/bin/python
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 import version
20 import time;
21
22 VERSION = version.VERSION
23
24 def write_config (prefix):
25 print ("Writing Config.vala")
26
27 vars = (('VERSION', VERSION),
28 ('BUILD_TIMESTAMP', time.asctime( time.localtime(time.time()))),
29 ('PREFIX', prefix),
30 )
31
32 f = open('./libbirdfont/Config.vala', 'w+')
33 f.write("// Don't edit this file -- it is generated by the build script\n")
34 f.write("namespace BirdFont {\n")
35
36 var_line = ' internal static const string %s = "%s";\n'
37 for name, value in vars:
38 f.write(var_line % (name, value))
39
40 f.write("}")
41
42 def write_compile_parameters (prefix, dest, cc, gee, posixvala):
43 f = open('./scripts/config.py', 'w+')
44 f.write("#!/usr/bin/python\n")
45 f.write("PREFIX = \"" + prefix + "\"\n")
46 f.write("DEST = \"" + dest + "\"\n")
47 f.write("CC = \"" + cc + "\"\n")
48 f.write("GEE = \"" + gee + "\"\n")
49 f.write("POSIXVALA = " + posixvala + "\n")
50
51
52