制作deb包

方法一:checkinstall

checkinstall的原理就是将make install的内容放到一个临时目录然后打包,只要能执行make install就能创建deb包,如果代码已经make install了,需要先执行make uninstall,不然会出现只打包库文件的软连接而没有打包库文件的情况。通过dpkg-deb -c可以查看deb包的文件是否正常。

  • 设置打包环境
sudo apt-get install checkinstall
  • 制作deb包
checkinstall make install
  • 检查deb包
dpkg-deb -c XX.deb

方法二: dpkg-buildpackage

  • 设置打包环境
$ sudo apt-get install -y dh-make dpkg-dev devscripts
  • 创建控制文件
$ wget http://zlib.net/zlib-1.2.8.tar.gz
$ tar xzf zlib-1.2.8.tar.gz
# 命令将在当前目录下生成debian目录
$ dh_make --createorig --copyright gpl3 --email fwdssg@gmail.com --single
  • 编辑debian/control
Source: zlib
Section: unknow
Priority: optional
Maintainer: ubuntu <fwdssg@gmail.com>
Build-Depends: debhelper (>=9),autotools-dev
Standards-Version: 3.9.6
Homepage: http://zlib.net/
#Vcs-Git: git://anonscm.debian.org/collab-maint/zlib.git
#Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/zlib.git
Package: zlib
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: <insert up to 60 chars description>
<insert long description, indented with spaces>
属性 说明
Section 软件的类别,常见的有utils、net、mail、text、x11等
Architecture 软件包结构,如基于i386、amd64、m68k、sparc、alpha、powerpc等
  • 编辑debian/postinst.ex
# deb安装完成时需要执行的脚本
$ mv postinst.ex postinst
$ sed -i '/ configure)/a\ echo -e \"zlib deb test\" > $HOME/zlib.log' postinst
  • 编辑debian/rules
# zlib比较特殊很多参数不支持,所以需要自定义configure,用--prefix=/usr/local会报错也是坑
echo -e "override_dh_auto_configure:\n\t./configure --prefix=/usr" >> rules
  • 制作deb包
$ cd zlib-1.2.8
# 自己测试完就不签名-uc -us
$ dpkg-buildpackage -rfakeroot -tc -uc -us -b
  • 检查deb包
dpkg-deb -c XX.deb

dpkg-buildpackage使用技巧

  • 编辑rules文件添加export DEB_BUILD_MAINT_OPTIONS = hardening=-all可以去掉编译时候自动添加的-Werror=XX参数

参考资料

从源码构建deb包

为现有的二进制文件制作deb包

官方文档

为Debian和Ubuntu制作软件包

构建软件包

官方文档

官方文档

官方文档

官方文档

Linux 的源码安装工具 CheckInstall

deb包制作的更多相关文章

  1. deb包制作(转)

    deb 包已被广泛应用但是也在不断的更新,这里介绍Ubuntu deb包安装设置使用,帮助大家安装更新Ubuntu deb包系统.制作Ubuntu deb包的三种方法 | Sean's Blog [转 ...

  2. s3-sftp-proxy goreleaser rpm &&deb 包制作

    上次写过简单的s3-sftp-proxy基于容器构建以及使用goreleaser构建跨平台二进制文件的,下边演示下关于 rpm&&deb 包的制作,我们只需要简单的配置就可以生成方便安 ...

  3. vigil deb 包制作

    前边有写过简单rpm 包的制作,现在制作一个简单的deb 包. deb 包的制作是通过源码编译+ fpm 环境准备 rust curl https://sh.rustup.rs -sSf | sh 配 ...

  4. rpm和deb包制作和升级执行步骤

    deb安装包升级和安装都是dpkg -i .deb命令,升级时直接覆盖安装新包安装步骤:1 preinst install2 postinst configure升级步骤:1 先执行旧包prerm u ...

  5. ubuntu 制作deb 包

    ubuntu下打包制作deb安装包 http://www.th7.cn/system/lin/201406/61012.shtml   2014-06-22 20:16:45CSDN-yangbing ...

  6. deb包+软件图标+添加到系统菜单+举例安装卸载

    本文介绍的内容和实验一下: 1. 制造deb包.2. 为了使软件图标.3. 开始菜单中添加到系统中的软件:4. 安装和卸载制作的deb包. 1. 制作deb包 制作deb包的方法可能有多种,本文使用的 ...

  7. 从源代码制作deb包的两种方法以及修改已有deb包(转载)

    From:http://yysfire.github.io/linux/%E4%BB%8E%E6%BA%90%E4%BB%A3%E7%A0%81%E5%88%B6%E4%BD%9Cdeb%E5%8C% ...

  8. QT程序制作deb包并安装在应用程序菜单

    制作原理:打包:将QT制作的源程序(没有编译的)用debian压缩打包(这里是用脚本对源程序再编译)安装:将deb包中的源程序解压(默认解压到根目录)到规定系统文件中并编译(postinst脚本)卸载 ...

  9. [deb]制作deb包

    转自:http://www.cnblogs.com/Genesis-007/p/5219960.html 查看系统安装了哪些deb包: dpkg -l 打包: dpkg -b dir result.d ...

随机推荐

  1. git版本控制-- Windows+Git+TortoiseGit+COPSSH安装图文教程

    Windows+Git+TortoiseGit+COPSSH 安装图文教程 教程网址: http://www.liaoxuefeng.com/wiki/0013739516305929606dd183 ...

  2. 剑指Offer:二叉树中和为某一值的路径【34】

    剑指Offer:二叉树中和为某一值的路径[34] 题目描述 输入一颗二叉树和一个整数,打印出二叉树中结点值的和为输入整数的所有路径.路径定义为从树的根结点开始往下一直到叶结点所经过的结点形成一条路径. ...

  3. Database: key

    super-key: Any key that has more columns than necessary to uniquely identify each row in the table i ...

  4. Automator 实例:使用快捷键 实现 快速在当前路径 打开 iTerm

    1. 在 finder -> 应用程序 或 通过 Spotlight 打开:Automator.app 2. 选择新建 “服务” 3. 设置服务,见下图,设置完成之后,command + s 保 ...

  5. image auto fix the View

    image: { flex: 1, width: null, height: null, resizeMode: 'contain' }

  6. Codeforces Round #553 (Div. 2) 题解

    昨晚深夜修仙上紫记,虽然不错还是很有遗憾的. A. Maxim and Biology 看完就会做的题,然而手速跟不上 #include<cstdio> #include<iostr ...

  7. codeforces 之 Little Pigs and Wolves

    B-Little Pigs and Wolvestime limit per test2 secondsmemory limit per test256 megabytesinputstandard ...

  8. 调用jersey发布的接口webservice,通过HttpPost传递文件

    项目媒体文件之前都是上传到七牛云处理,现在客户为了安全和私密性,准备将移动端拍摄的图片和视频传递到文件服务器,所以就想办法能不能在服务器端发布一个WebService,供移动端调用.刚好之前做的接口都 ...

  9. 通过阿里云域名动态解析 IP 地址

    这两天在家里用树莓派折腾了一个家用服务器,主要用来做 mac 的 Time Machine ,还有就是当做下载机和 nas ,想着平时上班时间家里没人用网络,空着也是空着,就可以利用空闲带宽下个美剧啥 ...

  10. T61

    你参加了这次科学讨论会,有什么体会?What have you learned from the symposium?那墙有点斜.The wall is a little out of the per ...