Make it run on FreeBSD

This commit is contained in:
johalun 2017-01-12 13:16:09 -08:00 committed by Joe Wilm
parent a2cd4b647c
commit 398e31fa37
4 changed files with 18 additions and 10 deletions

View file

@ -50,9 +50,9 @@ will walk you through how to build from source on both macOS and Ubuntu.
```sh
rustup override set nightly
```
If you run into problems, you can try a known-good version of the compiler by running
```sh
rustup override set $(<rustc-version)
```
@ -107,6 +107,16 @@ On [Void Linux](https://voidlinux.eu), install following packages before compili
xbps-install cmake freetype-devel freetype expat-devel fontconfig xclip
```
##### FreeBSD
On FreeBSD, you need a few extra libraries to build Alacritty. Here's a `pkg`
command that should install all of them. If something is still found to be
missing, please open an issue.
```sh
pkg install cmake freetype2 fontconfig xclip
```
##### Other
If you build Alacritty on another Linux distribution, we would love some help

View file

@ -40,13 +40,12 @@ pub trait Store : Load {
where S: Into<String>;
}
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
mod x11;
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
pub use x11::{Clipboard, Error};
#[cfg(target_os = "macos")]
mod macos;
#[cfg(target_os = "macos")]
pub use macos::{Clipboard, Error};

View file

@ -1100,7 +1100,7 @@ impl Default for Font {
}
}
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux",target_os = "freebsd"))]
impl Default for Font {
fn default() -> Font {
Font {
@ -1546,4 +1546,3 @@ impl Key {
}
}
}

View file

@ -20,7 +20,7 @@ use std::fs::File;
use std::os::unix::io::FromRawFd;
use std::ptr;
use libc::{self, winsize, c_int, pid_t, WNOHANG, WIFEXITED, WEXITSTATUS, SIGCHLD};
use libc::{self, winsize, c_int, pid_t, WNOHANG, WIFEXITED, WEXITSTATUS, SIGCHLD, TIOCSCTTY};
use term::SizeInfo;
use display::OnResize;
@ -112,7 +112,7 @@ fn openpty(rows: u8, cols: u8) -> (c_int, c_int) {
(master, slave)
}
#[cfg(target_os = "macos")]
#[cfg(any(target_os = "macos",target_os = "freebsd"))]
fn openpty(rows: u8, cols: u8) -> (c_int, c_int) {
let mut master: c_int = 0;
let mut slave: c_int = 0;
@ -138,7 +138,7 @@ fn openpty(rows: u8, cols: u8) -> (c_int, c_int) {
/// Really only needed on BSD, but should be fine elsewhere
fn set_controlling_terminal(fd: c_int) {
let res = unsafe {
libc::ioctl(fd, libc::TIOCSCTTY as _, 0)
libc::ioctl(fd, TIOCSCTTY as _, 0)
};
if res < 0 {