3
# Boost libraries for which we want separate packages
4
# context is conditionally compiled because it is not supported yet on several architectures
5
# coroutine, coroutine2, and fiber depend on context, so they are also conditionally compiled
6
boost_libs := atomic chrono date-time exception filesystem \
7
graph graph-parallel iostreams locale log math mpi \
8
mpi-python program-options python random regex \
9
serialization signals system test thread timer \
12
# these are special cases, where /usr/lib name differs from Boost library name
13
boost_lib_log := log log_setup
14
boost_lib_math := math_c99 math_c99f math_tr1 math_tr1f
15
boost_lib_math_long_double := math_c99l math_tr1l
16
boost_lib_serialization := serialization wserialization
17
boost_lib_test := prg_exec_monitor test_exec_monitor unit_test_framework
19
pyversions = $(shell pyversions -rv) $(shell py3versions -rv)
21
# These are special cases for suffixes. Generally come from --python-buildid, so begin with a dash.
22
boost_suffixes_python := $(addprefix -py,$(subst .,,$(pyversions)))
23
boost_suffixes_mpi-python := $(boost_suffixes_python)
25
# Files that are generated by filtering a template
28
DPKG_EXPORT_BUILDFLAGS = 1
29
include /usr/share/dpkg/buildflags.mk
30
include /usr/share/dpkg/architecture.mk
33
dh $@ --with python2 --with python3
35
override_dh_auto_configure: user-config.jam make-debhelper
37
override_dh_auto_build: $(bjam) debian/bjam.1
38
$(JAM) $(JAM_WITHOUT) --without-python
39
for pyver in $(pyversions); do \
40
pyid=$$(echo $$pyver | tr -d .); \
41
echo "Building Boost.Python for python version $$pyver"; \
42
$(JAM) --build-dir=build-$$pyver --user-config=$(CURDIR)/user-config-$$pyver.jam --with-python --with-mpi --python-buildid=py$$pyid python=$$pyver; \
43
mv stage/lib/mpi.so stage/lib/mpi-py$$pyid.so || true; \
46
cd $(bbv2dir) && ./bootstrap.sh --with-toolset=gcc
47
cd tools/bcp && $(JAM)
48
cd tools/inspect/build && $(JAM)
49
cd tools/quickbook && $(JAM)
52
cd status && $(JAM) $(JAM_WITHOUT)
54
override_dh_auto_clean: clean-debhelper
55
-cd tools && $(JAM) clean
57
rm -rf tools/jam/src/bootstrap
58
rm -rf tools/jam/src/bin.*
59
rm -ff tools/jam/src/bjam
60
rm -rf tools/regression/build/bin
62
rm -rf user-config.jam
63
rm -rf build-* user-config-*.jam
68
dh_compress -Xlibboost$(PKGVERSION)-doc/HTML
71
$(JAM) --prefix=$(CURDIR)/debian/tmp/usr $(JAM_WITHOUT) \
72
--libdir=$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) \
73
--without-python install
74
for pyver in $(pyversions); do \
75
pyid=`echo $$pyver | tr -d .`; \
76
$(JAM) --build-dir=build-$$pyver --user-config=$(CURDIR)/user-config-$$pyver.jam --prefix=$(CURDIR)/debian/tmp/usr \
77
--libdir=$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) \
78
install --with-python --with-mpi --python-buildid=py$$pyid python=$$pyver; \
81
# Install Boost.Build v2 & jam
82
cd $(bbv2dir) && ./bjam install --prefix=$(CURDIR)/debian/tmp/usr --libdir=$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
83
mv debian/tmp/usr/share/boost-build/example debian/boost-build-examples
85
find debian/tmp/usr/include debian/tmp/usr/share/boost-build -type f | xargs chmod 644
86
find debian/tmp -name .cvsignore | xargs rm -f
87
find debian -empty -type f | xargs rm -f
89
# package libboost$(PKGVERSION)-dev
90
dh_install -plibboost$(PKGVERSION)-dev \
91
debian/tmp/usr/include/boost \
93
dh_install -plibboost$(PKGVERSION)-tools-dev \
94
debian/tmp/usr/bin/bjam \
99
dh_link -plibboost$(PKGVERSION)-tools-dev usr/bin/bjam usr/bin/b2
100
dh_installman -plibboost$(PKGVERSION)-tools-dev debian/bjam.1 debian/bcp.1 debian/inspect.1 debian/quickbook.1
101
dh_install -plibboost$(PKGVERSION)-tools-dev tools/boostbook/xsl/* usr/share/boostbook/xsl
102
dh_install -plibboost$(PKGVERSION)-tools-dev tools/boostbook/dtd/* usr/share/boostbook/dtd
103
dh_install -plibboost$(PKGVERSION)-tools-dev debian/tmp/usr/share/boost-build
105
# package libboost-date-time$(PKGVERSION)-dev
106
dh_installdocs -plibboost-date-time$(PKGVERSION)-dev libs/date_time/data
108
# package libboost-doc
111
#cat debian/documentation-files | xargs cp --parents --target-directory=$(htmldir)
112
#find doc libs -name doc | xargs -n1 cp --archive --parents --target-directory=$(htmldir)
113
rm -rf $(htmldir)/boost
114
dh_link -plibboost$(PKGVERSION)-doc \
116
usr/share/doc/libboost$(PKGVERSION)-doc/HTML/boost
117
# provide a constant symlink to the latest documents and examples
118
dh_link -plibboost$(PKGVERSION)-doc \
119
usr/share/doc/libboost$(PKGVERSION)-doc/HTML \
120
usr/share/doc/libboost-doc/HTML
121
dh_link -plibboost$(PKGVERSION)-doc \
122
usr/share/doc/libboost$(PKGVERSION)-doc/examples \
123
usr/share/doc/libboost-doc/examples
125
dh_link -plibboost-python$(PKGVERSION)-dev \
126
usr/lib/$(DEB_HOST_MULTIARCH)/libboost_python-py27.a \
127
usr/lib/$(DEB_HOST_MULTIARCH)/libboost_python.a
128
dh_link -plibboost-python$(PKGVERSION)-dev \
129
usr/lib/$(DEB_HOST_MULTIARCH)/libboost_python-py27.so \
130
usr/lib/$(DEB_HOST_MULTIARCH)/libboost_python.so
132
dh_link -plibboost-mpi-python$(PKGVERSION)-dev \
133
usr/lib/$(DEB_HOST_MULTIARCH)/libboost_mpi_python-py27.a \
134
usr/lib/$(DEB_HOST_MULTIARCH)/libboost_mpi_python.a
135
dh_link -plibboost-mpi-python$(PKGVERSION)-dev \
136
usr/lib/$(DEB_HOST_MULTIARCH)/libboost_mpi_python-py27.so \
137
usr/lib/$(DEB_HOST_MULTIARCH)/libboost_mpi_python.so
139
dh_installexamples -plibboost$(PKGVERSION)-doc debian/boost-build-examples
140
mkdir -p $(exampledir)
141
cat debian/example-files | xargs cp -a --parents --target-directory=$(exampledir)
142
find $(exampledir) -type f | xargs chmod 644
144
# package libboost-mpi-python$(SOVERSION)
145
dh_install -plibboost-mpi-python$(SOVERSION)
146
for pyver in $(pyversions); do \
147
pyid=`echo $$pyver | tr -d .`; \
149
2.*) pydistdir=usr/lib/python$$pyver/dist-packages/boost ;; \
150
3.*) pydistdir=usr/lib/python3/dist-packages/boost ;; \
152
dh_install -plibboost-mpi-python$(SOVERSION) libs/mpi/build/__init__.py $$pydistdir; \
153
dh_installdirs -plibboost-mpi-python$(SOVERSION) $$pydistdir; \
154
cp stage/lib/mpi-py$$pyid.so debian/libboost-mpi-python$(SOVERSION)/$$pydistdir/mpi.so || true; \
157
find debian -iname '*.so*' -type f -print0 | xargs -0 chrpath --delete
158
dh_install --list-missing
161
dh_strip --dbgsym-migration='libboost1.55-dbg, libboost1.58-dbg, libboost1.61-dbg'
163
# set the number of build jobs
164
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
165
JOBS := -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
168
version_full := $(shell dpkg-parsechangelog | grep Version | cut -d' ' -f2)
169
version_upstream := $(shell echo $(version_full) | cut -d'+' -f1)
170
version_major := $(shell echo $(version_upstream) | cut -d'.' -f1,2)
172
PKGVERSION = $(version_major)
173
SOVERSION = $(version_upstream)
176
# Function to map Boost component name to set of shared library names
177
# Input: Boost component name
178
# Return: shared library names for the given Boost library
179
boost_lib = $(if $(boost_lib_$(1)), $(boost_lib_$(1)), $(1))
181
# Function to map Boost component name to set of suffixes for the library
182
# Input: Boost component name
183
# Return: suffixes for the given Boost component
184
boost_suffixes = $(if $(boost_suffixes_$(1)), $(boost_suffixes_$(1)),"")
186
# Helpers to make basic and decorated library names
187
# Input: library, suffix
188
# Return: base library filename for short or full name
189
mk_base_name = usr/lib/$(DEB_HOST_MULTIARCH)/libboost_$(subst -,_,$(1))$(2)
192
# Return: package name for shared library or development
193
mk_pkg_lib = libboost-$(1)$(SOVERSION)
194
mk_pkg_dev = libboost-$(1)$(PKGVERSION)-dev
196
# Helpers to generate debhelper input filenames.
198
# Return: prefix to debhelper filenames
199
mk_deb_lib = debian/$(call mk_pkg_lib,$(1))
200
mk_deb_dev = debian/$(call mk_pkg_dev,$(1))
202
# Helpers that update debhelper .install or .links files
203
# Input: component, library, suffix
205
mk_so_files = $(shell echo debian/tmp/$(call mk_base_name,$(2),$(3)).so.$(SOVERSION) >> $(call mk_deb_lib,$(1)).install)
206
mk_a_files = $(shell echo debian/tmp/$(call mk_base_name,$(2),$(3)).a >> $(call mk_deb_dev,$(1)).install)
207
mk_ln_files = $(shell echo $(call mk_base_name,$(2),$(3)).so.$(SOVERSION) $(call mk_base_name,$(2),$(3)).so >> $(call mk_deb_dev,$(1)).links)
209
# Specify the type of files/links to install.
210
# Special cases first, then general rule
211
boost_filetypes_exception = a
212
boost_filetypes_test_exec_monitor = a
213
boost_filetypes = $(if $(boost_filetypes_$(1)), $(boost_filetypes_$(1)),a so ln)
215
# Function that updates debhelper files for a given library
216
# Input: component, library, suffix
218
mk_files = $(foreach fn,$(call boost_filetypes,$(2)),$(call mk_$(fn)_files,$(1),$(2),$(3)))
220
# helpers to make and install lintian override files
222
# Input: package, override
223
add_override = echo $(1): $(2) >> debian/$(1).lintian-overrides;
226
add_dev_override = $(call add_override,libboost$(PKGVERSION)-dev,$(1))
227
add_doc_override = $(call add_override,libboost$(PKGVERSION)-doc,$(1))
229
# Input: component, lintian-warning
230
add_lib_override = $(call add_override,$(call mk_pkg_lib,$(1)),$(2))
231
add_libdev_override = $(call add_override,$(call mk_pkg_dev,$(1)),$(2))
233
# Input: package-name-base, versioned-package-name
234
cp_debhelper = for s in doc-base examples postinst prerm README.Debian; do \
235
if test -f debian/$(1).$$s; then cp -f debian/$(1).$$s debian/$(2).$$s; fi; done
237
# Function that updates debhelper files for all libraries shipped.
238
mk_debhelper_files = \
239
$(call add_dev_override,extra-license-file) \
240
$(call add_doc_override,extra-license-file) \
241
$(foreach l, $(boost_libs), \
242
echo "making debhelper files for $(l)..."; \
243
$(call add_lib_override,$(l),package-name-doesnt-match-sonames) \
244
$(foreach ll, $(call boost_lib,$(l)), \
245
$(foreach suf, $(call boost_suffixes,$(l)), \
246
$(call mk_files,$(l),$(ll),$(suf)) \
251
TOOLSET_CONFIG = 'using gcc : : $(DEB_HOST_GNU_TYPE)-g++-6 : <compileflags>"$(CPPFLAGS)" <cflags>"$(CFLAGS)" <cxxflags>"$(CXXFLAGS) -Wno-unused-local-typedefs" <linkflags>"$(LDFLAGS)" ;'
253
BUILD_LONG_DOUBLE = yes
255
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
257
ifeq ($(DEB_BUILD_ARCH), alpha)
259
else ifeq ($(DEB_BUILD_ARCH), arm)
260
BUILD_LONG_DOUBLE = no
261
else ifeq ($(DEB_BUILD_ARCH), armel)
262
BUILD_LONG_DOUBLE = no
263
else ifeq ($(DEB_BUILD_ARCH), armhf)
264
BUILD_LONG_DOUBLE = no
265
else ifeq ($(DEB_BUILD_ARCH), arm64)
266
BUILD_LONG_DOUBLE = no
268
else ifeq ($(DEB_BUILD_ARCH), hppa)
269
BUILD_LONG_DOUBLE = no
271
else ifeq ($(DEB_BUILD_ARCH), ia64)
273
else ifeq ($(DEB_BUILD_ARCH), m68k)
275
else ifeq ($(DEB_BUILD_ARCH), mips)
276
BUILD_LONG_DOUBLE = no
277
else ifeq ($(DEB_BUILD_ARCH), mipsel)
278
BUILD_LONG_DOUBLE = no
279
else ifeq ($(DEB_BUILD_ARCH), mips64)
281
else ifeq ($(DEB_BUILD_ARCH), mips64el)
283
else ifeq ($(DEB_BUILD_ARCH), powerpcspe)
285
else ifeq ($(DEB_BUILD_ARCH), ppc64)
287
else ifeq ($(DEB_BUILD_ARCH), ppc64el)
289
else ifeq ($(DEB_BUILD_ARCH), s390)
291
else ifeq ($(DEB_BUILD_ARCH), s390x)
293
else ifeq ($(DEB_BUILD_ARCH), sh4)
294
BUILD_LONG_DOUBLE = no
296
else ifeq ($(DEB_BUILD_ARCH), sparc)
298
else ifeq ($(DEB_BUILD_ARCH), sparc64)
300
else ifeq ($(DEB_BUILD_ARCH), x32)
304
ifeq ($(BUILD_CONTEXT), yes)
305
boost_libs += context coroutine fiber
307
JAM_WITHOUT += --without-context --without-coroutine --without-coroutine2 --without-fiber
310
ifeq ($(BUILD_LONG_DOUBLE), yes)
311
boost_lib_math += $(boost_lib_math_long_double)
313
JAM_OPT += --disable-long-double
316
exampledir = debian/libboost$(PKGVERSION)-doc/usr/share/doc/libboost$(PKGVERSION)-doc/examples
317
htmldir = debian/libboost$(PKGVERSION)-doc/usr/share/doc/libboost$(PKGVERSION)-doc/HTML
318
bjam = $(CURDIR)/bjam
319
bbv2dir = $(CURDIR)/tools/build
321
# With --ignore-site-config, can probably drop Build-Conflicts on boost-build.
322
JAM = $(bjam) $(JOBS) -d2 $(JAM_OPT) --layout=system --ignore-site-config --user-config=$(CURDIR)/user-config.jam debug-symbols=on
328
./bootstrap.sh --with-icu=/usr --prefix=$(CURDIR)/debian/tmp/usr \
329
--libdir=$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) \
332
debian/bjam.1: $(bjam)
333
help2man --name 'software build tool' --no-info ./bjam > $@
336
echo $(TOOLSET_CONFIG) > $@
337
echo "using mpi ;" >> $@
338
for pyver in $(pyversions); do \
339
cp $@ user-config-$$pyver.jam; \
340
echo "using python : $$pyver : /usr ;" >> user-config-$$pyver.jam; \
343
$(filtered_files): % : %.in
344
sed -e 's/@PKGVERSION@/$(PKGVERSION)/g' < $< > $@
347
rm -rf debian/*.install
348
rm -rf debian/*.links
349
rm -rf debian/*.lintian-overrides
351
# Make all the generated debhelper files.
352
make-debhelper: clean-debhelper $(filtered_files)
353
@$(call mk_debhelper_files)
354
@$(call cp_debhelper,libboost-dev,libboost$(PKGVERSION)-dev)
355
@$(call cp_debhelper,libboost-doc,libboost$(PKGVERSION)-doc)
356
@$(call cp_debhelper,libboost-python-dev,libboost-python$(PKGVERSION)-dev)
357
@$(call cp_debhelper,libboost-mpi-python-dev,libboost-mpi-python$(PKGVERSION)-dev)