方案一,基于dpkg-buildpackage
1.准备工作
1)重命名目标源码目录,目录名规则为文件名加大版本号,如下:
2)测试编译代码,清楚残余无用文件
安装libcurl开发包:
apt-get install libcurl4-gnutls-dev
清楚残余文件(bin/obj)
make clean
3)源码打包
2.制作deb包
1)利用dh_make生成debian模板文件
根据deb包类型选择对应的Type,-e 后跟包构建者E-mail.
2)修改控制文件
2.1)增加安装执行文件,如:libniscsdk.install
2.2)小版本更新,修改changelog文件
3)生成deb包:dpkg-buildpackage
root@liul-VirtualBox:~/tt/libniscsdk-1.0# dpkg-buildpackage
dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): -D_FORTIFY_SOURCE=2
dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security
dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): -Wl,-Bsymbolic-functions -Wl,-z,relro
dpkg-buildpackage: 源码包 libniscsdk
dpkg-buildpackage: 源码版本 1.0-1
dpkg-buildpackage: 源码修改者 root <liul.stone@gmail.com>
dpkg-buildpackage: 主机架构 amd64
dpkg-source --before-build libniscsdk-1.0
debian/rules clean
dh clean
dh_testdir
dh_auto_clean
make[1]: 正在进入目录 `/root/tt/libniscsdk-1.0'
Cleaning libSDK_VerifyRegister.so ...
rm -fr libSDK_VerifyRegister.so
make[1]:正在离开目录 `/root/tt/libniscsdk-1.0'
dh_clean
dpkg-source -b libniscsdk-1.0
dpkg-source: info: using source format `3.0 (quilt)'
dpkg-source: info: building libniscsdk using existing ./libniscsdk_1.0.orig.tar.gz
dpkg-source: 警告: 忽略对文件 libSDK_VerifyRegister.