http://zh.opensuse.org/index.php?title=openSUSE:Build_Service_Debian_builds&variant=zh-cn#.E8.9D.B6.E5.8F.98_deb_.E6.89.93.E5.8C.85 

编译服务对蝶变系发行版的支持

http://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog 

http://wowubuntu.com/ubuntu-packaging-guide.html

打包手册:Ubuntu Packaging Guide

http://developer.ubuntu.com/resources/tools/packaging/


install: build-stamp
    dh_testdir
    dh_testroot
    dh_prep
    dh_installdirs
    [ ! -f Makefile ] || $(MAKE) prefix=`pwd`/debian/wvdial/usr \
        PPPDIR=`pwd`/debian/wvdial/etc/ppp/peers \
        VERBOSE=1 \
        install-bin
    cp debian/pon.wvdial debian/poff.wvdial debian/wvdial/usr/bin/

选自wvdial包 http://sources.debian.net/src/wvdial/1.61-4.1/debian

采用的是拷贝到目录文件的方式,不需要xxx.install , debian/wvial/ 目录下


$ DEB_CPPFLAGS_SET="-I/foo/bar/baz" DEB_CFLAGS_SET="-g -O6" DEB_LDFLAGS_SET="-L/fruzzel/frazzel/" dpkg-buildpackage -uc -us -j8 -rfakeroot

取得版本号,从chang

VERSION := $(shell dpkg-parsechangelog \

| awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1)


从vifm包rules中参考

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
    CFLAGS += -g
endif

安装部分

INSTALLSTRIP = install -p -o root -g root -m 755

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
    INSTALLSTRIP += -s
endif



DESTDIR = `pwd`/debian/tmp
@test root = "`whoami`" || (echo need root priviledges; exit 1) #请求root权限
dpkg-shlibdeps $(BINDIR)/$(PACKAGE)
dpkg-gencontrol -isp -P$(DESTDIR)
dpkg --build $(DESTDIR) ..

直接运行 debian/rules build 构建

http://www.debian.org/doc/manuals/maint-guide/dreq.en.html

http://www.debian.org/doc/debian-policy/ch-source.html 重要参考

#export DH_VERBOSE=1

export DH_OPTIONS=-v


显示详细过程

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) in debian/rules to set DEB_HOST_MULTIARCH variable, first

设置自动安装目标目录

override_dh_auto_install:
   dh_auto_install --destdir=$(CURDIR)/debian/tmp


http://sources.debian.net/src/razorqt/0.5.2-2/debian/rules


#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
#export DEB_BUILD_MAINT_OPTIONS   := hardening=+all
export DEB_LDFLAGS_MAINT_APPEND  := -Wl,--as-needed
# CMake doesn't use CPPFLAGS, pass them to CFLAGS/CXXFLAGS instead (bug #662833)
export DEB_CFLAGS_MAINT_APPEND   := -pipe -Wall $(shell dpkg-buildflags --get CPPFLAGS)
export DEB_CXXFLAGS_MAINT_APPEND := -pipe -Wall $(shell dpkg-buildflags --get CPPFLAGS)
%:
    dh $@ --buildsystem=cmake --parallel
override_dh_auto_configure:
    dh_auto_configure -- -DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" -DBUNDLE_XDG_UTILS=No
override_dh_shlibdeps:
        # needed because other libraries depend on
        # /usr/lib//razor-desktop/libdesktop-razor.so, installed in
        # this private directory, and that it cannot be found otherwise
        #
        # dpkg-shlibdeps: warning: couldn't find library libdesktop-razor.so needed by debian/razorqt-desktop/usr/lib/x86_64-linux-gnu/razor-desktop/libiconview.so (ELF format: 'elf64-x86-64'; RPATH: '')
        # ...
    dh_shlibdeps -l"usr/lib/$(DEB_HOST_MULTIARCH)/razor-desktop/"
override_dh_install:
    dh_install --list-missing


export QUILT_PATCHES=debian/patches

quilt applied