sysutils/bat: fix build on i386, ok sthen

Add a cast to fix the type error on ILP32 architectures.
Patch merged upstream: https://github.com/FillZpp/sys-info-rs/pull/101
This commit is contained in:
tb 2021-09-15 08:27:44 +00:00
parent f2ad30e8cb
commit ab5614ec17
2 changed files with 20 additions and 10 deletions

View File

@ -1,19 +1,11 @@
# $OpenBSD: Makefile,v 1.5 2021/09/11 07:36:14 semarie Exp $
# building sys-info fails
# error[E0308]: mismatched types
# --> /pobj/bat-0.18.2/bat-0.18.2/modcargo-crates/sys-info-0.9.0/lib.rs:542:29
# |
# 542 | if ret < 1 || ret > std::u32::MAX as i64 {
# | ^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `i64`
ONLY_FOR_ARCHS = ${LP64_ARCHS}
# $OpenBSD: Makefile,v 1.6 2021/09/15 08:27:44 tb Exp $
COMMENT = cat(1) clone with wings
GH_ACCOUNT = sharkdp
GH_PROJECT = bat
GH_TAGNAME = v0.18.3
REVISION = 0
CATEGORIES = sysutils
@ -29,6 +21,7 @@ WANTLIB += c c++abi git2 m onig pthread
CONFIGURE_STYLE = cargo
SEPARATE_BUILD = Yes
PATCHORIG = .openbsd.orig
LIB_DEPENDS += devel/libgit2/libgit2 \
textproc/oniguruma

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-modcargo-crates_sys-info-0_9_0_lib_rs,v 1.1 2021/09/15 08:27:45 tb Exp $
Fix build on ILP32 architectures.
https://github.com/FillZpp/sys-info-rs/pull/101
Index: modcargo-crates/sys-info-0.9.0/lib.rs
--- modcargo-crates/sys-info-0.9.0/lib.rs.orig
+++ modcargo-crates/sys-info-0.9.0/lib.rs
@@ -539,7 +539,7 @@ pub fn cpu_num() -> Result<u32, Error> {
#[cfg(any(target_os = "solaris", target_os = "illumos", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd"))]
{
let ret = unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) };
- if ret < 1 || ret > std::u32::MAX as i64 {
+ if ret < 1 || ret as i64 > std::u32::MAX as i64 {
Err(Error::IO(io::Error::last_os_error()))
} else {
Ok(ret as u32)