2

I want to convert a C# library (not written by myself) licensed under Apache License v2 to C++. The original C# library has a LICENSE file with the Apache license information, however the individual code files have no license header or copyright notice.

I will have to modify every single line of code, but the modifications will be very minor (since the logic remains the same). If I want to add the apache license header to the code files, what should I put in the copyright field?

// Copyright [yyyy] [name of copyright owner]
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

Do I put the author of the original library? My own name? Both? Do I add two license blocks, despite the original files having none?

2
  • 2
    Are you able to contact the author(s) of the C# library? By far the best solution here all round is for them to add a header to the C# versions which you can then copy. Jan 1, 2023 at 11:47
  • 1
    @PhilipKendall In Apache license section 4b, the requirement to add such a notice to each file is for the person modifying the file(s); the original author does not have to mark each file with a copyright header if she does not wish to do that. Developer preferences vary; personally I would not like to do that if it were not required.
    – Brandin
    Jan 1, 2023 at 12:48

2 Answers 2

2

Section 4 of the Apache License is pretty clear:

  1. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:

    • You must give any other recipients of the Work or Derivative Works a copy of this License; and

    • You must cause any modified files to carry prominent notices stating that You changed the files; and

    • You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and

    • If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.

    • You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.

So you have to retain the copyright notice of the original author. If that was in a separate file you may move it into this modified file. Then add your own copyright notice right next to it.

Please consider adding SPDX identifiers to the file (in addition to the verbose items listed above). These license identifiers are the state of the art way to support any future automation w.r.t. license compliance.

3

If you want to add a comment block with a license indication, you should definitely have a Copyright line mentioning the original author to avoid the impression that you exclusively own the copyrights.

Assuming the conversion from C# to C++ takes at least some minimal creativity from you, you can add a second Copyright line next to it with your name.

If the conversion is purely mechanical (a script could do it), then the conversion does not anything that is protected by copyright law and all copyrights remain with the original authors.

3
  • 1
    For the mechanical conversion scenario in your last paragraph, while that's maybe true on copyright level ("the conversion does not [do] anything that is protected by copyright law"), if you read the Apache license note in 4b, you might still need to add a notice, since technically that case still could be seen as a modification (i.e. it's a derivative work, not an unmodified copy).
    – Brandin
    Jan 3, 2023 at 8:00
  • @Brandin, Does that mean that when I compile or minify a 3rd-party Apache project, that I need to add a notice? Those are also purely mechanical conversions. Jan 3, 2023 at 8:07
  • 1
    It's maybe a question of technicality. For this case maybe a catch-all notice somewhere would suffice to satisfy that condition, e.g. "the files in this directory were converted from the original using blah tool." If one reads the sentence very literally ("must cause any modified files to carry prominent notices") then one could imagine that each modified file must contain an individual prominent notice, technically.
    – Brandin
    Jan 3, 2023 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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