2

I have a website that uses MIT licensed libraries for JavaScript (THREE.js, Chart.js, js-yaml). The librairies are loaded through CDNs so their source files aren't explicitly present in the source code of the project. However I am using some scripts from THREE.js's public examples directly in my project source code.

The project also contains a file which is a modified script from a GPL licensed project.

According to the GPL terms, I must put a global GPL license on the project. Is that fine considering the MIT licensed parts ? If not, what license should I use ?

Krafpy
  • 123
  • 4

2 Answers2

5

According to the GPL terms, I must put a global GPL license on the project. Is that fine considering the MIT licensed parts ? If not, what license should I use ?

The project as a whole indeed needs to be under the GPL license, as you use (or depend on) some GPL code. But if there are parts (files, components, etc.) that can be distributed independently of the GPL code as well, then those parts may have a different, GPL-compatible license. The MIT license is such a GPL-compatible license.

A license is GPL-compatible if it allows you to apply the terms and conditions of the GPL in addition to the terms of the original license and that combination does not result in a contradiction in what you are/aren't allowed or required to do.


To keep the licensing situation manageable, it is strongly recommended that if you copy GPL-licensed code into your project, or if you add a mandatory GPL-licensed dependency, that you use the GPL license also for your own code. Third-party code that you copy into your project should keep its original license statements.

MadHatter
  • 48,547
  • 4
  • 122
  • 166
Bart van Ingen Schenau
  • 29,549
  • 3
  • 46
  • 83
  • I would agree if this was a project where the code is complied, but we are talking about a website. Here is a similar thread which I think hits the point very well https://opensource.stackexchange.com/questions/4360/what-are-the-implications-of-licensing-a-javascript-library-under-gpl . I also would like to point to https://www.gnu.org/licenses/gpl-faq.html#WMS where it states "As a special exception to the GPL, any HTML file which merely makes function calls to this [javascript] code, and for that purpose includes it by reference shall be deemed a separate work for copyright law purposes." – Martin_in_AUT Aug 17 '21 at 08:51
  • @Martin_in_GER, please read that FAQ entry carefully. The exception you quote is not automatically applied to all web-projects. Rather, the FSF mentions it as a way for authors of GPL-licensed templates/libraries to create a clear legal way to ensure the GPL is restricted to the JS side only. Without such an exception being explicitly added to the license, it is not clear if the HTML would be subject to the GPL license or not. And such an exception can only be added by the author of the GPL code. – Bart van Ingen Schenau Aug 17 '21 at 09:10
  • @BartvanIngenSchenau With all what have been said I guess the right way is to license my project under GPLv3 with a GPLv3 license in the LICENSE file in the root directory of my github repo. And add a NOTICE file containing copyright attributions and licenses of files I copied and modified from other projects / sources. I'll also precise in that NOTICE file that all scripts I made are independently licensed under MIT. Is that a right way of doing this ? – Krafpy Aug 17 '21 at 15:42
  • Note that applying a license to your code is not a magic incantation, because it's something you communicate to humans (for example lawyers), not to a computer. therefore there isn't exactly a single "right way" – user253751 Aug 17 '21 at 18:04
-2

No, you should not put your entire project under the GPL license. At least you don't need to. The file, which includes or modifies GPL-licensed code needs to be put under the same GPL license. Other files are not affected by the copyleft requirements. There is a description in the Q&A how to determine if 2 parts are separate or should be considered a single 'work' https://www.gnu.org/licenses/gpl-faq.html#MereAggregation .

GPL has a long list of requirements https://www.gnu.org/licenses/gpl-3.0.en.html . Please be sure to read and understand what is asked from you when you deliver source and/or object code.

There are several different versions of the GPL license, Version 1, Version 2, Version 3, AGPL... So if you need a specific answer you need to ask a specific question.

The MIT license is compatible with GPL https://en.wikipedia.org/wiki/License_compatibility , so if you have both MIT and GPL code in the same file you may license the entire file under GPL. Be sure to have to copyright attribution notices of all parts included.

Martin_in_AUT
  • 7,205
  • 10
  • 37
  • Thanks for your response ! So I can license the whole project under MIT, but keep the GPL license notice in the GPL-licensed code (GPL v2 or later as specified in the file). As for the files that are direct copies of MIT source codes, I just must add the copyright notice. Am I correct ? – Krafpy Aug 16 '21 at 12:41
  • 1
    I still have a small doubt though because of what is written in section 5 c) of the GPL requirements : "You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. [...] This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it." – Krafpy Aug 16 '21 at 12:42
  • No, you cannot license the entire work under the MIT license, if it includes code which has to be under GPL license. The GPL licensed parts need to remain under GPL. But any part of your project, which does not fall under the 'modified work' definition of the GPL license can be licensed under the MIT license, if you wish. I added a link to the GNU FAQ in my original answer above. – Martin_in_AUT Aug 16 '21 at 13:24
  • Thanks. So practically how would it go ? My project is public on github, what license should I put for it ? I will keep the copyright notices in the parts of the code that need them. But for all of the files except the GPL-licensed one, I understand that I must add a dedicated LICENSE file or comment stating it is under MIT license for all of them ? – Krafpy Aug 16 '21 at 13:33
  • A good way to implement the requirements of the MIT License... "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software" ...is to have the copyright attribution and the SPDX identifier in every file, and an additional file License.md with the copyright attribution and license language in the top folder of your project. It would be good to also identify in this file which parts are under GPL license and add that license language as well. Just look at some other projects how they do it. – Martin_in_AUT Aug 16 '21 at 13:50
  • Alright I'll have a LICENSE file at the root of the repo with an MIT license. I'll add a ThirdPartyNotice.txt file (as done on vscode's repo) to list all copyrights and licenses of the files that are not mine. Is that right ? – Krafpy Aug 16 '21 at 14:00
  • That is certainly a way of doing it. SPDX in each file is also good practice, as it helps with any automated scanning. The license terms are not specific in how you implement the requirements, there is a lot of freedom to implement things as you like, but doing it like others do it helps dealing with expectations. – Martin_in_AUT Aug 16 '21 at 14:50
  • 2
    This response is IMHO problematic. You may not need to put the FILES all under GPL. But if you build a single binary from the source which links or contains a single GPL-licensed file, you MUST distribute the binary and THE COMPLETE CORRESPONDING SOURCE CODE under GPL. – planetmaker Aug 16 '21 at 14:51
  • @planetmaker It is not a project that can be compiled to binary, it's a website, hosted on github pages. Does what you say applies here ? – Krafpy Aug 16 '21 at 15:07
  • @planetmaker The original question made it clear that it is a website, and that there is Javascript code from different sources, one of which is licensed under GPL. I believe it is safe to say that independent functions implemented as independent Javascript files within one website are more like an aggregation and not a 'covered work'. And in my initial response I mentioned AGPL, which indeed might change everything, but the OP explained that it is GPLv2+. – Martin_in_AUT Aug 16 '21 at 15:29
  • @Martin_in_GER I need to know what license to put in the LICENSE file at the root of my repo. Can it be MIT or must it be GPLv2+ ? The file containing the GPL-licensed code implements a small but important part of the program. In both cases I'll add the copyright notices to the files that are not fully mine and/or modified. I can give the link to the repo if needed to clearly see what file I'm talking about and its license. – Krafpy Aug 16 '21 at 16:54
  • 1
    You cannot license GPL code under Mit. So if you have one license file with one license it must be gpl – planetmaker Aug 16 '21 at 22:46
  • As mentioned in my comment above: The license file should identify which parts of the code are under MIT license and which other parts are under GPL. I supervise projects with 100s of different parts and many different licenses, they are all listed in one license.md file. It is very common to do that, just check the attribution notices of FF, Chrome, Acrobat, or any other large sw package. – Martin_in_AUT Aug 17 '21 at 06:28
  • @Martin_in_GER Thanks for your comments. I'll try to follow what you described as well as what came up with the new answer. – Krafpy Aug 17 '21 at 15:33