]> git.proxmox.com Git - cargo.git/blob - debian/rules
Fix the build
[cargo.git] / debian / rules
1 #!/usr/bin/make -f
2
3 include /usr/share/dpkg/pkg-info.mk
4 include /usr/share/dpkg/architecture.mk
5 include /usr/share/dpkg/buildflags.mk
6 RUSTFLAGS += $(foreach flag,$(LDFLAGS),-C link-arg=$(flag))
7 export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS RUSTFLAGS
8
9 rust_cpu = $(subst i586,i686,$(1))
10 DEB_HOST_RUST_TYPE := $(call rust_cpu,$(DEB_HOST_GNU_CPU))-unknown-$(DEB_HOST_GNU_SYSTEM)
11 DEB_TARGET_RUST_TYPE := $(call rust_cpu,$(DEB_TARGET_GNU_CPU))-unknown-$(DEB_TARGET_GNU_SYSTEM)
12
13 # Cargo looks for config in and writes cache to $CARGO_HOME/
14 export CARGO_HOME = $(CURDIR)/debian/cargohome
15 # Ask cargo to be verbose when building
16 export VERBOSE = 1
17
18 DEB_DESTDIR := $(CURDIR)/debian/tmp
19 VENDORDIR := $(CURDIR)/vendor
20 INDEXDIR := $(CURDIR)/vendor/index
21 DEPSDIR := $(CURDIR)/deps
22
23 %:
24 dh $@ --with bash-completion
25
26 override_dh_auto_configure:
27 cp -a $(CURDIR)/Cargo.lock $(CURDIR)/.Cargo.lock.orig
28
29 override_dh_auto_build:
30 ifneq ($(filter stage0,$(DEB_BUILD_PROFILES)),)
31 # Bootstrap cargo stage0
32 ./debian/bootstrap.py \
33 --no-clean \
34 --no-clone \
35 --no-git \
36 --no-download \
37 --crate-index $(INDEXDIR)/ \
38 --cargo-root $(CURDIR)/ \
39 --target-dir $(DEPSDIR)/ \
40 --host=$(DEB_HOST_RUST_TYPE) \
41 --target=$(DEB_TARGET_RUST_TYPE)
42 # Workaround for https://github.com/rust-lang/cargo/issues/1423
43 ln -s `find $(DEPSDIR) -name 'cargo-*' -type f -executable` $(CURDIR)/cargo-stage0
44 else
45 ln -s `which cargo` $(CURDIR)/cargo-stage0
46 endif
47 # Configure to build cargo using the just-built stage0
48 ./configure \
49 --prefix=/usr \
50 --disable-debug \
51 --enable-optimize \
52 --local-rust-root=/usr \
53 --cargo=$(CURDIR)/cargo-stage0
54 # Build final cargo binary and docs
55 $(MAKE)
56 ifeq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
57 $(MAKE) doc
58 cd target/doc/ && rm -f jquery.js && ln -s /usr/share/javascript/jquery/jquery.js
59 endif
60
61 override_dh_auto_clean:
62 -mv $(CURDIR)/.Cargo.lock.orig $(CURDIR)/Cargo.lock
63 dh_auto_clean
64 -$(RM) -r $(CURDIR)/deps/*.rlib \
65 $(CURDIR)/deps/build_script* \
66 $(CURDIR)/deps/cargo* \
67 $(CURDIR)/deps/*.o \
68 $(CURDIR)/target/ \
69 $(CURDIR)/.cargo \
70 $(CURDIR)/config.mk \
71 $(CURDIR)/config.stamp \
72 $(CURDIR)/Makefile \
73 $(CURDIR)/cargo-stage0 \
74 $(VENDORDIR)
75
76 override_dh_auto_install:
77 # We pick stuff directly from target/
78
79 override_dh_auto_test:
80 # we don't run tests at the moment due to too many deps
81