bat: fix build on x86 secondary arch (#4279)

This commit is contained in:
Crestwave
2019-10-09 11:27:31 +08:00
committed by waddlesplash
parent 892f69ca70
commit db47965c7f
2 changed files with 89 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ HOMEPAGE="https://github.com/sharkdp/bat"
COPYRIGHT="2018-2019 bat developers"
LICENSE="Apache v2
MIT"
REVISION="1"
REVISION="2"
SOURCE_URI="$HOMEPAGE/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="1dd184ddc9e5228ba94d19afc0b8b440bfc1819fef8133fe331e2c0ec9e3f8e2"
SOURCE_FILENAME="bat-$portVersion.tar.gz"
@@ -434,7 +434,7 @@ CHECKSUM_SHA256_141="65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="!x86"
SECONDARY_ARCHITECTURES="x86"
commandBinDir=$prefix/bin
fi

View File

@@ -209,3 +209,90 @@ index 89e2084..faf59d2 100644
--
2.23.0
From 5bf7c2c51d9461ea0667e46e2210ca36fcd01a8b Mon Sep 17 00:00:00 2001
From: Crestwave <crest.wave@yahoo.com>
Date: Mon, 7 Oct 2019 01:22:57 +0000
Subject: Fix tests on Haiku
diff --git a/termios-0.3.1/src/ffi.rs b/termios-0.3.1/src/ffi.rs
index faf59d2..7bd15ad 100644
--- a/termios-0.3.1/src/ffi.rs
+++ b/termios-0.3.1/src/ffi.rs
@@ -1,6 +1,8 @@
//! Unsafe FFI bindings.
-use libc::{c_int,pid_t};
+use libc::c_int;
+#[cfg(not(target_os = "haiku"))]
+use libc::pid_t;
#[cfg_attr(not(target_os = "haiku"), link(name = "c"))]
extern "C" {
@@ -15,6 +17,8 @@ extern "C" {
pub fn cfgetospeed(termios_p: *const ::os::target::termios) -> ::os::target::speed_t;
pub fn cfsetispeed(termios_p: *mut ::os::target::termios, speed: ::os::target::speed_t) -> c_int;
pub fn cfsetospeed(termios_p: *mut ::os::target::termios, speed: ::os::target::speed_t) -> c_int;
+ #[cfg(not(target_os = "haiku"))]
pub fn cfsetspeed(termios_p: *mut ::os::target::termios, speed: ::os::target::speed_t) -> c_int;
+ #[cfg(not(target_os = "haiku"))]
pub fn tcgetsid(fd: c_int) -> pid_t;
}
diff --git a/termios-0.3.1/src/lib.rs b/termios-0.3.1/src/lib.rs
index d229427..4870118 100644
--- a/termios-0.3.1/src/lib.rs
+++ b/termios-0.3.1/src/lib.rs
@@ -76,6 +76,7 @@
//! example of a portable function that sets the maximum speed on a `Termios` struct.
//!
//! ```no_run
+//! # #[cfg(not(target_os = "haiku"))] {
//! use std::io;
//! use termios::{Termios,cfsetspeed};
//!
@@ -107,6 +108,7 @@
//! # let fd = 1;
//! let mut termios = Termios::from_fd(fd).unwrap();
//! set_fastest_speed(&mut termios).unwrap();
+//! # }
//! ```
extern crate libc;
@@ -116,7 +118,9 @@ use std::mem;
use std::ops::{Deref,DerefMut};
use std::os::unix::io::RawFd;
-use libc::{c_int,pid_t};
+use libc::c_int;
+#[cfg(not(target_os = "haiku"))]
+use libc::pid_t;
pub use ::os::target::{cc_t,speed_t,tcflag_t}; // types
pub use ::os::target::{VEOF,VEOL,VERASE,VINTR,VKILL,VMIN,VQUIT,VSTART,VSTOP,VSUSP,VTIME}; // c_cc subscripts
@@ -161,6 +165,7 @@ pub mod os;
/// termios.c_cc[VMIN] = 0;
/// termios.c_cc[VTIME] = 0;
///
+/// #[cfg(not(target_os = "haiku"))]
/// try!(cfsetspeed(&mut termios, B9600));
/// try!(tcsetattr(fd, TCSANOW, &mut termios));
///
@@ -366,6 +371,7 @@ pub fn cfsetospeed(termios: &mut Termios, speed: speed_t) -> io::Result<()> {
///
/// This function is not part of the IEEE Std 1003.1 ("POSIX.1") specification, but it is available
/// on Linux, BSD, and OS X.
+#[cfg(not(target_os = "haiku"))]
pub fn cfsetspeed(termios: &mut Termios, speed: speed_t) -> io::Result<()> {
io_result(unsafe { ffi::cfsetspeed(termios.inner_mut(), speed) })
}
@@ -474,6 +480,7 @@ pub fn tcsetattr(fd: RawFd, action: c_int, termios: &Termios) -> io::Result<()>
/// # Parameters
///
/// * `fd` should be an open file descriptor associated with a controlling terminal.
+#[cfg(not(target_os = "haiku"))]
pub fn tcgetsid(fd: RawFd) -> pid_t {
unsafe { ffi::tcgetsid(fd) }
}
--
2.23.0