Thursday, November 5, 2009

How To Apply GPL v3.0 and Optionally the Classpath Exception License to Your Project

Recently, an open-source project (Mach-II Framework for CFML) I am involved with decided to change the license we use from Apache 2.0 to GPL v3.0 with Classpath Exception.  The team had many discussions on what we should change, but the the main reasons for changing to the GPLv3 License with Classpath Exception is because it allowed us to:



  • Ensure that changes made to Mach-II are contributed back to the project. We hope this will help foster and grow the community around the Mach-II project, which will benefit all Mach-II users.

  • Allow us to leverage additional existing open source libraries when needed. The GPL license and its variants are the most predominant licenses used in open source projects. With an Apache 2.0 License, Mach-II is not able to take advantage of any existing GPL code. With the GPL License, Mach-II will be able to leverage open source code released under practically any license.

  • Reduce the potential for forks and derivative projects. The development of Mach-II has required more than nine man years and nearly $700,000 of effort (based on COCOMO) to date. We want to protect that investment for the benefit of the project and our users.


Mach-II itself is not a standalone application.  It allows you to build applications on top of it and so there was a problem with switching to straight GPL because the license would stop people / companies from selling or distributing a proprietary product built on top of Mach-II.  This was a deal breaker for us and that is why we decided to use the Classpath Exception modifier available. The GPL v3.0 License is itself a copyleft license, but due to the Classpath Exception included in the new Mach-II license, all of our users are free to use unmodified versions of Mach-II in any project, whether it be open source or closed source, free or commercial.

After much internal discussion and a public call for comments, we decided all was well to proceed and apply the license to the new version of the project that will be releasing soon.  However how to do it?  I must admit that the Apache 2.0 license instructions are a bit easier to understand due to the use of bullet points instead of prose as the GPL uses.  Also, there is very little information on how the Classpath Exception modifier should be applied to the code. I had to look at the GNU Classpath project source code to see how they did it.

Things You'll Need



How to Apply GPL

1. You should bundle a copy of the GPL v3.0 your source code and executables if your application is also distributed as an executable. You should put an unmodified copy of the GPL in a file named COPYING in the root of your project.  This file should be all capitals and easy to find.  Do not nest in sub-directories.

2. Apply the notice to all source files.  This is important as bits of your project may float around the internet or an user may look at a source file but not look at the root of your project for a license.  The notice should be placed at the top of all your source text files (you may have to enclose it in some sort of comments depending on the language being used).  As in our case with Mach-II, we replaced the Apache 2.0 notice information in our source files with the GPL.  You may or may not have to do this depending on whether or not your project has been licensed under another license before.  As an aside, it would be impossible to apply this to binary files (such as images) since those files are not human readable.

The notice should contain the name of the project, copyright and copyright year(s).  Below is a template that you would need to change.  Just look for the < > placeholders:




<one line to give the program's name and a brief idea of what it does.>Copyright (C) <year(s)> <name of author or company>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.




3a. Now if you are using a Classpath Exception, you need to put that exception with the notice declaration.  For example, it would look something like this (notice the additional special exception information at the bottom of the notice):




<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year(s)> <name of author or company> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.




3b. If you are using the Classpath Exception, you also need to put the exception in a file at the root of your project in a file called LICENSE. This file name should be all capitals with no file name extension.  In this file, you need to put in the exception with some other information (replace the < > placeholders where applicable):




The software in this package is distributed under the GNU General Public License (with a special exception described below).




A copy of GNU General Public License (GPL) is included in this distribution, in the file COPYING.  If you do not have the source code, it is available at:     <http://www.example.com>   Linking this library statically or dynamically with other modules is making a combined work based on this library.  Thus, the terms and conditions of the GNU General Public License cover the whole combination.As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module.  An independent module is a module which is not derived from or based on this library.  If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so.  If you do not wish to do so, delete this exception statement from your version.<name of project> also contains other (example) code distributed under other terms.  External libraries included with <name of project> may also be distributed under different licensing terms. The location and the exact terms of this other code is mentioned below if applicable.<list of other bundled code and location in distribution package here>




If you bundle other software with your code, such as build tool jars for ANT like we do, you will need to list those projects with their license name and the location within your project distribution.

4. This is purely optional, but you might consider writing FAQs in plain English about what rights an user has in the terms of GPL.  We did this because only few of us (myself not included) are geek enough to really understand the minutia of a license.  For an example, see the Mach-II License FAQs as an example.

5. Let everybody know by blogging, tweeting and talking to people that you decided to move to GPL.  You may want to reiterate their rights and why you decided to change which is a good reason to produce FAQs on the subject.

Personally, I find that the GPL is a more moral license than Apache because it protects the rights of everybody that contributes to a project.  Apache allows proprietary derivatives to be made and therefore somebody else may end up making a profit off the efforts of open source developers.  The classpath exception was important to us to because the GPL protected all the great people that contribute to Mach-II and allowed Mach-II to be distributed with close-sourced applications, but disallowed proprietary forks of the project. Plus, we can now leverage all the cool GPL code available.

6. Voila! You are done and it really is that easy.  Now, go off an woot in the glory of the GPL. It's time to celebrate, but before you do -- there are a few things you should:

Be aware of...



  • In our case, our project was released as Apache 2.0 (and 1.0 even farther back) and we just switched to GPL v3.0 with Classpath Exception.  Be aware at the GPL cannot be backdated to previous version and that previous licenses will still apply to legacy releases of your project.  The license you released under for a particular version cannot be revoked.

  • Do not just change to GPL or GPL with Classpath Exception just because Team Mach-II liked it and because we felt that open source licenses have evolved to a point where we felt it was beneficial for us to switch.  Weigh all the options carefully and involve your open source community especially if you are switching licenses after having at least one release.

  • I feel it is best to choose a common / standard license such as Apache, GPL, LGPL, etc. instead of writing your own license.  There are two reasons why this is good to choose a "commodity open source license": 1) Most companies have an approved list of licenses and therefore it may be easier for a company to use your project if they do not have to deal with the legal department. If you make it hard to start using your project, somebody might just choose a different product because it is easier. 2) A lot of the commodity licenses have had some legal attention paid to them - either in the courts or out of court deals.  Choosing a standard license gives you some prior case law in case you need to enforce your rights as a project on a license violator.


I hope this "how to" has been beneficial to you. Feel free to comment below with questions or comments.

No comments:

Post a Comment