~ubuntu-branches/ubuntu/maverick/vala/maverick

« back to all changes in this revision

Viewing changes to compiler/valacompiler.vala

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-04-02 10:10:55 UTC
  • mfrom: (1.4.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100402101055-qbx3okzv0tnp3wpp
Tags: 0.8.0-0ubuntu1
* New upstream release:
  - Infer type arguments when calling generic methods.
  - Support `in' operator for arrays.
  - Add experimental support for regular expression literals.
  - Add experimental support for chained relational expressions.
  - Add va_list support.
  - Add clutter-gtk-0.10 bindings (Gordon Allott).
  - Add gdl-1.0 bindings (Nicolas Joseph).
  - Add gstreamer-app-0.10 bindings (Sebastian Dröge).
  - Add gstreamer-cdda-0.10 bindings (Sebastian Dröge).
  - Add gudev-1.0 bindings (Jim Nelson).
  - Add libgda-report-4.0 bindings (Shawn Ferris).
  - Add libgvc (graphviz) bindings (Martin Olsson).
  - Add purple bindings (Adrien Bustany).
  - Many bug fixes and binding updates.
* debian/patches/99_ltmain_as-needed.patch: refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* valacompiler.vala
2
2
 *
3
 
 * Copyright (C) 2006-2009  Jürg Billeter
 
3
 * Copyright (C) 2006-2010  Jürg Billeter
4
4
 * Copyright (C) 1996-2002, 2004, 2005, 2006 Free Software Foundation, Inc.
5
5
 *
6
6
 * This library is free software; you can redistribute it and/or
69
69
        static bool quiet_mode;
70
70
        static bool verbose_mode;
71
71
        static string profile;
 
72
        static bool nostdpkg;
 
73
        static bool enable_version_header;
 
74
        static bool disable_version_header;
72
75
 
73
76
        static string entry_point;
74
77
 
98
101
                { "enable-mem-profiler", 0, 0, OptionArg.NONE, ref mem_profiler, "Enable GLib memory profiler", null },
99
102
                { "define", 'D', 0, OptionArg.STRING_ARRAY, ref defines, "Define SYMBOL", "SYMBOL..." },
100
103
                { "main", 0, 0, OptionArg.STRING, ref entry_point, "Use SYMBOL as entry point", "SYMBOL..." },
 
104
                { "nostdpkg", 0, 0, OptionArg.NONE, ref nostdpkg, "Do not include standard packages", null },
101
105
                { "disable-assert", 0, 0, OptionArg.NONE, ref disable_assert, "Disable assertions", null },
102
106
                { "enable-checking", 0, 0, OptionArg.NONE, ref enable_checking, "Enable additional run-time checks", null },
103
107
                { "enable-deprecated", 0, 0, OptionArg.NONE, ref deprecated, "Enable deprecated features", null },
113
117
                { "quiet", 'q', 0, OptionArg.NONE, ref quiet_mode, "Do not print messages to the console", null },
114
118
                { "verbose", 'v', 0, OptionArg.NONE, ref verbose_mode, "Print additional messages to the console", null },
115
119
                { "target-glib", 0, 0, OptionArg.STRING, ref target_glib, "Target version of glib for code generation", "MAJOR.MINOR" },
 
120
                { "enable-version-header", 0, 0, OptionArg.NONE, ref enable_version_header, "Write vala build version in generated files", null },
 
121
                { "disable-version-header", 0, 0, OptionArg.NONE, ref disable_version_header, "Do not write vala build version in generated files", null },
116
122
                { "", 0, 0, OptionArg.FILENAME_ARRAY, ref sources, null, "FILE..." },
117
123
                { null }
118
124
        };
166
172
                if (FileUtils.test (deps_filename, FileTest.EXISTS)) {
167
173
                        try {
168
174
                                string deps_content;
169
 
                                ulong deps_len;
 
175
                                size_t deps_len;
170
176
                                FileUtils.get_contents (deps_filename, out deps_content, out deps_len);
171
177
                                foreach (string dep in deps_content.split ("\n")) {
172
178
                                        dep = dep.strip ();
202
208
                context.checking = enable_checking;
203
209
                context.deprecated = deprecated;
204
210
                context.experimental = experimental;
205
 
                context.experimental_non_null = experimental || experimental_non_null;
 
211
                context.experimental_non_null = experimental_non_null;
206
212
                context.dbus_transformation = !disable_dbus_transformation;
207
213
                context.report.enable_warnings = !disable_warnings;
208
214
                context.report.set_verbose_errors (!quiet_mode);
209
215
                context.verbose_mode = verbose_mode;
 
216
                context.version_header = enable_version_header;
210
217
 
211
218
                context.ccode_only = ccode_only;
212
219
                context.compile_only = compile_only;
240
247
                        // default profile
241
248
                        context.profile = Profile.GOBJECT;
242
249
                        context.add_define ("GOBJECT");
243
 
                        context.add_define ("VALA_0_7_6_NEW_METHODS");
 
250
                } else if (profile == "dova") {
 
251
                        context.profile = Profile.DOVA;
 
252
                        context.add_define ("DOVA");
244
253
                } else {
245
254
                        Report.error (null, "Unknown profile %s".printf (profile));
246
255
                }
254
263
                }
255
264
 
256
265
                if (context.profile == Profile.POSIX) {
257
 
                        /* default package */
258
 
                        if (!add_package (context, "posix")) {
259
 
                                Report.error (null, "posix not found in specified Vala API directories");
 
266
                        if (!nostdpkg) {
 
267
                                /* default package */
 
268
                                if (!add_package (context, "posix")) {
 
269
                                        Report.error (null, "posix not found in specified Vala API directories");
 
270
                                }
260
271
                        }
261
272
                } else if (context.profile == Profile.GOBJECT) {
262
273
                        int glib_major = 2;
263
 
                        int glib_minor = 12;
 
274
                        int glib_minor = 14;
264
275
                        if (target_glib != null && target_glib.scanf ("%d.%d", out glib_major, out glib_minor) != 2) {
265
276
                                Report.error (null, "Invalid format for --target-glib");
266
277
                        }
271
282
                                Report.error (null, "This version of valac only supports GLib 2");
272
283
                        }
273
284
 
274
 
                        /* default packages */
275
 
                        if (!add_package (context, "glib-2.0")) {
276
 
                                Report.error (null, "glib-2.0 not found in specified Vala API directories");
277
 
                        }
278
 
                        if (!add_package (context, "gobject-2.0")) {
279
 
                                Report.error (null, "gobject-2.0 not found in specified Vala API directories");
 
285
                        for (int i = 16; i <= glib_minor; i += 2) {
 
286
                                context.add_define ("GLIB_2_%d".printf (i));
 
287
                        }
 
288
 
 
289
                        if (!nostdpkg) {
 
290
                                /* default packages */
 
291
                                if (!add_package (context, "glib-2.0")) {
 
292
                                        Report.error (null, "glib-2.0 not found in specified Vala API directories");
 
293
                                }
 
294
                                if (!add_package (context, "gobject-2.0")) {
 
295
                                        Report.error (null, "gobject-2.0 not found in specified Vala API directories");
 
296
                                }
 
297
                        }
 
298
                } else if (context.profile == Profile.DOVA) {
 
299
                        if (!nostdpkg) {
 
300
                                /* default package */
 
301
                                if (!add_package (context, "dova-core-0.1")) {
 
302
                                        Report.error (null, "dova-core-0.1 not found in specified Vala API directories");
 
303
                                }
280
304
                        }
281
305
                }
282
306
 
313
337
                                                var ns_ref = new UsingDirective (new UnresolvedSymbol (null, "GLib", null));
314
338
                                                source_file.add_using_directive (ns_ref);
315
339
                                                context.root.add_using_directive (ns_ref);
 
340
                                        } else if (context.profile == Profile.DOVA) {
 
341
                                                // import the Dova namespace by default (namespace of backend-specific standard library)
 
342
                                                var ns_ref = new UsingDirective (new UnresolvedSymbol (null, "Dova", null));
 
343
                                                source_file.add_using_directive (ns_ref);
 
344
                                                context.root.add_using_directive (ns_ref);
316
345
                                        }
317
346
 
318
347
                                        context.add_source_file (source_file);
387
416
                }
388
417
 
389
418
                context.codegen.emit (context);
390
 
                
 
419
 
391
420
                if (context.report.get_errors () > 0) {
392
421
                        return quit ();
393
422
                }
567
596
                }
568
597
                
569
598
                if (version) {
570
 
                        stdout.printf ("Vala %s\n", Config.PACKAGE_VERSION);
 
599
                        stdout.printf ("Vala %s\n", Config.BUILD_VERSION);
571
600
                        return 0;
572
601
                }
573
602