7

Is there a way I can make the license I use for an open-source software package be valid for all contents of the package without having to write it into every single file?

I often saw a LICENSE file, but does this file (with the license in it) makes all contents of the package (i.e. the current directory and all sub-directories) use this license?

  • 3
    Your best option is to write a script that traverses all directories and prefixes the files with the license (for example all files that match *.c or *.h) – Shahbaz May 28 '12 at 17:05
  • Add the LICENSE file to the root of the project and then in the README of the package say all files in the repository fall under this license. In case a file gets separated from the repository, the general (usually quite) restricted copyright laws apply. – Daniel Jan 30 '17 at 11:30
6

The legal assumption is that every file is copyrighted. You can just describe in your license what's covered. Anyone who doesn't read the license but just the sourcefile will have a subset of the rights that you granted (Open Source doesn't take away legal rights). Everyone who does read the license knows what's covered, and can exercise all the rights that you have granted.

However, good Open Source licenses (such as the GPL) provide you with guidance how to apply the license. In particular, the GPL suggests adding to every source file a small reference to the actual license.

  • I'm going to upvote this answer while resisting the urge to begin the age-old debate as to whether copyleft is "good" open source ;-P – TehShrike May 28 '12 at 22:23
4

Judging by what I've seen in many other projects, you don't need to include the entire text of your license in every file. You should, however, include your copyright notice and a reference to your license in every file. I've often seen statements along the lines of:

©2012 Joe Cool. See the license terms in the file 'license.txt' which should
have been included with this distribution. A copy of the license is also
available at <http://joecoolswebsite.com/license.txt>.

Not the answer you're looking for? Browse other questions tagged or ask your own question.