22

Let's say I created a project containing hundreds of source files under the MIT License (most of which I wrote myself for this project). Now I want to add a GPL library to the project, that will be called from one of the source files ("File A"). A few other files call functions in "File A". The program is otherwise pretty indepedent of the library, meaning its core functions don't rely on it at all.

Since the library will be neatly packed into the executable, I'm pretty sure I have to make the whole project available under the terms of the GPL, which is fine because the MIT License is compatible with the GPL. So far so good.

What I don't quite understand is how it affects individual source files vs. the project as a whole. The GPL FAQ says about including a GPL library:

The software modules that link with the library may be under various GPL compatible licenses, but the work as a whole must be licensed under the GPL.

  • If I make the project available under GPL terms, then of course all parts of it are available under GPL terms (which they can be if they are under compatible licenses). But does that mean that all individual files "become" GPL (as in, add a GPL license header)? Is there a difference between individual code being licensed under GPL and the whole project being made available under GPL?
  • Do I have to put the file that directly communicates with the GPL library under GPL? And then put all files that are somehow connected to that one under GPL as well? Or can I keep them as MIT (as they've always been) and just make the whole project available under GPL?

To keep it simple, I would like to keep all my source code under MIT License and then put the whole project under GPL in a centralized notice. I'm just not sure if I'm approaching this correctly.

user2375667
  • 323
  • 2
  • 7

1 Answers1

11

Firstly, IANAL/IANYL, and the question of what makes a derivative work in law is still very much an open one.

That said, you are right that the FSF explicitly permits the use of more relaxed (compatible) licences on your contributions to a GPLed codebase. You are also correct that the GPL requires that the derivative codebase be covered by the GPL in its entirety (eg, s5c GNU GPL v3).

I struggled with how this might work for a while, until I gave up and asked a barrister with a speciality in intellectual property law. His analysis, which is specific to England and Wales but might well find favour in comparable jurisdictions, was based on land law. In land law, you may purchase a number of adjacent lots, each with its own restrictive covenant, and group them into a single lot for sale, to which you apply a further restrictive covenant. Any given piece of land therein is now covered by the restrictions of both the covenant that applied to it individually and the covenant that you have applied to the whole package, so the future uses of any given piece of land therein must abide by all the applicable restrictions thereon. If a later purchaser were to split his purchase back into the original smaller lots, that would not magically remove the restrictions you had applied.

Similarly, when you convey the resulting codebase forth, later users of any part of it must abide by the conditions of both the GPL and MIT licences which covered it as they received it. But you may still continue to make your contributions available directly to them, and that conveyance may continue to be under MIT only, even though you were required to convey your modifications as part of a work under a blanket GPL. Anyone who liked your contributions and wished to use them under MIT-only could come to you for them.

Assuming that at any given time more than one licence may apply to a piece of code within a larger codebase, and that the restrictions of all relevant licences apply thereto, my feeling (and this is not qualified legal opinion) is that you should add a GPL declaration to each file so included, without disturbing the MIT declaration that was there. The presence of the former will warn later users that they can't strip this code out of the codebase and use it under MIT-only, but let them know that it is likely available from its original authors under MIT-only.

MadHatter
  • 48,547
  • 4
  • 122
  • 166
  • 2
    If a file mentions both the MIT and GPL licenses, then that looks like dual licensing to me, which means that I would be able to choose one of the two licenses. – Bart van Ingen Schenau Oct 04 '17 at 17:52
  • Personally I'd be hesitant in assuming that, particularly since it only makes any sense if you wish to choose MIT, and the GPL would clearly be the more recent of the two. But I agree it's not completely clear, so perhaps adding a line that says eg "(c) 2017 J Bloggs. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License in addition to the terms of any licences already herein identified" would clarify the issue. Again, just my opinion. – MadHatter Oct 05 '17 at 06:16
  • 1
    My concern now is what if someone creates a Pull Request. That person would have gotten the code under GPL+MIT, then created a derivative work. Can that person even offer that code back to the original project in a way that will allow others to use it under MIT, assuming they omit the GPL dependencies (for example by just using a single source file that has no direct connection with the GPL library)? – user2375667 Oct 09 '17 at 13:53
  • 1
    A pull request is a git thing, and has no particular meaning in copyright law; I'll assume that you mean "gets a copy". As I said, "If a later purchaser were to split his purchase back into the original smaller lots, that would not magically remove the restrictions you had applied". Anyone who gets the new, combined work (whether from you or not) cannot separate out the previously-MIT components to use under MIT. To do that, they would have to go back to the original authors of that part, and get a copy from them under MIT-only. Is that what you were asking about? – MadHatter Oct 09 '17 at 14:01
  • "X" receives a copy under GPL+MIT (e.g. forking/cloning), fixes a bug, then offers to contribute the modified version back (Pull Request). Can "X" even decide to put his modifications under MIT, considering it's a derivative of GPL licensed code? People can't really go to him as an original author, because the copy he modified was GPL'd already. Basicially I'm wondering if it's even practical to receive modifications from "X" back into the original project, that someone else "Y" can then use under MIT. – user2375667 Oct 10 '17 at 12:13
  • In theory, no, X can't. In practice, people tend not to start modifying software without knowing that they're going to do it. All X needs to do is get an MIT-only copy direct from the authors before (s)he starts working on a bugfix. If X is too lazy or foolish to do that, then yes, in theory his/her contributions could not be accepted under MIT-only. I doubt that anyone anywhere has ever actually made such a case, but it seems to me that it could, theoretically, be made. – MadHatter Oct 10 '17 at 12:38
  • What would you consider getting an MIT-only copy direct from the authors? Ask them directly? If it's anything other than forking the original repository (which contains the GPL part), then I doubt it would be practical. I'm considering giving up on this and just assuming everything being under GPL. The point of this for me is to make it easy for people, and having to ask to get the MIT parts (either to modify or use elsewhere) doesn't really seem straightforward. If someone really wants a certain part I can figure out from the history if I'm the sole author and license it accordingly. – user2375667 Oct 11 '17 at 18:55
  • It's becopming quite unclear what you want to do. The question as written asks about a project containing source files under MIT, and asks about combining them with a GPL library. If you are the author of either of these parts it would be helpful to say so. If not, then we have already established that anyone can get them from the original authors, because you did. So what exactly are you trying to do here that is so impractical that you're considering giving up on it? – MadHatter Oct 12 '17 at 05:55
  • Sorry for being unclear. The MIT licensed files are the main source code of my project (mostly authored by me, with some contributions by others), so they aren't available anywhere else. I now want to add a GPL library to that project. So the MIT parts will only be available from the repository that also contains the GPL library. I'm not the author of the GPL library. – user2375667 Oct 12 '17 at 11:41
  • 3
    Then it's still simple. If you feel strongly that you want people to be able to work on your code under the MIT license, go to the effort of packaging it separately, so that people who want just the MIT parts can get them. Otherwise, don't, and the GPL will cover the combined package as discussed. – MadHatter Oct 12 '17 at 12:29
  • AFAIK you are also allowed to add additional liberties to a GPL license. You could add a statement saying that Module X is also available under MIT rules. The GPL says that other people are free to remove these additional liberties from their own redistribution. – user253751 Sep 03 '20 at 18:21