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 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
|
#!/usr/bin/make -f
#
# Copyright (C) 2004,2005,2006 Lemur Consulting Ltd
# Copyright (C) 2006,2007,2008,2009,2010,2011,2012,2013,2015,2016,2017 Olly Betts
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# For development releases, set DEV_SERIES to the release series (e.g. 1.3)
#DEV_SERIES := 1.3
# Codename we're building packages for. For backported packages, put the
# codename (e.g. jessie or trusty) in debian/codename. If that file doesn't
# exist, the default is sid.
#
# (Currently nothing in this file varies depending on the codename).
# CODENAME := $(shell cat debian/codename 2>/dev/null||echo sid)
# The soversion number needs to match that generated by libtool. The following
# lines should read configure.ac to get the current interface number and
# subtract it from the interface age, to get the oldest interface number
# supported by the library. This should correspond to the soversion assigned
# to the library by libtool. (This isn't documented, and is system dependent,
# so we need to check it doesn't break with future versions of libtool.)
libxapian_soversion:=$(shell \
awk -F'[=:]' '($$1 == "LIBRARY_VERSION_INFO") {print $$2-$$4}' configure.ac\
)
last_abi_change_version:=$(shell \
awk 'BEGIN {v="1.4.0"} ($$0 ~ /^dnl [0-9][0-9]*:0:[0-9][0-9]* [0-9][0-9]*\./) { v = $$3 } END {print v}' configure.ac\
)
ifneq ($(DEV_SERIES),)
libxapian_soversion:=-$(DEV_SERIES)-$(libxapian_soversion)
VERSION_SUFFIX:=-$(DEV_SERIES)
endif
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)
export DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
confflags := --prefix=/usr --sysconfdir=/etc
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
confflags += --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
# For i386 and *-i386.
ifeq ($(patsubst %-i386,i386,$(DEB_HOST_ARCH)), i386)
XAPIAN_BUILD_SSE := 1
endif
# Handle other DEB_BUILD_OPTIONS. Note that dh_strip handles nostrip for us,
# and dpkg-buildflags handles noopt.
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
# Set AUTOMATED_TESTING to skip timed tests which can be flaky under uneven
# load.
MAKE_CHECK := $(MAKE) check VALGRIND= AUTOMATED_TESTING=1
endif
ifneq (,$(filter assertions,$(DEB_BUILD_OPTIONS)))
confflags += --enable-assertions
endif
# In dpkg 1.17.0, --export=cmdline was added as the preferred name, but stick
# with --export=configure for now to ease backporting to suites with older
# dpkg.
confflags += $(shell dpkg-buildflags --export=configure)
# With GCC3 and later this won't make a huge difference, but it'll save
# a bit of time and diskspace while building.
confflags += --disable-dependency-tracking
maint: \
debian/control \
debian/libxapian$(libxapian_soversion).install \
debian/libxapian$(libxapian_soversion).shlibs \
debian/libxapian-dev.install
maintclean: clean
rm -f debian/control
rm -f debian/libxapian$(libxapian_soversion).install
rm -f debian/libxapian$(libxapian_soversion).shlibs
rm -f debian/libxapian-dev.install
rm -rf debian/libxapian$(libxapian_soversion)
rm -rf debian/libxapian-dev
rm -rf debian/xapian-doc
rm -rf debian/xapian-tools
rm -rf debian/tmp debian/tmp-sse2
debian/control: configure.ac debian/rules debian/control.in debian/compat
rm -f debian/control.tmp
sed -e 's/@LIBXAPIAN_SOVERSION@/$(libxapian_soversion)/g' \
-e 's/@BUILD_DEPS@/debhelper (>= $(shell cat debian/compat)),/g' \
debian/control.in > debian/control.tmp
mv debian/control.tmp debian/control
debian/libxapian$(libxapian_soversion).shlibs: configure.ac debian/rules
echo 'libxapian $(libxapian_soversion) libxapian$(libxapian_soversion) (>= $(last_abi_change_version)~)' > $@.tmp
mv $@.tmp $@
debian/libxapian$(libxapian_soversion).install: debian/rules debian/libxapianVERSION.install
rm -f $@.tmp
sed 's/@VERSION_SUFFIX@/$(VERSION_SUFFIX)/' \
debian/libxapianVERSION.install > $@.tmp
mv $@.tmp $@
debian/libxapian-dev.install: debian/rules debian/libxapianVERSION-dev.install
rm -f $@.tmp
sed 's/@VERSION_SUFFIX@/$(VERSION_SUFFIX)/' \
debian/libxapianVERSION-dev.install > $@.tmp
mv $@.tmp $@
configure: configure-stamp
configure-stamp: debian/control debian/libxapian$(libxapian_soversion).shlibs
dh_testdir
# Use the latest config.sub and config.guess from the autotools-dev
# package.
dh_autotools-dev_updateconfig
# Report kernel and compiler version so upstream PLATFORMS file can be
# updated from buildd logs.
-uname -a
-g++ --version
# Configure in a subdirectory, for neatness.
mkdir -p build
ifdef XAPIAN_BUILD_SSE
cd build && ../configure $(confflags) --disable-sse
mkdir -p build-sse2
cd build-sse2 && ../configure $(confflags)
else
cd build && ../configure $(confflags)
endif
# Touch the stamp file, to avoid repeating the configure step.
touch $@
build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: configure-stamp
dh_testdir
$(MAKE) -C build
ifdef XAPIAN_BUILD_SSE
$(MAKE) -C build-sse2
$(MAKE_CHECK) -C build-sse2
else
$(MAKE_CHECK) -C build
endif
touch $@
install: DH_OPTIONS=
install: install-stamp
install-stamp: build-stamp \
debian/libxapian$(libxapian_soversion).install \
debian/libxapian-dev.install
dh_testdir
dh_testroot
dh_prep
dh_installdirs
# Install the files into debian/tmp
$(MAKE) -C build DESTDIR=$(CURDIR)/debian/tmp install
ifdef XAPIAN_BUILD_SSE
$(MAKE) -C build-sse2 DESTDIR=$(CURDIR)/debian/tmp-sse2 install
mkdir -p $(CURDIR)/debian/libxapian$(libxapian_soversion)/usr/lib/$(DEB_HOST_MULTIARCH)/sse2
mv $(CURDIR)/debian/tmp-sse2/usr/lib/$(DEB_HOST_MULTIARCH)/libxapian*.so.* $(CURDIR)/debian/libxapian$(libxapian_soversion)/usr/lib/$(DEB_HOST_MULTIARCH)/sse2
rm -rf $(CURDIR)/debian/tmp-sse2
endif
# Empty dependency_libs to placate luddite release goal.
sed -i 's/^\(dependency_libs=\).*/\1/' $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libxapian$(VERSION_SUFFIX).la
# Install the example source code
mkdir -p debian/tmp/usr/share/doc/xapian-examples/examples
cp examples/*.cc debian/tmp/usr/share/doc/xapian-examples/examples
ln -s ../../../../lib/xapian-examples/examples debian/tmp/usr/share/doc/xapian-examples/examples/built
# Fix up link to the internal sourcedocs to point to those on the
# Xapian website since we don't build and package them.
sed -i 's,sourcedoc/html/annotated.html,https://xapian.org/docs/&,' debian/tmp/usr/share/doc/xapian-core/internals.html
# FIXME: Temporarily ignore these - we need to decide where to package
# them (new arch all -common or bundle into the main lib with a
# suitably versioned path?)
rm -rf debian/tmp/usr/share/xapian-core/stopwords
# Reads the *.install files to decide where to install everything
dh_install --sourcedir=debian/tmp --fail-missing
touch $@
binary: binary-arch binary-indep
binary-indep: DH_OPTIONS=-i
binary-indep: build-indep install
dh_testdir
dh_testroot
dh_installdocs
dh_installexamples
dh_installmenu
dh_installman
dh_installchangelogs ChangeLog
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary-arch: DH_OPTIONS=-a
binary-arch: build-arch 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
dh_gencontrol
dh_md5sums
dh_builddeb
clean: debian/control
dh_testdir
dh_testroot
rm -rf build build-sse2
dh_autotools-dev_restoreconfig
dh_clean
.PHONY: maint maintclean configure build build-arch build-indep install binary binary-arch binary-indep clean
|