|
| 1 | + |
| 2 | +# Copyright |
| 3 | + |
| 4 | +When creating new files in the FreeCAD project, you should - if possible - declare an `SPDX License Identifier` with the appropriate license. |
| 5 | + |
| 6 | +In source files it is currently also required to add a `Copyright Header`. |
| 7 | + |
| 8 | +[» Copyright Snippets](./Copyright-Snippets) |
| 9 | + |
| 10 | +<br/> |
| 11 | + |
| 12 | +## SPDX License Identifiers |
| 13 | + |
| 14 | +SPDX is a simple way of declaring what license something and is declared by adding a comment in the following format to a file: |
| 15 | + |
| 16 | +``` |
| 17 | +SPDX-License-Identifier: <License> |
| 18 | +``` |
| 19 | + |
| 20 | +1. It should be placed at the start of a file. |
| 21 | + |
| 22 | + ( Example exception, shebangs `#!` come first ) |
| 23 | + |
| 24 | +2. You should use the appropriate [License Identifier]. |
| 25 | + |
| 26 | +<br/> |
| 27 | + |
| 28 | +### Examples |
| 29 | + |
| 30 | +#### 1. Internal C++ Source File |
| 31 | + |
| 32 | +You just wrote a new `.cpp` file from scratch and want to license it under the standard license FreeCAD uses ( `LGPL-2.1-or-later` ) |
| 33 | + |
| 34 | +```c++ |
| 35 | +// SPDX-License-Identifier: LGPL-2.1-or-later |
| 36 | +// SPDX-FileNotice: Part of the FreeCAD project. |
| 37 | + |
| 38 | +... |
| 39 | +``` |
| 40 | + |
| 41 | +<br/> |
| 42 | + |
| 43 | +#### 2. External C++ Source File |
| 44 | + |
| 45 | +You want to include some pre-existing code licensed under a compatible but different license to what FreeCAD uses by default. |
| 46 | + |
| 47 | +```c++ |
| 48 | +// SPDX-License-Identifier: MIT |
| 49 | +// SPDX-FileNotice: Part of the FreeCAD project. |
| 50 | + |
| 51 | +... |
| 52 | +``` |
| 53 | + |
| 54 | +<br/> |
| 55 | + |
| 56 | +#### 3. Mixed Python Licensing |
| 57 | + |
| 58 | +You have some existing code licensed under one license but also want to add some code under a different license. |
| 59 | + |
| 60 | +```Python |
| 61 | +# SPDX-License-Identifier: LGPL-2.1-or-later AND MIT |
| 62 | +# SPDX-FileNotice: Part of the FreeCAD project. |
| 63 | + |
| 64 | +... |
| 65 | +``` |
| 66 | + |
| 67 | +<br/> |
| 68 | + |
| 69 | +#### 4. Executable Python Script |
| 70 | + |
| 71 | +You have a Python script that has a Shebang to specify how it can be run. |
| 72 | + |
| 73 | +```Python |
| 74 | +#!/usr/bin/env python3 |
| 75 | +# SPDX-License-Identifier: LGPL-2.1-or-later |
| 76 | +# SPDX-FileNotice: Part of the FreeCAD project. |
| 77 | + |
| 78 | +... |
| 79 | +``` |
| 80 | + |
| 81 | +<br/> |
| 82 | + |
| 83 | +#### 5. Icons |
| 84 | + |
| 85 | +Icons should have whatever license the author intended, for example `CC-BY-SA-4.0`. |
| 86 | + |
| 87 | +In `svg` files this is declared via metadata, not an SPDX comment. |
| 88 | + |
| 89 | +<br/> |
| 90 | + |
| 91 | +#### 6. Documentation |
| 92 | + |
| 93 | +Besides the wiki, currently don't license documentation, however you might want to consider putting that under the `Unlicense` or `CC-BY-SA-4.0`. |
| 94 | + |
| 95 | +<br/> |
| 96 | + |
| 97 | +## Copyright Headers |
| 98 | + |
| 99 | +Copyright headers are currently required to be added to files if **ALL** of the following conditions apply: |
| 100 | + |
| 101 | +1. The file is `C++` or `Python` source code |
| 102 | + |
| 103 | +2. The file is solely licensed under `LGPL-2.1-or-later` |
| 104 | + |
| 105 | +3. The code has been written for FreeCAD |
| 106 | + |
| 107 | + ( Do not mark included libraries with this ) |
| 108 | + |
| 109 | +<br/> |
| 110 | + |
| 111 | +### Declarations |
| 112 | + |
| 113 | +To declare the copyright holders, simply follow this format: |
| 114 | + |
| 115 | +`© <Year> <Entity>` |
| 116 | + |
| 117 | +- `<Year>` is the current year / the year you created the code. |
| 118 | + |
| 119 | +- `<Entity>` is either you - the person - or your organization. |
| 120 | + |
| 121 | +#### Examples |
| 122 | + |
| 123 | +##### Person |
| 124 | + |
| 125 | +`© 1999 Robert Robertson` |
| 126 | + |
| 127 | +##### Organization |
| 128 | + |
| 129 | +`© 2000 Crazy CAD Technologies` |
| 130 | + |
| 131 | + |
| 132 | +<br/> |
| 133 | + |
| 134 | +### Languages |
| 135 | + |
| 136 | +### C++ |
| 137 | + |
| 138 | +```C++ |
| 139 | +/****************************************************************************** |
| 140 | + * * |
| 141 | + * © <Year> <Entity> * |
| 142 | + * * |
| 143 | + * FreeCAD is free software: you can redistribute it and/or modify * |
| 144 | + * it under the terms of the GNU Lesser General Public License as * |
| 145 | + * published by the Free Software Foundation, either version 2.1 * |
| 146 | + * of the License, or (at your option) any later version. * |
| 147 | + * * |
| 148 | + * FreeCAD is distributed in the hope that it will be useful, * |
| 149 | + * but WITHOUT ANY WARRANTY; without even the implied warranty * |
| 150 | + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
| 151 | + * See the GNU Lesser General Public License for more details. * |
| 152 | + * * |
| 153 | + * You should have received a copy of the GNU Lesser General Public * |
| 154 | + * License along with FreeCAD. If not, see https://www.gnu.org/licenses * |
| 155 | + * * |
| 156 | + ******************************************************************************/ |
| 157 | +``` |
| 158 | + |
| 159 | +<br/> |
| 160 | + |
| 161 | +### Python |
| 162 | + |
| 163 | +```Python |
| 164 | +################################################################################ |
| 165 | +# # |
| 166 | +# © <Year> <Entity> # |
| 167 | +# # |
| 168 | +# FreeCAD is free software: you can redistribute it and/or modify # |
| 169 | +# it under the terms of the GNU Lesser General Public License as # |
| 170 | +# published by the Free Software Foundation, either version 2.1 # |
| 171 | +# of the License, or (at your option) any later version. # |
| 172 | +# # |
| 173 | +# FreeCAD is distributed in the hope that it will be useful, # |
| 174 | +# but WITHOUT ANY WARRANTY; without even the implied warranty # |
| 175 | +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # |
| 176 | +# See the GNU Lesser General Public License for more details. # |
| 177 | +# # |
| 178 | +# You should have received a copy of the GNU Lesser General Public # |
| 179 | +# License along with FreeCAD. If not, see https://www.gnu.org/licenses # |
| 180 | +# # |
| 181 | +################################################################################ |
| 182 | +``` |
| 183 | + |
| 184 | +<br/> |
| 185 | + |
| 186 | +[License Identifier]: https://spdx.org/licenses/ |
0 commit comments