nary: Apply patches from PR22 as suggested by Santhosh Raju, fix the build.

This commit is contained in:
ng0 2019-07-07 21:49:42 +00:00
parent 843beef3fd
commit 2530ec29db
6 changed files with 203 additions and 4 deletions

View File

@ -138,6 +138,8 @@ CARGO_CRATE_DEPENDS+= xattr-0.2.2
INSTALLATION_DIRS= bin
MAKE_ENV+= OPENSSL_DIR=${BUILDLINK_PREFIX.openssl:Q}
do-build:
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/cargo build --locked --frozen --release
@ -146,4 +148,5 @@ do-install:
.include "../../lang/rust/cargo.mk"
.include "../../lang/rust/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View File

@ -1,3 +0,0 @@
* Find a work-around for this blocker or wait for termios reaction,
which however will require patching Cargo checksums then.
- https://github.com/dcuddeback/termios-rs/pull/22

View File

@ -500,4 +500,6 @@ SHA1 (xattr-0.2.2.crate) = cde9102482a556b8c430631cc051a98afad04ded
RMD160 (xattr-0.2.2.crate) = 6d3668a1b5818aa07c3d40d4b6500abd6be89760
SHA512 (xattr-0.2.2.crate) = a89d34313c35ab02d6ea25675c99f9c9650dee40a76223d62941edda43b3d2db83ed223bada129625b3cf8487c293646ce9980afc6dba8888fa078d5aa035cab
Size (xattr-0.2.2.crate) = 11750 bytes
SHA1 (patch-netbsd) = e8b278cfea85480cc107d4037ee351430554f54e
SHA1 (patch-vendor_termios_src_lib.rs) = e97ac198e0a9e92d4128fcc1a87ffd66ec282e03
SHA1 (patch-vendor_termios_src_os_mod.rs) = d0714ceb7b507035374f18a5c741a46d3c3e6181
SHA1 (patch-vendor_termios_src_os_netbsd.rs) = 068343bce516bf63abb3f35ddd7f84f8255f2340

View File

@ -0,0 +1,17 @@
$NetBSD$
Upstream PR is wip: https://github.com/dcuddeback/termios-rs/pull/22
--- ../vendor/termios-0.3.1/src/lib.rs.orig 2016-01-20 16:52:20.000000000 +0000
+++ ../vendor/termios-0.3.1/src/lib.rs
@@ -99,6 +99,10 @@
//! cfsetspeed(termios, termios::os::openbsd::B921600)
//! }
//!
+//! #[cfg(target_os = "netbsd")]
+//! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> {
+//! cfsetspeed(termios, termios::os::netbsd::B921600)
+//! }
//! #[cfg(target_os = "dragonfly")]
//! fn set_fastest_speed(termios: &mut Termios) -> io::Result<()> {
//! cfsetspeed(termios, termios::os::dragonfly::B230400)

View File

@ -0,0 +1,20 @@
$NetBSD$
Upstream PR is wip: https://github.com/dcuddeback/termios-rs/pull/22
--- ../vendor/termios-0.3.1/src/os/mod.rs.orig 2016-01-20 16:52:20.000000000 +0000
+++ ../vendor/termios-0.3.1/src/os/mod.rs
@@ -5,6 +5,7 @@
#[cfg(target_os = "macos")] pub use self::macos as target;
#[cfg(target_os = "freebsd")] pub use self::freebsd as target;
#[cfg(target_os = "openbsd")] pub use self::openbsd as target;
+#[cfg(target_os = "netbsd")] pub use self::netbsd as target;
#[cfg(target_os = "dragonfly")] pub use self::dragonfly as target;
#[cfg(target_os = "linux")] pub mod linux;
@@ -12,4 +13,5 @@
#[cfg(target_os = "macos")] pub mod macos;
#[cfg(target_os = "freebsd")] pub mod freebsd;
#[cfg(target_os = "openbsd")] pub mod openbsd;
+#[cfg(target_os = "netbsd")] pub mod netbsd;
#[cfg(target_os = "dragonfly")] pub mod dragonfly;

View File

@ -0,0 +1,160 @@
$NetBSD$
Upstream PR is wip: https://github.com/dcuddeback/termios-rs/pull/22
--- ../vendor/termios-0.3.1/src/os/netbsd.rs.orig 2019-01-30 09:50:04.014973707 +0000
+++ ../vendor/termios-0.3.1/src/os/netbsd.rs
@@ -0,0 +1,153 @@
+#![allow(non_camel_case_types)]
+
+use libc::{c_int,c_uint,c_uchar};
+
+pub type cc_t = c_uchar;
+pub type speed_t = c_uint;
+pub type tcflag_t = c_uint;
+
+#[derive(Debug,Copy,Clone,Eq,PartialEq)]
+#[repr(C)]
+pub struct termios {
+ pub c_iflag: tcflag_t,
+ pub c_oflag: tcflag_t,
+ pub c_cflag: tcflag_t,
+ pub c_lflag: tcflag_t,
+ pub c_cc: [cc_t; NCCS],
+ c_ispeed: speed_t,
+ c_ospeed: speed_t
+}
+
+pub const NCCS: usize = 20;
+
+// c_cc characters
+pub const VEOF: usize = 0;
+pub const VEOL: usize = 1;
+pub const VEOL2: usize = 2;
+pub const VERASE: usize = 3;
+pub const VWERASE: usize = 4;
+pub const VKILL: usize = 5;
+pub const VREPRINT: usize = 6;
+pub const VERASE2: usize = 7;
+pub const VINTR: usize = 8;
+pub const VQUIT: usize = 9;
+pub const VSUSP: usize = 10;
+pub const VSTART: usize = 12;
+pub const VSTOP: usize = 13;
+pub const VLNEXT: usize = 14;
+pub const VDISCARD: usize = 15;
+pub const VMIN: usize = 16;
+pub const VTIME: usize = 17;
+pub const VSTATUS: usize = 18;
+// 19 is "spare"
+
+// c_iflag bits
+pub const IGNBRK: tcflag_t = 0x00000001;
+pub const BRKINT: tcflag_t = 0x00000002;
+pub const IGNPAR: tcflag_t = 0x00000004;
+pub const PARMRK: tcflag_t = 0x00000008;
+pub const INPCK: tcflag_t = 0x00000010;
+pub const ISTRIP: tcflag_t = 0x00000020;
+pub const INLCR: tcflag_t = 0x00000040;
+pub const IGNCR: tcflag_t = 0x00000080;
+pub const ICRNL: tcflag_t = 0x00000100;
+pub const IXON: tcflag_t = 0x00000200;
+pub const IXOFF: tcflag_t = 0x00000400;
+pub const IXANY: tcflag_t = 0x00000800;
+pub const IMAXBEL: tcflag_t = 0x00002000;
+
+// c_oflag bits
+pub const OPOST: tcflag_t = 0x00000001;
+pub const ONLCR: tcflag_t = 0x00000002;
+pub const OXTABS: tcflag_t = 0x00000004;
+pub const ONOEOT: tcflag_t = 0x00000008;
+pub const OCRNL: tcflag_t = 0x00000010;
+pub const ONOCR: tcflag_t = 0x00000020;
+pub const ONLRET: tcflag_t = 0x00000040;
+
+// c_cflag bits
+pub const CIGNORE: tcflag_t = 0x00000001;
+pub const CSIZE: tcflag_t = 0x00000300;
+pub const CS5: tcflag_t = 0x00000000;
+pub const CS6: tcflag_t = 0x00000100;
+pub const CS7: tcflag_t = 0x00000200;
+pub const CS8: tcflag_t = 0x00000300;
+pub const CSTOPB: tcflag_t = 0x00000400;
+pub const CREAD: tcflag_t = 0x00000800;
+pub const PARENB: tcflag_t = 0x00001000;
+pub const PARODD: tcflag_t = 0x00002000;
+pub const HUPCL: tcflag_t = 0x00004000;
+pub const CLOCAL: tcflag_t = 0x00008000;
+pub const CRTSCTS: tcflag_t = 0x00010000;
+pub const CRTS_IFLOW: tcflag_t = CRTSCTS;
+pub const CCTS_OFLOW: tcflag_t = CRTSCTS;
+pub const MDMBUF: tcflag_t = 0x00100000;
+// NetBSD defines CHFLOW as this:
+// pub const CHFLOW: tcflag_t = (MDMBUF|CRTSCTS|CDTRCTS);
+// Pick one and be consistent with above
+pub const CHFLOW: tcflag_t = CRTSCTS;
+
+// c_lflag bits
+pub const ECHOKE: tcflag_t = 0x00000001;
+pub const ECHOE: tcflag_t = 0x00000002;
+pub const ECHOK: tcflag_t = 0x00000004;
+pub const ECHO: tcflag_t = 0x00000008;
+pub const ECHONL: tcflag_t = 0x00000010;
+pub const ECHOPRT: tcflag_t = 0x00000020;
+pub const ECHOCTL: tcflag_t = 0x00000040;
+pub const ISIG: tcflag_t = 0x00000080;
+pub const ICANON: tcflag_t = 0x00000100;
+pub const ALTWERASE: tcflag_t = 0x00000200;
+pub const IEXTEN: tcflag_t = 0x00000400;
+pub const EXTPROC: tcflag_t = 0x00000800;
+pub const TOSTOP: tcflag_t = 0x00400000;
+pub const FLUSHO: tcflag_t = 0x00800000;
+pub const NOKERNINFO: tcflag_t = 0x02000000;
+pub const PENDIN: tcflag_t = 0x20000000;
+pub const NOFLSH: tcflag_t = 0x80000000;
+
+// baud rates
+pub const B0: speed_t = 0;
+pub const B50: speed_t = 50;
+pub const B75: speed_t = 75;
+pub const B110: speed_t = 110;
+pub const B134: speed_t = 134;
+pub const B150: speed_t = 150;
+pub const B200: speed_t = 200;
+pub const B300: speed_t = 300;
+pub const B600: speed_t = 600;
+pub const B1200: speed_t = 1200;
+pub const B1800: speed_t = 1800;
+pub const B2400: speed_t = 2400;
+pub const B4800: speed_t = 4800;
+pub const B9600: speed_t = 9600;
+pub const B19200: speed_t = 19200;
+pub const B38400: speed_t = 38400;
+pub const B7200: speed_t = 7200;
+pub const B14400: speed_t = 14400;
+pub const B28800: speed_t = 28800;
+pub const B57600: speed_t = 57600;
+pub const B76800: speed_t = 76800;
+pub const B115200: speed_t = 115200;
+pub const B230400: speed_t = 230400;
+pub const B460800: speed_t = 460800;
+pub const B921600: speed_t = 921600;
+pub const EXTA: speed_t = 19200;
+pub const EXTB: speed_t = 38400;
+
+// tcflow()
+pub const TCOOFF: c_int = 1;
+pub const TCOON: c_int = 2;
+pub const TCIOFF: c_int = 3;
+pub const TCION: c_int = 4;
+
+// tcflush()
+pub const TCIFLUSH: c_int = 1;
+pub const TCOFLUSH: c_int = 2;
+pub const TCIOFLUSH: c_int = 3;
+
+// tcsetattr()
+pub const TCSANOW: c_int = 0;
+pub const TCSADRAIN: c_int = 1;
+pub const TCSAFLUSH: c_int = 2;
+pub const TCSASOFT: c_int = 0x10;