はじめに
私は専門家・法律家ではないので、この記事の正しさを保証できません。個人的にライセンスをどう解釈してどう対応したかを公開する記事となります。
誤りに気づいたら、ご指摘頂けると幸いです。
コピー元について
コピー元のライブラリは GitHub で Microsoft が公開している windows-rs だけです。2022年8月11日現在 windows-rs は MIT License と Apache License 2.0 のデュアルライセンスです。
コピー元のコードは samples/direct2d/src/main.rs だけです。これはWin32 APIを使用したウィンドウ表示のサンプルです。
コピペして修正したコードについて
GitHub 上の horyu/rust-keyboard-visualizer-sample で公開しています。ソースコードは src/main.rs だけです。
これはキーボード入力表示ソフトのサンプルでコピ元とは以下の点で異なります。
- 表示内容が異なる
- レンダーループとメッセージループを別スレッドで処理する
- キーボードフックを設定する
最終的に501行のコードが315行になり、自分が書き換えたり追加したコードは100行以下です。
公開するライセンス選択する
個人的には WTFPL license
にしたいのですが、ライセンスの互換性やリライセンス周りを完全に理解するのが難しかったため、windows-rs と同じライセンスの片方を選択します。
Apache License 2.0
日本語参考訳: https://licenses.opensource.jp/Apache-2.0/Apache-2.0.html
元コードは Work(成果物)、自分が作ったコードは Derivative Works(派生成果物)と解釈しました。その上で 4. Redistribution. に書かれた再配布の条件を確認します。
4.1 成果物または派生成果物の受信者にライセンスのコピーを渡すこと、はライセンスのコピーをリポジトリの分かりやすい所に置いておけば問題なさそうです。
4.2 修正したファイルに対して行った変更を目立つように告知すること、を達成するの々面倒だと感じました。501行のコードを100行程度の独自要素を含む315行にする変更を同じファイル内で示す良い方法が思いつきませんでした。ファイルの冒頭に diff の結果を貼り付けることを考えましたが、それは避けたいです。
いったん Apache License 2.0 は見送ります。自分独自のコードがコピーした部分より多ければ、修正とは見なさず4.2の対応をする必要がないのでは?と考えています。
MIT License
日本語参考訳: https://licenses.opensource.jp/MIT/MIT.html
条件は「上記の著作権表示とこの許諾表示を、ソフトウェアの全コピーまたは重要な部分に含めること」だけです。
変更を示す必要がなく、テキストのコピペだけで対応できるということで MIT License に決めました。
MITライセンスのコードをコピペして修正したコードをMITライセンスとして公開する
参考
- github - MITライセンスで[再配布]の場合の表記例 - スタック・オーバーフロー
- github - MITライセンスのソフトウェアをフォークした場合のライセンス表記 - スタック・オーバーフロー
- オープンソースを改変する場合の著作権表示について - zenn
各ファイルに対して以下のことを行いました。
LICENSE
1. LICENSEファイルにwindows-rsのMITライセンスファイルをコピペしてコピーライト部分に自身の情報を記入する
MIT License
Copyright (c) 2022 horyu
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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
2. windows-rs のMITライセンスの条件に従うため、LICENSEファイルに区切り ---
を追加して、その後にwindows-rsのMITライセンスファイルをコピペする
MIT License
Copyright (c) 2022 horyu
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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
---
MIT License
Copyright (c) Microsoft Corporation.
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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
3. ライセンスが2連続で並んだ謎ファイルになったので、windows-rsを使用していることを区切りの部分に明記する
最終的に以下のようになりました。
MIT License
Copyright (c) 2022 horyu
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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
---
This software uses windows-rs developed by Microsoft.
---
MIT License
Copyright (c) Microsoft Corporation.
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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
ただ書き方が良くないのか、GitHubはこれをMITライセンスだとは表示してくれません。
README.md
README.md ファイルにライセンスを見ろと明記する。ついでに windows-rs を使っていることも書く。ついでの部分はMITライセンスの条件とは無関係だと思います。
<!--(略)-->
## License
See [LICENSE](./LICENSE).
This product uses [Microsoft](https://github.com/microsoft)/[windows-rs](https://github.com/microsoft/windows-rs).
src/main.rs
5. src/main.rs に windows-rs を参考にしたと冒頭に書く。これはMITライセンスの条件とは無関係だと思います。
// reference
// https://github.com/microsoft/windows-rs/blob/d40a51812f0a943f1c2124948ef4436d9276dbf4/crates/samples/direct2d/src/main.rs
use windows::{
// 略
疑問・思ったこと
サンプルコードはパブリックドメインだと嬉しい?
例えば webpack のサンプルコードはパブリックドメインだと書かれている(License | webpack )ので、自由にコピペに改変もできますね。パブリックドメインではないものの ライセンス | Webセキュリティの小部屋 のようなクレジット登記不要なライセンスでも嬉しい。
仮にパブリックドメインでなくても、以下のような場合はライセンスの条件に従わずコピペしても問題がない認識です。
- コードに創造性がない
- 誰が書いても同じになるようなコード
- コードの作者から許可を得ている
MITライセンスの条件はソフトウェア自体の名前を明記する必要がない?
「上記の著作権表示とこの許諾表示」にソフトウェア名が書いてないので、今回の場合だと windows-rs を明記する必要がない? 個人的にMITライセンスのテンプレートにソフトウェア名を記入する部分が追加されてほしい。