编译debian包相关

安装基础软件包

1
apt install devscripts equivs

开启deb-src选项

比如需要再focal上编译jammy的源码,可以假如jammy的源码选项

1
2
3
4
5
$ cat /etc/apt/sources.list.d/jammy-source.list                             ─╯
deb-src https://mirrors.cloud.tencent.com/ubuntu/ jammy universe main restricted multiverse #Added by software-properties
deb-src https://mirrors.cloud.tencent.com/ubuntu/ jammy-updates universe main restricted multiverse #Added by software-properties
deb-src https://mirrors.cloud.tencent.com/ubuntu/ jammy-backports main restricted universe multiverse #Added by software-properties
deb-src https://mirrors.cloud.tencent.com/ubuntu/ jammy-security universe main restricted multiverse #Added by software-properties

获取源码安装编译依赖

假设需要编译vim

1
2
3
4
5
apt showsrc vim
apt source vim
apt build-dep vim
# or
mk-build-deps debian/control --install --remove

编译相关包

1
2
3
4
5
fakeroot debian/rules binary
fakeroot debian/rules clean
DEB_BUILD_OPTIONS="parallel=7 nocheck" fakeroot debian/rules binary # 使用7个线程编译,编译过程不测试代码
# or
dpkg-buildpackage -j -us -uc -aarm64 -b
0%