summaryrefslogtreecommitdiffstats
path: root/src/include/compiler.h
diff options
context:
space:
mode:
authorMichael Brown2009-04-27 15:11:59 +0200
committerMichael Brown2009-05-18 09:26:08 +0200
commita525fb7782ee41b1e9c6687ce78983ab07509892 (patch)
treea1b1fcc760d4b2b99fbd0edaef22b1f1e5d84191 /src/include/compiler.h
parent[legacy] Remove long-obsolete old dhcp.h file (diff)
downloadipxe-a525fb7782ee41b1e9c6687ce78983ab07509892.tar.gz
ipxe-a525fb7782ee41b1e9c6687ce78983ab07509892.tar.xz
ipxe-a525fb7782ee41b1e9c6687ce78983ab07509892.zip
[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.
Diffstat (limited to 'src/include/compiler.h')
-rw-r--r--src/include/compiler.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index d23c1672..7c1aa1f4 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -408,6 +408,107 @@ int __debug_disable;
#define barrier() __asm__ __volatile__ ( "" : : : "memory" )
#endif /* ASSEMBLY */
+/**
+ * @defgroup licences Licence declarations
+ *
+ * For reasons that are partly historical, various different files
+ * within the gPXE codebase have differing licences.
+ *
+ * @{
+ */
+
+/** Declare a file as being in the public domain
+ *
+ * This licence declaration is applicable when a file states itself to
+ * be in the public domain.
+ */
+#define FILE_LICENCE_PUBLIC_DOMAIN \
+ PROVIDE_SYMBOL ( __licence_public_domain )
+
+/** Declare a file as being under version 2 (or later) of the GNU GPL
+ *
+ * This licence declaration is applicable when a file states itself to
+ * be licensed under the GNU GPL; "either version 2 of the License, or
+ * (at your option) any later version".
+ */
+#define FILE_LICENCE_GPL2_OR_LATER \
+ PROVIDE_SYMBOL ( __licence_gpl2_or_later )
+
+/** Declare a file as being under version 2 of the GNU GPL
+ *
+ * This licence declaration is applicable when a file states itself to
+ * be licensed under version 2 of the GPL, and does not include the
+ * "or, at your option, any later version" clause.
+ */
+#define FILE_LICENCE_GPL2_ONLY \
+ PROVIDE_SYMBOL ( __licence_gpl2_only )
+
+/** Declare a file as being under any version of the GNU GPL
+ *
+ * This licence declaration is applicable when a file states itself to
+ * be licensed under the GPL, but does not specify a version.
+ *
+ * According to section 9 of the GPLv2, "If the Program does not
+ * specify a version number of this License, you may choose any
+ * version ever published by the Free Software Foundation".
+ */
+#define FILE_LICENCE_GPL_ANY \
+ PROVIDE_SYMBOL ( __licence_gpl_any )
+
+/** Declare a file as being under the three-clause BSD licence
+ *
+ * This licence declaration is applicable when a file states itself to
+ * be licensed under terms allowing redistribution in source and
+ * binary forms (with or without modification) provided that:
+ *
+ * redistributions of source code retain the copyright notice,
+ * list of conditions and any attached disclaimers
+ *
+ * redistributions in binary form reproduce the copyright notice,
+ * list of conditions and any attached disclaimers in the
+ * documentation and/or other materials provided with the
+ * distribution
+ *
+ * the name of the author is not used to endorse or promote
+ * products derived from the software without specific prior
+ * written permission
+ *
+ * It is not necessary for the file to explicitly state that it is
+ * under a "BSD" licence; only that the licensing terms be
+ * functionally equivalent to the standard three-clause BSD licence.
+ */
+#define FILE_LICENCE_BSD3 \
+ PROVIDE_SYMBOL ( __licence_bsd3 )
+
+/** Declare a file as being under the two-clause BSD licence
+ *
+ * This licence declaration is applicable when a file states itself to
+ * be licensed under terms allowing redistribution in source and
+ * binary forms (with or without modification) provided that:
+ *
+ * redistributions of source code retain the copyright notice,
+ * list of conditions and any attached disclaimers
+ *
+ * redistributions in binary form reproduce the copyright notice,
+ * list of conditions and any attached disclaimers in the
+ * documentation and/or other materials provided with the
+ * distribution
+ *
+ * It is not necessary for the file to explicitly state that it is
+ * under a "BSD" licence; only that the licensing terms be
+ * functionally equivalent to the standard two-clause BSD licence.
+ */
+#define FILE_LICENCE_BSD2 \
+ PROVIDE_SYMBOL ( __licence_bsd2 )
+
+/** Declare a particular licence as applying to a file */
+#define FILE_LICENCE( _licence ) FILE_LICENCE_ ## _licence
+
+/** @} */
+
+/* This file itself is under GPLv2-or-later */
+FILE_LICENCE ( GPL2_OR_LATER );
+
#include <bits/compiler.h>
#endif /* COMPILER_H */