Skip to content
This repository was archived by the owner on Jun 8, 2020. It is now read-only.

Commit 0ae8cee

Browse files
committed
Fix build on *BSD
1 parent 9dbacd7 commit 0ae8cee

File tree

6 files changed

+21
-16
lines changed

6 files changed

+21
-16
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ if(NOT APPLE AND NOT WIN32)
6262
# We need to work with older cmake -- pkg_check_modules was added in
6363
# a version of cmake newer than what Ubuntu 14.04 LTS ships with.
6464
#pkg_check_modules(FREETYPE REQUIRED freetype2)
65-
EXEC_PROGRAM(pkg-config ARGS --cflags freetype2 OUTPUT_VARIABLE FREETYPE_CFLAGS RESULT_VARIABLE FREETYPE_NOT_FOUND)
65+
EXEC_PROGRAM(pkg-config ARGS --cflags freetype2 fontconfig OUTPUT_VARIABLE FREETYPE_CFLAGS RESULT_VARIABLE FREETYPE_NOT_FOUND)
6666
if(FREETYPE_NOT_FOUND)
67-
message(FATAL_ERROR "Freetype is required by Skia for this build, but it was not built by the freetype crate nor found by pkg-config")
67+
message(FATAL_ERROR "Freetype & fontconfig is required by Skia for this build, but it was not built by the freetype crate nor found by pkg-config")
6868
endif()
69-
EXEC_PROGRAM(pkg-config ARGS --libs freetype2 OUTPUT_VARIABLE FREETYPE_CLDFLAGS)
69+
EXEC_PROGRAM(pkg-config ARGS --libs freetype2 fontconfig OUTPUT_VARIABLE FREETYPE_CLDFLAGS)
7070
message(STATUS "Using FREETYPE_CFLAGS: " ${FREETYPE_CFLAGS})
7171
message(STATUS "Using FREETYPE_CLDFLAGS: " ${FREETYPE_CLDFLAGS})
7272
add_definitions(${FREETYPE_CFLAGS})
@@ -669,7 +669,7 @@ if($ENV{TARGET} MATCHES ".*android.*")
669669
set_prefix(SKIA_UTILS_PLATFORM_SRC platform_tools/android/third_party/cpufeatures/
670670
cpu-features.c
671671
)
672-
elseif($ENV{TARGET} MATCHES ".*linux.*")
672+
elseif($ENV{TARGET} MATCHES ".*linux.*" OR $ENV{TARGET} MATCHES ".*bsd.*")
673673
set_prefix(SKIA_GL_PLATFORM_SRC src/gpu/gl/unix/
674674
GrGLCreateNativeInterface_unix.cpp
675675
SkNativeGLContext_unix.cpp

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ expat-sys = "2.1.5"
3636
[target.'cfg(target_os = "windows")'.dependencies]
3737
servo-glutin = "0.12"
3838

39-
[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
39+
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
4040
servo-fontconfig-sys = "4.0.0"
4141
servo-freetype-sys = "4.0.0"
4242

43-
[target.'cfg(target_os = "linux")'.dependencies]
43+
[target.'cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))'.dependencies]
4444
x11 = { version = "2.0.0", features = ["xlib"] }
4545
glx = "0.1.0"
4646

build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ fn main() {
2424
println!("cargo:rustc-link-lib=c++");
2525
println!("cargo:rustc-link-lib=framework=OpenGL");
2626
println!("cargo:rustc-link-lib=framework=ApplicationServices");
27+
} else if target.contains("bsd") {
28+
println!("cargo:rustc-link-search=native=/usr/local/lib");
29+
println!("cargo:rustc-link-lib=c++");
30+
println!("cargo:rustc-link-lib=bz2");
31+
println!("cargo:rustc-link-lib=GL");
2732
} else if target.contains("windows") {
2833
if target.contains("gnu") {
2934
println!("cargo:rustc-link-lib=stdc++");

src/gl_context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ pub use gl_context_cgl::GLPlatformContext;
1818
#[cfg(target_os="macos")]
1919
pub use gl_context_cgl::PlatformDisplayData;
2020

21-
#[cfg(target_os="linux")]
21+
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
2222
pub use gl_context_glx::GLPlatformContext;
23-
#[cfg(target_os="linux")]
23+
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
2424
pub use gl_context_glx::PlatformDisplayData;
25-
#[cfg(target_os="linux")]
25+
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
2626
pub use gl_rasterization_context::GLRasterizationContext;
2727

2828
#[cfg(target_os="android")]

src/gl_rasterization_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::ffi::CString;
1313

1414
#[cfg(target_os="macos")]
1515
pub use gl_rasterization_context_cgl::GLRasterizationContext;
16-
#[cfg(target_os="linux")]
16+
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
1717
pub use gl_rasterization_context_glx::GLRasterizationContext;
1818
#[cfg(target_os="android")]
1919
pub use gl_rasterization_context_android::GLRasterizationContext;

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ extern crate cgl;
1111
#[cfg(target_os="macos")]
1212
extern crate io_surface;
1313

14-
#[cfg(target_os="linux")]
14+
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
1515
extern crate x11;
16-
#[cfg(target_os="linux")]
16+
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
1717
extern crate glx;
1818

1919
#[cfg(target_os="android")]
2020
extern crate egl;
2121

22-
#[cfg(any(target_os="linux", target_os="android"))]
22+
#[cfg(all(unix, not(target_os = "macos")))]
2323
extern crate freetype_sys;
2424

25-
#[cfg(any(target_os="linux", target_os="android"))]
25+
#[cfg(all(unix, not(target_os = "macos")))]
2626
extern crate fontconfig_sys;
2727

2828
pub use skia::{
@@ -42,9 +42,9 @@ pub mod gl_context;
4242
pub mod gl_rasterization_context;
4343
pub mod skia;
4444

45-
#[cfg(target_os="linux")]
45+
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
4646
pub mod gl_context_glx;
47-
#[cfg(target_os="linux")]
47+
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
4848
pub mod gl_rasterization_context_glx;
4949

5050
#[cfg(target_os="macos")]

0 commit comments

Comments
 (0)