diff options
author | Tobias Kortkamp <tobik@FreeBSD.org> | 2018-06-14 17:56:02 +0800 |
---|---|---|
committer | Tobias Kortkamp <tobik@FreeBSD.org> | 2018-06-14 17:56:02 +0800 |
commit | ad49ddf876913e2c108c637134c5a976938a6fba (patch) | |
tree | df9fd85a2838645caaaa3fc0bda7bb51eac5b5cf /Mk | |
parent | 0dbf2df9caa1bd5d87b005c1e4478844d1058f01 (diff) | |
download | freebsd-ports-gnome-ad49ddf876913e2c108c637134c5a976938a6fba.tar.gz freebsd-ports-gnome-ad49ddf876913e2c108c637134c5a976938a6fba.tar.zst freebsd-ports-gnome-ad49ddf876913e2c108c637134c5a976938a6fba.zip |
Mk/Uses/cargo.mk: Encode more crate build dependencies
- Add build/lib dependencies, environment variables to ports using
the backtrace-sys, freetype-sys, gettext-sys, onig_sys,
thrussh-libsodium crates instead of doing this individually for
every port.
- Add a DEV_WARNING when using libc versions < 0.2.37 to prevent
instability of Rust applications on 12.0-CURRENT [1]
- Sort cargo-crates-licenses output
Reviewed by: pizzamig, jbeich [1]
Differential Revision: https://reviews.freebsd.org/D15463
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Uses/cargo.mk | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk index e3439579639f..ab3951b25b71 100644 --- a/Mk/Uses/cargo.mk +++ b/Mk/Uses/cargo.mk @@ -117,23 +117,67 @@ CARGO_TEST_ARGS+= --release CARGO_INSTALL_ARGS+= --debug .endif -.if ${CARGO_CRATES:Mlibgit2-sys-*} +.if ${CARGO_CRATES:Mbacktrace-sys-[0-9]*} +BUILD_DEPENDS+= gmake:devel/gmake +.endif + +.if ${CARGO_CRATES:Mcmake-[0-9]*} +BUILD_DEPENDS+= cmake:devel/cmake +.endif + +.if ${CARGO_CRATES:Mfreetype-sys-[0-9]*} +LIB_DEPENDS+= libfreetype.so:print/freetype2 +.endif + +.if ${CARGO_CRATES:Mgettext-sys-[0-9]*} +.include "${USESDIR}/gettext.mk" +CARGO_ENV+= GETTEXT_BIN_DIR=${LOCALBASE}/bin \ + GETTEXT_INCLUDE_DIR=${LOCALBASE}/include \ + GETTEXT_LIB_DIR=${LOCALBASE}/lib +.endif + +.if ${CARGO_CRATES:Mlibc-[0-9]*} +# FreeBSD 12.0 changed ABI: r318736 and r320043 +# https://github.com/rust-lang/libc/commit/78f93220d70e +# https://github.com/rust-lang/libc/commit/969ad2b73cdc +_libc_VER= ${CARGO_CRATES:Mlibc-[0-9]*:C/.*-//} +. if ${_libc_VER:R:R} == 0 && (${_libc_VER:R:E} < 2 || ${_libc_VER:R:E} == 2 && ${_libc_VER:E} < 38) +DEV_WARNING+= "CARGO_CRATES=libc-0.2.37 or older maybe unstable on FreeBSD 12.0. Consider updating to the latest version." +. endif +.undef _libc_VER +.endif + +.if ${CARGO_CRATES:Mlibgit2-sys-[0-9]*} # Use the system's libgit2 instead of building the bundled version -LIB_DEPENDS+= libgit2.so:devel/libgit2 CARGO_ENV+= LIBGIT2_SYS_USE_PKG_CONFIG=1 +LIB_DEPENDS+= libgit2.so:devel/libgit2 .endif -.if ${CARGO_CRATES:Mopenssl-sys-*} +.if ${CARGO_CRATES:Monig_sys-[0-9]*} +# onig_sys always prefers the system library but will try to link +# statically with it. Since devel/oniguruma doesn't provide a static +# library it'll link to libonig.so instead. Strictly speaking setting +# RUSTONIG_SYSTEM_LIBONIG is not necessary, but will force onig_sys to +# always use the system's libonig as returned by `pkg-config oniguruma`. +CARGO_ENV+= RUSTONIG_SYSTEM_LIBONIG=1 +LIB_DEPENDS+= libonig.so:devel/oniguruma +.endif + +.if ${CARGO_CRATES:Mopenssl-sys-[0-9]*} # Make sure that openssl-sys can find the correct version of OpenSSL .include "${USESDIR}/ssl.mk" CARGO_ENV+= OPENSSL_LIB_DIR=${OPENSSLLIB} \ OPENSSL_INCLUDE_DIR=${OPENSSLINC} .endif -.if ${CARGO_CRATES:Mpkg-config-*} +.if ${CARGO_CRATES:Mpkg-config-[0-9]*} .include "${USESDIR}/pkgconfig.mk" .endif +.if ${CARGO_CRATES:Mthrussh-libsodium-[0-9]*} +LIB_DEPENDS+= libsodium.so:security/libsodium +.endif + _USES_extract+= 600:cargo-extract cargo-extract: # target for preparing crates directory. It will put all crates in @@ -222,5 +266,5 @@ cargo-crates-licenses: configure | ${SED} \ -e 's@^${CARGO_VENDOR_DIR}/@@' \ -e 's@/Cargo.toml:license.*= *"@|@' \ - -e 's@"$$@@g' | /usr/bin/column -t -s '|' + -e 's@"$$@@g' | sort | /usr/bin/column -t -s '|' .endif |