]>
Commit | Line | Data |
---|---|---|
be771b38 LB |
1 | #!/usr/bin/make -f |
2 | # -*- makefile -*- | |
3 | ||
b59979d9 | 4 | include /usr/share/dpkg/pkg-info.mk |
d75d48d6 | 5 | include /usr/share/dpkg/architecture.mk |
7d40d3e1 AL |
6 | include /usr/share/dpkg/buildflags.mk |
7 | RUSTFLAGS = -C link-args="$(LDFLAGS)" | |
8 | export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS RUSTFLAGS | |
b59979d9 | 9 | |
525ff0f9 AL |
10 | # Defines DEB_*_RUST_TYPE triples |
11 | include debian/architecture.mk | |
12 | ||
be771b38 LB |
13 | # Uncomment this to turn on verbose mode. |
14 | #export DH_VERBOSE=1 | |
15 | ||
03b69fec JJ |
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. | |
19 | unexport SUDO_USER | |
20 | ||
1c8ac2b0 SL |
21 | # Debhelper clears MAKEFLAGS, so we have to do this again for any |
22 | # target where we call $(MAKE) directly. Boo. | |
23 | DEB_PARALLEL_JOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) | |
525ff0f9 | 24 | PMAKE = $(MAKE) $(if $(DEB_PARALLEL_JOBS),-j$(DEB_PARALLEL_JOBS)) |
b59979d9 | 25 | |
d4357a26 | 26 | # Release type (one of beta, stable or nightly) |
0f9154de | 27 | RELEASE_CHANNEL := stable |
d4357a26 | 28 | |
8354de7a | 29 | DEB_DESTDIR := $(CURDIR)/debian/tmp |
525ff0f9 | 30 | |
f20ed4ac | 31 | RUST_HASH := $(shell printf '%s' $(DEB_VERSION_UPSTREAM) | sed -e 's/\+dfsg[0-9]*$$//' | md5sum | head -c 8) |
525ff0f9 | 32 | LIBSTD_PKG := libstd-rust-$(RUST_HASH) |
02b74708 | 33 | |
be771b38 | 34 | # These are the normal build flags |
525ff0f9 AL |
35 | DEB_CONFIGURE_FLAGS = \ |
36 | --host=$(DEB_HOST_RUST_TYPE) \ | |
37 | --target=$(DEB_TARGET_RUST_TYPE) \ | |
be771b38 | 38 | --disable-manage-submodules \ |
d4357a26 | 39 | --release-channel=$(RELEASE_CHANNEL) \ |
525ff0f9 | 40 | --prefix=/usr |
be771b38 | 41 | |
525ff0f9 AL |
42 | # Use system LLVM (comment out to use vendored LLVM) |
43 | DEB_CONFIGURE_FLAGS += --llvm-root=/usr/lib/llvm-3.6 | |
1c8ac2b0 SL |
44 | |
45 | ifeq (,$(findstring dlstage0,$(DEB_BUILD_PROFILES))) | |
46 | # Without these options, a pre-built stage0 will be downloaded from | |
525ff0f9 AL |
47 | # rust-lang.org at build time (or looked for in dl/). |
48 | #DEB_CONFIGURE_FLAGS += --enable-local-rust --local-rust-root=/usr | |
1c8ac2b0 SL |
49 | endif |
50 | ||
51 | BUILD_DOCS = 1 | |
120b4d47 | 52 | ifneq (,$(findstring nodoc,$(DEB_BUILD_PROFILES))) |
525ff0f9 | 53 | DEB_CONFIGURE_FLAGS += --disable-docs |
2e97839d | 54 | BUILD_DOCS = |
1c8ac2b0 SL |
55 | endif |
56 | ||
57 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) | |
525ff0f9 | 58 | DEB_CONFIGURE_FLAGS += --disable-optimize --disable-optimize-cxx --disable-optimize-llvm |
1c8ac2b0 SL |
59 | endif |
60 | ||
61 | ||
be771b38 | 62 | %: |
2679d355 | 63 | dh $@ --parallel |
be771b38 | 64 | |
7a06551f | 65 | # Note: SHELL is not set by dash, but the configure script wants to use it |
be771b38 | 66 | override_dh_auto_configure: |
7a06551f | 67 | SHELL=/bin/sh \ |
525ff0f9 | 68 | ./configure $(DEB_CONFIGURE_FLAGS) |
ef102071 | 69 | |
1c8ac2b0 | 70 | |
11c430be | 71 | override_dh_auto_clean: |
525ff0f9 AL |
72 | set -e; \ |
73 | if [ -f Makefile ]; then \ | |
74 | $(PMAKE) clean-all; \ | |
75 | $(RM) Makefile config.stamp; \ | |
76 | fi | |
11c430be | 77 | |
1c8ac2b0 SL |
78 | override_dh_auto_build-arch: |
79 | dh_auto_build -- all VERBOSE=1 | |
80 | ||
81 | override_dh_auto_build-indep: | |
82 | $(if $(BUILD_DOCS),dh_auto_build -- docs) | |
becfe001 | 83 | |
23d2674b | 84 | override_dh_auto_install: |
39a0abff | 85 | dh_auto_install --destdir=$(DEB_DESTDIR) |
525ff0f9 AL |
86 | |
87 | mkdir -p $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/ | |
88 | mv $(DEB_DESTDIR)/usr/lib/lib*.so $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/ | |
6fce0a99 | 89 | |
1261b4b3 | 90 | # Replace duplicated compile-time/run-time dylibs with symlinks |
525ff0f9 AL |
91 | @set -e; \ |
92 | for f in $(DEB_DESTDIR)/usr/lib/rustlib/$(DEB_HOST_RUST_TYPE)/lib/lib*.so; do \ | |
93 | name=$${f##*/}; \ | |
94 | if [ -f "$(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/$$name" ]; then \ | |
95 | echo "ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f"; \ | |
96 | ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f; \ | |
97 | fi; \ | |
1261b4b3 AL |
98 | done |
99 | ||
525ff0f9 | 100 | ifneq (,$(BUILD_DOCS)) |
6fce0a99 SL |
101 | # Brute force to remove privacy-breach-logo lintian warning. |
102 | # We could have updated the upstream sources but it would complexify | |
103 | # the rebase | |
b556761e AL |
104 | @set -e; \ |
105 | find $(DEB_DESTDIR)/usr/share/doc/rust/html -iname '*.html' | \ | |
1add0b94 | 106 | while read file; do \ |
b556761e AL |
107 | topdir=$$(echo "$$file" | sed 's,^$(DEB_DESTDIR)/usr/share/doc/rust/html/,,; s,/[^/]*$$,/,; s,^[^/]*$$,,; s,[^/]\+/,../,g'); \ |
108 | sed -i "s,http://www.rust-lang.org/\(favicon.ico\|logos/rust-logo-32x32-blk.png\),$${topdir}rust-logo-32x32-blk.png," "$$file"; \ | |
1add0b94 | 109 | done |
525ff0f9 | 110 | |
36a05422 | 111 | find $(DEB_DESTDIR) \( -iname '*.html' -empty -o -name .lock -o -name '*.inc' \) -delete |
525ff0f9 AL |
112 | |
113 | find $(DEB_DESTDIR)/usr/share/doc -name jquery.js \ | |
114 | -exec ln -sf /usr/share/javascript/jquery/jquery.js '{}' \; | |
2e97839d | 115 | endif |
525ff0f9 AL |
116 | |
117 | override_dh_install: | |
6fce0a99 | 118 | dh_install |
525ff0f9 AL |
119 | dh_install -p$(LIBSTD_PKG) usr/lib/$(DEB_HOST_MULTIARCH)/ |
120 | ||
121 | chmod -x \ | |
122 | debian/rust-gdb/usr/share/rust-gdb/*.py \ | |
123 | debian/rust-lldb/usr/share/rust-lldb/*.py | |
1c8ac2b0 | 124 | |
bc0aa84e AL |
125 | override_dh_installchangelogs: |
126 | dh_installchangelogs RELEASES.md | |
127 | ||
128 | override_dh_installdocs: | |
129 | dh_installdocs -X.tex -X.aux -X.log -X.out -X.toc | |
130 | ||
1c8ac2b0 | 131 | override_dh_auto_test: |
0be7358c | 132 | ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS))) |
525ff0f9 | 133 | $(PMAKE) check-notidy |
0be7358c | 134 | endif |
525ff0f9 AL |
135 | |
136 | override_dh_makeshlibs: | |
137 | dh_makeshlibs -V | |
138 | ||
139 | # dh_makeshlibs doesn't support our "libfoo-version.so" naming | |
140 | # structure, so we have to do this ourselves. | |
141 | install -o 0 -g 0 -d debian/$(LIBSTD_PKG)/DEBIAN | |
142 | ls debian/$(LIBSTD_PKG)/usr/lib/$(DEB_HOST_MULTIARCH)/lib*.so | \ | |
143 | sed -n 's,^.*/\(lib.*\)-\(.\+\)\.so$$,\1 \2,p' | \ | |
144 | while read name version; do \ | |
145 | echo "$$name $$version $(LIBSTD_PKG) (>= $(DEB_VERSION_UPSTREAM))"; \ | |
146 | done > debian/$(LIBSTD_PKG)/DEBIAN/shlibs | |
147 | chmod 644 debian/$(LIBSTD_PKG)/DEBIAN/shlibs | |
148 | chown 0:0 debian/$(LIBSTD_PKG)/DEBIAN/shlibs | |
149 | ||
150 | override_dh_shlibdeps: | |
151 | dh_shlibdeps -- -x$(LIBSTD_PKG) |