]>
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 LB |
47 | |
48 | # TODO | |
49 | # These flags will be used to avoid external | |
50 | # stage0 bootstrap binaries | |
51 | SELF_BOOTSTRAP = \ | |
52 | --enable-local-rust \ | |
53 | --local-rust-root=/usr | |
54 | ||
55 | # TODO | |
56 | # These flags will enable the system-wide LLVM | |
57 | SYSTEM_LLVM = --llvm-root=/usr | |
58 | ||
1c8ac2b0 SL |
59 | |
60 | ifeq (,$(findstring dlstage0,$(DEB_BUILD_PROFILES))) | |
61 | # Without these options, a pre-built stage0 will be downloaded from | |
62 | # rust-lang.org at build time. | |
63 | DEB_CONFIGURE_EXTRA_FLAGS += --enable-local-rust --local-rust-root=/usr | |
64 | endif | |
65 | ||
66 | BUILD_DOCS = 1 | |
67 | ifneq (,$(findstring nodocs,$(DEB_BUILD_PROFILES))) | |
68 | DEB_CONFIGURE_EXTRA_FLAGS += --disable-docs | |
69 | BUILD_DOCS = 0 | |
70 | endif | |
71 | ||
72 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) | |
73 | DEB_CONFIGURE_EXTRA_FLAGS += --disable-optimize --disable-optimize-cxx --disable-optimize-llvm | |
74 | endif | |
75 | ||
76 | ||
be771b38 | 77 | %: |
2679d355 | 78 | dh $@ --parallel |
be771b38 | 79 | |
7a06551f | 80 | # Note: SHELL is not set by dash, but the configure script wants to use it |
be771b38 | 81 | override_dh_auto_configure: |
7a06551f | 82 | SHELL=/bin/sh \ |
be771b38 LB |
83 | ./configure \ |
84 | $(COMMON_FLAGS) \ | |
1c8ac2b0 | 85 | $(DEB_CONFIGURE_EXTRA_FLAGS) \ |
be771b38 LB |
86 | # TODO |
87 | # $(SELF_BOOTSTRAP) | |
88 | # $(SYSTEM_LLVM) | |
ef102071 | 89 | |
1c8ac2b0 SL |
90 | |
91 | override_dh_auto_build-arch: | |
92 | dh_auto_build -- all VERBOSE=1 | |
93 | ||
94 | override_dh_auto_build-indep: | |
95 | $(if $(BUILD_DOCS),dh_auto_build -- docs) | |
becfe001 | 96 | |
0f729e31 | 97 | LD_TMP1 := $(RUST_TMP_PREFIX)/lib |
7bdffa5b SL |
98 | # TODO improve this stuff to make it dynamic |
99 | LD_TMP_i386 := $(LD_TMP1)/rustlib/i686-unknown-linux-gnu/lib | |
100 | LD_TMP_AMD64 := $(LD_TMP1)/rustlib/x86_64-unknown-linux-gnu/lib | |
101 | RUST_TMP_LD_PATH := $(LD_TMP1):$(LD_TMP_i386):$(LD_TMP_AMD64) | |
0f729e31 | 102 | |
c92744c0 | 103 | override_dh_shlibdeps: |
0f729e31 JJ |
104 | LD_LIBRARY_PATH=$(RUST_TMP_LD_PATH):$(LD_LIBRARY_PATH) \ |
105 | dh_shlibdeps -l$(RUST_TMP_LD_PATH) | |
c92744c0 | 106 | |
23d2674b JJ |
107 | override_dh_auto_install: |
108 | dh_auto_install | |
3f9812c2 LB |
109 | dh_link $(RUST_PREFIX)/bin/rustc usr/bin/rustc-$(MAIN_RUST_VERSION) |
110 | dh_link usr/bin/rustc-$(MAIN_RUST_VERSION) usr/bin/rustc | |
111 | dh_link $(RUST_PREFIX)/bin/rustdoc usr/bin/rustdoc-$(MAIN_RUST_VERSION) | |
112 | dh_link usr/bin/rustdoc-$(MAIN_RUST_VERSION) usr/bin/rustdoc | |
113 | dh_link $(RUST_PREFIX)/bin/rust-gdb usr/bin/rust-gdb-$(MAIN_RUST_VERSION) | |
114 | dh_link usr/bin/rust-gdb-$(MAIN_RUST_VERSION) usr/bin/rust-gdb | |
6fce0a99 SL |
115 | |
116 | override_dh_install: | |
117 | # Brute force to remove privacy-breach-logo lintian warning. | |
118 | # We could have updated the upstream sources but it would complexify | |
119 | # the rebase | |
bc0aa84e | 120 | if test "$(BUILD_DOCS)" = "1"; then \ |
1c8ac2b0 | 121 | sed -i '/rel="shortcut icon" href="http:\/\/www.rust-lang.org\/favicon.ico"/d' `find $(DEB_DESTDIR) -iname '*.html'`; \ |
bc0aa84e | 122 | rm -f `find $(DEB_DESTDIR) -iname '*.html' -empty` $(DEB_DESTDIR)/usr/share/doc/rust-doc/html/.lock; \ |
1c8ac2b0 | 123 | fi |
6fce0a99 | 124 | dh_install |
1c8ac2b0 | 125 | |
bc0aa84e AL |
126 | override_dh_installchangelogs: |
127 | dh_installchangelogs RELEASES.md | |
128 | ||
129 | override_dh_installdocs: | |
130 | dh_installdocs -X.tex -X.aux -X.log -X.out -X.toc | |
131 | ||
1c8ac2b0 SL |
132 | override_dh_auto_test: |
133 | # NB: not parallel - there is some race that leads to failures like: | |
134 | # 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 | |
135 | $(MAKE) check-notidy |