3 include /usr
/share
/dpkg
/pkg-info.mk
4 include /usr
/share
/dpkg
/architecture.mk
5 include /usr
/share
/dpkg
/buildflags.mk
6 include /usr
/share
/rustc
/architecture.mk
8 # For cross-compiling; perhaps we should add this to dh-cargo or debcargo
9 export PKG_CONFIG
= $(DEB_HOST_GNU_TYPE
)-pkg-config
10 export PKG_CONFIG_ALLOW_CROSS
= 1
11 RUSTFLAGS
+= -C linker
=$(DEB_HOST_GNU_TYPE
)-gcc
13 # Pass on dpkg-buildflags stuff
14 RUSTFLAGS
+= $(foreach flag
,$(LDFLAGS
),-C link-arg
=$(flag
))
15 export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS RUSTFLAGS
17 CARGO
= RUST_BACKTRACE
=1 cargo
18 CARGOFLAGS
= --release
--target
=$(DEB_HOST_RUST_TYPE
)
19 # Cargo looks for config in and writes cache to $CARGO_HOME/
20 export CARGO_HOME
= $(CURDIR
)/debian
/cargohome
21 # Ask cargo to be verbose when building
25 dh
$@
--with bash-completion
27 override_dh_auto_configure
:
28 cp
-a
$(CURDIR
)/Cargo.lock
$(CURDIR
)/.Cargo.lock.orig
29 ifneq ($(filter pkg.cargo.mkstage0
,$(DEB_BUILD_PROFILES
)),)
30 # NOTE: this very likely doesn't work any more, see bootstrap.py for details
31 # Instead, you can try to bootstrap by setting PATH to a binary cargo
32 # downloaded from upstream; or by cross-compiling, see "build-cross" below
33 # Preserved in case someone wants to resurrect it later:
34 # Bootstrap cargo stage0
35 .
/debian
/bootstrap.py \
40 --crate-index
$(CURDIR
)/vendor
/index
/ \
41 --cargo-root
$(CURDIR
)/ \
42 --target-dir
$(CURDIR
)/deps \
43 --host
=$(DEB_HOST_RUST_TYPE
) \
44 --target
=$(DEB_TARGET_RUST_TYPE
)
45 # Workaround for https://github.com/rust-lang/cargo/issues/1423
46 ln
-s
`find $(CURDIR)/deps -name 'cargo-*' -type f -executable` $(CURDIR
)/cargo-stage0
48 ln
-sf
`which cargo` $(CURDIR
)/cargo-stage0
50 debian
/scripts
/prune-checksums vendor
/backtrace-sys-
*/
51 debian
/scripts
/prune-checksums vendor
/libgit2-sys-
*/
53 override_dh_auto_build-arch
:
54 $(CARGO
) build
$(CARGOFLAGS
)
56 override_dh_auto_build-indep
:
57 ifeq (,$(findstring nodoc
,$(DEB_BUILD_PROFILES
)))
58 $(CARGO
) doc
$(CARGOFLAGS
)
59 cd target
/doc
/ && rm -f jquery.js
&& ln
-s
/usr
/share
/javascript
/jquery
/jquery.js
62 override_dh_auto_test
:
63 ifeq (,$(findstring nocheck
,$(DEB_BUILD_PROFILES
)))
64 ifeq (,$(findstring nocheck
,$(DEB_BUILD_OPTIONS
)))
65 CFG_DISABLE_CROSS_TESTS
=1 $(CARGO
) test $(CARGOFLAGS
)
69 override_dh_auto_install
:
70 # We pick stuff directly from target/
72 override_dh_auto_clean
:
73 -mv
$(CURDIR
)/.Cargo.lock.orig
$(CURDIR
)/Cargo.lock
74 $(CARGO
) clean $(CARGOFLAGS
)
75 -$(RM
) -r
$(CURDIR
)/target
/ \
78 $(CURDIR
)/config.stamp \
80 $(CURDIR
)/cargo-stage0
83 # Upstream contains a lot of these
84 dh_clean
-XCargo.toml.orig
86 CROSS_SBUILD
= sbuild
--profiles
=nocheck \
87 --build-failed-commands
'%SBUILD_SHELL' \
88 --host
=$(DEB_HOST_ARCH
) \
89 --no-arch-all
$(EXTRA_SBUILD_FLAGS
)
91 SBUILD_REPO_EXPERIMENTAL
= --extra-repository
="deb http://httpredir.debian.org/debian experimental main"
93 # Sometimes this is necessary, if the mirrors have different versions for different architectures
94 ifeq (1,$(SBUILD_USE_INCOMING
))
95 CROSS_SBUILD
+= --extra-repository
="deb http://incoming.debian.org/debian-buildd buildd-unstable main"
96 SBUILD_REPO_EXPERIMENTAL
+= --extra-repository
="deb http://incoming.debian.org/debian-buildd buildd-experimental main"
102 crossbuild-experimental
:
103 $(CROSS_SBUILD
) $(SBUILD_REPO_EXPERIMENTAL
) --build-dep-resolver
=aspcud .