一文详解常见开源协议

本文涉及的产品
云数据库 Redis 版,社区版 2GB
推荐场景:
搭建游戏排行榜
简介: 日常从Github拷贝代码过程中,也要抽空了解一下,我们拷贝的代码在商用上是否存在风险。版权保护方面,虽然相关法规尚有待完善,但在研发商用软件过程中,作为软件开发者还是很有必要了解一下,我们平时使用的`开源组件/框架`都涉及到了哪些开源协议,以避免今后的法律风险。

自12年到北京做程序员,貌似从未关心过项目中使用的“轮子”涉及到了哪些开源协议。版权保护方面,虽然相关法规尚有待完善,但在研发商用软件过程中,作为软件开发者还是很有必要了解一下,我们平时使用的开源组件/框架都涉及到了哪些开源协议,以避免今后的法律风险。

现在市面上的开源协议至少有上百种,经过开源促进会(Open Source Initiative)认可的开源协议也多达 70 多种。
这里标题叫常见开源协议详解,因此我们只介绍常见的6中开源协议。

  • BSD(Berkeley Software Distribution license)
  • MIT(Massachusetts Institute of Technology)
  • Apache Licence 2.0
  • GPL(General Public License)
  • LGPL(Lesser General Public License)
  • Mozilla(Mozilla Public License)

借用以下分析图(该图乌克兰程序员PaulBagwell原创,阮一峰翻译)展示一下常用的开源协议:

分析图:乌克兰程序员Paul Bagwell原创 阮一峰翻译

一、BSD (Berkeley Software Distribution license)

BSD源自加州大学伯克利分校,是自由软件中使用最广泛的许可协议之一,其给于使用者很大自由的协议。

使用者可以自由的使用、修改源代码,也可以将修改后的代码开源或闭源,甚至作为商业软件再发布。前提是发布的源代码、二进制可执行文件相关文档中需包含BSD许可协议声明,并且不能使用开源机构名字做产品的市场推广

使用BSD前提条件:

当你发布使用了BSD协议的代码,或以BSD协议代码为基础做二次开发时,需要满足以下三个条件:

  • 如果再发布的产品中包含源代码,则在源代码中必须带有原来代码中的BSD协议;
  • 如果再发布的是二进制类库/软件,则需要在类库/软件的文档和版权声明中包含原来代码中的BSD协议;
  • 不可以使用开源代码的作者/机构名字和原来产品的名字做市场推广;

BSD 鼓励代码共享,但需要尊重代码作者的著作权。
BSD允许使用者修改和重新发布代码,也允许基于BSD代码上开发商业软件的发布和销售,因此很多公司企业在选用开源产品的时候都首选BSD协议(因为遵循BSD协议的代码完全可控,必要的时候可以修改或者二次开发)

BSD许可条款

Copyright (c) 1998, Regents of the University of California All rights reserved.
Copyright (c) 1998 著作权由加州大学董事会所有,著作权人保留一切权利。

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 University of California, Berkeley 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 regents 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 regents and 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(Massachusetts Institute of Technology)

MIT源自麻省理工学院(Massachusetts Institute of Technology, MIT)

MIT是和BSD一样宽范的许可协议,作者只想保留版权,而无任何其他了限制。
使用者只需在发布的源代码、二进制可执行文件相关文档中包含MIT许可协议声明,便可自由的使用、修改源代码、作为商业软件再发布、甚至使用开源机构名字做产品的市场推广

MIT许可条款

Copyright (C) <year> <copyright holders>

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.

三、Apache Licence 2.0

Apache Licence是一个由Apache软件基金会发布的自由软件许可证,最初为Apache http服务器而撰写。
该协议与BSD类似,同样鼓励代码共享和尊重原作者的著作权,允许代码修改、再发布。
Apache Licence也是对商业应用友好的许可,使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售

前提条件

需要满足的条件与BSD类似:

  • 需要给使用代码的用户拷贝一份Apache Licence
  • 如果你修改了代码,需要再被修改的文件中说明。
  • 在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包含的说明。
  • 如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。

你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。

如何引用Apache Licence 2.0条款

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.

四、GPL(General Public License)

GPL许可证最初由自由软件基金会(Free Software Foundation)理查德·斯托曼为GNU项目所撰写。

GPL是一个Copyleft许可证,其派生作品只能以相同的许可条款分发:
使用者在软件开发中只要使用GPL协议的相关类库与代码,则该软件亦必须采用GPL协议,既必须开源与免费。

我们很熟悉的Linux操作系统、GNU编译器集合(GCC)就是采用了GPL。
GPL协议和BSD、MIT、Apache Licence等鼓励代码重用的许可很不一样。GPL的出发点是代码的开源/免费使用和引用/修改/衍生代码的开源/免费使用,其不允许修改后和衍生的代码做为闭源的商业软件发布和销售(只要使用GPL协议的相关类库与代码,则该软件亦必须采用GPL协议,既必须开源与免费。)
这也就是为什么我们能免费使用各种版本的linux,包括商业公司的Linux、个人组织二次开发的Linux版本。

如何引用GPL条款

Copyright (C) <year>  <name of author>

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 <https://www.gnu.org/licenses/>.

五、LGPL(Lesser General Public License)

LGPL原本被称为GNU Library General Public License,最初于1991年发布,为与GPLv2保持一致而采用2.0版的编号;
许可证的2.1版与1999年在修订后发布,与此同时,它被重命名为GNU Lesser General Public License,以显示自由软件基金会(Free Software Foundation)认为并不是所有程序库都应当采用该许可证的态度;
LGPL的第3版于2007年发布,它以在GPL第3版之上附加应用一系列许可的方式表现。

LGPL是GPL的一个主要为类库使用设计的开源协议,与GPL要求任何使用/修改/衍生之GPL类库的的软件必须采用GPL协议不同。
LGPL允许商业软件通过类库引用方式使用LGPL类库而不需要开源商业软件的代码,这使得采用LGPL协议的开源代码可以被商业软件作为类库引用并发布和销售;但使用者如果修改了LGPL协议的代码或衍生,则所有修改的代码和衍生的代码都必须采用LGPL协议

如何引用LGPL条款

Copyright (C) year  name of author

This library 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 2.1 of the License, or (at your option) any later version.

This library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

六、Mozilla(Mozilla Public License)

Mozilla开源协议由Mozilla基金会开发并维护。
该协议融合了BSD许可与GNU通用公共许可协议的特性,追求平衡专有软件和开源软件开发者之间的顾虑(平衡开发者对源代码的需求和他们利用源代码获得的利益)。

Mozilla允许使用者在自己已有的源代码库上加一个接口,除了对接Mozilla Public License开源库的接口程序源代码以MPL许可的形式对外许可外,源代码中的其他源码可以不用MPL许可证的方式强制对外许可

使用BSD前提条件:

  • 经MPL许可证发布的源代码的修改也要以MPL许可证的方式再许可出来;
  • 如果修改了代码,需要有一个专门文件描述对源代码程序的修改时间和修改方式;

= THE END =

文章首发于公众号”CODING技术小馆“,如果文章对您有帮助,可关注我的公众号。
文章首发于公众号”CODING技术小馆“,如果文章对您有帮助,可关注我的公众号。
文章首发于公众号”CODING技术小馆“,如果文章对您有帮助,可关注我的公众号。

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore &nbsp; &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
目录
相关文章
|
2月前
|
存储 JavaScript 前端开发
Wikijs 简介 - 强大 & 可扩展的开源维基软件
Wikijs 简介 - 强大 & 可扩展的开源维基软件
|
9月前
|
安全 Unix Apache
开源许可证保姆级入门手册
还在为开源许可证头秃?快收下这份保姆级入门手册~
109 0
开源许可证保姆级入门手册
|
10月前
|
Kubernetes 安全 Cloud Native
开源协议简介
开源协议简介
1091 0
|
供应链 安全 IDE
墨菲安全正式发布 murphysec 开源项目!让开发者更安全的使用开源代码
墨菲安全正式发布 murphysec 开源项目!让开发者更安全的使用开源代码
433 0
墨菲安全正式发布 murphysec 开源项目!让开发者更安全的使用开源代码
|
程序员 Apache
程序员之路:开源许可证
程序员之路:开源许可证
120 0
程序员之路:开源许可证
|
Web App开发 Kubernetes Unix
开源许可证的变迁:从 Elastic 两次变更开源协议说开去
开源从开始到现在已经有几十年历史,开源许可证在开源运动的发展中起到了基石作用,不管是从文化还是法律的角度,都较好地推动了开源的发展。
757 0
开源许可证的变迁:从 Elastic 两次变更开源协议说开去
|
Linux uml Windows
知名开源UML工具StarUML有了新的版本:StarUML-v2.5.0
较早之前使用Delphi开发的开源UML工具StarUML,到5.0后多年来一直未有更新,从StarUML-v2.5.0官网看,它就是StartUML的最新版本,支持Windows、Mac OS X和Linux。
1817 0