Hi,
The latest update of lang/rust (1.31) has stabilized clippy (linter) and
rustfmt (code formatter) and there are included in the rustc tarball
(there are strongly linked to rustc internals).
The diff below enable the compilation of them (it added 20min build
time on my test - amd64 / 4 cores), and package them as subpackages.
While here, I also packaged rust-gdb as a subpackage, in order to have
devel/gdb as RDEP only for it when installed. Currently, rust-lldb isn't
packaged as testsuite told me it doesn't work. It could be revisited
later.
REVISION bumped on -main, as rust-gdb script moved to another
subpackage.
Thanks.
--
Sebastien Marie
Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/rust/Makefile,v
retrieving revision 1.86
diff -u -p -r1.86 Makefile
--- Makefile 8 Dec 2018 09:16:09 -0000 1.86
+++ Makefile 15 Dec 2018 09:23:03 -0000
@@ -10,11 +10,18 @@ DPB_PROPERTIES = parallel
COMMENT-main = compiler for Rust Language
COMMENT-doc = html documentation for rustc
+COMMENT-gdb = Rust debugger thought gdb
+COMMENT-clippy = Rust linter
+COMMENT-rustfmt = Rust code formatter
V = 1.31.0
CARGO_V = 0.32.0
+CLIPPY_V = 0.0.212
+RUSTFMT_V = 1.0.0
DISTNAME = rustc-${V}-src
+REVISION-main = 0
+
# rustc bootstrap version
BV-aarch64 = 1.31.0-20181207
BV-amd64 = 1.31.0-20181205
@@ -24,8 +31,11 @@ BV = ${BV-${MACHINE_ARCH}}
PKGNAME = rust-${V}
PKGNAME-main = rust-${V}
PKGNAME-doc = rust-doc-${V}
+PKGNAME-gdb = rust-gdb-${V}
+PKGNAME-clippy = rust-clippy-${V}
+PKGNAME-rustfmt = rust-rustfmt-${V}
-MULTI_PACKAGES = -main -doc
+MULTI_PACKAGES = -main -doc -gdb -clippy -rustfmt
CATEGORIES = lang
@@ -38,6 +48,9 @@ PERMIT_PACKAGE_CDROM = Yes
WANTLIB-main = ${COMPILER_LIBCXX} c crypto curl git2 m pthread ssh2
ssl z
WANTLIB-doc =
+WANTLIB-gdb =
+WANTLIB-clippy = c c++abi m pthread
+WANTLIB-rustfmt = c c++abi m pthread
# XXX should this actually just be ports-clang?
COMPILER = base-clang
@@ -53,7 +66,7 @@ DIST_SUBDIR = rust
EXTRACT_SUFX = .tar.xz
DISTFILES = ${DISTNAME}${EXTRACT_SUFX}
.if ${FLAVOR} == native_bootstrap
-BUILD_DEPENDS+= lang/rust
+BUILD_DEPENDS += lang/rust
.else
DISTFILES += ${BOOTSTRAP}
.endif
@@ -93,6 +106,11 @@ LIB_DEPENDS += devel/libgit2/libgit2 \
net/curl \
security/libssh2
+RUN_DEPENDS-gdb += lang/rust,-main \
+ devel/gdb
+RUN_DEPENDS-clippy += lang/rust,-main
+RUN_DEPENDS-rustfmt += lang/rust,-main
+
MAKE_ENV += LIBGIT2_SYS_USE_PKG_CONFIG=1 \
LIBSSH2_SYS_USE_PKG_CONFIG=1
TEST_ENV += RUST_BACKTRACE=0
@@ -174,10 +192,11 @@ TEST_BIN = cd ${WRKBUILD} && exec ${SETE
do-build:
${BUILD_BIN} dist --jobs=${MAKE_JOBS} \
- src/libstd src/librustc src/doc cargo
+ src/libstd src/librustc src/doc cargo clippy rustfmt
rm -rf -- ${WRKBUILD}/build/tmp/dist
-COMPONENTS ?= rustc-${V} rust-std-${V} rust-docs-${V} cargo-${CARGO_V}
+COMPONENTS ?= rustc-${V} rust-std-${V} rust-docs-${V} cargo-${CARGO_V} \
+ clippy-${CLIPPY_V} rustfmt-${RUSTFMT_V}
do-install:
rm -rf ${WRKBUILD}/_extractdist
.for _c in ${COMPONENTS}
Index: patches/patch-src_etc_rust-gdb
===================================================================
RCS file: /cvs/ports/lang/rust/patches/patch-src_etc_rust-gdb,v
retrieving revision 1.5
diff -u -p -r1.5 patch-src_etc_rust-gdb
--- patches/patch-src_etc_rust-gdb 1 Nov 2018 13:50:30 -0000 1.5
+++ patches/patch-src_etc_rust-gdb 15 Dec 2018 09:23:03 -0000
@@ -1,20 +1,8 @@
$OpenBSD: patch-src_etc_rust-gdb,v 1.5 2018/11/01 13:50:30 landry Exp $
-only compatible with egdb (gdb from ports)
+use egdb (gdb from ports)
Index: src/etc/rust-gdb
--- src/etc/rust-gdb.orig
+++ src/etc/rust-gdb
-@@ -12,6 +12,11 @@
- # Exit if anything fails
- set -e
-
-+if ! command -v egdb; then
-+ echo "error: rust-gdb requires devel/gdb to be installed" >&2
-+ exit 1
-+fi
-+
- # Find out where the pretty printer Python module is
- RUSTC_SYSROOT=`rustc --print=sysroot`
- GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
@@ -19,7 +24,7 @@ GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustli
# Run GDB with the additional arguments that load the pretty printers
# Set the environment variable `RUST_GDB` to overwrite the call to a
Index: pkg/DESCR-clippy
===================================================================
RCS file: pkg/DESCR-clippy
diff -N pkg/DESCR-clippy
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/DESCR-clippy 15 Dec 2018 09:23:03 -0000
@@ -0,0 +1 @@
+A bunch of lints to catch common mistakes and improve your Rust code.
\ No newline at end of file
Index: pkg/DESCR-gdb
===================================================================
RCS file: pkg/DESCR-gdb
diff -N pkg/DESCR-gdb
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/DESCR-gdb 15 Dec 2018 09:23:03 -0000
@@ -0,0 +1,2 @@
+Small wrapper script for gdb that will start the underlying debugger with
+Rust pretty printers enabled.
\ No newline at end of file
Index: pkg/DESCR-rustfmt
===================================================================
RCS file: pkg/DESCR-rustfmt
diff -N pkg/DESCR-rustfmt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/DESCR-rustfmt 15 Dec 2018 09:23:03 -0000
@@ -0,0 +1 @@
+A tool for formatting Rust code according to style guidelines.
\ No newline at end of file
Index: pkg/PLIST-clippy
===================================================================
RCS file: pkg/PLIST-clippy
diff -N pkg/PLIST-clippy
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/PLIST-clippy 15 Dec 2018 09:23:03 -0000
@@ -0,0 +1,7 @@
+@comment $OpenBSD: PLIST-clippy,v$
+@bin bin/cargo-clippy
+@bin bin/clip${MODPY_PY_PREFIX}driver
+share/doc/clippy/
+share/doc/clippy/LICENSE-APACHE
+share/doc/clippy/LICENSE-MIT
+share/doc/clippy/README.md
Index: pkg/PLIST-gdb
===================================================================
RCS file: pkg/PLIST-gdb
diff -N pkg/PLIST-gdb
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/PLIST-gdb 15 Dec 2018 09:23:04 -0000
@@ -0,0 +1,6 @@
+@comment $OpenBSD: PLIST-gdb,v$
+bin/rust-gdb
+lib/rustlib/etc/gdb_load_rust_pretty_printers.py
+lib/rustlib/etc/gdb_load_rust_pretty_printers.pyc
+lib/rustlib/etc/gdb_rust_pretty_printing.py
+lib/rustlib/etc/gdb_rust_pretty_printing.pyc
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/lang/rust/pkg/PLIST-main,v
retrieving revision 1.14
diff -u -p -r1.14 PLIST-main
--- pkg/PLIST-main 22 May 2018 06:04:33 -0000 1.14
+++ pkg/PLIST-main 15 Dec 2018 09:23:04 -0000
@@ -2,7 +2,6 @@
@conflict cargo-<0.20.0
@pkgpath devel/cargo
@bin bin/cargo
-bin/rust-gdb
@bin bin/rustc
@bin bin/rustdoc
lib/rustlib/
@@ -12,12 +11,8 @@ lib/rustlib/
lib/rustlib/etc/
lib/rustlib/etc/debugger_pretty_printers_common.py
lib/rustlib/etc/debugger_pretty_printers_common.pyc
-lib/rustlib/etc/gdb_load_rust_pretty_printers.py
-lib/rustlib/etc/gdb_load_rust_pretty_printers.pyc
-lib/rustlib/etc/gdb_rust_pretty_printing.py
-lib/rustlib/etc/gdb_rust_pretty_printing.pyc
-lib/rustlib/etc/lldb_rust_formatters.py
-lib/rustlib/etc/lldb_rust_formatters.pyc
+@comment lib/rustlib/etc/lldb_rust_formatters.py
+@comment lib/rustlib/etc/lldb_rust_formatters.pyc
@man man/man1/cargo-bench.1
@man man/man1/cargo-build.1
@man man/man1/cargo-check.1
Index: pkg/PLIST-rustfmt
===================================================================
RCS file: pkg/PLIST-rustfmt
diff -N pkg/PLIST-rustfmt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/PLIST-rustfmt 15 Dec 2018 09:23:04 -0000
@@ -0,0 +1,7 @@
+@comment $OpenBSD: PLIST-rustfmt,v$
+@bin bin/cargo-fmt
+@bin bin/rustfmt
+share/doc/rustfmt/
+share/doc/rustfmt/LICENSE-APACHE
+share/doc/rustfmt/LICENSE-MIT
+share/doc/rustfmt/README.md