Site icon 碼蟻創研工坊 – CODEANT STUDIOS

如何製作 Ubuntu DEB 安裝檔

一般來說,可以有三種方式來製作適合  Ubuntu  的 DEB  套件安裝檔,如下:

1. 使用 RPM 安裝檔進行轉換:

sudo apt-get install alien sudo alien "要轉換RPM的檔名"

2. 簡單快速製作 DEB  檔的方式:

sudo apt-get install dh-make debhelper fakeroot devscripts checkinstall 
sudo checkinstall -D make install

Notes : 使用 source tarball , 執行 ./configure & make , 成功  build pass 後使用

3. 完整製作 DEB 安裝檔的方式:

sudo apt-get install dh-make debhelper fakeroot devscripts checkinstall 
mkdir -p ~/debbuild/codeant-camview/debian 
cd ~/debbuild/codeant-camview 
dch --create touch debian/control debian/rules debian/dirs

changelog 內容範例,建議用 dch 產生及編輯:

codeant-camview (2.0.1) 
unstable; urgency=low   
* Initial release. For network video streaming.  
-- CODEANT STUDIOS <email@address>;  Mon, 08 Jun 2015 13:50:14 +0800

control 內容範例:

Source: codeant-camview Section: graphics
Priority: extra
Maintainer: CODEANT STUDIOS <email@address>;
Build-Depends: debhelper (>= 9)
Standards-Version: 2.0.1 Package: codeant-camview 
Architecture: amd64
Depends: 
libavcodec53 (>= 4:0.8-1~) | libavcodec-extra-53 (>= 4:0.8-1~),
libavutil51 (>= 4:0.8-1~) | libavutil-extra-51 (>= 4:0.8-1~), 
libc6 (>= 2.15), libglib2.0-0 (>= 2.24.0), libgtk-3-0 (>= 3.0.0),
libpango1.0-0 (>= 1.14.0), libpng12-0 (>= 1.2.13-4), 
libportaudio2 (>= 19+svn20101113), libsdl1.2debian (>= 1.2.10-1),
libudev0 (>= 147), libv4l-0 (>= 0.5.0)
Description: CODEANT Video Viewer and Capturer
 A capturing and viewing video from devices 

rules 內容範例:

#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Tsung.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1clean:
    dh_testdir
    dh_testroot
    dh_cleanbuild:
# Nothing to dobinary: binary-arch binary-indep
# Nothing to dobinary-arch:
# Nothing to do#install: build
#    dh_testdir
#    dh_testroot
#    dh_clean -k
#    dh_installdirsbinary-indep:
    dh_testdir
    dh_installdirs     # Custom package commands
    cp -raf usr/* debian/tmp/usr     # Resuming debhelper scripts
    dh_testroot
    dh_installchangelogs
    dh_installdocs
    dh_fixperms
    dh_compress
    dh_gencontrol
    dh_md5sums
    dh_builddeb
.PHONY: binary binary-arch binary-indep build clean

dirs 內容範例:

usr/bin
usr/share
usr/lib

Build DEB 安裝檔:

dpkg-buildpackage -rfakeroot -b

安裝套件 Install:

sudo dpkg -i ../codeant-camview_2.0.1_amd64.deb

移除套件 Remove:

sudo dpkg -r codeant-camview
Exit mobile version