Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

How do I include the copyright/license for a library if I use on 1 function?

Say if I have a class that I have taking 1 function from another library:

class MyClass {
    ...
    public function someOtherLibrariesFunction() {}
}

And the at the top of the file I took the function from it says:

/*
 * This file is part of the Other Library package.
 *
 * (c) James Smith <j.smith@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

And the LICENSE file:

Copyright (c) 2004-2013 James Smith

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:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

...standard as is warranty...

So my understanding is I would have to have a copy of the LICENSE file included with my code, and I would also somehow point out the exact function it it applies to?

share|improve this question
1  
I guess copying the license here to PSE and reading answers took you already more time than just doing what the license says. So why bother? Just copy the text to your source code. –  Doc Brown May 7 '13 at 7:39

2 Answers 2

I would include a file like "LICENSE_CodeFile_Function.txt", and then as a comment above the function, include an attribution, ie "This function is from ..... and is Copyright (c) 2004-2013 James Smith... please see the license ....."

In general, as long as you include the license in your distribution, and are very clear about where you got the code from, and who owns it etc, ie not trying to pass it off as your own, you should be fine.

Of course, for licenses like GPL, that require you to release your entire codebase under the same license, it is a little bit different.

share|improve this answer

I have had to deal with a similar situation, and this is how I solved it:

  • At the top of my file, I did not put the standard copyright notice, but rather a notice that the function contained held different copyrights.
  • Preceding each function implementation, I put a copyright notice pertaining to that function.

In my case, there were only a handful of functions in the file and two of them were copied from elsewhere. If you have a different ratio between your own code and foreign code, you could also use this slightly different solution (which is possible because the license on the foreign code allows sub-licensing)

  • At the top of your file, augment the standard copyright notice to make it clear that some functions have additional copyrights.
  • Preceding the foreign function, place a copyright notice for that function containing the text from the LICENSE file that came with the original. There is no need to include the LICENSE file itself in your distribution, as its contents are already reproduced at the relevant spot in the code.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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