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 ?

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.

4
  • 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 opensource.stackexchange.com/questions/4360/… . I also would like to point to 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." Aug 17 at 8: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. Aug 17 at 9: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 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 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.

14
  • 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 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 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. Aug 16 at 13:24
  • 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. Aug 16 at 14:51
  • 1
    You cannot license GPL code under Mit. So if you have one license file with one license it must be gpl Aug 16 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.