diff --git a/Cargo.toml b/Cargo.toml index b28d0a1..209ccae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ name = "azure" version = "0.1.0" authors = ["The Servo Project Developers"] -build = "make -f makefile.cargo" +build = "build.rs" [dependencies.geom] diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..f7f3ed8 --- /dev/null +++ b/build.rs @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#![feature(io, os)] + +use std::old_io::process::{Command, ProcessExit, StdioContainer}; +use std::os; + + +fn main() { + let out_dir = os::getenv("OUT_DIR").unwrap(); + let result = Command::new("make") + .args(&["-f", "makefile.cargo"]) + .stdout(StdioContainer::InheritFd(1)) + .stderr(StdioContainer::InheritFd(2)) + .status() + .unwrap(); + assert_eq!(result, ProcessExit::ExitStatus(0)); + println!("cargo:rustc-flags=-L native={}", out_dir); +} diff --git a/makefile.cargo b/makefile.cargo index 89ec1b6..e3c3790 100644 --- a/makefile.cargo +++ b/makefile.cargo @@ -59,8 +59,8 @@ CXXFLAGS += \ $(NULL) endif -SKIA_OUTDIR = $(shell find $(OUT_DIR)/.. -name 'skia-*' -type d) -FREETYPE_OUTDIR = $(shell find $(OUT_DIR)/.. -name 'freetype-sys-*' -type d) +SKIA_OUTDIR = $(shell find $(OUT_DIR)/../.. -name 'skia-*' -type d)/out +FREETYPE_OUTDIR = $(shell find $(OUT_DIR)/../.. -name 'freetype-sys-*' -type d)/out CXXFLAGS += \ -I $(FREETYPE_OUTDIR)/include \