开源许可(Open Source License) 是一种法律协议,用于规定用户如何使用、修改和分发开源软件。它保障了软件的自由可用性,同时明确了开发者和使用者的权利与义务。常见的开源许可包括 MIT、Apache、BSD、Mozilla、GPL等,这些协议都是由Open Source Initiative(OSI)组织批准的,每种协议对代码的使用方式和再分发要求都有不同的限制和规定。
开源 ≠ 免费使用
- 开源指的是软件的源代码公开,任何人都可以查看、使用、修改或分发,但必须遵守相应的开源许可协议。
- 免费使用则是指软件可以在不付费的情况下使用,与是否公开源代码无关。
开源软件的免费使用可能需要附带一些限制,例如:
- GPL协议下的开源软件,必须公开修改后的代码。
- MIT、Apache等协议下的开源软件,必须保留原作者的版权声明。
- 一些特殊许可的协议,可能会限制不得用于某些特定用途等等。
开源软件提供的是“有条件的自由”,而不是“完全免费、无约束”的使用。
常见的开源协议
BSD
全称Berkeley Software Distribution,是一个给于使用者很大自由的协议。可以自由的使用、修改源代码,也可以将修改后的代码作为开源或者专有软件再发布,是对商业集成很友好的协议。
BSD协议特点:
- 如果再发布的产品中包含源代码,则在源代码中必须带有原来代码中的BSD协议。
- 如果再发布的只是二进制类库/软件,则需要在类库/软件的文档和版权声明中包含原来代码中的BSD协议。
- 禁止背书:禁止使用源代码的原作者/机构名字和原产品的名字做市场推广。
版权声明如下:
/**
** Copyright [yyyy] [copyright_user] <copyright_email>.
** 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.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
**/
MIT
全称MIT license,是最宽松的开源许可协议,只需要包含原始版权声明即可,其他的完全自由。
MIT协议的软件及其相关文档对所有人免费,可以自由的使用、复制、修改、合并、发表、分发、再授权或者销售。唯一的限制是必须包含版权许可声明。
MIT协议特点:
- 自由的使用、复制、修改、合并,用于自己的项目。
- 可以免费分发或用来盈利。
- 唯一限制:必须包含许可声明。
版权声明如下:
/**
** Copyright [yyyy] [copyright_user] <copyright_email>.
**
** 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 condition:
** The above copyright notice and this permission notice shall be included in all
** copies or substantial portions of the Software.
**/
Apache
全称Apache License,当前版本为Apache 2.0,除了提供版权许可之外,还有专利许可。
Apache 协议特点:
- 永久权利:一旦被授权,永久拥有。
- 全球范围的权利:在一个国家获得授权,适用于所有国家。假如你在美国,许可是从印度授权的,也没有问题。
- 授权免费,且无版税:前期、后期均无任何费用。
- 授权无排他性:任何人都可以获得授权。
- 授权不可撤消:一旦获得授权,没有任何人可以取消(比如,你基于该产品代码开发了衍生产品,你不用担心会在某一天被禁止使用该代码)。
- 分发代码:要在声明中对参与开发的人给予认可并包含一份许可协议原文。
版权声明如下:
/**
** Copyright [yyyy] [copyright_user] <copyright_email>.
** 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.
**/
MPL
全称Mozilla Public License,当前版本为MPL 2.0,修改版本必须保持其原始版权声明,如果发布了编译后的可执行文件,那么必须让对方可以取得MPL协议下程序的源代码。
MPL协议特点:
- MPL允许在自己的类库上加一个接口,仅将接口的源代码以MPL许可证的形式对外许可(类库中的源代码不强制对外)。
- MPL允许被许可人将获得的源代码与自己的代码混合得到自己的软件程序。
- MPL不反对软件专利,但是要求源代码作者不能提供已经受到专利保护的代码(除非本人是专利人,且书面向公众授权),也不能将这些源代码开源许可后再去申请相关专利。
- 必须有一个专门的文件对源代码修改的时间和修改方式进行描述。
版权声明如下:
Exhibit A - Source Code Form License Notice
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - “Incompatible With Secondary Licenses” Notice
This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0.
GPL
全称GNU General Public License,目前最新版本为 GPL v3,有可能是开源界最常用的许可模式,GPL 保证了所有开发者的权利,同时为使用者提供了足够的复制,分发,修改的权利,Linux 系统广泛采用 GPL 协议。
GPL协议特点:
- 可自由复制:可以无限制的复制,复制份数没有任何限制。
- 可自由分发:可以在任何平台上发布或共享。
- 可以用来盈利:允许收费分发,但必须提供该软件的 GNU GPL 许可协议(让使用者知晓可以免费得到此软件),以及收费的理由。
- 可自由修改:可以自由修改或引用代码,但衍生作品必须采用 GPL 协议(开源)。
版权声明如下:
/**
** Copyright [yyyy] [copyright_user] <copyright_email>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
LGPL
全称Lesser General Public License,最新版本为 LGPL v3,是专为类库设计的开源许可协议,相较 GPL 更加灵活,允许商业软件通过链接使用 LGPL 类库,而无需开源商业软件的代码。
LGPL协议特点:
- 商业用途的软件可以链接LGPL类库并分发。
- 如果修改了 LGPL 类库的代码,修改部分及衍生部分必须开源。
版权声明如下:
/**
** Copyright [yyyy] [copyright_user] <copyright_email>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
常见开源软件使用的许可协议
Library | Version | License |
---|---|---|
OpenSceneGraph | > 3.1.1 | LGPL (+) |
SDL2 | Zlib | |
Bullet | > 3.17 | Zlib (+) |
Effekseer | > 1.70e | MIT |
osgEarth | > 2.10 | LGPL (+) |
Qt | > 5.5 | LGPL |
backward-cpp | MIT | |
imgui | 1.83 | MIT |
leveldb | BSD3 | |
OpenFBX | MIT | |
ozz-animation | MIT | |
rapidjson | MIT (+) | |
rapidxml | Boost / MIT | |
sqlite3 | Public | |
xatlas | MIT | |
xxYUV | MIT |
文章评论