5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Stack (Haskell): `stack new`で自動的に生成されるLICENSEはBSDライセンスである

Last updated at Posted at 2016-09-17

(2016-09-17 15:50: ライセンスの書き方について訂正しました。)

ちょっと気になったのでメモ。

Home - The Haskell Tool Stack

このチュートリアル通りにstack newを実行すると、次のようなディレクトリ構成でファイル群が生成されます:

.
├── LICENSE
├── Setup.hs
├── app
│   └── Main.hs
├── my-project.cabal
├── src
│   └── Lib.hs
├── stack.yaml
└── test
    └── Spec.hs

Stackの標準的なプロジェクトにおけるLICENSE

このLICENSEというファイルの中身は下記の通りです:

Copyright 【ここに西暦年と名前を書く】

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the following
      disclaimer in the documentation and/or other materials provided
      with the distribution.

    * Neither the name of Yuki Fujiwara nor the names of other
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

なお、【ここに名前と西暦年を書く】の部分は、後で説明します。

このLICENSEは、実はBSDライセンスである

このライセンス文は、実は「修正BSDライセンス・三条項BSDライセンス」と同じものです。

The BSD 3-Clause License | Open Source Initiative から引用します。

Copyright (c) <YEAR>, <OWNER>
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

BSDライセンスってどんなライセンス?

ソフトウェアライセンスの中でもかなり「ゆるい」部類のものです。
GPLみたいに、配布先にも公開を強制する(GPL汚染)ようなものではありません。

  • 保障: 無保証
  • 商用: 可能
  • ソース: 複製、改変、配布可能
  • 必要な表記: 著作権表示、無保証の旨、ライセンス条文

(出典: Webデザイナーが覚えておく、代表的なライセンスまとめ|Web Design KOJIKA17

面倒なことは避けたいけど、どうしたらいいの?

  • 公開しない→このままでOK。
  • 公開したい→BSDライセンスのルールを最低限守ればOK。

公開する場合には、LICENSEファイルの【ここに西暦年と名前を書く】部分に次のことを書きます:

  • (c) (copyrightマーク。~~厳密には不要ですが、~~慣習とおまじないとして。)
    • 多くの場合には(少なくとも日本と欧米諸国向けには)(c)Copyrightも不要ですが、例外もあるので(特にラオスとカンボジア)、念のため付けるとよいでしょう。
    • 詳細: 著作権表示 - Wikipedia
  • 公開年
  • 自分の名前(ネット上で特定できれば、ハンドルネームでOK)

例:

Copyright (c) 2016, Tarou Yamada

All rights reserved.

Stackの設定としてあらかじめ書いておく

stack newコマンドで生成されるLICENSEファイルは、あらかじめ設定を書くことで上記3つを入れてくれるようになります。

  • グローバルに設定する場合: ~/.stack/config.yaml
  • プロジェクト毎に設定する場合: プロジェクトディレクトリ内のstack.yaml

で設定できます。

設定例: ~/.stack/config.yamlに次のような記述を加えます。

config.yaml
# This file contains default non-project-specific settings for 'stack', used
# in all projects.  For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration/
#
templates:
  params:
    author-email: myname@gmail.com
    author-name: Tarou Yamada
    copyright: '(c) 2016, Tarou Yamada'
    github-username: t-yamada

config.yaml中のcopyrightの設定が、最初のLICENSEファイルの【ここに名前と西暦年を書く】の部分へそのまま置換されます。

参考: stack/yaml_configuration.md at master · commercialhaskell/stack

違うライセンスがいいんだけど、どうしたらいいの?

LICENSEファイルを違うライセンス文に差し替えたらOKです。

他のライセンスについては、下記サイトが参考になります:

以上です。

5
4
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?