File: rules

package info (click to toggle)
xapian-omega 1.0.7-3+lenny2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,424 kB
  • ctags: 744
  • sloc: sh: 9,112; cpp: 7,954; makefile: 245; perl: 119
file content (195 lines) | stat: -rwxr-xr-x 6,257 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/usr/bin/make -f
#
# Copyright (C) 2004,2005,2006 Lemur Consulting Ltd
# Copyright (C) 2006,2007,2008 Olly Betts
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
# USA

# Version without the "-N" suffix.
XAPIAN_VERSION := $(shell sed 's/.*(\([^-]*\)\(-.*\)*).*/\1/;q' debian/changelog)

# The next incompatible version - i.e. the first release of the next release
# branch.  So for XAPIAN_VERSION "1.0.<n>", this should be "1.1.0".
XAPIAN_VERSION_CEILING := $(shell echo '$(XAPIAN_VERSION)'|awk -F. '{print $$1"."$$2+1".0"}')

export DH_OPTIONS

export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
    confflags += --build $(DEB_HOST_GNU_TYPE)
else
    confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
    # Disable the testsuite when cross-compiling.
    DEB_BUILD_OPTIONS += nocheck
endif

# Handle DEB_BUILD_OPTIONS.  Note that dh_strip handles nostrip for us.
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
    confflags += CFLAGS=-O0 CXXFLAGS=-O0
else
    confflags += CFLAGS=-O2 CXXFLAGS=-O2
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    MAKEFLAGS += -j$(NUMJOBS)
endif
ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
    MAKE_CHECK := :
else
    MAKE_CHECK := make check
endif

BUILD_DEPS := debhelper (>= 4.1.22),
# We need a versioned build dependency on libxapian-dev.
BUILD_DEPS += libxapian-dev (>= $(XAPIAN_VERSION)),# NB Trailing ',' required here!
BUILD_DEPS += libxapian-dev (<< $(XAPIAN_VERSION_CEILING)),# NB Trailing ',' required here!

commonconfflags := \
	$(confflags) \
	--prefix=/usr \
	--sysconfdir=/etc

# Needed for dapper where we end up using automake1.9
commonconfflags += --mandir=/usr/share/man

# With GCC3 and later this won't make a huge difference, but it'll save
# a bit of time and diskspace while building.
commonconfflags += --disable-dependency-tracking

maint: debian/control

maintclean: clean
	rm -f debian/control

debian/control: debian/rules debian/control.in
	rm -f debian/control.tmp
	sed -e "s/@BUILD_DEPS@/$(BUILD_DEPS)/g" \
	    < debian/control.in > debian/control.tmp
	mv debian/control.tmp debian/control

configure: configure-stamp
configure-stamp:
	dh_testdir

	# Use Debian's patched libtool to avoid trying to explicitly link with
	# -lz.  Just forcing link_all_deplibs=no doesn't help here.
	autoreconf -if

	# Use the latest config.sub and config.guess from the autotools-dev
	# package.
	rm -f config.sub config.guess
	ln -s /usr/share/misc/config.sub config.sub
	ln -s /usr/share/misc/config.guess config.guess

	# Configure in a subdirectory, for neatness.
	mkdir -p build
	cd build && ../configure $(commonconfflags)

	# Touch the stamp file, to avoid repeating the configure step.
	touch $@

build: build-stamp
build-stamp: configure
	dh_testdir
	$(MAKE) -C build
	$(MAKE_CHECK) -C build
	touch $@

install: DH_OPTIONS=
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Install the files into debian/tmp.
	$(MAKE) -C build DESTDIR=$(CURDIR)/debian/tmp install

	# Replace omega.conf with one with paths suitable for debian.
	rm -f debian/tmp/etc/omega.conf
	install -m 644 debian/omega.conf.debian debian/tmp/etc/omega.conf

	# Install the icons.
	install -d -m 755 debian/tmp/usr/share/images/xapian-omega
	install -m 644 images/*.png debian/tmp/usr/share/images/xapian-omega

	# Install the omegascript templates.
	install -d -m 755 debian/tmp/usr/share/xapian-omega/templates
	install -d -m 755 debian/tmp/usr/share/xapian-omega/templates/inc
	install -m 644 templates/inc/[a-z]* debian/tmp/usr/share/xapian-omega/templates/inc
	install -m 644 templates/[a-hj-z]* debian/tmp/usr/share/xapian-omega/templates

	# Fix paths in query template, and install that instead.
	sed 's!/icons/omega/!/images/xapian-omega/!g' templates/query > debian/query.tmp
	install -m 644 debian/query.tmp debian/tmp/usr/share/xapian-omega/templates/query
	rm -f debian/query.tmp

	# Symlink them in as examples (they can't just go under /usr/share/doc
	# because policy 12.3 says "Packages must not require the existence of
	# any files in `/usr/share/doc/' in order to function").
	install -d -m 755 debian/tmp/usr/share/doc/xapian-omega/examples
	ln -s ../../../xapian-omega/templates debian/tmp/usr/share/doc/xapian-omega/examples/templates

	# Create the /var directories.
	install -d -m 755 debian/tmp/var/lib/xapian-omega/data
	install -d -m 755 debian/tmp/var/lib/xapian-omega/cdb
	install -d -m 755 debian/tmp/var/log/xapian-omega

	# Reads the *.install files to decide where to install everything.
	dh_install --sourcedir=debian/tmp --fail-missing

binary: binary-arch binary-indep
binary-indep: DH_OPTIONS=-i
binary-indep:

binary-arch: DH_OPTIONS=-a
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installman
	dh_installchangelogs ChangeLog
	dh_strip
	dh_link
	dh_compress
	dh_fixperms
	dh_makeshlibs
	dh_installdeb

	dh_shlibdeps
	# Rewrite the dependency on libxapianN to be >= our version, since
	# we may require features added in that version.
	perl -pi -e \
	    's/^(shlibs:Depends=.*libxapian\d+)/$$1 (>= $(XAPIAN_VERSION))/' \
	    debian/*.substvars

	dh_gencontrol
	dh_md5sums
	dh_builddeb

clean:
	dh_testdir
	dh_testroot
	rm -rf build
	rm -f config.sub config.guess
	dh_clean
	rm -f build-stamp configure-stamp

.PHONY: configure build install binary binary-arch binary-indep clean