diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d138548 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +# Shortcut for common operations: + +CRATES=perlmod perlmod-macro + +# By default we just run checks: +.PHONY: all +all: check + +.PHONY: deb +deb: $(foreach c,$(CRATES), $c-deb) + echo $(foreach c,$(CRATES), $c-deb) + lintian build/*.deb + +.PHONY: dinstall +dinstall: + $(MAKE) clean + $(MAKE) deb + sudo -k dpkg -i build/librust-*.deb + +%-deb: + ./build.sh $* + touch $@ + +.PHONY: check +check: + cargo test + +# Prints a diff between the current code and the one rustfmt would produce +.PHONY: fmt +fmt: + cargo +nightly fmt -- --check + +# Doc without dependencies +.PHONY: doc +doc: + cargo doc --no-deps + +.PHONY: clean +clean: + cargo clean + rm -rf build *-deb + +.PHONY: update +update: + cargo update + +%-upload: %-deb + cd build; \ + dcmd --deb rust-$*_*.changes \ + | grep -v '.changes$$' \ + | tar -cf- -T- \ + | ssh -X repoman@repo.proxmox.com upload --product devel --dist buster diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..7554e7d --- /dev/null +++ b/build.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +export CARGO=/usr/bin/cargo +export RUSTC=/usr/bin/rustc + +CRATE=$1 +BUILDCMD=${BUILDCMD:-"dpkg-buildpackage -b -uc -us"} + +mkdir -p build +echo system >build/rust-toolchain +rm -rf "build/${CRATE}" + +debcargo package --config "$PWD/${CRATE}/debian/debcargo.toml" --changelog-ready --no-overlay-write-back --directory "$PWD/build/${CRATE}" "${CRATE}" "$(dpkg-parsechangelog -l "${CRATE}/debian/changelog" -SVersion | sed -e 's/-.*//')" +cd "build/${CRATE}" +${BUILDCMD}