Saturday, September 03, 2022

Re: [new] net/arti

On Sat, Sep 03, 2022 at 12:08:33PM +0200, Pascal Stumpf wrote:
> On Sat, 03 Sep 2022 12:04:30 +0200, Pascal Stumpf wrote:
> > Done, new tarball.
>

I did more tests.

First, I will copte more crates in devel/cargo: arti is using crates with
embedded C sources which could be statically used (lzma, openssl, zstd).

With the current framework, only zstd is built from source (instead of using
archivers/zstd).

Index: ports/devel/cargo/cargo.port.mk
===================================================================
RCS file: /cvs/ports/devel/cargo/cargo.port.mk,v
retrieving revision 1.28
diff -u -p -r1.28 cargo.port.mk
--- ports/devel/cargo/cargo.port.mk 13 Mar 2022 13:05:52 -0000 1.28
+++ ports/devel/cargo/cargo.port.mk 3 Sep 2022 14:55:26 -0000
@@ -144,6 +144,16 @@ MODCARGO_post-extract += \
sed -i -e 's,find_library("lua5.2"),find_library("lua52"),' \
${MODCARGO_VENDOR_DIR}/${_cratename}-${_cratever}/build.rs ;

+. elif "${_cratename}" == "lzma-sys"
+MODCARGO_post-extract += \
+ ${ECHO_MSG} "[modcargo] Removing libsrc for ${_cratename}-${_cratever}" ; \
+ rm -rf -- ${MODCARGO_VENDOR_DIR}/${_cratename}-${_cratever}/xz-[0-9]* ;
+
+. elif "${_cratename}" == "openssl-src"
+MODCARGO_post-extract += \
+ ${ECHO_MSG} "[modcargo] Removing libsrc for ${_cratename}-${_cratever}" ; \
+ rm -rf -- ${MODCARGO_VENDOR_DIR}/${_cratename}-${_cratever}/openssl ;
+
. elif "${_cratename}" == "openssl-sys"
MODCARGO_post-extract += \
${ECHO_MSG} "[modcargo] Patching ${_cratename}-${_cratever} for supporting -current" ; \
@@ -179,6 +189,13 @@ MODCARGO_post-extract += \
${ECHO_MSG} "[modcargo] Removing libsrc for ${_cratename}-${_cratever}" ; \
rm -rf -- ${MODCARGO_VENDOR_DIR}/${_cratename}-${_cratever}/{src,makefile.cargo} ;

+. elif "${_cratename}" == "zstd-sys"
+MODCARGO_post-extract += \
+ ${ECHO_MSG} "[modcargo] Removing libsrc for ${_cratename}-${_cratever}" ; \
+ rm -rf -- ${MODCARGO_VENDOR_DIR}/${_cratename}-${_cratever}/zstd ; \
+ ${ECHO_MSG} "[modcargo] Patching ${_cratename}-${_cratever} to use archivers/zstd" ; \
+ sed -i -e 's,^fn main() {,fn main() { println!("cargo:rustc-link-lib=zstd"); return;,' \
+ ${MODCARGO_VENDOR_DIR}/${_cratename}-${_cratever}/build.rs ;
. endif
. endfor
.endif


With that, your port needs LIB_DEPENDS + WANTLIB changes for archivers/zstd as
it will be properly linked with zstd from ports.

Just an additionnal question: why NO_TEST=Yes ? A testsuite exists (and cargo
module could use it), even if not very developed (only 14 tests, and seems to be
related to configuration).


Once I commited cargo.port.mk changes, ok semarie@ for importing arti with
LIB_DEPENDS + WANTLIB modification for archivers/zstd.

Thanks.
--
Sebastien Marie

No comments:

Post a Comment