~gabriel1984sibiu/boost/debian

« back to all changes in this revision

Viewing changes to rules

  • Committer: Grevutiu Gabriel
  • Date: 2017-05-02 13:12:34 UTC
  • Revision ID: gabriel1984sibiu@gmail.com-20170502131234-29jl6l37o59682ua
Initial state

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/make -f
 
2
 
 
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            \
 
10
              type-erasure wave
 
11
 
 
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
 
18
 
 
19
pyversions = $(shell pyversions -rv) $(shell py3versions -rv)
 
20
 
 
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)
 
24
 
 
25
# Files that are generated by filtering a template
 
26
filtered_files = 
 
27
 
 
28
DPKG_EXPORT_BUILDFLAGS = 1
 
29
include /usr/share/dpkg/buildflags.mk
 
30
include /usr/share/dpkg/architecture.mk
 
31
 
 
32
%:
 
33
        dh $@ --with python2 --with python3
 
34
 
 
35
override_dh_auto_configure: user-config.jam make-debhelper
 
36
 
 
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; \
 
44
        done
 
45
 
 
46
        cd $(bbv2dir) && ./bootstrap.sh --with-toolset=gcc
 
47
        cd tools/bcp && $(JAM)
 
48
        cd tools/inspect/build && $(JAM)
 
49
        cd tools/quickbook && $(JAM)
 
50
 
 
51
testsuite:
 
52
        cd status && $(JAM) $(JAM_WITHOUT)
 
53
 
 
54
override_dh_auto_clean: clean-debhelper
 
55
        -cd tools && $(JAM) clean
 
56
        -$(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
 
61
        rm -rf bin.v2 dist
 
62
        rm -rf user-config.jam
 
63
        rm -rf build-* user-config-*.jam
 
64
        rm -rf debian/bjam.1
 
65
        dh_auto_clean
 
66
 
 
67
override_dh_compress:
 
68
        dh_compress -Xlibboost$(PKGVERSION)-doc/HTML
 
69
 
 
70
override_dh_install:
 
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; \
 
79
        done
 
80
 
 
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
 
84
 
 
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
 
88
 
 
89
        # package libboost$(PKGVERSION)-dev
 
90
        dh_install -plibboost$(PKGVERSION)-dev \
 
91
           debian/tmp/usr/include/boost \
 
92
           usr/include
 
93
        dh_install -plibboost$(PKGVERSION)-tools-dev \
 
94
           debian/tmp/usr/bin/bjam \
 
95
           dist/bin/bcp \
 
96
           dist/bin/inspect \
 
97
           dist/bin/quickbook \
 
98
           usr/bin
 
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
 
104
 
 
105
        # package libboost-date-time$(PKGVERSION)-dev
 
106
        dh_installdocs -plibboost-date-time$(PKGVERSION)-dev libs/date_time/data
 
107
 
 
108
        # package libboost-doc
 
109
        rm -rf $(htmldir)
 
110
        mkdir -p $(htmldir) 
 
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 \
 
115
           usr/include/boost \
 
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
 
124
 
 
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
 
131
 
 
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
 
138
 
 
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
 
143
 
 
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 .`; \
 
148
                case $$pyver in \
 
149
                        2.*) pydistdir=usr/lib/python$$pyver/dist-packages/boost ;; \
 
150
                        3.*) pydistdir=usr/lib/python3/dist-packages/boost ;; \
 
151
                esac; \
 
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; \
 
155
        done
 
156
 
 
157
        find debian -iname '*.so*' -type f -print0 | xargs -0 chrpath --delete
 
158
        dh_install --list-missing
 
159
 
 
160
override_dh_strip:
 
161
        dh_strip --dbgsym-migration='libboost1.55-dbg, libboost1.58-dbg, libboost1.61-dbg'
 
162
 
 
163
# set the number of build jobs
 
164
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
 
165
  JOBS := -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
 
166
endif
 
167
 
 
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)
 
171
 
 
172
PKGVERSION = $(version_major)
 
173
SOVERSION = $(version_upstream)
 
174
 
 
175
 
 
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))
 
180
 
 
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)),"")
 
185
 
 
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)
 
190
 
 
191
# Input: component
 
192
# Return: package name for shared library or development
 
193
mk_pkg_lib = libboost-$(1)$(SOVERSION)
 
194
mk_pkg_dev = libboost-$(1)$(PKGVERSION)-dev
 
195
 
 
196
# Helpers to generate debhelper input filenames.
 
197
# Input: component
 
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))
 
201
 
 
202
# Helpers that update debhelper .install or .links files
 
203
# Input: component, library, suffix
 
204
# Output: none
 
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)
 
208
 
 
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)
 
214
 
 
215
# Function that updates debhelper files for a given library
 
216
# Input: component, library, suffix
 
217
# Output: none
 
218
mk_files = $(foreach fn,$(call boost_filetypes,$(2)),$(call mk_$(fn)_files,$(1),$(2),$(3)))
 
219
 
 
220
# helpers to make and install lintian override files
 
221
 
 
222
# Input: package, override
 
223
add_override = echo $(1): $(2) >> debian/$(1).lintian-overrides;
 
224
 
 
225
# Input: override
 
226
add_dev_override = $(call add_override,libboost$(PKGVERSION)-dev,$(1))
 
227
add_doc_override = $(call add_override,libboost$(PKGVERSION)-doc,$(1))
 
228
 
 
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))
 
232
 
 
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
 
236
 
 
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)) \
 
247
                        ) \
 
248
                ) \
 
249
        )
 
250
 
 
251
TOOLSET_CONFIG = 'using gcc : : $(DEB_HOST_GNU_TYPE)-g++-6 : <compileflags>"$(CPPFLAGS)" <cflags>"$(CFLAGS)" <cxxflags>"$(CXXFLAGS) -Wno-unused-local-typedefs" <linkflags>"$(LDFLAGS)" ;'
 
252
BUILD_CONTEXT = yes
 
253
BUILD_LONG_DOUBLE = yes
 
254
 
 
255
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
 
256
 
 
257
ifeq ($(DEB_BUILD_ARCH), alpha)
 
258
BUILD_CONTEXT = no
 
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
 
267
JAM_OPT += pch=off
 
268
else ifeq ($(DEB_BUILD_ARCH), hppa)
 
269
BUILD_LONG_DOUBLE = no
 
270
BUILD_CONTEXT = no
 
271
else ifeq ($(DEB_BUILD_ARCH), ia64)
 
272
BUILD_CONTEXT = no
 
273
else ifeq ($(DEB_BUILD_ARCH), m68k)
 
274
BUILD_CONTEXT = no
 
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)
 
280
BUILD_CONTEXT = no
 
281
else ifeq ($(DEB_BUILD_ARCH), mips64el)
 
282
BUILD_CONTEXT = no
 
283
else ifeq ($(DEB_BUILD_ARCH), powerpcspe)
 
284
BUILD_CONTEXT = no
 
285
else ifeq ($(DEB_BUILD_ARCH), ppc64)
 
286
BUILD_CONTEXT = yes
 
287
else ifeq ($(DEB_BUILD_ARCH), ppc64el)
 
288
BUILD_CONTEXT = yes
 
289
else ifeq ($(DEB_BUILD_ARCH), s390)
 
290
BUILD_CONTEXT = no
 
291
else ifeq ($(DEB_BUILD_ARCH), s390x)
 
292
BUILD_CONTEXT = no
 
293
else ifeq ($(DEB_BUILD_ARCH), sh4)
 
294
BUILD_LONG_DOUBLE = no
 
295
BUILD_CONTEXT = no
 
296
else ifeq ($(DEB_BUILD_ARCH), sparc)
 
297
BUILD_CONTEXT = no
 
298
else ifeq ($(DEB_BUILD_ARCH), sparc64)
 
299
BUILD_CONTEXT = no
 
300
else ifeq ($(DEB_BUILD_ARCH), x32)
 
301
BUILD_CONTEXT = no
 
302
endif
 
303
 
 
304
ifeq ($(BUILD_CONTEXT), yes)
 
305
boost_libs += context coroutine fiber
 
306
else
 
307
JAM_WITHOUT += --without-context --without-coroutine --without-coroutine2 --without-fiber
 
308
endif
 
309
 
 
310
ifeq ($(BUILD_LONG_DOUBLE), yes)
 
311
boost_lib_math += $(boost_lib_math_long_double)
 
312
else
 
313
JAM_OPT += --disable-long-double
 
314
endif
 
315
 
 
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
 
320
 
 
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
 
323
 
 
324
 
 
325
 
 
326
 
 
327
$(bjam):
 
328
        ./bootstrap.sh --with-icu=/usr --prefix=$(CURDIR)/debian/tmp/usr \
 
329
                --libdir=$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) \
 
330
          || cat bootstrap.log
 
331
 
 
332
debian/bjam.1: $(bjam)
 
333
        help2man --name 'software build tool' --no-info ./bjam > $@
 
334
 
 
335
user-config.jam:
 
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; \
 
341
        done
 
342
 
 
343
$(filtered_files): % : %.in
 
344
        sed -e 's/@PKGVERSION@/$(PKGVERSION)/g' < $< > $@
 
345
 
 
346
clean-debhelper:
 
347
        rm -rf debian/*.install
 
348
        rm -rf debian/*.links
 
349
        rm -rf debian/*.lintian-overrides
 
350
 
 
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)
 
358