]>
Commit | Line | Data |
---|---|---|
be771b38 LB |
1 | #!/usr/bin/make -f |
2 | # -*- makefile -*- | |
3 | ||
b59979d9 LB |
4 | include /usr/share/dpkg/pkg-info.mk |
5 | ||
be771b38 LB |
6 | # Uncomment this to turn on verbose mode. |
7 | #export DH_VERBOSE=1 | |
8 | ||
03b69fec JJ |
9 | # When using sudo pbuilder, this will cause mk/install.mk to run sudo, |
10 | # but we don't need sudo as a build-dep for the package if we unexport | |
11 | # the SUDO_USER variable. | |
12 | unexport SUDO_USER | |
13 | ||
1c8ac2b0 SL |
14 | # Debhelper clears MAKEFLAGS, so we have to do this again for any |
15 | # target where we call $(MAKE) directly. Boo. | |
16 | DEB_PARALLEL_JOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) | |
17 | DEB_MAKE_PARALLEL = $(if $(DEB_PARALLEL_JOBS),-j$(DEB_PARALLEL_JOBS)) | |
18 | ||
2d084d4c | 19 | |
b59979d9 LB |
20 | # $DEB_VERSION_UPSTREAM is the full upstream version (eg. 1.0.0~alpha) |
21 | ||
22 | # This is original/unmangled upstream version (eg. 1.0.0-alpha) | |
23 | UPSTREAM_RUST_VERSION := $(subst ~,-,$(DEB_VERSION_UPSTREAM)) | |
24 | ||
25 | # Main (major.minor) upstream version (eg. 1.0) | |
26 | MAIN_RUST_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | egrep -o '^[^\.]+\.[^\.]+') | |
27 | ||
28 | # Upstream version suffix, if any (eg. alpha) | |
29 | UPSTREAM_RUST_SUFFIX := $(shell echo $(DEB_VERSION_UPSTREAM) | egrep -o '[^\~]+$$') | |
30 | ||
31 | # Private dir for rust .so and .rlib | |
3f9812c2 | 32 | RUST_PREFIX := usr/lib/$(DEB_HOST_MULTIARCH)/rust/$(MAIN_RUST_VERSION) |
b59979d9 | 33 | |
d4357a26 LB |
34 | # Release type (one of beta, stable or nightly) |
35 | RELEASE_CHANNEL := beta | |
36 | ||
8354de7a | 37 | DEB_DESTDIR := $(CURDIR)/debian/tmp |
02b74708 JJ |
38 | RUST_TMP_PREFIX := $(DEB_DESTDIR)/$(RUST_PREFIX) |
39 | ||
be771b38 LB |
40 | # These are the normal build flags |
41 | COMMON_FLAGS = \ | |
42 | --disable-manage-submodules \ | |
d4357a26 | 43 | --release-channel=$(RELEASE_CHANNEL) \ |
c92744c0 | 44 | --mandir=/usr/share/man \ |
ac9de7b6 | 45 | --enable-rpath \ |
02b74708 | 46 | --prefix=/$(RUST_PREFIX) |
be771b38 | 47 | |
0577fc84 | 48 | SYSTEM_LLVM = --llvm-root=/usr/lib/llvm-3.6 |
be771b38 | 49 | |
1c8ac2b0 SL |
50 | |
51 | ifeq (,$(findstring dlstage0,$(DEB_BUILD_PROFILES))) | |
52 | # Without these options, a pre-built stage0 will be downloaded from | |
53 | # rust-lang.org at build time. | |
54 | DEB_CONFIGURE_EXTRA_FLAGS += --enable-local-rust --local-rust-root=/usr | |
55 | endif | |
56 | ||
57 | BUILD_DOCS = 1 | |
58 | ifneq (,$(findstring nodocs,$(DEB_BUILD_PROFILES))) | |
59 | DEB_CONFIGURE_EXTRA_FLAGS += --disable-docs | |
60 | BUILD_DOCS = 0 | |
61 | endif | |
62 | ||
63 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) | |
64 | DEB_CONFIGURE_EXTRA_FLAGS += --disable-optimize --disable-optimize-cxx --disable-optimize-llvm | |
65 | endif | |
66 | ||
67 | ||
be771b38 | 68 | %: |
2679d355 | 69 | dh $@ --parallel |
be771b38 | 70 | |
7a06551f | 71 | # Note: SHELL is not set by dash, but the configure script wants to use it |
be771b38 | 72 | override_dh_auto_configure: |
7a06551f | 73 | SHELL=/bin/sh \ |
be771b38 LB |
74 | ./configure \ |
75 | $(COMMON_FLAGS) \ | |
0577fc84 AL |
76 | $(DEB_CONFIGURE_EXTRA_FLAGS) \ |
77 | $(SYSTEM_LLVM) | |
ef102071 | 78 | |
1c8ac2b0 | 79 | |
11c430be AL |
80 | override_dh_auto_clean: |
81 | -$(MAKE) $(DEB_MAKE_PARALLEL) clean-all | |
82 | -$(RM) Makefile | |
83 | ||
1c8ac2b0 SL |
84 | override_dh_auto_build-arch: |
85 | dh_auto_build -- all VERBOSE=1 | |
86 | ||
87 | override_dh_auto_build-indep: | |
88 | $(if $(BUILD_DOCS),dh_auto_build -- docs) | |
becfe001 | 89 | |
0f729e31 | 90 | LD_TMP1 := $(RUST_TMP_PREFIX)/lib |
7bdffa5b SL |
91 | # TODO improve this stuff to make it dynamic |
92 | LD_TMP_i386 := $(LD_TMP1)/rustlib/i686-unknown-linux-gnu/lib | |
93 | LD_TMP_AMD64 := $(LD_TMP1)/rustlib/x86_64-unknown-linux-gnu/lib | |
94 | RUST_TMP_LD_PATH := $(LD_TMP1):$(LD_TMP_i386):$(LD_TMP_AMD64) | |
0f729e31 | 95 | |
c92744c0 | 96 | override_dh_shlibdeps: |
0f729e31 JJ |
97 | LD_LIBRARY_PATH=$(RUST_TMP_LD_PATH):$(LD_LIBRARY_PATH) \ |
98 | dh_shlibdeps -l$(RUST_TMP_LD_PATH) | |
c92744c0 | 99 | |
23d2674b JJ |
100 | override_dh_auto_install: |
101 | dh_auto_install | |
3f9812c2 LB |
102 | dh_link $(RUST_PREFIX)/bin/rustc usr/bin/rustc-$(MAIN_RUST_VERSION) |
103 | dh_link usr/bin/rustc-$(MAIN_RUST_VERSION) usr/bin/rustc | |
104 | dh_link $(RUST_PREFIX)/bin/rustdoc usr/bin/rustdoc-$(MAIN_RUST_VERSION) | |
105 | dh_link usr/bin/rustdoc-$(MAIN_RUST_VERSION) usr/bin/rustdoc | |
106 | dh_link $(RUST_PREFIX)/bin/rust-gdb usr/bin/rust-gdb-$(MAIN_RUST_VERSION) | |
107 | dh_link usr/bin/rust-gdb-$(MAIN_RUST_VERSION) usr/bin/rust-gdb | |
6fce0a99 SL |
108 | |
109 | override_dh_install: | |
110 | # Brute force to remove privacy-breach-logo lintian warning. | |
111 | # We could have updated the upstream sources but it would complexify | |
112 | # the rebase | |
bc0aa84e | 113 | if test "$(BUILD_DOCS)" = "1"; then \ |
1c8ac2b0 | 114 | sed -i '/rel="shortcut icon" href="http:\/\/www.rust-lang.org\/favicon.ico"/d' `find $(DEB_DESTDIR) -iname '*.html'`; \ |
bc0aa84e | 115 | rm -f `find $(DEB_DESTDIR) -iname '*.html' -empty` $(DEB_DESTDIR)/usr/share/doc/rust-doc/html/.lock; \ |
1c8ac2b0 | 116 | fi |
6fce0a99 | 117 | dh_install |
1c8ac2b0 | 118 | |
bc0aa84e AL |
119 | override_dh_installchangelogs: |
120 | dh_installchangelogs RELEASES.md | |
121 | ||
122 | override_dh_installdocs: | |
123 | dh_installdocs -X.tex -X.aux -X.log -X.out -X.toc | |
124 | ||
1c8ac2b0 SL |
125 | override_dh_auto_test: |
126 | # NB: not parallel - there is some race that leads to failures like: | |
127 | # note: cc: error: x86_64-unknown-linux-gnu/test/run-pass/generic-default-type-params-cross-crate.stage2-x86_64-unknown-linux-gnulibaux/default_type_params_xc.o: No such file or directory | |
0be7358c | 128 | ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS))) |
1c8ac2b0 | 129 | $(MAKE) check-notidy |
0be7358c | 130 | endif |