Laurence Tratt <[email protected]> writes:
> I would like to port skim (https://github.com/skim-rs/skim), but its Rust
> structure doesn't seem an obvious match for modcargo -- or, at least, I
> can't work out how to do it!
>
> There are two complications:
>
> 1. It has a top-level manifest file, including an `xtask` command.
> 2. There are multiple sub-libraries that need to be built.
>
> My normal process for creating a Rust port leads to various complaints from
> various things, and I am out of ideas. The naive port leads modcargo to
> complain that the top-level Cargo.toml is a virtual Cargo.toml file. BUt
> setting:
>
> MODCARGO_CARGOTOML = ${WRKSRC}/skim/Cargo.toml
>
> doesn't seem to set up the cargo registry sufficiently for the e2e library
> to build.
>
> Does anyone know how to handle such a case? I attach the (painfully simple)
> outline `Makefile` for a potential /usr/ports/sysutils/skim if anyone would
> like to fiddle with this and tell me what obvious thing(s) I'm missing out
> on!
In your example, you missed "CONFIGURE_STYLE=cargo". It is required if
you want to divert crates.io to local directory. Else it will not look
at modcargo-crates directory for local files.
You also want MODCARGO_INSTALL_TARGET_PATHS=skim for install, as the
Cargo.toml file at toplevel is a virtual manifest.
Diff below.
> Laurie
>
> ```
> COMMENT = fuzzy finder
>
> CATEGORIES = sysutils
>
> GH_ACCOUNT = skim-rs
> GH_PROJECT = skim
> GH_TAGNAME = v0.16.0
>
> # MIT
> PERMIT_PACKAGE = Yes
>
> MODULES = devel/cargo
> SEPARATE_BUILD = Yes
>
> .include "crates.inc"
>
> .include <bsd.port.mk>
> ```
>
--
Sebastien Marie
diff --git a/sysutils/skim/Makefile b/sysutils/skim/Makefile
index f8b351da14..430065038f 100644
--- a/sysutils/skim/Makefile
+++ b/sysutils/skim/Makefile
@@ -9,9 +9,15 @@
# MIT
PERMIT_PACKAGE = Yes
+WANTLIB += ${MODCARGO_WANTLIB} m
+
MODULES = devel/cargo
SEPARATE_BUILD = Yes
+CONFIGURE_STYLE = cargo
+
+MODCARGO_INSTALL_TARGET_PATHS = skim
+
.include "crates.inc"
.include <bsd.port.mk>