Entering a license into each code file?

I find it overly duplicated to have it in every code file, but I see it in most open source projects. Should I do the same or just include one license outside the code?

+87
licensing
May 10 '09 at 19:12
source share
10 answers

One outside the code, please! I do not know about others, but I hate to see the same thing on top of every file. It seems I read it several times, just through the page. By this.

+68
May 10 '09 at 19:15
source share

EULA is the wrong term here because people who look at the source code are usually not end users.

Legally, that doesn't matter either; Copyright does not have to be explicitly declared.

Basically, all that you achieve is a lower risk that people will accidentally violate your license terms. You will need to decide how important this is for you.

I would say that the best compromise is to put a very short heading containing the link (absolute URL, as well as relative within the project), to the full license text in each source code file. Thus, anyone who is interested in a license knows where to find it (ideally, people who are willing to pay huge license fees, you certainly want these people to be able to contact you!)

+24
May 10 '09 at 19:53
source share

No, you do not need to specify a license in each source code.

If you look closer, most FOSS applications do not. They put a copyright statement at the top of each file and a short sentence telling you which license the file is in and where you can find the full text of the license. They usually point you to a COPYING or LICENSE file containing the full text of the license and / or to a website that contains the full text (if the COPYING file is missing).

As Michael Borgwardt said in his answers, legally you do not need to do this. But the source code that you are going to distribute is recommended, as people can immediately see who owns the copyright and what the license is.

+14
May 10 '09 at 9:17
source share

This may be licensed. The GPL distinguishes between preamble and license . It clearly states that the predicate (annoying) should be part of the code :

Can I omit the GPL preamble or instructions for using this on your own programs to save space?

The preamble and instructions are integral parts of the GNU GPL and cannot be omitted. In fact, the GPL is copyrighted, and its license only allows verbatim copying of the entire GPL. (You can use the legal conditions to obtain another license, but it will not be the GNU GPL.) (1)

Source: 1) http://www.gnu.org/licenses/gpl-faq.html#GPLOmitPreamble

See also http://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html

A free e-book from ifrOSS explains and comments on GPL 2 in German. There is one more for GPL 3

For a reasoned answer, you must request legal advice that is not available in sx. If you cannot find a lawyer for your open source project, check out the FSFE legal network .

+12
Mar 11 '13 at 2:51
source share

I think the reasoning to put it in every file is legal. If the agreement is contained in each file, there is no chance that anyone will stumble on a piece of code without having obtained a license.

It may not be very good, but all the big boys use it, so if it's just a visual pain, I will look for the best reason not to do the same.

If you use the GPL, this is more of a problem, but if you use public licenses like BSD or MIT, I donโ€™t think you care what people do with the code anyway. I suppose it depends on how strictly your license is.

+7
May 10 '09 at 19:36
source share

IANAL,

Assuming you're talking about licensing, not EULA, you can put the license in appearance. This is almost always the case with really long licenses such as the GPL. It would be foolish to put the entire GPL in every file. Usually you will just have a notification about where you can find the actual license. This is completely legal. However, with very short licenses, such as BSD / Apache / MIT / whatever, it is easier to simply include the license in each file, since the notification about where to find the license will be almost the same as the license itself.

+3
May 10 '09 at 19:57
source share

It depends on what the license dictates. For example, the GPL gives you a short notice in every source file, including the entire license somewhere in your source distribution, and makes the source distribution available to anyone who receives a copy of the binary distribution.

If you do not agree with this, and this is your code, you can choose a more acceptable license or create your own.

+2
May 12, '09 at 14:24
source share

If your code is compiled, so you just distribute the binary, then that really doesn't matter. Because when you create a binary file, comments are deleted before the compilation process begins. This only matters if you distribute the actual source code either with open source or closed source. This is typical if you will distribute the application in a scripting language that does not compile.

+1
May 10, '09 at 19:17
source share

What I'm doing is putting a two-line comment at the top of the file, indicating the name of my company, the date of the last revision and the name of the license in the source file, and then at the bottom of the file is a short version of the license.

Of course, a full license (all of them in the case of several licenses) is always enclosed in the source file and release files.

+1
Jul 24. '09 at 3:19
source share

You do not need this for a license, one external file will do until it cleans which files it covers.

However, for Copyright you must have a copyright notice for each piece of text.

0
May 11 '09 at 10:10
source share



All Articles