Browse Source

[legal] Add mechanism for explicit per-file licence declarations

For partly historical reasons, various files in the gPXE source tree
are licensed under different, though compatible, terms.  Most of the
code is licensed under GPLv2 with the "or later" clause, but there are
exceptions such as:

  The string.h file, which derives from Linux and is licensed as
  Public Domain.

  The EFI header files, which are taken from the EDK2 source tree and
  are licensed under BSD.

  The 3c90x driver, which has a custom GPL-like licence text.

Introduce a FILE_LICENCE() macro to make licensing more explicit.
This macro should be applied exactly once to each source (.c, .S or
.h) file.  It will cause a corresponding zero-sized common symbol to
be added to any .o files generated from that source file (and hence to
any final gPXE binaries generated from that source file).  Determining
the applicable licences to generated files can then be done using e.g.

  $ objdump -t bin/process.o | grep __licence
  00000000       O *COM*  00000001 .hidden __licence_gpl2_or_later

indicating that bin/process.o is covered entirely by the GPLv2
with the "or later" clause, or

  $ objdump -t bin/rtl8139.dsk.tmp | grep __licence
  00033e8c g     O .bss.textdata  00000000 .hidden __licence_gpl2_only
  00033e8c g     O .bss.textdata  00000000 .hidden __licence_gpl2_or_later
  00033e8c g     O .bss.textdata  00000000 .hidden __licence_public_domain

indicating that bin/rtl8139.dsk includes both code licensed under
GPLv2 (both with and without the "or later" clause) and code licensed
as Public Domain.

Determining the result of licence combinations is currently left as an
exercise for the reader.
tags/v0.9.8
Michael Brown 15 years ago
parent
commit
a525fb7782
1 changed files with 101 additions and 0 deletions
  1. 101
    0
      src/include/compiler.h

+ 101
- 0
src/include/compiler.h View File

@@ -408,6 +408,107 @@ int __debug_disable;
408 408
 #define barrier() __asm__ __volatile__ ( "" : : : "memory" )
409 409
 #endif /* ASSEMBLY */
410 410
 
411
+/**
412
+ * @defgroup licences Licence declarations
413
+ *
414
+ * For reasons that are partly historical, various different files
415
+ * within the gPXE codebase have differing licences.
416
+ *
417
+ * @{
418
+ */
419
+
420
+/** Declare a file as being in the public domain
421
+ *
422
+ * This licence declaration is applicable when a file states itself to
423
+ * be in the public domain.
424
+ */
425
+#define FILE_LICENCE_PUBLIC_DOMAIN \
426
+	PROVIDE_SYMBOL ( __licence_public_domain )
427
+
428
+/** Declare a file as being under version 2 (or later) of the GNU GPL
429
+ *
430
+ * This licence declaration is applicable when a file states itself to
431
+ * be licensed under the GNU GPL; "either version 2 of the License, or
432
+ * (at your option) any later version".
433
+ */
434
+#define FILE_LICENCE_GPL2_OR_LATER \
435
+	PROVIDE_SYMBOL ( __licence_gpl2_or_later )
436
+
437
+/** Declare a file as being under version 2 of the GNU GPL
438
+ *
439
+ * This licence declaration is applicable when a file states itself to
440
+ * be licensed under version 2 of the GPL, and does not include the
441
+ * "or, at your option, any later version" clause.
442
+ */
443
+#define FILE_LICENCE_GPL2_ONLY \
444
+	PROVIDE_SYMBOL ( __licence_gpl2_only )
445
+
446
+/** Declare a file as being under any version of the GNU GPL
447
+ *
448
+ * This licence declaration is applicable when a file states itself to
449
+ * be licensed under the GPL, but does not specify a version.
450
+ *
451
+ * According to section 9 of the GPLv2, "If the Program does not
452
+ * specify a version number of this License, you may choose any
453
+ * version ever published by the Free Software Foundation".
454
+ */
455
+#define FILE_LICENCE_GPL_ANY \
456
+	PROVIDE_SYMBOL ( __licence_gpl_any )
457
+
458
+/** Declare a file as being under the three-clause BSD licence
459
+ *
460
+ * This licence declaration is applicable when a file states itself to
461
+ * be licensed under terms allowing redistribution in source and
462
+ * binary forms (with or without modification) provided that:
463
+ *
464
+ *     redistributions of source code retain the copyright notice,
465
+ *     list of conditions and any attached disclaimers
466
+ *
467
+ *     redistributions in binary form reproduce the copyright notice,
468
+ *     list of conditions and any attached disclaimers in the
469
+ *     documentation and/or other materials provided with the
470
+ *     distribution
471
+ *
472
+ *     the name of the author is not used to endorse or promote
473
+ *     products derived from the software without specific prior
474
+ *     written permission
475
+ *
476
+ * It is not necessary for the file to explicitly state that it is
477
+ * under a "BSD" licence; only that the licensing terms be
478
+ * functionally equivalent to the standard three-clause BSD licence.
479
+ */
480
+#define FILE_LICENCE_BSD3 \
481
+	PROVIDE_SYMBOL ( __licence_bsd3 )
482
+
483
+/** Declare a file as being under the two-clause BSD licence
484
+ *
485
+ * This licence declaration is applicable when a file states itself to
486
+ * be licensed under terms allowing redistribution in source and
487
+ * binary forms (with or without modification) provided that:
488
+ *
489
+ *     redistributions of source code retain the copyright notice,
490
+ *     list of conditions and any attached disclaimers
491
+ *
492
+ *     redistributions in binary form reproduce the copyright notice,
493
+ *     list of conditions and any attached disclaimers in the
494
+ *     documentation and/or other materials provided with the
495
+ *     distribution
496
+ *
497
+ * It is not necessary for the file to explicitly state that it is
498
+ * under a "BSD" licence; only that the licensing terms be
499
+ * functionally equivalent to the standard two-clause BSD licence.
500
+ */
501
+#define FILE_LICENCE_BSD2 \
502
+	PROVIDE_SYMBOL ( __licence_bsd2 )
503
+
504
+/** Declare a particular licence as applying to a file */
505
+#define FILE_LICENCE( _licence ) FILE_LICENCE_ ## _licence
506
+
507
+/** @} */
508
+
509
+/* This file itself is under GPLv2-or-later */
510
+FILE_LICENCE ( GPL2_OR_LATER );
511
+
411 512
 #include <bits/compiler.h>
412 513
 
413 514
 #endif /* COMPILER_H */

Loading…
Cancel
Save