OSDN Git Service

Finished the struct of spec.
authorHe Chenlan <210hcl@gmail.com>
Mon, 18 Jan 2021 13:29:50 +0000 (21:29 +0800)
committerHe Chenlan <210hcl@gmail.com>
Mon, 18 Jan 2021 13:29:50 +0000 (21:29 +0800)
RPM参考指南.txt

index 9e7dbdc..f736c1d 100644 (file)
@@ -17,17 +17,17 @@ popt https://github.com/rpm-software-management/popt http://ftp.rpm.org/popt/rel
 zlib https://zlib.net/ https://zlib.net/zlib-1.2.11.tar.xz
 libmagic 系统核心包file提供
 加密库二选一
-openssl(fedora选择的) https://www.openssl.org/ https://mirrors.cloud.tencent.com/openssl/source/openssl-1.1.1i.tar.gz (受制于EAR①,openssl 1系列许可证与GPL不兼容) //EAR 美国出口管制条例
-libgcrypt(openSUSE选择的) https://www.gnupg.org/software/libgcrypt/ https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.7.tar.bz2 (不受制于EAR)
+openssl(fedora选择的) https://www.openssl.org/ https://mirrors.cloud.tencent.com/openssl/source/openssl-1.1.1i.tar.gz ##受制于EAR,openssl 1系列许可证与GPL不兼容。EAR 美国出口管制条例。
+libgcrypt(openSUSE选择的) https://www.gnupg.org/software/libgcrypt/ https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.7.tar.bz2 ##不受制于EAR
 数据库引擎
 主推荐ndb (rpm自己写的,rpm内建)
 主推荐sqlite https://sqlite.org/index.html https://sqlite.org/2020/sqlite-src-3340000.zip https://sqlite.org/2020/sqlite-autoconf-3340000.tar.gz 
 BDB已经弃用 (BDB新版使用AGPLv3,是开源许可证,但是和GPLv2不兼容)
 BDB RO版支持方案--enable-bdb-ro (rpm内建)
 lua支持 (fedora的spec嵌入了大量lua源代码) https://www.lua.org/ https://www.lua.org/ftp/lua-5.4.2.tar.gz
-SELinux (原文为可选依赖,但fedora和OpenSUSE都有) https://github.com/SELinuxProject https://github.com/SELinuxProject/selinux/releases/download/20200710/libselinux-3.1.tar.gz //Warning:SELinux编译依赖较多
-python (原文为可选依赖,但fedora和OpenSUSE都有) https://www.python.org/ https://mirrors.huaweicloud.com/python/3.9.1/Python-3.9.1.tar.xz //Python依赖非常多连Xorg都需要
-libcap (原文为可选依赖,但fedora和OpenSUSE都有) https://sites.google.com/site/fullycapable/ http://mirrors.ustc.edu.cn/kernel.org/linux/libs/security/linux-privs/libcap2/libcap-2.46.tar.xz
+SELinux (原文为可选依赖,但fedora和OpenSUSE都有) https://github.com/SELinuxProject https://github.com/SELinuxProject/selinux/releases/download/20200710/libselinux-3.1.tar.gz #Warning: SELinux编译依赖较多
+python (原文为可选依赖,但fedora和OpenSUSE都有) https://www.python.org/ https://mirrors.huaweicloud.com/python/3.9.1/Python-3.9.1.tar.xz #Warning: Python编译依赖非常多连Xorg都需要
+libcap (原文为可选依赖,但fedora和OpenSUSE都有) https://sites.google.com/site/fullycapable/ https://mirrors.ustc.edu.cn/kernel.org/linux/libs/security/linux-privs/libcap2/libcap-2.46.tar.xz
 acl (原文为可选依赖,但fedora和OpenSUSE都有) https://savannah.nongnu.org/projects/acl https://download.savannah.nongnu.org/releases/acl/acl-2.2.53.tar.gz
 autoconf
 automake
@@ -61,4 +61,29 @@ rpmdev-setuptree
 确定好准备打包的软件后,在SPEC文件夹内创建文件,软件名.spec,并将软件的源代码放到SOURCES文件夹。
 
 4.spec文件
-spec文件和bash一样,#后面为注释。
+spec文件和bash一样,#后面为注释。推荐参考GNU nano的打包脚本,简单明了。
+spec文件结构:
+Name: 软件的名字,同时也是这个spec文件的文件名
+Version: 软件的版本号
+Release: 打包的版次,如果Version更新,则版次清零(从0开始标)
+Summary: 包的简短描述
+License: 许可证 ##详细规定见打包规范文件
+URL: 源代码下载地址 ##不提供下载地址的需要报备
+Source0: 0号源文件一定是源代码文件,除了补丁,必须要被打包的文件依次从1开始编号。
+Patch0:0号补丁文件,patch或者diff文件。如有需要,依次编号。
+BuildArch: 不区分架构的软件写noarch,比如python, perl写的软件。x86_64不写。 ##暂不考虑aarch64的 ##Warning: 任何32位库依然作为x86_64的软件!
+BuildRequires: 编译依赖。可以写在同一行。 ##在项目统一通知前,不要写编译依赖!
+Requires: 运行依赖。除了glibc之外的所有依赖。
+ExcludeArch: 无法打包的架构。 ##暂不使用
+
+%description 软件的详细描述。请注意强制换行。
+%prep 编译前的准备工作,比如解包。
+%build 编译。
+%install 安装。
+%check 测试编译情况。
+%files 编译出来的文件,SOURCES1开始的文件要放在哪里。
+%changelog 打包日志。
+
+关于编译的根目录:
+在RPM打包的上下​​文中,"buildroot"是chroot环境。这意味着构建工件将使用与最终用户系统中相同的文件系统层次结构放置在此处,其中"buildroot"充当根目录。构建工件的放置应符合最终用户系统的文件系统层次结构标准。稍后会将"buildroot"中的文件放入cpio归档文件,该文件成为RPM的主要部分。在最终用户的系统上安装RPM时,这些文件将提取到根目录中,并保留正确的层次结构。
+