From f5d8956ec3a53b7827aa68a9e8698af6552ac932 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 19 Oct 2017 10:16:51 +0100 Subject: [PATCH] glib-genmarshal/glib-mkenums: Add comment clarifying licensing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clarify the licensing of the code generated by the two scripts in a comment in the header of each generated file. The intention is that the license of GLib does *not* apply to the generated files; but that they are subject to the linking restrictions of the LGPL, since they link to GLib and GLib is licensed under the LGPL. The generated files themselves are under the license of whatever project they’re generated for. Signed-off-by: Philip Withnall https://bugzilla.gnome.org/show_bug.cgi?id=788990 --- gobject/glib-genmarshal.in | 12 +++++++++++- gobject/glib-mkenums.in | 7 ++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gobject/glib-genmarshal.in b/gobject/glib-genmarshal.in index 09e84083f..2560f9fb2 100755 --- a/gobject/glib-genmarshal.in +++ b/gobject/glib-genmarshal.in @@ -162,9 +162,17 @@ def print_info(msg): print_color(msg, color=Color.GREEN, prefix='INFO') +def generate_licensing_comment(outfile): + outfile.write('/* This file is generated by glib-genmarshal, do not ' + 'modify it. This code is licensed under the same license as ' + 'the containing project. Note that it links to GLib, so ' + 'must comply with the LGPL linking clauses. */\n') + + def generate_header_preamble(outfile, prefix='', std_includes=True, use_pragma=False): '''Generate the preamble for the marshallers header file''' - outfile.write('/* This file is generated, all changes will be lost */\n') + generate_licensing_comment(outfile) + if use_pragma: outfile.write('#pragma once\n') outfile.write('\n') @@ -193,6 +201,8 @@ def generate_header_postamble(outfile, prefix='', use_pragma=False): def generate_body_preamble(outfile, std_includes=True, include_headers=None, cpp_defines=None, cpp_undefines=None): '''Generate the preamble for the marshallers source file''' + generate_licensing_comment(outfile) + for header in (include_headers or []): outfile.write('#include "{}"\n'.format(header)) if include_headers: diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in index 1e4565271..2d6a8c8f3 100755 --- a/gobject/glib-mkenums.in +++ b/gobject/glib-mkenums.in @@ -381,7 +381,12 @@ else: tmpfile = None # put auto-generation comment -comment = comment_tmpl.replace('\u0040comment\u0040', 'Generated data (by glib-mkenums)') +comment = comment_tmpl.replace('\u0040comment\u0040', + 'This file is generated by glib-mkenums, do ' + 'not modify it. This code is licensed under ' + 'the same license as the containing project. ' + 'Note that it links to GLib, so must comply ' + 'with the LGPL linking clauses.') write_output("\n" + comment + '\n') def replace_specials(prod):