source: MondoRescue/trunk/mondo/debian/rules @ 302

Last change on this file since 302 was 302, checked in by andree, 14 years ago

Add initial Debian package building support.

  • Property svn:executable set to *
File size: 3.9 KB
Line 
1#!/usr/bin/make -f
2# -*- makefile -*-
3# Sample debian/rules that uses debhelper.
4# GNU copyright 1997 to 1999 by Joey Hess.
5
6# Uncomment this to turn on verbose mode.
7#export DH_VERBOSE=1
8
9# Define package name variable for a one-stop change.
10PACKAGE_NAME = mondo
11
12# These are used for cross-compiling and for saving the configure script
13# from having to guess our platform (since we know it already)
14DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
15DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
16
17
18CFLAGS = -Wall -g
19
20ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
21    CFLAGS += -O0
22else
23    CFLAGS += -O2
24endif
25ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
26    INSTALL_PROGRAM += -s
27endif
28
29config.status: configure
30    dh_testdir
31
32    # Configure the package.
33    CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man
34
35# Build both architecture dependent and independent
36build: build-arch build-indep
37
38# Build architecture dependent
39build-arch: build-arch-stamp
40
41build-arch-stamp:  config.status
42    dh_testdir
43
44    # Compile the package.
45    $(MAKE)
46
47    touch build-stamp
48
49# Build architecture independent
50build-indep: build-indep-stamp
51
52build-indep-stamp:  config.status
53    # Nothing to do, the only indep item is the manual which is available as html in original source
54    touch build-indep-stamp
55
56# Clean up
57clean:
58    dh_testdir
59    dh_testroot
60    rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
61    # Clean temporary document directory
62    rm -rf debian/doc-temp
63    # Clean up.
64    -$(MAKE) distclean
65    rm -f config.log
66ifneq "$(wildcard /usr/share/misc/config.sub)" ""
67    cp -f /usr/share/misc/config.sub config.sub
68endif
69ifneq "$(wildcard /usr/share/misc/config.guess)" ""
70    cp -f /usr/share/misc/config.guess config.guess
71endif
72
73    dh_clean
74
75# Install architecture dependent and independent
76install: install-arch install-indep
77
78# Install architecture dependent
79install-arch: build-arch
80    dh_testdir
81    dh_testroot
82    dh_clean -k -s
83    dh_installdirs -s
84
85    # Install the package files into build directory:
86    # - start with upstream make install
87    $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE_NAME)/usr mandir=$(CURDIR)/debian/$(PACKAGE_NAME)/usr/share/man
88    # - fix library permissions
89    chmod 644 debian/$(PACKAGE_NAME)/usr/lib/libmondo.so.2.0.3      \
90                  debian/$(PACKAGE_NAME)/usr/lib/libmondo-newt.so.1.0.0 \
91                  debian/$(PACKAGE_NAME)/usr/lib/libmondo.la            \
92                  debian/$(PACKAGE_NAME)/usr/lib/libmondo-newt.la
93    # - remove library symlinks only relevant for development
94    rm -f debian/$(PACKAGE_NAME)/usr/lib/libmondo.so      \
95              debian/$(PACKAGE_NAME)/usr/lib/libmondo-newt.so
96    # - fix autorun script permissions
97    chmod 755 debian/$(PACKAGE_NAME)/usr/lib/mondo/autorun
98    # - relocate manual to temporary location because package directory mondo-doc doesn't exist yet
99    mkdir -p debian/doc-temp
100    mv debian/$(PACKAGE_NAME)/usr/share/doc/mondo-2.11 debian/doc-temp/html
101
102    dh_install -s
103
104# Install architecture independent
105install-indep: build-indep
106    dh_testdir
107    dh_testroot
108    dh_clean -k -i
109    dh_installdirs -i
110    dh_install -i
111
112# Must not depend on anything. This is to be called by
113# binary-arch/binary-indep
114# in another 'make' thread.
115binary-common:
116    dh_testdir
117    dh_testroot
118    dh_installchangelogs ChangeLog
119    dh_installdocs
120    dh_installexamples
121    dh_installman
122    dh_link
123    dh_strip
124    dh_compress
125    dh_fixperms
126    dh_makeshlibs
127    dh_installdeb
128    dh_shlibdeps -l debian/$(PACKAGE_NAME)/usr/lib
129    dh_gencontrol
130    dh_md5sums
131    dh_builddeb
132
133# Build architecture independant packages using the common target.
134binary-indep: build-indep install-indep
135    $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
136
137# Build architecture dependant packages using the common target.
138binary-arch: build-arch install-arch
139    $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
140
141# Build architecture depdendent and independent packages
142binary: binary-arch binary-indep
143.PHONY: clean binary
Note: See TracBrowser for help on using the repository browser.