How to Choose an Open Source Licence
If you decided to share your project’s source code, you still have to deliberately state what do you allow, and which rights you want to keep. While it is possible to write your own detailed licence, there’s probably no need to do it. The most common models have already been created. Let’s review some popular licence types.
Disclaimer: please note that I’m not a lawyer. While this article covers basics of licensing an open source software, intellectual property law is a wide topic. Nothing described in this article should be taken as formal legal advice. If you are in doubt, consult a professional lawyer.
First, let’s see what happens when you do nothing, and later let’s talk about licences ordered from the most restrictive to the most permissive.
What if I won’t specify a licence?
Then it’s “all rights reserved” by default. Under your local copyright law based on an international agreement known as the Berne Convention, you retain all rights to your work. It is worth noting that you do not have to write “all rights reserved” or put the © symbol anywhere to be protected by it.
This also means that no one may use, copy or distribute your work. Probably not what you wanted after deciding to open source your project.
However, if you uploaded your sources to the public repository on GitHub, then you accepted their Terms of Service (which you carefully have read while creating your account, right?). According to it, you allow other users to view and copy (“fork”) your repositories.
GNU General Public License 3.0
If you don’t want to grant the rights to use your work in closed-source (proprietary) software, you may want to choose this licence.
It allows to use, modify and distribute the source code of your project. Copyright and licence notices must be preserved. Private and commercial use is possible, but it is required that any modifications and larger works must be licensed under the same conditions. This is why commercial companies avoid using such projects if they don’t want to share their code.
This kind of licences are often called “viral” or “copyleft”; any derivative works of open source software should use the same licence as the original work.
GNU Lesser General Public License 3.0
A modification of the GNU GPL 3.0, also called GNU “Library” GPL 3.0. It is possible to use, modify and distribute your work. Copyright and licence notices must be preserved. Private and commercial use is possible. However, if a larger work is using your project through interfaces it provides (like a library), then the larger work may be distributed under different licence and without source code.
Apache License 2.0
A non-copyleft, permissive licence. It allows to use, modify and distribute your work. Copyright and licence notices must be preserved. Private and commercial use is allowed. Any modifications and larger works may use different licence and can be distributed without source code.
A very permissive and short licence that allows to use, modify, distribute, and sell copies of your project. You do not take any liability or provide a warranty of any kind. The text of the copyright notice and your name should be included in all copies of your project.
Again, it is possible to use your sources by commercial companies in their products, so you may even end up paying for a software that uses your work.
The most permissive licence that put your work into the public domain. There are no limits on usage (including commercial), and no credits are required. Simply “do whatever you want, I don’t care”.
Can I use a Creative Commons licence to my software?
You should not use CC licences for software. They say nothing about the distribution of source code and are not compatible with major software licences.
You may want to use them for software documentation or separate artistic elements like soundtrack or graphics, though. Read more on this in the Creative Commons FAQ.
How to apply a licence
You should include the text of chosen licence in your project’s repository. The standard way to name the file is “LICENCE” or “COPYING”, optionally with “.txt” or “.md” extension.
If the licence text has placeholders for your name and a year, replace them. Example:
The MIT License (MIT) Copyright (c) [year] [fullname] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: (...)
Some licences, like GPL 3.0 or Apache 2.0, asks you to also include a short notice in every source file or at least the copyright line and a pointer to where the full notice is found. Check the instructions at the end of the licence. Example:
/* [one line to give the program's name and a brief idea of what it does.] Copyright (C) [year] [name of author] 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. (...) */
What year to put in the licence?
You probably noticed many variations of the date in copyright notices. This is a year of modification. If you changed something in 2010, 2012 and 2016, then it should state “Copyright (c) 2010, 2012, 2016”, not “2010-2016”, as there was no modification in 2011, 2013, 2014 and 2015.
Are demoscene releases open source?
Most of them are not. That’s because the demoscene is a place where you compete with others, so coders protect their engines and effects. As a matter of fact, most of the releases (especially the older ones) doesn’t include any licence information at all, making them “all right reserved” ones.
This is changing, as more authors are becoming aware of legal regulations and copyright laws. There are also some coders that provide their sources. If you have read demoscene reviews on this website, you probably noticed that sometimes releases have a GitHub repository.
Also, the demoscene is a really friendly community. If you are curious about a particular effect in a demo, most of the coders will be more than happy to tell you how they did it.
You have to decide if you want to license your sources as copyleft or to be more permissive. More restrictions can prevent companies from using your code in their closed-source products. But be aware that none of the licences forbids a commercial usage of your work. That’s because one of the open source definitions says that the licence must not restrict anyone from making use of the program in a specific field of endeavour.
Remember to check the other way round too: if you plan to use others code in your project, always read its licence, as you have to stay compatible with it.
Many other licences are available. To be sure that they are really open source, check if they are approved by the Open Source Initiative or the Free Software Foundation. You should find something that fits your needs there. If you are still in doubt, I prepared some helpful links in the resources section.
Is header in every source file really required? For me it is unnecessary noise.
So in case of GPL2 license I have to append it to existing files?
Both GPL2 and GPL3 say that “each file should have at least the ‘copyright’ line and a pointer to where the full notice is found”. So you don’t have to paste 10+ lines of licence at the beginning of each file, this one should do.
However, having a short info about title, date and author is a good idea anyway. If someone will copy just one file from your repository, he still can track down its origin.
Comments are automatically closed on articles older than 512 days.