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

Fix build on *BSD #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ if(NOT APPLE AND NOT WIN32)
message(STATUS "Using FREETYPE_CLDFLAGS: " ${FREETYPE_CLDFLAGS})
add_definitions(${FREETYPE_CFLAGS})
link_libraries(${FREETYPE_CLDFLAGS})
EXEC_PROGRAM(pkg-config ARGS --cflags fontconfig OUTPUT_VARIABLE FONTCONFIG_CFLAGS RESULT_VARIABLE FONTCONFIG_NOT_FOUND)
if(FONTCONFIG_NOT_FOUND)
message(FATAL_ERROR "Fontconfig is required by Skia for this build, but it was not built by the fontconfig crate nor found by pkg-config")
endif()
EXEC_PROGRAM(pkg-config ARGS --libs fontconfig OUTPUT_VARIABLE FONTCONFIG_CLDFLAGS)
message(STATUS "Using FONTCONFIG_CFLAGS: " ${FONTCONFIG_CFLAGS})
message(STATUS "Using FONTCONFIG_CLDFLAGS: " ${FONTCONFIG_CLDFLAGS})
add_definitions(${FONTCONFIG_CFLAGS})
link_libraries(${FONTCONFIG_CLDFLAGS})
endif()
endif()

Expand Down Expand Up @@ -669,7 +678,7 @@ if($ENV{TARGET} MATCHES ".*android.*")
set_prefix(SKIA_UTILS_PLATFORM_SRC platform_tools/android/third_party/cpufeatures/
cpu-features.c
)
elseif($ENV{TARGET} MATCHES ".*linux.*")
elseif($ENV{TARGET} MATCHES ".*linux.*" OR $ENV{TARGET} MATCHES ".*bsd.*")
set_prefix(SKIA_GL_PLATFORM_SRC src/gpu/gl/unix/
GrGLCreateNativeInterface_unix.cpp
SkNativeGLContext_unix.cpp
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ expat-sys = "2.1.5"
[target.'cfg(target_os = "windows")'.dependencies]
servo-glutin = "0.12"

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

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

Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ fn main() {
println!("cargo:rustc-link-lib=c++");
println!("cargo:rustc-link-lib=framework=OpenGL");
println!("cargo:rustc-link-lib=framework=ApplicationServices");
} else if target.contains("bsd") {
println!("cargo:rustc-link-search=native=/usr/local/lib");
println!("cargo:rustc-link-lib=c++");
println!("cargo:rustc-link-lib=bz2");
println!("cargo:rustc-link-lib=GL");
} else if target.contains("windows") {
if target.contains("gnu") {
println!("cargo:rustc-link-lib=stdc++");
Expand Down
6 changes: 3 additions & 3 deletions src/gl_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ pub use gl_context_cgl::GLPlatformContext;
#[cfg(target_os="macos")]
pub use gl_context_cgl::PlatformDisplayData;

#[cfg(target_os="linux")]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
pub use gl_context_glx::GLPlatformContext;
#[cfg(target_os="linux")]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
pub use gl_context_glx::PlatformDisplayData;
#[cfg(target_os="linux")]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
pub use gl_rasterization_context::GLRasterizationContext;

#[cfg(target_os="android")]
Expand Down
2 changes: 1 addition & 1 deletion src/gl_rasterization_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::ffi::CString;

#[cfg(target_os="macos")]
pub use gl_rasterization_context_cgl::GLRasterizationContext;
#[cfg(target_os="linux")]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
pub use gl_rasterization_context_glx::GLRasterizationContext;
#[cfg(target_os="android")]
pub use gl_rasterization_context_android::GLRasterizationContext;
Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ extern crate cgl;
#[cfg(target_os="macos")]
extern crate io_surface;

#[cfg(target_os="linux")]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
extern crate x11;
#[cfg(target_os="linux")]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
extern crate glx;

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

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

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

pub use skia::{
Expand All @@ -42,9 +42,9 @@ pub mod gl_context;
pub mod gl_rasterization_context;
pub mod skia;

#[cfg(target_os="linux")]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
pub mod gl_context_glx;
#[cfg(target_os="linux")]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
pub mod gl_rasterization_context_glx;

#[cfg(target_os="macos")]
Expand Down