Skip to content

Update freetype-sys and regenerate bindings based on vendored freetype - #77

Open
jschwe wants to merge 7 commits into
servo:mainfrom
jschwe:update
Open

Update freetype-sys and regenerate bindings based on vendored freetype#77
jschwe wants to merge 7 commits into
servo:mainfrom
jschwe:update

Conversation

@jschwe

@jschwe jschwe commented May 7, 2026

Copy link
Copy Markdown
Member

The commits should be reviewed individually, and ideally not squashed.

Background:

  • The bindgen layout tests before this PR used undefined behavior (dereference nullptr), which doesn't compile on recent versions of rust.
  • the bindings were generated from the freetype headers present of the person running bindgen.sh - That seems very wrong. Generate from the freetype-sys version we support instead.
  • Since the bindings were regenerated, any manual edits might have been lost.

Pending servo companion PR. One step towards updating freetype-sys in servo.

jschwe added 4 commits May 7, 2026 21:01
blacklist and whitelist were renamed in bindgen.
crates.io release mapped to commit, by checking
git log.
The submodule is necessary to generate bindings for the
correct headers, and not whatever is on the local system!
- Don't generate bindings from the headers that happen
  to be installed on the authors machine
- Instead use the vendored dependency and its headers.
- Regenerate using the latest bindgen version.

Note: This changes types of `define`s from c integer types,
to rust-fixed size integers. C defines don't have a fixed type,
since they are just preprocessor tokens.
This is a breaking API change on our side though (via bindgen),
so bump the version to 0.8
This  included a type change in FT_Outline_ to `ushort` members.
Otherwise only minor doc changes.
@jschwe
jschwe force-pushed the update branch 2 times, most recently from 0528d25 to 35235b0 Compare May 7, 2026 20:00
freetype-sys 0.23 doesn't build with the version shipped in ubuntu 22.
Ubuntu 24 doesn't seem to ship libfreetype-dev in CI images by default.

configuration error in freetype-sys in ubuntu 22.04 CI:
```

  thread 'main' (2233) panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/freetype-sys-0.23.0/build.rs:21:18:
  called `Result::unwrap()` on an `Err` value:
  pkg-config exited with status code 1
  > PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags freetype2 'freetype2 >= 24.3.18'

  pkg-config output:
    Package dependency requirement 'freetype2 >= 24.3.18' could not be satisfied.
    Package 'freetype2' has version '24.1.18', required version is '>= 24.3.18'

  The system library `freetype2` required by crate `freetype-sys` was not found.
  The file `freetype2.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `freetype2.pc`.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant