YLmf OS 编译系统
一、YBS 是什么?
YBS 指的是 Ylmf OS 的打包系统 (Ylmf OS Build System)。这是一种用于从源代码编译软件的类 ports 系统。在 Ylmf OS 中,yget 专门管理二进制软件包,而 YBS 则专门负责把源代码编译,并打包成可安装的 ypk 软件包。Ports 是 FreeBSD 使用的一种系统,它对源码包进行下载、解压缩、打补丁、编译和安装等一系列操作。一个 port 包含一些文件来指导源码的下载和编译安装,系统会自动完成操作。
YBS 由一个目录树构成,位于 /var/ybs/pbslib,它包含许多子目录,每个子目录都属于某一类别,都以相应的可创建的软件包命名。此目录并不包含软件包或源代码,相对的它包含一个 pbs 文件和 files 目录。Package Build Script (简称 pbs)是一个脚本——文本文件(包含对编译和打包过程的指示、包含源码包的下载地址等),files 目录则存放额外的一些文件,例如补丁文件等。YBS 最重要的部分就是 pbs 文件。
1、获得 YBS 树
以 root 身份运行
01.#ybs --sync
复制代码可以从服务器同步 YBS 树,git 管理。有了 YBS 树,用户可以自己定制,从源代码编译打包软件。
YBS 包含以下结构和工具的完整工具箱:
YBS 目录树: /var/ybs/pbslib,包含所有软件的 pbs 文件和相关文件
ybs 命令: 读取 pbs 文件,编译源代码并创建 ypk 包。
pbs 文件: 记录有创建软件包的指示和源代码地址。
2、YBS是用来做这些的:
从源代码编译 Ylmf OS 官方源里没有的软件,当然首先要编写 pbs 文件。
定制现有的软件包以满足你的特定需求,修改已存在的 pbs 文件,通常是开启或禁用相关配置选项
用其它编译器的 flags 重新构建整个系统 。
干净地编译安装你自己定制的内核,只需要修改内核的 pbs 文件。
当然,你也可以按照传统的方式 configure/make/make install 来安装软件,但是 ybs 可以使这个工作实现自动化。
3、全局编译环境 /etc/ybs.conf 指明环境变量和编译器的 flags。
01.$ cat /etc/ybs.conf
02.CC=gcc
03.CXX=g++
04.#CFLAGS="-march=native -mtune=native -O2 -fomit-frame-pointer -pipe"
05.CFLAGS="-march=i686 -mtune=i686 -O2 -pipe" #
06.CXXFLAGS="$CFLAGS"
07.MAKEOPTS="-j6" # make 的进程数
08.#YPINST_PREFIX="--prefix=/usr"
09.YPINST_PREFIX=
10.ACCEPT_REPO="stable" # 分支
11.#YP_I18N="en zh_CN" # 仅需要的语言,其它语言将会被丢掉
12.YPPATH_DIST_URI="http://pkg.ylmf.com/sources" # 备用的源代码下载服务器
13.AUTO_INSTALL="yes" # 编译打包成功后自动安装到系统
14.YPPATH_PACKAGE="/var/ypkg/packages" # 打包好的 ypk 包存放地址
复制代码二、 pbs 文件介绍:
1、pbs 文件的位置和命名规则是固定的。
以 leafpad 例, 运行:
01.# ybs -w leafpad
02./var/ybs/pbslib/app-editors/leafpad/leafpad_0.8.18.1.pbs
复制代码app-editors 软件类别
leafpad 软件名
leafpad_0.8.18.1.pbs 软件名_主版本号.pbs
leafpad_0.8.18.1-ylmf1.pbs 软件名_主版本号-修正版本号.pbs
2、简单的 pbs 文件:
以 leafpad 例, 运行:
01.$ cat /var/ybs/pbslib/app-editors/leafpad/leafpad_0.8.18.1.pbs
02.#
03.# YLmf_OS package build script
04.#
05.
06.DESCRIPTION="GTK+ based simple text editor."
07.HOMEPAGE="http://tarot.freeshell.org/leafpad/"
08.LICENSE="GPL-2"
09.PACKAGER="<
ylmfos@115.com>"
10.
11.SRC_URI="http://savannah.nongnu.org/download/"$N"/"$N-$V$R".tar.gz"
12.
13.RDEPEND="atk cairo expat fontconfig freetype gcc glib2 glibc gtk+ libpng libX11 libXau libxcb libXcomposite libXcursor libXdamage libXdmcp libXext libXfixes libXi libXrandr libXrender pango pixman zlib"
14.BDEPEND="libpng"
15.
16.pbs_unpack() {
17. ypkg_unpack
18.}
19.
20.pbs_config() {
21. ypkg_patch desktop-i18n.patch
22. YPB_CONFIG+="--disable-print"
23. ypkg_config
24.}
25.
26.pbs_build() {
27. ypkg_make
28.}
29.
30.pbs_install() {
31. ypkg_mkinstall
32.}
复制代码运行:
01.#ybs -s leafpad
复制代码就可以查询到
运行:
01.#ybs -i leafpad
复制代码开始编译和打包 leafpad
2、ybs 可以使编译打包工作自动化,主要原因是 pbs 文件的编译规则。下面学习更为复杂的 pbs 文件。/var/ybs/pbslib/template.pbs 是一个模板,里面有详细的各个规则。
01.$ cat /var/ybs/pbslib/template.pbs
复制代码#
01.# YLmf_OS package build script
02.#
复制代码# 简单的描述,推荐用英文
01.DESCRIPTION=""
复制代码# 软件主页
01.HOMEPAGE=""
复制代码# 软件分支,testing 或者 stable, 默认是 stable
01.REPO=""
复制代码# 许可协议
01.LICENSE="GPL"
复制代码# 优先级,设置为 required,则在软件中心无法删除
01.PRIORITY="required"
复制代码# 打包者,写上自己的名字和联系方式
01.PACKAGER="Ylmf OS Developers <
ylmfos@115.com>"
复制代码# 源代码包下载地址。
# $N = 软件名, 例如 leafpad
# $V = 主版本号, 例如 0.8.1
# $R = 副版本号,例如 0.8.1-rc1 中的 -rc1
支持以下 url:
01.SRC_URI="http://foo.bar.com/$N-$V.tar.bz2"
02.SRC_URI="http://foo.bar.com/$N.deb"
03.SRC_URI="http://foo.bar.com/$N.rpm"
04.SRC_URI="git://foo.bar.com/$N.git"
05.SRC_URI="git://foo.bar.com/$N"
复制代码如果已经源代码包是自己手动压缩的,复制到 $YPPATH_SOURCE(/var/ybs/sources), 则可以按照以下方式写:
01.SRC_URI=""
02.SRC_URI="$N-$V.tar.bz2"
复制代码#绝对路径
01.SRC_URI="$DIR/$N-$V.tar.bz2"
复制代码# 依赖关系
运行时依赖,ybs 会事先安装; yget install 处理二进制包时也会自动安装。
01.RDEPEND=""
复制代码推荐依赖,ybs 不处理; yget install 处理二进制包时会自动安装。
01.RECOMMENDED=""
复制代码编译依赖, ybs 会事先安装; yget install-dev 会安装,yget install 不处理
01.BDEPEND=""
复制代码可选依赖,这里只是起到一个记录的作用。
01.OPTIONAL="a: support a
02. b: support b"
复制代码冲突依赖,ybs 会在编译安装成功之后自动删除冲突包,yget install 处理二进制包时也会自动删除
01.CONFLICT=""
复制代码# 记录一些注意事项
01.NOTES=""
复制代码# 指定 desktop 和 icon 文件
01.DESKTOPFILE="glchess.desktop" or "/opt/test/test.desktop"
02.ICONFILE="test.png" or "/opt/test/test.png"
复制代码# 拆分包。注意开发包( -dev),包含头文件; 文档包( -doc) 是自动处理的。PROVIDE 支持定制的拆分包,规则由以下的 foo_install 函数来处理
01.PROVIDE="foo"
复制代码# 编译之前调用,例如某些软件需要创建用户等
01.pbs_init() {
02. #ypkg_useradd -c "$C" -d "$D" -s "$S" -g "$G" "$N"
03.}
复制代码# 自动解压源代码包,并 cd 进入解压目录
01.pbs_unpack() {
02. ypkg_unpack
03.}
复制代码# 配置编译选项
01.pbs_config() {
复制代码# 配置之前 打补丁。$FILES_PATH 是 pbs 文件所在的目录,补丁文件只要放到 $FILES_PATH/files/ 或者 $FILES_PATH/files/patches 会自动被找到。
01. ypkg_patch *.patch
复制代码# 编译选项,默认的是:
01. #YPB_CONFIG+=" --prefix=/usr
02. # --sysconfdir=/etc
03. # --localstatedir=/var
04. # --infodir=/usr/share/info
05. # --mandir=/usr/share/man
06. # --disable-static
07. # --enable-shared "
复制代码#需要额外的在这里加:
01. YPB_CONFIG+=""
02. ypkg_config
03.}
复制代码# 开始编译
01.pbs_build() {
02. ypkg_make
03.}
复制代码# 测试,一般不需要
01.pbs_check() {
02. make check
03.}
复制代码# 安装到指定目录 $YPPATH_DEST
01.pbs_install() {
02. ypkg_mkinstall
复制代码#ybs 还提供了几个工具:
# 复制 systemd 的 service 文件到 "$YPPATH_DEST"/lib/systemd/system 目录
01. #ypkg_dounit "N".service
复制代码# 复制 desktop 和 icon 文件到 "$YPPATH_DEST"/usr/share/applications 目录
01.#ypkg_dodesktop "*.desktop" "*.png"
复制代码# 复制文档文件到 "$YPPATH_DEST"/usr/share/doc/"$N" 目录
01. #ypkg_dodoc AUTHORS ChangeLog COPYING INSTALL NEWS README
复制代码# 复制时自动创建目标目录
01.#ypkg_docp "$FILES_PATH/files/XXXX" "dirname"
复制代码
01.#ypkg_domv "$FILES_PATH/files/XXXX" "dirname"
02.#ypkg_docp_rename "$1" "$2" #
03.#ypkg_domv_rename "$1" "$2"
复制代码# 链接时自动创建目标
01.#ypkg_doln "$1 "$2"
复制代码# 复制 man 文件到指定目录
01. #ypkg_doman a.1 b.2 c.3
复制代码#当 SRC_URI 后缀是 deb 或者 rpm 包时,ybs 自动解压所有文件到 data/ 目录下,这个时候只要以下命令。
01. #ypkg_docp data/* "$YPPATH_DEST"
复制代码
01.}
复制代码# 拆分包,函数名必须和 PROVIDE 一致,这个时候的 $N,$YPPATH_DEST 变量已经变成 foo
01.foo_install() {
02. ypkg_mkinstall
03.}
复制代码# 安装后执行:
01.pbs_postinst() {
02. #gnome2_install_schema "$1"
03. #gnome2_install_defaut_gconf "$1 $2 $3
04. #gnome2_rarian_sk_update
05. #gnome2_desktop_database_update
06. #gnome2_icon_cache_update /usr/share/icons/titans|titans $default is /usr/share/icons/hicolor
07. #gnome2_gconfd_reload
08. #gnome2_gtk_immodules_update
09. #gnome2_mime_database_update
10. #gnome2_gdk_pixbuf_loaders_update
11. #ypkg_dofont /usr/share/fonts/truetype/ttf-dejavu
12.}
复制代码# 删除软件包之前执行
01.pbs_prerm() {
02.
03.}
复制代码#删除软件之后执行
01.pbs_postrm() {
02.
03.}
复制代码3、更多的例子请参考 /var/ybs/pbslib
三、ybs 常用命令介绍:
搜索:
01.$ ybs -s leafpad
02.* Searching for leafpad ...
03.
leafpad
04. Installed: 0.8.18.1 2011-06-02,09:43:36
05. Available: 0.8.17 | 0.8.18.1
06. Homepage: http://tarot.freeshell.org/leafpad/
07. Description: GTK+ based simple text
复制代码 表示已安装
s表示 stable 分支
t 表示测试分支
定位 pbs 文件,找到可用的最高版本的 pbs 文件
01.$ ybs -w leafpad
02./var/ybs/pbslib/app-editors/leafpad/leafpad_0.8.18.1.pbs
复制代码编译某个包,同时自动编译依赖包,加上 -p 参数,可以模拟执行:
01.# ybs -i -p leafpad
02.* Calculating dependencies...
03. sys-libs/zlib_1.2.5
04. dev-util/pkgconfig_0.23
05. app-admin/gamin_0.1.10
06. dev-libs/mpfr_2.4.2
07. dev-libs/gmp_4.3.2
08. x11-libs/xcb-util_0.3.6
09. x11-libs/gtk+_2.20.1
10. app-editors/leafpad_0.8.18.1
复制代码 表示已安装,而且无须升级或者降级
表示此包需要降级
表示此包需要升级
已经安装的包,强制编译,加上 -F 参数,如果不加上 -p 参数会开始编译 leafpad:
01.# ybs -i -F -p leafpad
02.* Calculating dependencies...
03. dev-util/pkgconfig_0.23
04. app-admin/gamin_0.1.10
05. sys-apps/linux-headers_2.6.37 ----> sys-apps/linux-headers_2.6.38.2
06. dev-libs/mpfr_2.4.2
07. dev-libs/gmp_4.3.2
08. x11-libs/xcb-util_0.3.6
09. x11-libs/gtk+_2.20.1
10. app-editors/leafpad_0.8.18.1
复制代码 表示已安装,但是还是强制编译
编译单个软件包,不自动编译依赖。这个方式是在已知依赖完全满足的前提下,如果不加上 -p 参数会立即开始编译 leafpad,不计算依赖。
01.# ybs -is -p leafpad
02.* Installing leafpad ...
03. app-editors/leafpad_0.8.18.1
复制代码更多选项请参考 ybs --help
四、
Ylmf OS 系统以及运行其上的软件,由无数软件包组成。而每个软件包的编译规则则由 pbs 文件控制,可以说 pbs 是 Ylmf OS 的灵魂。而 ybs 方式在某种程度上实现了自动化,同时,通过 pbs 文件,也保持了完全的透明度以及对编译安装流程的控制。
除了分享 ypk 包之外,欢迎大家提交 ybs 文件给我们,同时欢迎有能力的朋友加入开发组,我们将给你一个账户,与开发人员一起维护 ybs 树。请联系 ylmfos@115.com。
--------------------------------------------------------------------------------------------------------
FHS标准使得众多的Linux发布包有了可以遵循的标准,使得软件和用户可以预测已经安装了的文件和目录的位置。它定义了如下的内容。
定义了文件系统中每个区域的用途
定义了所需要的最小构成的文件和目录
给出了例外处理和矛盾的特殊例子
--文件名的含义
/bin, binary二进制文件,可执行的命令,非管理的命令
/sbin,管理类的命令,通常只有管理员才能使用
/lib,存放库文件
/etc,配置文件的存放位置
/etc/sysconfig,服务额外配置文件,及网络设备相关配置文件
/etc/init.d 服务管理脚本
/usr,类似于windows的program file系统日常管理软件的安装路径
/usr/include 头文件存放位置
/usr/local(安装第三方软件的路径)
/usr/local/bin
/boot,引导文件,系统启动,kernel,bootloader(grub)
/dev ,设备文件所在目录
/home,/root,用户主目录
lost+found 系统意外关机 未保存的文件
/media(挂载便携性设备),/mnt,挂载点
/misc ,杂项
/opt,option,有些第三方软件,把此目录当作默认安装位置
/proc,内存中的内核相关信息的映射
/sys,像磁盘这样的存储设备或某些总线设备的驱动程序相关属性信息;
/srv,service,服务运行中中间的存放位置;
/tmp,存放临时文件的目录
/var,
/var/log,日志文件
/var/run,pid文件
/var/mail,用户邮件的存放位置
zzz19760225@zzz19760225-PC:~$ locale -a
C
C.UTF-8
en_US.utf8
POSIX
zh_CN.utf8
zzz19760225@zzz19760225-PC:~$ locale -m
ANSI_X3.110-1983
ANSI_X3.4-1968
ARMSCII-8
ASMO_449
BIG5
BIG5-HKSCS
BRF
BS_4730
BS_VIEWDATA
CP10007
CP1125
CP1250
CP1251
CP1252
CP1253
CP1254
CP1255
CP1256
CP1257
CP1258
CP737
CP770
CP771
CP772
CP773
CP774
CP775
CP949
CSA_Z243.4-1985-1
CSA_Z243.4-1985-2
CSA_Z243.4-1985-GR
CSN_369103
CWI
DEC-MCS
DIN_66003
DS_2089
EBCDIC-AT-DE
EBCDIC-AT-DE-A
EBCDIC-CA-FR
EBCDIC-DK-NO
EBCDIC-DK-NO-A
EBCDIC-ES
EBCDIC-ES-A
EBCDIC-ES-S
EBCDIC-FI-SE
EBCDIC-FI-SE-A
EBCDIC-FR
EBCDIC-IS-FRISS
EBCDIC-IT
EBCDIC-PT
EBCDIC-UK
EBCDIC-US
ECMA-CYRILLIC
ES
ES2
EUC-JISX0213
EUC-JP
EUC-JP-MS
EUC-KR
EUC-TW
GB18030
GB2312
GBK
GB_1988-80
GEORGIAN-ACADEMY
GEORGIAN-PS
GOST_19768-74
GREEK-CCITT
GREEK7
GREEK7-OLD
HP-GREEK8
HP-ROMAN8
HP-ROMAN9
HP-THAI8
HP-TURKISH8
IBM037
IBM038
IBM1004
IBM1026
IBM1047
IBM1124
IBM1129
IBM1132
IBM1133
IBM1160
IBM1161
IBM1162
IBM1163
IBM1164
IBM256
IBM273
IBM274
IBM275
IBM277
IBM278
IBM280
IBM281
IBM284
IBM285
IBM290
IBM297
IBM420
IBM423
IBM424
IBM437
IBM500
IBM850
IBM851
IBM852
IBM855
IBM856
IBM857
IBM860
IBM861
IBM862
IBM863
IBM864
IBM865
IBM866
IBM866NAV
IBM868
IBM869
IBM870
IBM871
IBM874
IBM875
IBM880
IBM891
IBM903
IBM904
IBM905
IBM918
IBM922
IEC_P27-1
INIS
INIS-8
INIS-CYRILLIC
INVARIANT
ISIRI-3342
ISO-8859-1
ISO-8859-10
ISO-8859-11
ISO-8859-13
ISO-8859-14
ISO-8859-15
ISO-8859-16
ISO-8859-2
ISO-8859-3
ISO-8859-4
ISO-8859-5
ISO-8859-6
ISO-8859-7
ISO-8859-8
ISO-8859-9
ISO-8859-9E
ISO-IR-197
ISO-IR-209
ISO-IR-90
ISO_10367-BOX
ISO_10646
ISO_11548-1
ISO_2033-1983
ISO_5427
ISO_5427-EXT
ISO_5428
ISO_646.BASIC
ISO_646.IRV
ISO_6937
ISO_6937-2-25
ISO_6937-2-ADD
ISO_8859-1,GL
ISO_8859-SUPP
IT
JIS_C6220-1969-JP
JIS_C6220-1969-RO
JIS_C6229-1984-A
JIS_C6229-1984-B
JIS_C6229-1984-B-ADD
JIS_C6229-1984-HAND
JIS_C6229-1984-HAND-ADD
JIS_C6229-1984-KANA
JIS_X0201
JOHAB
JUS_I.B1.002
JUS_I.B1.003-MAC
JUS_I.B1.003-SERB
KOI-8
KOI8-R
KOI8-RU
KOI8-T
KOI8-U
KSC5636
LATIN-GREEK
LATIN-GREEK-1
MAC-CENTRALEUROPE
MAC-CYRILLIC
MAC-IS
MAC-SAMI
MAC-UK
MACINTOSH
MAC_CENTRALEUROPE
MIK
MSZ_7795.3
NATS-DANO
NATS-DANO-ADD
NATS-SEFI
NATS-SEFI-ADD
NC_NC00-10
NEXTSTEP
NF_Z_62-010
NF_Z_62-010_(1973)
NF_Z_62-010_1973
NS_4551-1
NS_4551-2
PT
PT154
PT2
RK1048
SAMI
SAMI-WS2
SEN_850200_B
SEN_850200_C
SHIFT_JIS
SHIFT_JISX0213
T.101-G2
T.61-7BIT
T.61-8BIT
TCVN5712-1
TIS-620
TSCII
UTF-8
VIDEOTEX-SUPPL
VISCII
WIN-SAMI-2
WINDOWS-31J
zzz19760225@zzz19760225-PC:
Last edited by zzz19760225 on 2017-11-11 at 18:11 ]
YLmf OS Compilation System
I. What is YBS?
YBS refers to the packaging system of Ylmf OS (Ylmf OS Build System). It is a ports-like system used to compile software from source code. In Ylmf OS, yget is specifically for managing binary software packages, while YBS is specifically responsible for compiling source code and packaging it into installable ypk packages. Ports is a system used by FreeBSD that performs a series of operations such as downloading, decompressing, patching, compiling, and installing source code packages. A port contains some files to guide the download, compilation, and installation of the source code, and the system automatically completes the operations.
YBS is composed of a directory tree located at /var/ybs/pbslib, which contains many subdirectories, each belonging to a certain category and named after the corresponding package that can be created. This directory does not contain packages or source code, but rather contains a pbs file and a files directory. The Package Build Script (referred to as pbs) is a script - a text file (containing instructions for the compilation and packaging process, including the download address of the source code package, etc.), and the files directory stores additional files, such as patch files, etc. The most important part of YBS is the pbs file.
1. Obtain the YBS tree
Run as root
01. #ybs --sync
The code can synchronize the YBS tree from the server, managed by git. With the YBS tree, users can customize and compile and package software from source code.
YBS contains a complete toolbox of the following structures and tools:
YBS directory tree: /var/ybs/pbslib, containing pbs files and related files of all software
ybs command: reads the pbs file, compiles the source code, and creates a ypk package.
pbs file: records instructions for creating the package and the source code address.
2. What YBS is used for:
Compile software not in the official source of Ylmf OS from source code. Of course, you first need to write a pbs file.
Customize existing packages to meet your specific needs, modify the existing pbs file, usually to enable or disable relevant configuration options
Rebuild the entire system with other compiler flags.
Cleanly compile and install your own customized kernel, just modify the pbs file of the kernel.
Of course, you can also install software in the traditional way configure/make/make install, but ybs can automate this work.
3. Global compilation environment /etc/ybs.conf specifies environment variables and compiler flags.
01. $ cat /etc/ybs.conf
02. CC=gcc
03. CXX=g++
04. #CFLAGS="-march=native -mtune=native -O2 -fomit-frame-pointer -pipe"
05. CFLAGS="-march=i686 -mtune=i686 -O2 -pipe" #
06. CXXFLAGS="$CFLAGS"
07. MAKEOPTS="-j6" # Number of make processes
08. #YPINST_PREFIX="--prefix=/usr"
09. YPINST_PREFIX=
10. ACCEPT_REPO="stable" # Branch
11. #YP_I18N="en zh_CN" # Only the required languages, other languages will be discarded
12. YPPATH_DIST_URI="http://pkg.ylmf.com/sources" # Backup source code download server
13. AUTO_INSTALL="yes" # Automatically install to the system after successful compilation and packaging
14. YPPATH_PACKAGE="/var/ypkg/packages" # Storage address of the packaged ypk package
Code
II. Introduction to the pbs file:
1. The location and naming rules of the pbs file are fixed.
Take leafpad as an example, run:
01. # ybs -w leafpad
02. /var/ybs/pbslib/app-editors/leafpad/leafpad_0.8.18.1.pbs
app-editors Software category
leafpad Software name
leafpad_0.8.18.1.pbs Software name_Main version number.pbs
leafpad_0.8.18.1-ylmf1.pbs Software name_Main version number-Corrected version number.pbs
2. Simple pbs file:
Take leafpad as an example, run:
01. $ cat /var/ybs/pbslib/app-editors/leafpad/leafpad_0.8.18.1.pbs
02. #
03. # YLmf_OS package build script
04. #
05.
06. DESCRIPTION="GTK+ based simple text editor."
07. HOMEPAGE="http://tarot.freeshell.org/leafpad/"
08. LICENSE="GPL-2"
09. PACKAGER="<
ylmfos@115.com>"
10.
11. SRC_URI="http://savannah.nongnu.org/download/"$N"/"$N-$V$R".tar.gz"
12.
13. RDEPEND="atk cairo expat fontconfig freetype gcc glib2 glibc gtk+ libpng libX11 libXau libxcb libXcomposite libXcursor libXdamage libXdmcp libXext libXfixes libXi libXrandr libXrender pango pixman zlib"
14. BDEPEND="libpng"
15.
16. pbs_unpack() {
17. ypkg_unpack
18.}
19.
20. pbs_config() {
21. ypkg_patch desktop-i18n.patch
22. YPB_CONFIG+="--disable-print"
23. ypkg_config
24.}
25.
26. pbs_build() {
27. ypkg_make
28.}
29.
30. pbs_install() {
31. ypkg_mkinstall
32.}
Run:
01. #ybs -s leafpad
You can query
Run:
01. #ybs -i leafpad
Start compiling and packaging leafpad
2. ybs can automate the compilation and packaging work, mainly because of the compilation rules of the pbs file. Let's learn more complex pbs files. /var/ybs/pbslib/template.pbs is a template with detailed rules.
01. $ cat /var/ybs/pbslib/template.pbs
#
01. # YLmf_OS package build script
02. #
# Simple description, recommended in English
01. DESCRIPTION=""
# Software homepage
01. HOMEPAGE=""
# Software branch, testing or stable, default is stable
01. REPO=""
# License agreement
01. LICENSE="GPL"
# Priority, set to required, then it cannot be deleted in the software center
01. PRIORITY="required"
# Packager, write your own name and contact information
01. PACKAGER="Ylmf OS Developers <
ylmfos@115.com>"
# Source code package download address.
# $N = software name, for example leafpad
# $V = main version number, for example 0.8.1
# $R = sub-version number, for example -rc1 in 0.8.1-rc1
Support the following urls:
01. SRC_URI="http://foo.bar.com/$N-$V.tar.bz2"
02. SRC_URI="http://foo.bar.com/$N.deb"
03. SRC_URI="http://foo.bar.com/$N.rpm"
04. SRC_URI="git://foo.bar.com/$N.git"
05. SRC_URI="git://foo.bar.com/$N"
If the source code package is manually compressed and copied to $YPPATH_SOURCE (/var/ybs/sources), it can be written as follows:
01. SRC_URI=""
02. SRC_URI="$N-$V.tar.bz2"
# Absolute path
01. SRC_URI="$DIR/$N-$V.tar.bz2"
# Dependencies
Runtime dependencies, ybs will install in advance; yget install will also install automatically when processing binary packages.
01. RDEPEND=""
Recommended dependencies, ybs does not process; yget install will install automatically when processing binary packages.
01. RECOMMENDED=""
Compile dependencies, ybs will install in advance; yget install-dev will install, yget install does not process
01. BDEPEND=""
Optional dependencies, here is just a record.
01. OPTIONAL="a: support a
02. b: support b"
Conflict dependencies, ybs will automatically delete conflicting packages after successful compilation and installation, and yget install will also delete conflicting packages when processing binary packages
01. CONFLICT=""
# Record some notes
01. NOTES=""
# Specify desktop and icon files
01. DESKTOPFILE="glchess.desktop" or "/opt/test/test.desktop"
02. ICONFILE="test.png" or "/opt/test/test.png"
# Split packages. Note the development package (-dev), which contains header files; the document package (-doc) is processed automatically. PROVIDE supports customized split packages, and the rules are handled by the following foo_install function
01. PROVIDE="foo"
# Called before compilation, for example, some software needs to create users, etc.
01. pbs_init() {
02. #ypkg_useradd -c "$C" -d "$D" -s "$S" -g "$G" "$N"
03.}
# Automatically unpack the source code package and cd into the unpacked directory
01. pbs_unpack() {
02. ypkg_unpack
03.}
# Configure compilation options
01. pbs_config() {
# Patch before configuration. $FILES_PATH is the directory where the pbs file is located, and the patch file will be automatically found if it is placed in $FILES_PATH/files/ or $FILES_PATH/files/patches.
01. ypkg_patch *.patch
# Compilation options, the default is:
01. #YPB_CONFIG+=" --prefix=/usr
02. # --sysconfdir=/etc
03. # --localstatedir=/var
04. # --infodir=/usr/share/info
05. # --mandir=/usr/share/man
06. # --disable-static
07. # --enable-shared "
# Add extra ones here:
01. YPB_CONFIG+=""
02. ypkg_config
03.}
# Start compiling
01. pbs_build() {
02. ypkg_make
03.}
# Test, generally not needed
01. pbs_check() {
02. make check
03.}
# Install to the specified directory $YPPATH_DEST
01. pbs_install() {
02. ypkg_mkinstall
# ybs also provides several tools:
# Copy the systemd service file to the "$YPPATH_DEST"/lib/systemd/system directory
01. #ypkg_dounit "N".service
# Copy desktop and icon files to the "$YPPATH_DEST"/usr/share/applications directory
01. #ypkg_dodesktop "*.desktop" "*.png"
# Copy document files to the "$YPPATH_DEST"/usr/share/doc/"$N" directory
01. #ypkg_dodoc AUTHORS ChangeLog COPYING INSTALL NEWS README
# Automatically create the target directory when copying
01. #ypkg_docp "$FILES_PATH/files/XXXX" "dirname"
01. #ypkg_domv "$FILES_PATH/files/XXXX" "dirname"
02. #ypkg_docp_rename "$1" "$2" #
03. #ypkg_domv_rename "$1" "$2"
# Automatically create the target when linking
01. #ypkg_doln "$1 "$2"
# Copy man files to the specified directory
01. #ypkg_doman a.1 b.2 c.3
# When the SRC_URI suffix is a deb or rpm package, ybs automatically unpacks all files to the data/ directory. At this time, just use the following command.
01. #ypkg_docp data/* "$YPPATH_DEST"
01.}
# Split package, the function name must be the same as PROVIDE. At this time, the $N, $YPPATH_DEST variables have become foo
01. foo_install() {
02. ypkg_mkinstall
03.}
# Execute after installation:
01. pbs_postinst() {
02. #gnome2_install_schema "$1"
03. #gnome2_install_defaut_gconf "$1 $2 $3
04. #gnome2_rarian_sk_update
05. #gnome2_desktop_database_update
06. #gnome2_icon_cache_update /usr/share/icons/titans|titans $default is /usr/share/icons/hicolor
07. #gnome2_gconfd_reload
08. #gnome2_gtk_immodules_update
09. #gnome2_mime_database_update
10. #gnome2_gdk_pixbuf_loaders_update
11. #ypkg_dofont /usr/share/fonts/truetype/ttf-dejavu
12.}
# Execute before deleting the package
01. pbs_prerm() {
02.
03.}
# Execute after deleting the software
01. pbs_postrm() {
02.
03.}
3. For more examples, please refer to /var/ybs/pbslib
III. Introduction to common ybs commands:
Search:
01. $ ybs -s leafpad
02. * Searching for leafpad ...
03.
leafpad
04. Installed: 0.8.18.1 2011-06-02,09:43:36
05. Available: 0.8.17 | 0.8.18.1
06. Homepage: http://tarot.freeshell.org/leafpad/
07. Description: GTK+ based simple text
means installed
s means stable branch
t means test branch
Locate the pbs file and find the available pbs file of the highest version
01. $ ybs -w leafpad
02. /var/ybs/pbslib/app-editors/leafpad/leafpad_0.8.18.1.pbs
Compile a certain package, and automatically compile dependent packages. Add the -p parameter to simulate execution:
01. # ybs -i -p leafpad
02. * Calculating dependencies...
03. sys-libs/zlib_1.2.5
04. dev-util/pkgconfig_0.23
05. app-admin/gamin_0.1.10
06. dev-libs/mpfr_2.4.2
07. dev-libs/gmp_4.3.2
08. x11-libs/xcb-util_0.3.6
09. x11-libs/gtk+_2.20.1
10. app-editors/leafpad_0.8.18.1
means installed, and no upgrade or downgrade is required
means this package needs to be downgraded
means this package needs to be upgraded
The installed package is compiled forcefully, and the -F parameter is added. If the -p parameter is not added, leafpad will start to be compiled:
01. # ybs -i -F -p leafpad
02. * Calculating dependencies...
03. dev-util/pkgconfig_0.23
04. app-admin/gamin_0.1.10
05. sys-apps/linux-headers_2.6.37 ----> sys-apps/linux-headers_2.6.38.2
06. dev-libs/mpfr_2.4.2
07. dev-libs/gmp_4.3.2
08. x11-libs/xcb-util_0.3.6
09. x11-libs/gtk+_2.20.1
10. app-editors/leafpad_0.8.18.1
means installed, but still compiled forcefully
Compile a single software package without automatically compiling dependencies. This method is under the premise that the dependencies are known to be fully satisfied. If the -p parameter is not added, leafpad will start to be compiled immediately without calculating dependencies.
01. # ybs -is -p leafpad
02. * Installing leafpad ...
03. app-editors/leafpad_0.8.18.1
For more options, please refer to ybs --help
IV.
The Ylmf OS system and the software running on it are composed of countless software packages. The compilation rules of each software package are controlled by the pbs file. It can be said that pbs is the soul of Ylmf OS. And the ybs method realizes automation to a certain extent, and at the same time, through the pbs file, complete transparency and control over the compilation and installation process are also maintained.
In addition to sharing ypk packages, everyone is welcome to submit ybs files to us. At the same time, friends with the ability are welcome to join the development team. We will give you an account to maintain the ybs tree together with the developers. Please contact ylmfos@115.com.
--------------------------------------------------------------------------------------------------------
The FHS standard makes many Linux distributions have a followable standard, so that software and users can predict the location of installed files and directories. It defines the following contents.
Defines the use of each area in the file system
Defines the minimum required files and directories
Gives special examples of exceptions and contradictions
--Meaning of file names
/bin, binary binary files, executable commands, non-administrative commands
/sbin, administrative commands, usually only administrators can use
/lib, store library files
/etc, location of configuration files
/etc/sysconfig, additional configuration files for services, and configuration files related to network devices
/etc/init.d service management script
/usr, similar to the program file in Windows, the installation path of system daily management software
/usr/include header file storage location
/usr/local (installation path of third-party software)
/usr/local/bin
/boot, boot files, system startup, kernel, bootloader (grub)
/dev, device file directory
/home, /root, user home directory
lost+found system unexpectedly powered off unsaved files
/media (mount portable devices), /mnt, mount point
/misc, miscellaneous
/opt, option, some third-party software use this directory as the default installation location
/proc, kernel-related information mapping in memory
/sys, driver-related attribute information of storage devices such as disks or some bus devices;
/srv, service, the intermediate storage location during service operation;
/tmp, directory for storing temporary files
/var,
/var/log, log files
/var/run, pid files
/var/mail, location of user mail
zzz19760225@zzz19760225-PC:~$ locale -a
C
C.UTF-8
en_US.utf8
POSIX
zh_CN.utf8
zzz19760225@zzz19760225-PC:~$ locale -m
ANSI_X3.110-1983
ANSI_X3.4-1968
ARMSCII-8
ASMO_449
BIG5
BIG5-HKSCS
BRF
BS_4730
BS_VIEWDATA
CP10007
CP1125
CP1250
CP1251
CP1252
CP1253
CP1254
CP1255
CP1256
CP1257
CP1258
CP737
CP770
CP771
CP772
CP773
CP774
CP775
CP949
CSA_Z243.4-1985-1
CSA_Z243.4-1985-2
CSA_Z243.4-1985-GR
CSN_369103
CWI
DEC-MCS
DIN_66003
DS_2089
EBCDIC-AT-DE
EBCDIC-AT-DE-A
EBCDIC-CA-FR
EBCDIC-DK-NO
EBCDIC-DK-NO-A
EBCDIC-ES
EBCDIC-ES-A
EBCDIC-ES-S
EBCDIC-FI-SE
EBCDIC-FI-SE-A
EBCDIC-FR
EBCDIC-IS-FRISS
EBCDIC-IT
EBCDIC-PT
EBCDIC-UK
EBCDIC-US
ECMA-CYRILLIC
ES
ES2
EUC-JISX0213
EUC-JP
EUC-JP-MS
EUC-KR
EUC-TW
GB18030
GB2312
GBK
GB_1988-80
GEORGIAN-ACADEMY
GEORGIAN-PS
GOST_19768-74
GREEK-CCITT
GREEK7
GREEK7-OLD
HP-GREEK8
HP-ROMAN8
HP-ROMAN9
HP-THAI8
HP-TURKISH8
IBM037
IBM038
IBM1004
IBM1026
IBM1047
IBM1124
IBM1129
IBM1132
IBM1133
IBM1160
IBM1161
IBM1162
IBM1163
IBM1164
IBM256
IBM273
IBM274
IBM275
IBM277
IBM278
IBM280
IBM281
IBM284
IBM285
IBM290
IBM297
IBM420
IBM423
IBM424
IBM437
IBM500
IBM850
IBM851
IBM852
IBM855
IBM856
IBM857
IBM860
IBM861
IBM862
IBM863
IBM864
IBM865
IBM866
IBM866NAV
IBM868
IBM869
IBM870
IBM871
IBM874
IBM875
IBM880
IBM891
IBM903
IBM904
IBM905
IBM918
IBM922
IEC_P27-1
INIS
INIS-8
INIS-CYRILLIC
INVARIANT
ISIRI-3342
ISO-8859-1
ISO-8859-10
ISO-8859-11
ISO-8859-13
ISO-8859-14
ISO-8859-15
ISO-8859-16
ISO-8859-2
ISO-8859-3
ISO-8859-4
ISO-8859-5
ISO-8859-6
ISO-8859-7
ISO-8859-8
ISO-8859-9
ISO-8859-9E
ISO-IR-197
ISO-IR-209
ISO-IR-90
ISO_10367-BOX
ISO_10646
ISO_11548-1
ISO_2033-1983
ISO_5427
ISO_5427-EXT
ISO_5428
ISO_646.BASIC
ISO_646.IRV
ISO_6937
ISO_6937-2-25
ISO_6937-2-ADD
ISO_8859-1,GL
ISO_8859-SUPP
IT
JIS_C6220-1969-JP
JIS_C6220-1969-RO
JIS_C6229-1984-A
JIS_C6229-1984-B
JIS_C6229-1984-B-ADD
JIS_C6229-1984-HAND
JIS_C6229-1984-HAND-ADD
JIS_C6229-1984-KANA
JIS_X0201
JOHAB
JUS_I.B1.002
JUS_I.B1.003-MAC
JUS_I.B1.003-SERB
KOI-8
KOI8-R
KOI8-RU
KOI8-T
KOI8-U
KSC5636
LATIN-GREEK
LATIN-GREEK-1
MAC-CENTRALEUROPE
MAC-CYRILLIC
MAC-IS
MAC-SAMI
MAC-UK
MACINTOSH
MAC_CENTRALEUROPE
MIK
MSZ_7795.3
NATS-DANO
NATS-DANO-ADD
NATS-SEFI
NATS-SEFI-ADD
NC_NC00-10
NEXTSTEP
NF_Z_62-010
NF_Z_62-010_(1973)
NF_Z_62-010_1973
NS_4551-1
NS_4551-2
PT
PT154
PT2
RK1048
SAMI
SAMI-WS2
SEN_850200_B
SEN_850200_C
SHIFT_JIS
SHIFT_JISX0213
T.101-G2
T.61-7BIT
T.61-8BIT
TCVN5712-1
TIS-620
TSCII
UTF-8
VIDEOTEX-SUPPL
VISCII
WIN-SAMI-2
WINDOWS-31J
zzz19760225@zzz19760225-PC:
Last edited by zzz19760225 on 2017-11-11 at 18:11 ]