licença – Can I use MIT along with GPL?


There are several software licenses around the world, but I came across a problem that can sometimes even reach the legal level. And that wouldn't be very good for my project.

My software is licensed under the MIT license, so far so good, but I would like to include parts (or entire parts) of software that are under the GPL license.

Under the GPL license:

You are allowed to sell copies of the modified program commercially, but only under the terms of the GNU GPL. Thus, for instance, you must make the source code available to the users of the program as described in the GPL, and they must be allowed to redistribute and modify it as described in the GPL.

These requirements are the condition for including the GPL-covered code you received in a program of your own.

The snippet says that I need to include the code for the users, which I already do, along with the MIT license.

But part of this code is under the GPL license, where should I say that this snippet is under GP` and is not originally mine? I can do this?

PS : If possible a practical and simple example.

PS 2 : This goes for package manager too, can I include a GPL file through packages.json ? (composer, npm, etc.)


Only a specialized lawyer can guide you correctly. I can give you preliminary information.

If you've described your situation correctly (it's amazing how often people don't understand their own situation) it seems to me that it's okay to include GPL code in an MIT project as long as the sources that use GPL clearly contain the information that that code is under GPL license. It needs to be clear that that snippet has more restrictions than the rest of the code and that it can't be used in the same way.

You must include authorship, copyright and GPL license text. This must be in all source files. Of course, the full text of the license can be referenced to a file contained in the repository.

One suggestion is to contact the maintainer of the GPL project and ask if what they are doing is ok for them. A lawyer will demand that this be in writing and that it be from someone who can demonstrate that they have the authority to sign it. Which is pretty hard to get.

This is my understanding of the license but it may not be everyone's. I've seen a lot of discussion about this. This is the problem with asking about legal issues on a development site .

So the ideal is to leave the part that is GPL well separated, even to facilitate those who want to replace this part. Preferably in another repository. If that's not possible, you may be in trouble (although I've never seen a GPL license violation lawsuit).

Just keep in mind that you can't change the license of the GPL code and you can't leave any door open for anyone using your code to get confused because of you and end up misusing the GPL part.

On the other hand, if your project is difficult to decouple the GPL and MIT parts, in practice you have a GPL project. After all, no one can use a part of the project in one way and another part in another. GPL is viral, that is, it contaminates everything that is close to it.

Personally, I wouldn't put GPL code in a project that I want to be MIT. I could use something GPL to make some component optional or that can be completely separate from the MIT part. So I guarantee that the MIT part can be used as MIT itself.

Scroll to Top