blob: 00beb1f4a060fda77031e86b4a2238c2c7fdc927 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
#
# Copyright (C) 2021-2022 Red Hat, Inc. All rights reserved.
#
# Author: Fabio M. Di Nitto <fabbione@kronosnet.org>
#
# This software licensed under GPL-2.0+
#
RUST_COMMON = \
build.rs.in
RUST_SRCS = $(RUST_SHIP_SRCS) $(RUST_BUILT_SRCS)
%.rlib: $(RUST_SRCS) Cargo.toml build.rs
PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(CARGO) build $(RUST_FLAGS)
%-test: $(RUST_SRCS) Cargo.toml build.rs
PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(CARGO) build $(RUST_FLAGS)
build.rs: build.rs.in
rm -f $@ $@-t
cat $^ | sed \
-e 's#@ABSTOPLEVELSRC@#$(abs_top_srcdir)#g' \
-e 's#@ABSTOPLEVELBUILD@#$(abs_top_builddir)#g' \
-e 's#@LIBQBLIBS@#$(LIBQB_LIBS)#g' \
> $@-t
chmod a-w $@-t
mv $@-t $@
rm -f $@-t
cargo-tree-prep:
if [ "${abs_builddir}" != "${abs_srcdir}" ]; then \
echo "Generating builddir out-of-tree rust symlinks"; \
src_realpath=$(shell realpath ${abs_srcdir}); \
for i in `find "$$src_realpath/" -type d | \
grep -v "${abs_builddir}" | \
sed -e 's#^'$$src_realpath'/##g'`; do \
$(MKDIR_P) ${abs_builddir}/$${i}; \
done; \
find "$$src_realpath/" -type f | { while read src; do \
process=no; \
copy=no; \
case $$src in \
${abs_builddir}*) \
;; \
*Makefile.*|*.in) \
;; \
*) \
process=yes; \
;; \
esac ; \
dst=`echo $$src | sed -e 's#^'$$src_realpath'/##g'`; \
if [ $${process} == yes ]; then \
rm -f ${abs_builddir}/$$dst; \
$(LN_S) $$src ${abs_builddir}/$$dst; \
fi; \
if [ $${copy} == yes ]; then \
rm -f ${abs_builddir}/$$dst; \
cp $$src ${abs_builddir}/$$dst; \
chmod u+w ${abs_builddir}/$$dst; \
fi; \
done; }; \
fi
cargo-clean:
-$(CARGO) clean
rm -rf Cargo.lock $(RUST_BUILT_SRCS) build.rs target/
if [ "${abs_builddir}" != "${abs_srcdir}" ]; then \
echo "Cleaning out-of-tree rust symlinks" ; \
find "${abs_builddir}/" -type l -delete; \
find "${abs_builddir}/" -type d -empty -delete; \
fi
clippy-check:
$(CARGO) clippy --verbose --all-features -- -D warnings
format-check:
if [ "${abs_builddir}" = "${abs_srcdir}" ]; then \
$(CARGO) fmt --all --check; \
else \
echo "!!!!! WARNING: skipping format check !!!!!"; \
fi
doc-check:
$(CARGO) doc --verbose --all-features
publish-check:
if [ -f "${abs_srcdir}/README.md" ]; then \
$(CARGO) publish --dry-run; \
fi
crates-publish:
if [ -f "${abs_srcdir}/README.md" ]; then \
bindingname=`cat Cargo.toml | grep ^name | sed -e 's#.*= ##g' -e 's#"##g'` && \
cratesver=`cargo search $$bindingname | grep "^$$bindingname " | sed -e 's#.*= ##g' -e 's#"##g' -e 's/\+.*//g'` && \
testver=`echo $(localver) | sed -e 's/\+.*//g'` && \
if [ "$$cratesver" != "$$testver" ]; then \
$(CARGO) publish; \
fi; \
fi
crates-check:
if [ -f "${abs_srcdir}/README.md" ]; then \
bindingname=`cat Cargo.toml | grep ^name | sed -e 's#.*= ##g' -e 's#"##g'` && \
cratesver=`cargo search $$bindingname | grep "^$$bindingname " | sed -e 's#.*= ##g' -e 's#"##g' -e 's/\+.*//g'` && \
testver=`echo $(localver) | sed -e 's/\+.*//g'` && \
if [ "$$cratesver" != "$$testver" ]; then \
echo "!!!!! WARNING !!!!!"; \
echo "!!!!! WARNING: $$bindingname local version ($$testver) is higher than the current published one on crates.io ($$cratesver)"; \
echo "!!!!! WARNING !!!!!"; \
fi; \
fi
check-local: clippy-check format-check doc-check crates-check publish-check
|