diff --git a/deps/freetype/build.rs b/deps/freetype/build.rs index 5cbcc1e0f..878661d04 100644 --- a/deps/freetype/build.rs +++ b/deps/freetype/build.rs @@ -32,7 +32,10 @@ fn zlib() { cfg.define("HAVE_SYS_TYPES_H", None); cfg.define("HAVE_STDINT_H", None); cfg.define("HAVE_STDDEF_H", None); - cfg.define("_LARGEFILE64_SOURCE", Some("1")); + let target = env::var("TARGET").unwrap(); + if !target.contains("windows") { + cfg.define("_LARGEFILE64_SOURCE", Some("1")); + } cfg.compile("z"); } @@ -65,11 +68,23 @@ fn libpng() { .file("libpng/pngwtran.c") .file("libpng/pngwutil.c"); + cfg.include("zlib"); cfg.include("libpng"); + cfg.include(&build_dir); cfg.define("HAVE_SYS_TYPES_H", None); cfg.define("HAVE_STDINT_H", None); cfg.define("HAVE_STDDEF_H", None); - cfg.define("_LARGEFILE64_SOURCE", Some("1")); + let target = env::var("TARGET").unwrap(); + if !target.contains("windows") { + cfg.define("_LARGEFILE64_SOURCE", Some("1")); + } + + fs::write( + build_dir.join("pnglibconf.h"), + fs::read_to_string("libpng/scripts/pnglibconf.h.prebuilt").unwrap(), + ) + .unwrap(); + cfg.compile("png"); } @@ -84,6 +99,9 @@ fn freetype() { let build_dir = out_dir.join("freetype-build"); fs::create_dir_all(&build_dir).unwrap(); cfg.out_dir(&build_dir); + cfg.include("zlib"); + cfg.include("libpng"); + cfg.include(out_dir.join("png-build")); fs::create_dir_all(build_dir.join("freetype2/include/freetype/config")).unwrap(); cfg.include(format!("{}/freetype2/include", build_dir.display())); @@ -170,8 +188,7 @@ fn freetype() { } if target.contains("windows") { - cfg.file("freetype2/builds/windows/ftdebug.c") - .file("freetype2/src/base/ftver.rc"); + cfg.file("freetype2/builds/windows/ftdebug.c"); } else { cfg.file("freetype2/src/base/ftdebug.c"); } diff --git a/deps/harfbuzz/build.rs b/deps/harfbuzz/build.rs index 1e896054f..c55f971c1 100644 --- a/deps/harfbuzz/build.rs +++ b/deps/harfbuzz/build.rs @@ -112,8 +112,13 @@ fn harfbuzz() { if target.contains("windows") { cfg.define("HAVE_DIRECTWRITE", None); cfg.file("harfbuzz/src/hb-directwrite.cc"); + println!("cargo:rustc-link-lib=dwrite"); + cfg.define("HAVE_UNISCRIBE", None); cfg.file("harfbuzz/src/hb-uniscribe.cc"); + println!("cargo:rustc-link-lib=usp10"); + + println!("cargo:rustc-link-lib=rpcrt4"); } // Import the include dirs exported from deps/freetype/build.rs