Avoin lähdekoodi

A deep dive into open source

What is open source or free source? What are its limitations? How to choose a license from hundreds of options for your code? This article looks at some of the most common open source licenses for modern software development.

Open source code includes several different licensing options

At its simplest, open source means that the source code of the software is available for review. In practice, however, open source refers to a type of licensing in which the software code is made available for distribution and modification, subject to certain restrictions. However, open source does not necessarily exclude commerciality. Many large open source projects, such as the Linux kernel, the Firefox browser and the MySQL database server, are driven by commercial interests.

Program code, like many other types of works, has automatic international copyright protection in countries that have signed the Berne Convention. Without a specific licence, neither the program nor derivative works based on it may be distributed. Open source licenses do not override copyright law, but allow redistribution and the creation of derivative works, provided that the conditions are met.

There are innumerable licenses, but the five most popular cover about 75% of all published code[Black Duck Software].

In addition to open source, the termFree/Libre and Open Source Software is also used. Free Software is an older term defined by Richard Stallman, founder of the Free Software Foundation. Open source originated with the Open Source Initiative, founded by Eric Raymond, which tries to be less political. In practice, there is little difference between free software and open source, but the definition of free software is a little stricter. The most popular open source licenses are also free source licenses.

According to the FSF’s definition, software is free if the user is allowed four essential freedoms:

  • The freedom to run the program for any purpose
  • The freedom to use the program for any purpose. The right to use the program to perform any function it is intended to perform, to use it for any purpose, to use it for any purpose, and to use it for any purpose.
  • Freedom to distribute copies of the software
  • Freedom to distribute modified versions of the program

Contrary to popular misconception, free source code does not prohibit commercial exploitation of the program. In fact, the prohibition of commercial use makes the software non-free! It is also possible to license the work under several licenses at the same time. For example, the Qt software platform, owned by Digia, is available under the LGPL and a commercial licence that can be purchased.

The GPL is perhaps the best known free source licence

The GNU General Public License (GPL), known in particular for the Linux kernel, is probably the most famous free source licence. The GPL is an example of a copyleft licence. Copyleft licenses are free source licenses that require derivative works to also be covered by a copyleft license. Copyleft licenses are therefore also called restrictive licenses. As the name suggests, the purpose of copyleft is to protect the end user. It does this by prohibiting the addition of new restrictions to the licence, thus encouraging developers to favour free source code. The GPL allows the distribution and modification of a work, provided the following conditions are met:

  • The licence may not be modified or removed
  • Modifications must be accompanied by a note
  • The program must include a license notice.
  • The source code must be made available to everyone to whom the program is distributed
  • Derivative works must be licensed under the same licence

However, the GPL is not an EULA, i.e. it does not apply to the user of the software. The terms apply only to distributors. Also, you do not have to publish your own modifications to just anyone, but only to those who have been given a copy of the modified program.

Currently, the latest version of the GPL is GPLv3, but version 2 is still the most common. The recommended way to use the GPL licence is to include a clause that allows upgrading to a newer version of the GPL, so that much of the GPLv2-licensed code can be freely used in GPLv3-licensed projects.

GPLv3 clarifies the legal language to improve internationalisation, improve compatibility with other licences and give users additional protection against closed systems and patents.

There is also a version of the GPL licence for software libraries: the Lesser General Public License (LGPL). The LGPL eases the licensing conditions so that a program that uses an LGPL-licensed module does not need to be LGPL-licensed itself. The LGPL is therefore less restrictive than the standard GPL. According to the FSF’s interpretation, to use it, a linkage counts so that it is technically possible to replace a module with another that implements the same interface.

Since the GPL only applies to the distribution of software, it has a so-called “application provider loophole.” A Software as a Service provider can use GPL-licensed code without having to provide users with the source code, since the application itself is not distributed.

The Affero GPL is a slightly less common variation of the GPL license that adds the requirement that the source code must be available to users who access the application over the network. The Affero GPL is not compatible with other GPL licences, except for the GPLv3 version.

BSD licenses

BSD is a free source license that represents a different direction from the GPL. Unlike copyleft licenses, which prohibit license exchange, BSD allows re-licensing of a derivative work. Because the BSD licence places fewer restrictions on reuse, it is called a permissive licence.

The BSD licence originates from the Berkeley Software Distribution UNIX operating system. There are three versions, although only two are in general use today. The oldest BSD licence (4-clause) is no longer favoured because of its awkward ‘advertising clause’. The most common version is the 3-step version (new BSD license/modified BSD license) which is otherwise the same as the original, but with the advertising clause removed.

The third BSD version(2-step/simplified BSD license/FreeBSD license) removes the prohibition on using the name of the original developer for advertising purposes.

MIT and Apache licenses

The MIT licence is a BSD-like non-copyleft free source licence that has gained popularity for its simplicity.

The Apache Software License 2.0 is the second most popular free source license according to Black Duck Software statistics. Older versions of Apache (1.0 and 1.1) are not GPL-compatible, but 2.0 licensed code can be combined with GPLv3 licensed code. Although Apache 2.0 is not a copyleft license, it is considerably more complex than the BSD or MIT licenses. Like GPLv3, it contains a patent protection clause, which affects the producer (licensor) of the software as well as the user of the software.

The producer gives the user the right to use any patents it owns to run the licensed program. This right automatically expires if the user tries to sue another user for patent infringement for using the same software.

Creative Commons licences

The licences mentioned so far are all designed for software licensing. Open source has inspired the Creative Commons family of licences for more traditional works such as images, videos and articles. For example, Wikipedia content is CC-licensed.

There are six CC licences, all of which allow the work to be distributed free of charge as long as the original author is credited:

  • CC BY: allows modification and use for commercial purposes.
  • CC BY-SA: like CC-BY, but the derivative work must also be CC BY-SA licensed. Cf. copyleft licenses.
  • CC BY-ND: allows commercial use, but prohibits the creation of derivative works.
  • CC BY-NC: Allows editing, but prohibits commercial use.
  • CC BY-NC-SA: Like CC BY-SA, but prohibits commercial use.
  • CC BY-NC-ND: Prohibits derivative works and commercial use.

Open source – many licences to choose from

A licence is a necessity if the source code is to be made available to others. According to a recent study, less than 15% of projects published on github include a license file. While the intention was undoubtedly to release the project for free use, if the license is not disclosed, the project cannot be used under copyright law.

The first step in choosing a license is to check compatibility with any licensed code that may be used in the project (e.g. libraries.) This step should be done even before introducing foreign code. For example, BSD- and GPL-licensed code can be mixed, but the whole must be GPL-licensed, whereas, for example, GPLv2 and AGP code cannot legally be mixed at all. Compatibility needs to be checked on a license-by-license basis.

In a new project where there are no dependencies (or the dependencies are so permissively licensed that they have no effect) you are faced with a multitude of choices. However, to make life easier for yourself and future users, you should choose one of the most popular licenses. Examples of license choices:

Linux kernel GPLv2
Apache HTTP server ASL 2.0
MySQL GPLv2
MariaDB GPLv2/LGPLv2
PostgreSQL (own BSD-style license)
nginx BSD
Django BSD
Ruby on Rails MIT
Drupal GPLv2
Joomla GPLv2
WordPress GPLv2
Magento OSL/AFL
jQuery MIT

The first choice is: copyleft or not? The GPL prevents the use of code in closed products, but it may also exclude some users. For example, Apple is slowly replacing all GPL-licensed components of its operating systems with more permissively licensed equivalents, and Google’s Android open source components are ASL 2.0 licensed except for the kernel.

If copyleft licenses are not to be used, the choice is effectively between simple licenses like MIT or BSD and more complex but more protective ones like ASL. Services such as ChooseALicense and tl;drLegal make it easier to choose a licence. Examples of licences:

Permissive Copyleft
PD* MIT ASL LGPL GPL AGPL
You can do anything May be included in closed code May be included in closed code. Includes patent license. May be used from closed code. Includes patent license May not be included in a closed code. Contains a patent license. May not be included in closed code. Includes patent license. Source code for web service must be available.

* In the Public Domain, the author waives all rights. There is no such concept in Finnish law.

Summary

Free source licences can be divided into two categories: copyleft and non-copyleft licences. The GPL family of licences is almost synonymous with copyleft. The most popular non-copyleft licenses are the Apache Software License, BSD and MIT.

Copyleft licenses are “restrictive” licenses, i.e. they require that derivative works are licensed in the same way. More permissive licences also allow code to be used as part of an otherwise licensed product.

New licences such as ASL 2.0 and GPLv3 also include automatic patent licensing.

Read more about topic