4 include /usr
/share
/dpkg
/pkg-info.mk
5 include /usr
/share
/dpkg
/architecture.mk
6 include /usr
/share
/dpkg
/buildflags.mk
7 RUSTFLAGS
= -C link-args
="$(LDFLAGS)"
8 export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS RUSTFLAGS
10 # Defines DEB_*_RUST_TYPE triples
11 include debian
/architecture.mk
13 # Uncomment this to turn on verbose mode.
16 # When using sudo pbuilder, this will cause mk/install.mk to run sudo,
17 # but we don't need sudo as a build-dep for the package if we unexport
18 # the SUDO_USER variable.
21 # src/rt/miniz.c (incorrectly) triggers -Wmisleading-indentation with
22 # gcc-6. See bug #811573.
23 CFLAGS
+= -Wno-misleading-indentation
25 # Debhelper clears MAKEFLAGS, so we have to do this again for any
26 # target where we call $(MAKE) directly. Boo.
27 DEB_PARALLEL_JOBS
= $(patsubst parallel
=%,%,$(filter parallel
=%,$(DEB_BUILD_OPTIONS
)))
28 PMAKE
= $(MAKE
) $(if
$(DEB_PARALLEL_JOBS
),-j
$(DEB_PARALLEL_JOBS
))
30 # Release type (one of beta, stable or nightly)
31 RELEASE_CHANNEL
:= stable
33 DEB_DESTDIR
:= $(CURDIR
)/debian
/tmp
35 RUST_VERSION
:= $(shell dpkg-parsechangelog
--show-field Version | sed
-re
's/([^.]+)\.([^.]+)\..*/\1.\2/')
36 LIBSTD_PKG
:= libstd-rust-
$(RUST_VERSION
)
38 # These are the normal build flags
39 DEB_CONFIGURE_FLAGS
= \
40 --host
=$(DEB_HOST_RUST_TYPE
) \
41 --target
=$(DEB_TARGET_RUST_TYPE
) \
42 --disable-manage-submodules \
43 --release-channel
=$(RELEASE_CHANNEL
) \
46 # Use system LLVM (comment out to use vendored LLVM)
47 DEB_CONFIGURE_FLAGS
+= --llvm-root
=/usr
/lib
/llvm-3.7
49 ifeq (,$(findstring dlstage0
,$(DEB_BUILD_PROFILES
)))
50 # Without these options, a pre-built stage0 will be downloaded from
51 # rust-lang.org at build time (or looked for in dl/).
52 #DEB_CONFIGURE_FLAGS += --enable-local-rust --local-rust-root=/usr
56 ifneq (,$(findstring nodoc
,$(DEB_BUILD_PROFILES
)))
57 DEB_CONFIGURE_FLAGS
+= --disable-docs
61 ifneq (,$(findstring noopt
,$(DEB_BUILD_OPTIONS
)))
62 DEB_CONFIGURE_FLAGS
+= --disable-optimize
--disable-optimize-cxx
--disable-optimize-llvm
69 # Note: SHELL is not set by dash, but the configure script wants to use it
70 override_dh_auto_configure
:
72 .
/configure
$(DEB_CONFIGURE_FLAGS
)
73 # test "$$($(MAKE) --no-print-directory print-CFG_FILENAME_EXTRA | tail -n1 | cut -d= -f2)" = "$$(echo $(RUST_VERSION))"
76 override_dh_auto_clean
:
78 if
[ -f Makefile
]; then \
80 $(RM
) Makefile config.stamp
; \
82 $(RM
) src
/etc
/snapshot.pyc
84 override_dh_auto_build-arch
:
85 dh_auto_build
-- all VERBOSE
=1
87 override_dh_auto_build-indep
:
88 $(if
$(BUILD_DOCS
),dh_auto_build
-- docs
)
90 override_dh_auto_install
:
91 dh_auto_install
--destdir
=$(DEB_DESTDIR
)
93 mkdir
-p
$(DEB_DESTDIR
)/usr
/lib
/$(DEB_HOST_MULTIARCH
)/
94 mv
$(DEB_DESTDIR
)/usr
/lib
/lib
*.so
$(DEB_DESTDIR
)/usr
/lib
/$(DEB_HOST_MULTIARCH
)/
96 # Replace duplicated compile-time/run-time dylibs with symlinks
98 for f in
$(DEB_DESTDIR
)/usr
/lib
/rustlib
/$(DEB_HOST_RUST_TYPE
)/lib
/lib
*.so
; do \
100 if
[ -f
"$(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/$$name" ]; then \
101 echo
"ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f"; \
102 ln
-sf ..
/..
/..
/$(DEB_HOST_MULTIARCH
)/$$name $$f; \
106 ifneq (,$(BUILD_DOCS
))
107 # Brute force to remove privacy-breach-logo lintian warning.
108 # We could have updated the upstream sources but it would complexify
111 find
$(DEB_DESTDIR
)/usr
/share
/doc
/rust
/html
-iname
'*.html' | \
112 while read file
; do \
113 topdir
=$$(echo
"$$file" | sed
's,^$(DEB_DESTDIR)/usr/share/doc/rust/html/,,; s,/[^/]*$$,/,; s,^[^/]*$$,,; s,[^/]\+/,../,g'); \
114 sed
-i
-e
"s,https://doc.rust-lang.org/\(favicon.ico\|logos/rust-logo-32x32-blk.png\),$${topdir}rust-logo-32x32-blk.png," \
115 -e
"s,https://www.rust-lang.org/\(favicon.ico\|logos/rust-logo-32x32-blk.png\),$${topdir}rust-logo-32x32-blk.png," "$$file"; \
118 find
$(DEB_DESTDIR
) \
( -iname
'*.html' -empty
-o
-name .lock
-o
-name
'*.inc' \
) -delete
121 override_dh_install-arch
:
123 dh_install
-p
$(LIBSTD_PKG
) usr
/lib
/$(DEB_HOST_MULTIARCH
)/
126 debian
/rust-gdb
/usr
/share
/rust-gdb
/*.py \
127 debian
/rust-lldb
/usr
/share
/rust-lldb
/*.py
129 override_dh_installchangelogs
:
130 dh_installchangelogs RELEASES.md
132 override_dh_installdocs
:
133 dh_installdocs
-X.
tex -X.aux
-X.log
-X.out
-X.toc
135 override_dh_compress
:
138 override_dh_auto_test
:
139 ifeq (, $(filter nocheck
,$(DEB_BUILD_OPTIONS
)))
140 $(PMAKE
) check-notidy
143 override_dh_makeshlibs
:
146 # dh_makeshlibs doesn't support our "libfoo-version.so" naming
147 # structure, so we have to do this ourselves.
148 install -o
0 -g
0 -d debian
/$(LIBSTD_PKG
)/DEBIAN
149 ls debian
/$(LIBSTD_PKG
)/usr
/lib
/$(DEB_HOST_MULTIARCH
)/lib
*.so | \
150 sed
-n
's,^.*/\(lib.*\)-\(.\+\)\.so$$,\1 \2,p' | \
151 while read name version
; do \
152 echo
"$$name $$version $(LIBSTD_PKG) (>= $(DEB_VERSION_UPSTREAM))"; \
153 done
> debian
/$(LIBSTD_PKG
)/DEBIAN
/shlibs
154 chmod
644 debian
/$(LIBSTD_PKG
)/DEBIAN
/shlibs
155 chown
0:0 debian
/$(LIBSTD_PKG
)/DEBIAN
/shlibs
157 override_dh_shlibdeps
:
158 dh_shlibdeps
-- -x
$(LIBSTD_PKG
)