]> git.proxmox.com Git - rustc.git/blame - debian/rules
Numerous minor rust-doc fixups
[rustc.git] / debian / rules
CommitLineData
be771b38
LB
1#!/usr/bin/make -f
2# -*- makefile -*-
3
b59979d9
LB
4include /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.
12unexport 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.
16DEB_PARALLEL_JOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
17DEB_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)
23UPSTREAM_RUST_VERSION := $(subst ~,-,$(DEB_VERSION_UPSTREAM))
24
25# Main (major.minor) upstream version (eg. 1.0)
26MAIN_RUST_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | egrep -o '^[^\.]+\.[^\.]+')
27
28# Upstream version suffix, if any (eg. alpha)
29UPSTREAM_RUST_SUFFIX := $(shell echo $(DEB_VERSION_UPSTREAM) | egrep -o '[^\~]+$$')
30
31# Private dir for rust .so and .rlib
3f9812c2 32RUST_PREFIX := usr/lib/$(DEB_HOST_MULTIARCH)/rust/$(MAIN_RUST_VERSION)
b59979d9 33
d4357a26
LB
34# Release type (one of beta, stable or nightly)
35RELEASE_CHANNEL := beta
36
8354de7a 37DEB_DESTDIR := $(CURDIR)/debian/tmp
02b74708
JJ
38RUST_TMP_PREFIX := $(DEB_DESTDIR)/$(RUST_PREFIX)
39
be771b38
LB
40# These are the normal build flags
41COMMON_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
51SELF_BOOTSTRAP = \
52 --enable-local-rust \
53 --local-rust-root=/usr
54
55# TODO
56# These flags will enable the system-wide LLVM
57SYSTEM_LLVM = --llvm-root=/usr
58
1c8ac2b0
SL
59
60ifeq (,$(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
64endif
65
66BUILD_DOCS = 1
67ifneq (,$(findstring nodocs,$(DEB_BUILD_PROFILES)))
68 DEB_CONFIGURE_EXTRA_FLAGS += --disable-docs
69 BUILD_DOCS = 0
70endif
71
72ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
73 DEB_CONFIGURE_EXTRA_FLAGS += --disable-optimize --disable-optimize-cxx --disable-optimize-llvm
74endif
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 81override_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
91override_dh_auto_build-arch:
92 dh_auto_build -- all VERBOSE=1
93
94override_dh_auto_build-indep:
95 $(if $(BUILD_DOCS),dh_auto_build -- docs)
becfe001 96
0f729e31 97LD_TMP1 := $(RUST_TMP_PREFIX)/lib
7bdffa5b
SL
98# TODO improve this stuff to make it dynamic
99LD_TMP_i386 := $(LD_TMP1)/rustlib/i686-unknown-linux-gnu/lib
100LD_TMP_AMD64 := $(LD_TMP1)/rustlib/x86_64-unknown-linux-gnu/lib
101RUST_TMP_LD_PATH := $(LD_TMP1):$(LD_TMP_i386):$(LD_TMP_AMD64)
0f729e31 102
c92744c0 103override_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
107override_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
116override_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
126override_dh_installchangelogs:
127 dh_installchangelogs RELEASES.md
128
129override_dh_installdocs:
130 dh_installdocs -X.tex -X.aux -X.log -X.out -X.toc
131
1c8ac2b0
SL
132override_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