Skip to content

Commit 701b2ee

Browse files
committed
bridge_harfbuzz: no longer require ICU
The motivation for this change is to fix the Windows pkg-config CI, where MSYS2's switch to the `pkgconf` implementation of `pkg-config` has surfaced challenges in this crate's build script. But, it is also true that we only need harfbuzz-icu for versions of Harfbuzz that are very old at this point, and separating out that dependency will help us work towards potentially one day being able to swap out the ICU dependency with something else. So it's good to make that jump for bigger reasons than just the CI.
1 parent 3dfc7fe commit 701b2ee

6 files changed

Lines changed: 18 additions & 26 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ x86_64-pc-windows-msvc = { triplet = "x64-windows-static-release", install = [
158158
tectonic_bridge_core = "thiscommit:2023-06-11:PvhF7YB"
159159
tectonic_bridge_flate = "thiscommit:2021-01-01:eer4ahL4"
160160
tectonic_bridge_graphite2 = "2c1ffcd702a662c003bd3d7d0ca4d169784cb6ad"
161-
tectonic_bridge_harfbuzz = "2c1ffcd702a662c003bd3d7d0ca4d169784cb6ad"
161+
tectonic_bridge_harfbuzz = "thiscommit:2023-09-17:FZwRtUP"
162162
tectonic_bridge_icu = "thiscommit:2023-09-17:AwTXf3W"
163163
tectonic_bundles = "thiscommit:2022-03-29:SFnXSaL"
164164
tectonic_cfg_support = "thiscommit:aeRoo7oa"

crates/bridge_harfbuzz/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Copyright 2020-2021 the Tectonic Project
1+
# Copyright 2020-2023 the Tectonic Project
22
# Licensed under the MIT License.
33

44
# See README.md for discussion of features (or lack thereof) in this crate.
55

66
[package]
77
name = "tectonic_bridge_harfbuzz"
8-
version = "0.0.0-dev.0" # assigned with cranko (see README)
8+
version = "0.0.0-dev.0" # assigned with cranko (see README)
99
authors = ["Peter Williams <peter@newton.cx>"]
1010
description = """
1111
Expose the Harfbuzz C/C++ APIs to Rust/Cargo.
@@ -21,7 +21,6 @@ exclude = ["/harfbuzz/docs/", "/harfbuzz/perf/", "/harfbuzz/test/"]
2121

2222
[dependencies]
2323
tectonic_bridge_graphite2 = { path = "../bridge_graphite2", version = "0.0.0-dev.0" }
24-
tectonic_bridge_icu = { path = "../bridge_icu", version = "0.0.0-dev.0" }
2524

2625
[build-dependencies]
2726
cc = "^1.0.66"
@@ -32,5 +31,4 @@ external-harfbuzz = []
3231

3332
[package.metadata.internal_dep_versions]
3433
tectonic_bridge_graphite2 = "2722731f9e32c6963fe8c8566a201b33672c5c5a"
35-
tectonic_bridge_icu = "2c1ffcd702a662c003bd3d7d0ca4d169784cb6ad"
3634
tectonic_dep_support = "5faf4205bdd3d31101b749fc32857dd746f9e5bc"

crates/bridge_harfbuzz/build.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 the Tectonic Project
1+
// Copyright 2020-2023 the Tectonic Project
22
// Licensed under the MIT License.
33

44
//! Harfbuzz build script.
@@ -7,15 +7,23 @@
77
mod inner {
88
use tectonic_dep_support::{Configuration, Dependency, Spec};
99

10-
// TODO: ICU not necessary if Harfbuzz >= 2.5.
1110
struct HarfbuzzSpec;
1211

1312
impl Spec for HarfbuzzSpec {
13+
// We require Harfbuzz >= 1.4, but that version is ancient, and
14+
// specifying the version constraint in this string causes problems with
15+
// the `pkgconf` implementation of pkg-config on Windows/MSYS2.
16+
// (Specifically, its `--modversion` mode won't print anything out when
17+
// given two arguments, causing an unhandled crash inside the pkg_config
18+
// Rust library.) Likewise, for Harfbuzz < 2.5, the `harfbuzz-icu`
19+
// pkg-config item is needed, but this may also cause problems for
20+
// pkgconf. If you really need to compile against very old Harfbuzz,
21+
// patch this file and don't use pkgconf.
1422
fn get_pkgconfig_spec(&self) -> &str {
15-
"harfbuzz >= 1.4 harfbuzz-icu"
23+
"harfbuzz"
1624
}
1725

18-
// TODO: can we ensure that the ICU and graphite2 options are enabled?
26+
// TODO: can we ensure that the graphite2 option is enabled?
1927
fn get_vcpkg_spec(&self) -> &[&str] {
2028
&["harfbuzz"]
2129
}
@@ -75,26 +83,19 @@ mod inner {
7583
// Include paths exported by our internal dependencies:
7684
let graphite2_include_path = env::var("DEP_GRAPHITE2_INCLUDE_PATH").unwrap();
7785
let graphite2_static = !env::var("DEP_GRAPHITE2_DEFINE_STATIC").unwrap().is_empty();
78-
let icu_include_path = env::var("DEP_ICUUC_INCLUDE_PATH").unwrap();
7986

8087
let mut cfg = cc::Build::new();
8188

8289
cfg.cpp(true)
8390
.flag("-std=c++11")
8491
.warnings(false)
8592
.define("HAVE_GRAPHITE2", "1")
86-
.define("HAVE_ICU", "1")
87-
.file("harfbuzz/src/harfbuzz.cc")
88-
.file("harfbuzz/src/hb-icu.cc");
93+
.file("harfbuzz/src/harfbuzz.cc");
8994

9095
for item in graphite2_include_path.split(';') {
9196
cfg.include(item);
9297
}
9398

94-
for item in icu_include_path.split(';') {
95-
cfg.include(item);
96-
}
97-
9899
if graphite2_static {
99100
cfg.define("GRAPHITE2_STATIC", "1");
100101
}
@@ -129,10 +130,6 @@ mod inner {
129130
print!(";{}", item);
130131
}
131132

132-
for item in icu_include_path.split(';') {
133-
print!(";{}", item);
134-
}
135-
136133
println!();
137134

138135
let dest_dir = include_dir.join("harfbuzz");

crates/bridge_harfbuzz/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 the Tectonic Project
1+
// Copyright 2020-2023 the Tectonic Project
22
// Licensed under the MIT License.
33

44
//! No Rust code. This crate exists to export the Harfbuzz *C/C++* API into the
@@ -9,7 +9,4 @@
99
mod linkage {
1010
#[allow(unused_imports)]
1111
use tectonic_bridge_graphite2 as clippyrenamehack1;
12-
13-
#[allow(unused_imports)]
14-
use tectonic_bridge_icu as clippyrenamehack2;
1512
}

crates/xetex_layout/layout/xetex-XeTeXLayoutInterface.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ authorization from the copyright holders.
4040
#include <harfbuzz/hb.h>
4141
#include <harfbuzz/hb-graphite2.h>
4242
#if !HB_VERSION_ATLEAST(2,5,0)
43+
/* Note: this configuration is no longer actively tested */
4344
#include <harfbuzz/hb-icu.h>
4445
#endif
4546
#include <harfbuzz/hb-ot.h>

0 commit comments

Comments
 (0)