Debian维护者指南:https://www.debian.org/doc/manuals/debmake-doc/index.zh-cn.html
假如我们要把自己的软件包制作为可安装的deb包,应该怎么做呢?
如图先创建一个工程目录,注意目录名一定要带版本号,否则debmake时会报版本号异常的错误,然后分别创建编译文件和代码文件:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.4.1)
project(hello)
add_executable(hello hello.cpp)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
hello.cpp:
#include <stdio.h>
int main(int argc, char*argv[])
{
printf("**********Hello World************\n");
return 0;
}
生成压缩文件:
tar -zcvf hello-0.0.0.tar.gz hello-0.0.0/
执行debmake生成模板文件:
debmake
如图生成了Debian目录:
可以把format文件中的quilt改为native,否则在未添加quilt的patch文件之前修改代码文件构建源码包会报错(quilt表示上游包,native表示自建包):
现在就可以直接使用debuild -b生成deb包,例如我们修改changelog中的版本号:
然后在工程目录中执行debuild -b:
debuild -b
到这里就已经生成了deb安装包:
安装之后可以查看版本号:
我们可以根据需要修改debian目录下的各种文件,如依赖、编译规则等等。
更多介绍文章: