Source code licenses: can I append together source code from different sources if I include all licenses?
<p>I'm putting together a &quot;library of libraries&quot; for the C++ programming language. Each library is a collection of one or more text files of source code, plus a text file containing the license.</p>
<p>Rather than require the users of my &quot;library of libraries&quot; to download and import each individual library into their project, I'd prefer to put all the different libraries together into single massive text file.</p>
<p>This is not a modification of the source code, since the license covers the code, not the text file itself (and in most cases modification is allowed, but I'd like to avoid it altogether just in case.) I'm thinking I can just insert the licenses directly into the source code as a comment (a 'comment' is a section ignored by the programming language where you can write anything.)</p>
<p>So what would start as:</p>
<pre><code>Library 1
 - file1A.cpp  &quot;1A code&quot;
 - file1B.cpp  &quot;1B code&quot;
 - license1.txt  &quot;1 license&quot;
Library 2
 - file2A.cpp  &quot;2A code&quot;
 - file2B.cpp  &quot;2B code&quot;
 - license2.txt  &quot;2 license&quot;
</code></pre>
<p>Becomes</p>
<pre><code>- library.cpp
   /* Notice: the following is subject to license1 */
   1A code
   1B code
   /* Notice: the following is subject to license2 */
   2A code
   2B code
</code></pre>
<p>All I've done is changed the delivery format, so this should be acceptable. Can you see any reason why it would not be?</p>

<p>Very likely not, but it would depend on each license.</p>
<p>For example, GPL has requirements for the license of a complete work, if you received one part based on the GPL license. If the other licenses are not compatible with the GPL license, then you can't publish with the different licenses. Say A is licensed under GPL, B is licensed under the B-license, GPL requires that A+B is licensed under GPL, the B-license requires that B is licensed under the B-license, and you cannot publish B both under GPL and under the B-license because the terms are contradicting, then you can't legally publish A+B.</p>
<p>As an extreme, assume the B-license explicitely says &quot;B cannot be published under the GPL license, and cannot be combined with another part that is published under the GPL license&quot;. Then obviously you can't do what you are planning.</p>
<p>However, you may get away with it if you don't actually create anything new based on the existing projects. A CD containing three separate individual open source licensed projects is most likely not a &quot;derived work&quot;, just a container with three individual works. A zip file probably the same. A giant text file containing all the sources is arguably a derived work.</p>

licensing