Index | Thread | Search

From:
Sebastien Marie <semarie@kapouay.eu.org>
Subject:
Re: Add devel/rust-analyzer
To:
Edd Barrett <edd@theunixzoo.co.uk>, Laurent Cheylus <foxy@free.fr>
Cc:
ports@openbsd.org, tb@openbsd.org
Date:
Fri, 19 Jan 2024 15:41:48 +0100

Download raw body.

Thread
Edd Barrett <edd@theunixzoo.co.uk> writes:

> About the latter, the tests expect "stable" to appear in the output of `rustfmt
> --version`. But that's not so for our package:
>
> ```
> $ rustfmt --version   
> rustfmt 1.7.0-
> ```
>
> I suspect it should return `rustfmt 1.7.0-stable`? CC semarie@

I will take a look at rustfmt.

for now, patching rust-analyzer is fine.

> Anyway, below is a diff showing what I changed, and I've attached a tarball for
> convenience.
>
> Still OK?
>
>
> diff -urNa rust-analyzer.old/Makefile rust-analyzer/Makefile
> --- rust-analyzer.old/Makefile	Fri Jan 19 10:49:54 2024
> +++ rust-analyzer/Makefile	Fri Jan 19 11:16:07 2024
> @@ -12,7 +12,11 @@
>  # MIT OR Apache-2.0
>  PERMIT_PACKAGE =	Yes
>  
> -RUN_DEPENDS =	lang/rust,-src
> +RUN_DEPENDS =	lang/rust,-src \
> +		lang/rust,-rustfmt
> +BUILD_DEPENDS =	${RUN_DEPENDS} \
> +		textproc/ruby-rouge \
> +		textproc/asciidoctor

I am unsure to properly understand here. You need rust,-src and rustfmt
to build the port now ?

You mentionned rustfmt about tests previously.

>  
>  WANTLIB += ${MODCARGO_WANTLIB} m
>  
> @@ -23,6 +27,19 @@
>  SEPARATE_BUILD =	Yes
>  
>  CONFIGURE_STYLE =	cargo
> +
> +# Make `rust-analyzer --version` print the right thing.
> +# (otherwise it reports itself as version 0.0.0)
> +MAKE_ENV += CFG_RELEASE=${GH_TAGNAME}
> +
> +# generate manual.html
> +post-build:
> +	asciidoctor ${WRKSRC}/docs/user/manual.adoc
> +

I would use a slightly different invocation:

post-build:
	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${LOCALBASE}/bin/asciidoctor \
		docs/user/manual.adoc

it will more constraint the environment seen by asciidoctor (the one
configured in the port, and not the one of the build user).

if possible, I would use `asciidoctor --safe` also, but I didn't check it.

> +DOCDIR =	${PREFIX}/share/doc/rust-analyzer
> +post-install:
> +	${INSTALL_DATA_DIR} ${DOCDIR}
> +	${INSTALL_DATA} ${WRKSRC}/docs/user/manual.html ${DOCDIR}

Please install both manual.html and manual.adoc. AsciiDoc format is
readable in a terminal.

Thanks.
-- 
Sebastien Marie